PHP does not have access to remote MySQL problem analysis and solve _php skills

Source: Internet
Author: User
First, the remote server is reachable remotely.

I encountered the problem is this: there are three servers a,b,c, C for the server, B can be successfully connected to PHP with the C machine MySQL, and a machine can not connect!
It can be said that the code is not the problem, the MySQL server on the setup is no problem, because B machine can be.
There must be a problem with the setup of a machine!

A search on the internet, a variety of said MySQL licensing issues, as well as modify the php.ini, modify the firewall, in fact, is not the cause of these problems.
Similar to the issues discussed on this page, but no one gives the results, Link: http://bbs.csdn.net/topics/90284141
Finally thought of the selinux of the problem, compared to the next AB two machines, and indeed set a different! I guess it's the problem.

The following settings are made:

Under root, open the file file with vim/etc/selinux/config
To modify the value of SELinux:
#SELINUX =enforcing
Selinux=disabled
Save and exit.
Reboot is in effect, if you do not want to reboot, command line input
Setenforce 0
Enter, OK
Here to modify the reference: http://www.xiaojb.com/archives/tips/disabled-selinux.shtml

Finally, the connection was successful, oh yes!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.