Original link:
Http://www.centoscn.com/CentosBug/softbug/2015/0622/5709.html
Problem Description:
Using client Telnet connection on a CentOS 6.5 server based on MySQL, error: Can ' t connect to MySQL server on ' XXX ' (13)
Workaround:
In general, you can set the following
1. Go to MySQL Console
# mysql-u Root-p
2. Enter the following command in the MySQL console
Mysql> Grant all privileges on * * to ' root ' @ ' Your-host-ip ' identified by ' Your-mysql-password ' with GRANT option;
mysql> flush Privileges;
Mysql> exit
3. Restart MySQL
#/etc/init.d/mysqld Restart
At this point, no unexpected changes have been completed and validation passed.
However, if you still see the error message of Can ' t connect to MySQL server on ' XXX ' (13), you can try the following methods:
1. See if the value of Httpd_can_network_connect is off (for example: httpd_can_network_connect---off)
# Getsebool-a | grep httpd
2. Change the value of Httpd_can_network_connect to ON
# Setsebool Httpd_can_network_connect 1
3. Re-verify Httpd_can_network_connect
# Getsebool-a | grep httpd
4. Restart HTTP
#/etc/init.d/httpd Restart
5. Enter Client Restart login verification
At this point the error message changes to: Access denied for user ' root ' @ ' Your-host-ip ' (usring password:yes)
6. Go to MySQL console to re-grant (as above)
CentOS MySQL Error: Can ' t connect to MySQL server