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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi all,

maybe this isn't a php question, but a MySQL question.

If so I'm sorry for asking you guys to help me :)

I know this question is asked often in NGs, but I couldn't find the
answer that works for me.

I've just installed my server with following:

Apache2, PHP5 and MySQL 4.1.12 on Windows 2000 Server.

Apache and PHP are funtioning properly (I can open a page like
phpinfo() ).

But now i've come upon a problem with MySQL.

When i try to run a simple PHP script like:
mysql_connect("localhost", "root", "password") or die (mysql_error());
I get the following error:
Can't connect to MySQL server on 'localhost' (10061)

I've tried several different addresses like: localhost,,
server01, all with same result.

Loopback address should work cause I configured MySQL that way.

The MySQL service is started.

I don't know whether it's a good way to test the MySQL server but on
commandline I typed:
mysql --user=user_name --password=your_password
And I got mysql> commandline.

Can someone please help me find the problem and/or give a better way of

Thanks in advance for your replies.

P. Hordijk

Re: Can't connect to MySQL server on 'localhost' (10061)

Quoted text here. Click to load it

Have you tried plugging in the phrase (in quotes) to Google?

This is a fairly common problem with an easy fix posted on the MySQL manual

Go to Google & put in: "Can't connect to MySQL server on 'localhost'"
(quotes included) - the answer is one of the top two responses.

It has to do with the passwords & latest versions of MySQL - the page on the
MySQL site you find will tell you how to fix it.

Re: Can't connect to MySQL server on 'localhost' (10061)

Thanks for your reply!

When i said i searched NGs, I meant I also searched Google (Could be
that I'm so retarded that I overlooked the sollution to my problem

I followed your instruction to enter "Can't connect to MySQL server on
'localhost'" in google and I studied the results, none of them did the
trick for me.

Bout the password thingy: I couldn't find it (but like I said before
that could also be me being retarded), so I'm blushing when I ask you
the following: Can you give me the URL of the site where you found out
bout that password thingy and latest versions.

Do you still think this is a php question or do I need to post in a

I know I can be a pain in the ass :), so I thank all for taking the
time to help me.

Site Timeline