PHP MySQL failed to connect due to a target computer being actively rejected

Source: Internet
Author: User
Tags php mysql

In addition to those on the internet Baidu, my machine has this error

I need to use PHP remote connection to MySQL, the target machine has given the client permissions, but still occurs "because the target computer actively refused to connect" error

MySQL that connects to the target machine directly on the client computer is error is can ' t connect to MySQL server on ' *.*.*.* ' (111)

Using NETSTAT-TANP to view the open port after the discovery of the 3306 port is the MySQL listening port can only listen to 127.0.0.1, that is, this machine, so suspect is the port monitoring problem, in fact, has been suspected of a firewall problem, in fact, the firewall did not open

Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN-
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN-
TCP 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN-
TCP 0 192 192.168.1.117:22 192.168.1.100:4674 established-
TCP6 0 0::: $:::* LISTEN


Http://www.2cto.com/database/201204/127400.html

After viewing this blog post, locate the MySQL configuration file my.cnf, modify the bind-address = IP of the target machine in the LAN, and then restart the MySQL service, success!

After modifying, run the NETSTAT-TANP command as follows

Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN-
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN-
TCP 0 0 192.168.1.117:3306 0.0.0.0:* LISTEN-
TCP 0 0 192.168.1.117:22 192.168.1.100:4674 established-
TCP6 0 0::::::* LISTEN-

Acknowledgements: http://www.2cto.com/database/201204/127400.html

PHP MySQL failed to connect due to a target computer being actively rejected

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.