Skip navigation links

MySQL Forums :: Install & Repo :: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061)


Advanced Search

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


Subject Written By Posted
ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) L RLJ 09/28/2010 06:27AM
Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) L RLJ 09/28/2010 11:16AM
Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) Jostein Bjørkøy 10/08/2010 03:16PM
ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) vardhan r 02/03/2011 04:52AM
Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) sari lindroos 11/08/2010 11:06AM
Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) vicente deluca 01/25/2011 10:54PM
Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) Davis Carhuancho 01/27/2011 10:13AM
Re: ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost' (10061) Sathish Kumar Rebba 02/24/2011 09:14PM


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.