Centos将PHP升级之后遇到Can’t connect to MySQL server on ‘192.168.56.112’ (13)错误处理办法:
mysql -u root -p
直接回车
grant all privileges on *.* to 'root'@'192.168.56.112' identified by 'password' with grant option;
flush privileges;
quit;
service mysqld restart
但是如果此时还是出现Can’t connect to MySQL server on ‘XXX’ (13)的错误提示,可以尝试如下方法:
- 查看httpd_can_network_connect的值是否为off(例如:httpd_can_network_connect --> off)
getsebool -a | grep httpd
- 修改httpd_can_network_connect的值为on
setsebool httpd_can_network_connect 1
- 重新验证httpd_can_network_connect
getsebool -a | grep httpd
重启服务
service mysqld restart
service nginx restart