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.

So everything was working fine a few hours ago. I restarted my computer to update some software and now I can't connect to mysql via phpmyadmin or any of my locally hosted sites. The sites come up with database setting errors and phpmyadmin won't allow me to log in. The weird thing is that I can log in fine using any user via Terminal or using mysql workbench. I know that the mysql server instance is running fine and the login details haven't changed or been edited. Any ideas?

I'm running mac osx 10.6 with the bundled apache server and php. Latest version of mysql. The software updates were: security update, safari, iTunes and a graphics update.

share|improve this question
Have you checked which IP address the MySQL server is bound to? –  wolfgangsz Sep 11 '10 at 13:57

2 Answers 2

The user via terminal is going to use a socket, it sounds like your web is using localhost (TCP/IP). Check that something else didn't steal :3306 locally and test from the Terminal (commandline):

mysql --protocol=SOCKET -u root -p


mysql --protocol=TCP -u root -h localhost -p

Most likely the second one is failing and you need to debug.

share|improve this answer
Thanks for your suggestion - I'll try it as soon as I can. I know nothing about server config so I might need some help! Can you think of why it has suddenly stopped working? –  musoNic80 Sep 11 '10 at 14:12
sadly, there could be a million. the most obvious would be on startup it can't bind to localhost:3306 because something else took that port; by any chance do you have 2 mysqls running? do a 'netstat -lntp | grep ":3306 "' to get the PID of what's there, and make sure that's the right MySQL PID you want there. –  troyengel Sep 11 '10 at 14:45
I tried the suggestion from your main answer and both allowed me to connect. Could you explain what you mean by "do a netstat"? I don't know what that is or how to do it! –  musoNic80 Sep 11 '10 at 15:17
ok I've run network utility which I think does the same thing. On localhost port 3306 it says there is mysql. It also says there is mysql at tcp 4 with a state of listen. This doesn't mean much to me but perhaps it can help solve the problem? –  musoNic80 Sep 11 '10 at 16:39

You don't state what OS you are running or what the updates you applied were, that would help.

The most common reasons for an update/restart causing this to fail from my expreience are:

1) When initially deployed, the mysql server wasn't listening on TCP, and it was re-started manually to listen properly, but the startup configuration wasn't changed - so the reboot reverted things back to normal. 2) Same as #1 - but the iptables configuration. 3) THe update somehow turned SELinux on when you probably don't want/need it and it's getting in the way, or you had it on and the update changed something. Solution - disable it.

share|improve this answer
he used the word Terminal putting him on an OS X box by most guesses. –  troyengel Sep 11 '10 at 14:46
I've edited the op with more details. –  musoNic80 Sep 11 '10 at 15:02

Your Answer


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.