Starting MySQL produces "The server quit without updating PID file"

I've literally looked all over Stack Overflow, Superuser, I cannot find a solution to my problem that I'm experiencing right now, when I want to start MySQL, it produces this error:

ERROR! The server quit without updating PID file (/usr/local/var/mysql/My-Username.local.pid).

with the sudo mysql.server start command, however, if I simply use the mysql command, it will produce:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Which is also another problem I cannot fix, I did touch /tmp/mysql.sock, nothing.

I've chown'd the /usr/local/var/mysql with mysql:mysql recursively, but that didn't help at all.

I installed MySQL via homebrew on OS X 10.7.3. How can I start up MySQL?


We (myself and Mr. Burning) did some diagnosis in chat, and I will detail what we did find:

The root of his problem was that MySQLd was already running in some capacity. This could have been a previous version of MySQL installed from Homebrew, still running after upgrading the binaries/libraries.

Our resolution was to simply kill all of the running processes. Then, OS X's launchd did it's work and restarted MySQLd, which was definitively running as installed by Homebrew.

That seemed to resolve the issue.


There used to be a bug in where MySQL would look for it's socket. I think this is your problem as well. I discovered it several years ago when using phpMyAdmin.

There seems to be a problem with how current versions of OS X store the mysql socket and how phpMyAdmin looks for it. It seems currently the socket is stored at /tmp/mysql.sock but phpMyAdmin is looking for it at /var/mysql/mysql.sock. The result is a connection error type #2002.

here’s the solution. Create a symlink. Do the following from the terminal.

sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock