Solve the problem that PHP cannot access remote mysql _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Solve the problem that PHP cannot access remote mysql. The remote server can be accessed remotely. The problem I encountered was as follows: 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, remote servers 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.

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

Bytes. 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...

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.