Home  >  Article  >  Database  >  What should I do if navicat fails to connect to the database with error code 10038?

What should I do if navicat fails to connect to the database with error code 10038?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-06 11:15:133370browse

What should I do if navicat fails to connect to the database with error code 10038?

Solution to the problem of remote connection to mysql (10038)

1. User permissions problem

连接linux,登录数据库:mysql -uroot -p

What should I do if navicat fails to connect to the database with error code 10038?

Modify root user remote login permissions:

If you want myuser to use mypassword to connect to the mysql server from any host

myuser is your user name, mypassword is your password

use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
flush privileges;
quit

What should I do if navicat fails to connect to the database with error code 10038?

Related recommendations: "Navicat for mysql graphic tutorial"

2. My.cnf file configuration problem

Comment out the option skip-networking (Note: Some information says that bind-address should also be set to 127.0.0.1. I didn’t see this sentence in my configuration file anyway, so I didn’t set it. This option is used To set the IP that can access Mysql externally, it has a filtering effect and there is no need to set it).

skip-networking

Run MySQL on a stand-alone machine and use skip-networking to turn off MySQL's TCP/IP connection. After this option is turned on, you cannot access MySQL remotely

bind-address

For security reasons, if you want a specified IP to access MySQL, you can add bind-address=IP in the configuration file, provided that skip-networking is turned off

vi /etc/my.cnf

What should I do if navicat fails to connect to the database with error code 10038?

保存退出
esc
:wq

3. Check to see if the firewall has blocked port 3306. For Centos systems, in /etc/sysconfig/iptables, is there such a sentence:

-A INPUT -p tcp -m tcp –dport 3306 -j If ACCEPT is not available, add it, or the following ACCEPT is DROP, just change it to ACCEPT

vi /etc/sysconfig/iptables
保存退出
esc
:wq

What should I do if navicat fails to connect to the database with error code 10038?

4. Restart the firewall and mysql

service iptables restart 
service mysql restart

The above is the detailed content of What should I do if navicat fails to connect to the database with error code 10038?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn