[Solved] MYSQL ERROR 2003 (HY000): can’t connect to MySQL server (10060)

How to Solve MYSQL ERROR 2003 (HY000): Can’t connect to MySQL server on “host” (10038)

Error when connecting to remote MySQL.

ERROR 2003 (HY000): Can’t connect to MySQL server ‘ip’ (10038)

View error type (Linux systems)

perror 113


The results are as follows:
OS error code 113: no route to host

The reason for this error is that the server-side firewall does not open the port used by MySQL program. The default is 3306, and the port can be opened

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 


Save the settings and restart the firewall

service iptables save
service iptables restart

Linux Set up open 3306 port solution


Enable: service iptables start
Shutdown: service iptables stop

Turn off the firewall for a long time

On: chkconfig iptables on
Turn off: chkconfig iptables off

/sbin/iptables -I INPUT -p tcp –dport 3306 -j ACCEPT #Open port 3306

/sbin/iptables -A INPUT -p tcp –dport 80 -j ACCEPT #Enable port 80

/sbin/iptables -A INPUT -p tcp –dport 22 -j ACCEPT #Open port 22

My local machine is Ubuntu, and I can open it by just typing the above command

/etc/rc.d/init.d/iptables save #Save the configuration

/etc/rc.d/init.d/iptables restart #restart the service

View open ports
/etc/init.d/iptables status
The result is as follows
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
2 ACCEPT tcp — tcp dpt:22

3 ACCEPT tcp — tcp dpt:80

Similar Posts: