Error the server quit without updating pid file opt homebrew var mysql

November, 2014: If you're getting this error on MySQL 5.6.x on Mac OS X Mavericks or Yosemite and want to use MySQL with PHP locally (/tmp/mysql.sock is where PHP PDO expects to find the sock file), here is what fixed it for me:

1) Uncomment the default homebrew config file lines and edit as below

$ sudo vi /usr/local/Cellar/mysql/5.6.21/my.cnf
...
basedir = /usr/local/Cellar/mysql/5.6.21
datadir = /usr/local/var/mysql
port = 3306
server_id = 
socket = /tmp/mysql.sock
pid-file = /usr/local/var/mysql/[BOXNAME].local.pid
....

BOXNAME is what you have in your System Prefs -> Network as the unique id for your computer on the network.

2) Set permissions on all the files in the mysql datadir. These were all owned by [my_username]. MySQL is very picky about this and refuses to create the pid file unless it (the user _mysql) owns the directory.

$ sudo chown -R _mysql:mysql /usr/local/var/mysql

3) Start MySQL using the bash helper/wrapper script:

$ sudo mysql.server start
Starting MySQL
. SUCCESS! 

Hope that helps. If the above doesn't work for you, try to run the mysqld_safe binary manually in the Cellar/mysql/VERSION_/bin/ directory and check what the settings are (if it runs)

sudo /usr/local/Cellar/mysql/5.6.12/bin/mysqld_safe &

If that runs, you can

ps aux | grep mysql 

and see something like

[username]  6881   0.0  2.7  3081392 454836   ??  S     8:52AM   0:00.54 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --verbose --log-error=/usr/local/var/mysql/BOXNAME.local.err --pid-file=/usr/local/var/mysql/BOXNAME.local.pid

I'm not sure why that worked for me but it shows you where I got the my.cnf config file options from. You can also use the command line options to try to troubleshoot when starting mysqld manually.

If you do run manage to run MySQL server using mysqld_safe, you may have to do this to shut it down before trying the mysql.server bash helper. Resist the urge to kill -9 [PID] because you can corrupt your data.

mysqladmin -uroot shutdown

Good luck!

I installed MySQL using brew. Suddenly, after running mysql.start I get the following error:

jmeena@Js-MacBook-Pro /usr/local/var % mysql.server startStarting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Js-MacBook-Pro.local.pid).

In the logs, I would see:

Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock

Solution 1: Change ownership of the MySQL folder

I think the problem might be the PID file

There are two I can see

One in the directory

/usr/local/mysql/data/mysqld.local.pid

and one in the error message

/usr/local/mysql/data/Nicks-MacBook-Pro.local.pid

Please delete those two pid files if they still exist.

Then, start mysql and let’s us know what happens.

I have suggested this twice in the past, 4 years ago and 6 years ago

Before doing so, check to make mysqld is not running.

ps -ef | grep -v grep | grep mysqld

If you see mysqld still running, kill the process, then delete the pid files and retry starting mysql.

UPDATE 2021-01-29 15:56 EST

As it turns out, there were two installations of MySQL involved on the Mac as was learned in the Chat Session.

One installation was done as a dmg install; the other was a homebrew installation.

Once it was discovered that homebrew was competing with the dmg for the PID file, it was decided to stop using the dmg version and use the homebrew version via brew services approach.

The two installs were butting heads, having different PID files.

YES.

Following homebrew caveats, did you setup launchd?

To have launchd start mysql at login:
    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Well, now using mysql.server is pointless. It basically doesn't work, because (from my poor understanding) mysqld is now managed by launchd, and it is mysqld_safe. I don't know if actually because of that is different from what you control with mysql.server.

The solution I came up with is to not use launchd for mysql from brew. Rather, I just use the mysql.server tool to start, stop, and restart mysql.

If you want to follow my steps, this is what you need to do:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

And whenever you want to start the mysql server, use mysql.server start.

If you actually want to make mysql start at boot time, you can take that plist and copy it, delete the KeepAlice line, replace the string values under ProgramArguments with /usr/local/bin/mysql.server and start. After that do
launchctl load ~/path/to/com.file.plist

How do I fix the server stopped without updating PID files?

How we fix Server Quit Without Updating PID File error in MySQL?.
Restart the MySQL service to fix Server Quit Without Updating PID File. ... .
Remove Your MySQL Config File and start again. ... .
Check ownership of /var/lib/mysql/ directory. ... .
Removing the error files. ... .
Check the MySQL error log file. ... .
Upgrade to latest MySQL version..

How do I completely remove MySQL from my Mac?

3 Uninstalling. To uninstall MySQL Workbench for macOS, locate MySQL Workbench in the Applications folder, right-click, and select Move to Trash.

How do I start MySQL server on Mac?

To enable the launchd service, you can either:.
Open macOS system preferences and select the MySQL preference panel, and then execute Start MySQL Server. ... .
Or, manually load the launchd file. ... .
To configure MySQL to automatically start at bootup, you can: $> sudo launchctl load -w com..

How do I start Mysqld as root?

To ensure this, run mysqld_safe as root and include the --user option as shown. Otherwise, you should execute the program while logged in as mysql , in which case you can omit the --user option from the command.