Can't connect to local MySQL server through
Posted by: bradford-online (141.151.236.---)
Date: January 29, 2006 09:33PM

I am getting the following error whenever I try to create a db connection in php.

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I am running WinXP SP2 and Macromedia Dreamweaver 8

Previously I tried manual installations of IIS, PHP, and mySQL.. I uninstalled all that and then installed WAMP5.

No matter what I do, I still get this same error. Everything else works fine. I can view a page with php code on localhost. I can access the default databases and tables from the command prompt.

I tried the default my.ini file. I even added this line:

socket = /tmp/mysql.sock

Then I stopped, uninstalled, installed, and started mysql. It's like it is just ignoring the my.ini file. I checked Windows Task Manager and the following processes were running:

Apache.exe (twice)

Most of what I've read says this error message occurs when mysqld is not running. I haven't seen mysqld-nt referred to. Is this the problem or do WinXP machines run mysqld-nt?

I have tried addressing the server as localhost,,, and the machine name (asp). I've tried putting my.ini in my root directory. Again, everything else is working.

I have been searching and reading and trying things for days now. Any help would be appreciated!

Options: ReplyQuote
Re: Can't connect to local MySQL server through
Posted by: bradford-online (
Date: February 18, 2006 07:26AM

I wanted to revisit this thread since no one else answered and I found a solution that works. The author of WAMP5 is clear that he doesn't support his product and the user is on their own. The fact is WAMP5 doesn't work very well, which is why there are so many problems posted here.

After struggling with this package, wasting days trying to troubleshoot with no help, and finally giving up, I went looking for another installer. I found XAMPP in a Google search. I downloaded and extracted the files, ran it, tested it, and IT WORKED! Just that easy. The package includes:

PHP Switch
Mercury Mail
FileZilla FTP
Several database driven example projects too

If WAMP5 works for you, fine. If you're ripping your hair out like I was and getting no help here, try XAMPP. It was a pure joy to install.

Options: ReplyQuote
Re: Can't connect to local MySQL server through
Posted by: emanuel rasolof (
Date: February 18, 2006 08:46AM

I concur with Bradford. Spent all day trying to figure out how to make up for the missing socket file mysql.sock. My efforts were vain. I intend to run Ruby On Rails, but I don't think I will be successful using the Wamp5 MySql package.

I will try the XAMP package or install MySql independently.
Good luck.

Options: ReplyQuote

Sorry, only registered users may post in this forum.