(mysql+php+apache) 127.0.0.1 and localhost can connect to the MySQL server, but IP cannot

Source: Internet
Author: User

127.0.0.1 and localhost can connect to the MySQL server, but the corresponding IP is not, and error:

Can ' t connect to MySQL server on "10.0.73.25" (111)

The following may be the cause:

1. Network does not pass: Ping 10.0.73.25 found can ping, exclude this reason.

2.mysql configuration problem: Open MySQL configuration file mysql.cnf (the path under Linux is generally/etc/mysql/mysql.cnf), see skip-networking and bind_address configuration items

Ship-networking: It is used to skip TCP/IP traffic. MySQL can only be connected via a local socket, blocking the external network connection.

You can see if remote access is turned on by mysql>show variables like "%skip-networking%".

For off indicates that remote access is not blocked, exclude this cause.

Bind_address: The IP address it uses to bind MySQL. The default binding is to connect the bind_addres=127.0.0.1. You can either comment out the bing_address or set it to 0.0.0.0来 binds all IPs.

See mysql.cnf in Bing_address indeed 127.0.0.1, modified to 0.0.0.0.

Restart MySQL and find that the MySQL server is still not connected

3. May be the host setting or permissions issue for the root user of MySQL

View the user table in MySQL's MySQL database and find that the root host is localhost and only localhost is allowed, so change the root host to "%".

You can view the root user "%" host by mysql>show grants for [email protected] "%", if permissions are not sufficient to set their permissions.

Restart mysql,localhost,127.0.0.1 and 10.0.73.25 to connect to the MySQL server.

MYSQL.CNF Configuration classification: http://www.cnblogs.com/toby/articles/2198697.html

Reference Blog: http://blog.csdn.net/qustdjx/article/details/26937325

(mysql+php+apache) 127.0.0.1 and localhost can connect to the MySQL server, but IP cannot

Related Article

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.