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?

3 Answers 3


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.

  • If is every time will kill the running processes? and does kill all of the running processes. means kill mysqld and mysql?
    – aircraft
    Commented Jun 26, 2017 at 1:55

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
  • 1
    Hmm. That didn't change anything at all - still cannot connect to mysql.
    – MacMac
    Commented May 1, 2012 at 20:57
  • still cannot connect to mysql
    – niksmac
    Commented Mar 16, 2013 at 2:24

Finally solved this issue... (3 days later)

  1. Open up YOURUSERNAME.local.err in /Applications/XAMPP/xamppfiles/var/mysql/ with a text editor.
  2. I had "InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files"
  3. Then follow instructions on http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html as it states in the log file
  4. Add "innodb_foce_recovery = 2" after line: [mysqld] to your my.cnf located in /XAMPP/xamppfiles/etc/
  5. Then "sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start" Give it a minute and it should repair itself
  6. Comment out with "#innodb_foce_recovery = 2" in my.cnf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .