If you’ve installed MacPorts’ mysql5-server, you may find that it doesn’t work after a restart.
This can be resolved by running the following commands to make sure you’ve killed off everything MySQL related.
sudo port unload mysql5-server ps -ax | grep mysql sudo kill
Once you have done this, load it again.
sudo port load mysql5-server
Not it should be working. This is fine, but quickly gets very annoying every time you restart your computer! A common cause is that you have a MySQL sock file in your tmp directory. Removing this may allow it to start automatically.
cd /tmp rm -f mysql.sock
Once removed, restart your computer and see if MySQL works first time – hopefully, it will.