PHP

Problem analysis and resolution of PHP unable to access remote mysql


First, the remote server is remotely accessible.

The problem I have is this: there are A, B, C3 servers, C is the server, B can use PHP successfully connect to mysql of C machine, but A machine can’t connect! It’s safe to say that there’s nothing wrong with the code, and the mysql Settings on the server are fine, as B machines are fine. It must be the setup of the A machine!

A search on the Internet for various authorization issues of mysql, modification of ES19en.ini, modification of the firewall, in fact, is not caused by these problems. And discussed on this page are similar, but no one gives as a result, the link: http: / / bbs csdn. net/topics / 90284141 Finally, I came up with the problem of SELINUX, and compared the two machines of AB, and the setting was not the same as expected! Estimate is its problem, have a play!

The following Settings were made:

Under root, open file /etc/selinux/config with vim Modify the value of SELINUX: #SELINUX=enforcing SELINUX=disabled Save and exit. Restart takes effect. If you do not want to restart, type from the command line setenforce 0 Enter, OK Modify the reference here: http: / / www xiaojb. com/archives/tips/disabled - selinux. shtml

Finally, the connection is successful, oh yeah!!