Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed ZWAMP 1.0.7 (on Windows 7), but I'm having a weird problem. I can't connect to my MySQL server from any PHP script. If I try to use MySQL command line everything works fine but PHPMyAdmin retruns error #2002. I'm not sure whether it's important or not but MySQL server is not able to create socket file. I don't know what's the problem but I think everything is configured in my.cnf properly.

Do you have any ideas?

share|improve this question
    
Do you have more error messages in either the httpd log or the mysql log? And can you create a pretty simple PHP script where you try to connect to mysql. And then tell us what error messages you get then... And yes, it is very important that mysql can not create a socket. You have to solve this problem. Probably the path to the file is wrong in the config file. –  Raffael Luthiger Nov 26 '11 at 1:24

3 Answers 3

That PHPMyAdmin error relates to a problem connecting to MySQL over a socket, maybe it's been configured to connect over a UNIX socket which Windows 7 doesn't support? See if you can configure it in the config file to connect to 127.0.0.1 instead of localhost as this should force a TCP/IP connection instead of a socket.

share|improve this answer

The MySQL CLI uses a named pipe to connect to the MySQL Server. PHP (almost always) uses IP networking to connect to the server.

Is the MySQL server listening for TCP/IP connections? Is your firewall allowing connections to port 3306 (The default MySQL port)?

Try to telnet localhost 3306 to see if you get any prompting or feedback from the MySQL daemon.

share|improve this answer
    
The response is "5.1.45-community♦VC+M$ha1!☻kJmf8'V\LHb8". As I said mysql server works fine but I jsut can't connect from any PHP script. –  Martin Apr 27 '10 at 16:09
    
There goes my theory. –  Joe Apr 27 '10 at 17:28

I had a similar problem after I migrated my local testing environment from Windows XP to Windows 7. Specifying the IP address instead of localhost in the config.inc.php file of the PHPMyAdmin did the trick.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.