A connection attempt failed because the connected party did not (trying to connect via Tcp://localho

Source: Internet
Author: User

The following error occurred while PHP was connecting to MySQL:

Warning:mysql_connect () [Function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (Trying to connect via tcp://localhost:3306) into E:\apache\www\mysql.php on line warning:mysql_connect () [function.mysq L-connect]: A connection attempt failed because the connected party did no properly respond after a period of time, or ES Tablished Connection failed because connected host has failed to respond. In E:\apache\www\mysql.php to
Fatal error:maximum execution time seconds exceeded in E:\apache\www\mysq l.php on line 20

The solution has the following two:

1, the C:\Windows\System32\drivers\etc\ Hosts file

#127.0.0.1 localhost

Note # Remove, you can connect successfully. This solution can also make phpmyadmin normal use.

2, because some PHP version can not turn the localhost to 127.0 0.1, so can be directly 127.0.0.1 can also be 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.