Troubleshoot problems with PHP's inability to access remote MySQL

Source: Internet
Author: User

Indicates that the remote server is remotely reachable.

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.

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

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.