Analysis and Solution to problems related to remote mysql access by PHP

Source: Internet
Author: User
Analysis and Solution to the Problem that PHP cannot access remote mysql. First, the remote server can be accessed remotely. The problem I encountered was: There are three servers A, B, and C, and C is the server. B can use PHP to successfully connect to mysql ON MACHINE C, while machine A cannot connect! It can be said that it is certainly not a problem with the code, and the mysql settings on the server are not

Analysis and Solution to the Problem that PHP cannot access remote mysql. First, the remote server can be accessed remotely. The problem I encountered was: There are three servers A, B, and C, and C is the server. B can use PHP to successfully connect to mysql ON MACHINE C, while machine A cannot connect! It can be said that it is certainly not a problem with the code, and the mysql settings on the server are not

Analysis and Solution of remote mysql access failure in PHP

The remote server can be accessed remotely.

The problem I encountered was: There are three servers A, B, and C, and C is the server. B can use PHP to successfully connect to mysql ON MACHINE C, while machine A cannot connect!
It can be said that it is certainly not a problem with the code, and the mysql settings on the server are also OK, because the B server can all be used.
It must have been A problem with machine A's settings!

I searched on the Internet and found that mysql authorization problems, php. ini modification, and firewall modification were not actually caused by these problems.
Similar to the problem discussed on this page, but no one gives the result, link: http://bbs.csdn.net/topics/90284141
Finally, I thought about the SELINUX problem. I compared the two AB machines and set them differently! It's probably a problem!

The following settings are made:

Root, use vim to open the file/etc/selinux/config
Modify the value of SELINUX:
# SELINUX = enforcing
SELINUX = disabled
Save and exit.
Restart takes effect. If you do not want to restart, enter the command line
Setenforce 0
Press enter, OK
Here modify reference: http://www.xiaojb.com/archives/tips/disabled-selinux.shtml

Finally, the connection is successful !!!

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.