When you remotely connect to CentOS MySQL, the following error occurs: CantconnecttoMySQLserveronXXX (13) environment:
System version: CentOS release 6.5 (Final)
Database version: 5.1.73
Problem description:
Use the client to remotely log on to Mysql on the CentOS 6.5 server. the error "Can't connect to MySQL server on 'XXX' (13)" is returned)
Solution:
Generally, you can perform the following settings:
1. log on to the 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
So far, no accident has been completed, and the verification has passed.
However, if the error message "Can't connect to MySQL server on 'XXX' (13)" still appears, try the following method:
1. check whether 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. verify httpd_can_network_connect again.
# Getsebool-a | grep httpd
4. restart http
#/Etc/init. d/httpd restart
5. log on to the client and restart the client for logon verification.
The error message becomes: Access denied for user 'root' @ 'Your-host-IP' (usring password: YES)
6. log on to the Mysql console and re-GRANT (as shown above)