MySQL Forums
Forum List  »  Install & Repo

ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061)
Posted by: L RLJ
Date: September 28, 2010 06:27AM

Hi, I can't seem to connect to MySQL via PHP. I get the following error message when I try:

----------------------------------------------------------------------------------
Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3 Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysqlconnect.php on line 3
----------------------------------------------------------------------------------

I am running windows 7 with Apache 2.2, PHP 5.3 and MySQL server 5.1. In task manager, ApacheMonitor is running under processes and Apache is running under services. MySQL is listed under services, but is stopped. When I try to access MySQL via the command line I get the following error message:

ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061)

So it would seem I have installed/configured Apache/MySQL wrong. Could anyone please tell me what I should check for? e.g. is there a setting in one of the .ini files that I should change?

P.S. when I first installed MySQL I could access it via the command line fine, but I still couldn't connect via PHP. Not being able to access it via command line is a recent development.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.