Solve the MySQL connection error: Can't connect to MySQL server (10060)
When you use the graphic interface management tool Navicat forMySQL to connect to the Mysql database, the following error occurs: Can't connect to MySQL server (10060)
Cause:
Some problems may be caused by the following reasons:
1. The network is disconnected;
2. The service is not started;
3. Firewall ports are not open;
Solution:
Start the service:
[Plain] view plaincopy
- Servicemysqldstart;
After analysis, the problem I encountered was caused by the firewall!
Open firewall port
Add the port to be listened on
/Sbin/iptables-I INPUT-p tcp -- dport 3306-j ACCEPT
Save settings
/Etc/init. d/iptables save
View status
/Etc/init. d/iptables status
Temporarily disable the Firewall Service
Service iptables stop
Enable Firewall Service
Service iptables start
Start the Firewall Service again
Chkconfig iptables off
Note:
This document applies to server environments: CentOS 6.5 MySQL 5.6
If the Java program cannot connect to the database, see: Connections cocould not be acquired from the underlying database