PHP cannot connect to mysql

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

Threaded View


I've had PHP 5.2.6, MySQL 5.0.27 Community and Apache 2.0.63 installed
for quite some time and have not had any issues.

Today, i'm trying to login to my application and i'm getting an error
message stating "Can't connect to MySQL server on
'localhost' (10061)".

I've done the following:

MySQL running: yes
Connected to MySQL using Navicat - THIS WORKS
Created a test PHP script to connect to the database - DOESNT WORK -
Can't connect to MySQL server on 'localhost' (10061)

I've stopped the mysql server and tried connecting - still get the
same error message. I know this wouldn't work but i wanted to see if
the error message was different.

The only thing i've noticed on the server was Apache was restarted at
1:30 in the morning - I'm the only admin for the server so no one has
amended anything in the Conf files - the restart of apache was due to
a power failure.

Can anyone think of anything else i can try or has anyone else
experienced a similar issue?

Many Thanks.

Re: PHP cannot connect to mysql

Followups set to comp.databases.mysql

On Tue, 2 Feb 2010 07:03:35 -0800 (PST), wrote:
Quoted text here. Click to load it

This is using a nework socket?

Quoted text here. Click to load it

This is trying to use a local OS socket, not a network socket.

Quoted text here. Click to load it

If the OS socket isn't there when the database is running, it's sure not
going to be there when the database ISN'T running.

Quoted text here. Click to load it

Did your mysqld come back up using the same configuration as it did the
last time it started? It's really easy to get something working via
experimental means and then forget to install the changes....

Life does not cease to be funny when people die any more than it ceases
to be serious when people laugh.
        -- George Bernard Shaw

Site Timeline