Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks again. :) –  MacMac May 2 '12 at 21:27

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
share|improve this answer
1  
Hmm. That didn't change anything at all - still cannot connect to mysql. –  MacMac May 1 '12 at 20:57
    
still cannot connect to mysql –  Nikhil M Mar 16 '13 at 2:24

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.