After configuring Navicat’s new database, I always get a 10038 error when I click on the connection test, and I can’t enter the database. I upload a PHP file to connect to the database on the server. , test, mysql can be accessed normally inside the server. I used the cmd dos window of win to test. Mysql cannot be accessed from the external network. That is, the internal network of the server can be accessed normally, but the external network cannot. Here is a specific solution for you. .
Recommended tutorial: MySQL database introductory video tutorial
Set the mysql service to allow external network access, modify Mysql configuration files, some are my.ini, some are my.cnf[linux].
1: Set the mysql configuration file
/etc/mysql/my.cnf
Find bind-address =127.0.0.1
Comment it out; //Function This means that only local access is no longer allowed;
can also be changed to bind-address =0.0.0.0
Restart mysql: /etc/init.d /mysql restart;
2: Log in to the mysql database on the Linux side: mysql -u root -p
mysql> ; use mysql;
Query host value:
mysql> select user,host from user;
If there is no "%" For host value, execute the following two sentences:
mysql> update user set host='%' where user='root';
mysql> flush privileges;
This is the situation after the modification
After the modification, I tested it and still got the same error. Later I found out that the firewall of the server was not turned off. After turning off the firewall, you can connect normally
Attached is the method of opening/closing the firewall
How to open and close the LINUX firewall
1) It takes effect after restarting
Turn on: chkconfig iptables on
Turn off: chkconfig iptables off
2) It takes effect immediately and becomes invalid after restarting
Start: service iptables start
Close: service iptables stop
It should be noted that the above commands can be used to open and close other services under Linux.
When the firewall is turned on, make the following settings and open the relevant ports.
Modify the /etc/sysconfig/iptables file and add the following content:
-A RH-Firewall -1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp - p tcp --dport 22 -j ACCEPT
The above is the detailed content of navicat reports error 10038. For more information, please follow other related articles on the PHP Chinese website!