After MySQL install via Brew, I get the error - The server quit without updating PID file

MysqlHomebrew

Mysql Problem Overview


Ok, I've searched all over and have spent quite a bit of my time installing, uninstalling, trying various option but without success.

I'm on Mac OS X Lion (10.7.3) and am trying to setup a Python, MySQL.

I successfully installed Python and MySQL via HomeBrew. Python works great.

After MySQL Installation, I followed the first 2 steps - unset and the mysql_install_db commands.

Now, when I try to start mysql "mysql.server start", I get the following error

ERROR! The server quit without updating PID file (/usr/local/var/mysql/Brajeshwar.local.pid).
  • Brajeshwar is my username on my machine.

Mysql Solutions


Solution 1 - Mysql

I found that it was a permissions issue with the mysql folder.

chmod -R 777 /usr/local/var/mysql/ 

solved it for me.

Solution 2 - Mysql

EDIT 2012/09/18: As pointed out by Kane, make sure the mysql database is properly set up before doing anything else. See “PID error on mysql.server start?” for more info.

Original answer kept for history's sake: It most likely is a permissions issue. Check /usr/local/var/mysql/*.err. Mine said:

120314 16:30:14  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
120314 16:30:14 mysqld_safe mysqld from pid file /usr/local/var/mysql/janmoesen.local.pid ended

I also had to do this:

sudo chown _mysql /usr/local/var/mysql/*

Solution 3 - Mysql

I ended up with completely reinstalling of mysql, and it finally worked out.

WARNING This will remove all of your databases, so make sure to save dumps first.

brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql

brew install mysql
mysqld --initialize --explicit_defaults_for_timestamp
mysql.server start # no sudo!

Solution 4 - Mysql

I had this issue on mac 10.10.5 Yosemite

What I did to solve this

cd /usr/local/var/mysql
sudo rm *.err && sudo rm *.pid
sudo reboot
sudo mysql.server start

Solution 5 - Mysql

I had the same issue on OS X El Capitan, here's the terminal command sequence that fixed it for me.

Delete error files (you'll have to change the path depending on your setup)

sudo rm /usr/local/mysql/data/*.err

Find the info for the mysql process that's still running and kill it:

ps -A | grep -m1 mysql | awk '{print $1}' | sudo xargs kill -9

Now restart MySQL:

/usr/local/mysql/support-files/mysql.server start

Solution 6 - 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.

  1. 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

  2. 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!

Solution 7 - Mysql

This worked for me:

sudo chmod -R 777 /usr/local/var/mysql/
sudo /usr/local/mysql/support-files/mysql.server start

Solution 8 - Mysql

This worked for me on 10.12.2 :

$ rm /usr/local/var/mysql/*.err

then

$ brew services restart mysql

Solution 9 - Mysql

If I remember correctly it is a permissions issue. Try to 'touch' and 'chmod' the pid file or the folder the file is held in.

Solution 10 - Mysql

My issue was that I started server as sudo once and then tried to restart as a local user.

Here mysql was not able to write to '.err' file owned by root. I had to remove that file and restart the server:

sudo rm /usr/local/var/mysql/*.err
mysql.server start

Solution 11 - Mysql

I’ve got a similar problem with MySQL on a Mac (Mac Os X Could not startup MySQL Server. Reason: 255 and also “ERROR! The server quit without updating PID file”). After a long trial and error process, finally in order to restore the file permissions, I’ve just do that:

launch the Disk Utilities.app
choose my drive on the left panel
click on the “Repair disk permissions” button

This did the trick for me. Hoping this can help someone else.

Solution 12 - Mysql

Find usr/local/var/mysql/your_computer_name.local.err file and understand the more information about error

Location : /usr/local/var/mysql/your_computer_name.local.err

It's probably problem with permissions

  1. Find if mysql is running and kill it

> ps -ef | grep mysql > > kill -9 PID

where PID is second column value 2. check ownership of mysql

> ls -laF /usr/local/var/mysql/

if it is owned by root, change it mysql or your user name



> sudo chown -R mysql /usr/local/var/mysql/

Solution 13 - Mysql

For me it worked with:

unset TMPDIR
mysql_install_db --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

Solution 14 - Mysql

What worked for me was:

  1. Go to your mysql installation directory
  2. sudo chmod -R 777 data
  3. Then go back one directory
  4. cd support-files/
  5. sudo ./mysql.server start

After that the server started running.

But the problem with this method is that I have to repeat this every time I want to start the mysql now. Don't know why it started behaving like this suddenly.

Solution 15 - Mysql

Try this (OSX)

Step 1: ps -aux | grep mysql

Then kill the 4 digits PID number

Step 2: kill 1965

Step 3: mysql.server start

Or having hard time to locate those PID numbers, try this below

Step 1 again: ps -aux | grep mysql

Step 2 again: killall

Step 3 again: mysql.server start

Solution 16 - Mysql

If you have upgraded your mysql installation to 8.x, check if your previous version is supported for upgradation.

If not, mysql will not work! Uninstall your mysql along with all configuration files in /usr/local/var/mysql (remove the whole folder). Reinstall mysql.

NOTE: reinstalling might lead to loss of data.

Solution 17 - Mysql

Please check the log , you will get more detailed information .

Use the below command to tail the error log

tail -100 /usr/local/var/mysql/<user_name>.local.err

For me , one of the directory is missing , once created the server has started .

Solution 18 - Mysql

The key takeaway is to check the .err file, by default on Mac OSX it's in /usr/local/var/mysql.

That log filed revealed to me that I had to delete the following files:

ibdata1
ib_logfile0
ib_logfile1

Running MySQL with mysql.start worked successfully after that. Note that deleting those files will likely causes data loss.

Solution 19 - Mysql

This is file permission problem. Check disk permissions and repair.

Osx => Cmd+Space => Disk Utilty => Verify Disk Permissions.

Verify completed after Repair Disk Permissions. mysql.server start command is worked succesfuly.

Solution 20 - Mysql

sudo chmod -R 777 /usr/local/var/mysql/

works for me.

Solution 21 - Mysql

I had the same issue:

But the situation was, every time i try to enter:

/usr/local/mysql/support-files/mysql.server start

a file named localhost.pid is created instead of iMax0.local.pid which was stated in the error:

ERROR! The server quit without updating PID file (/usr/local/mysql/data/iMax0.local.pid).

Solution that works for me was copying localhost.pid and renaming it to iMax0.local.pid.

Solution 22 - Mysql

I had the similar issue. But the following commands saved me.

cd /usr/local/Cellar
sudo chown _mysql mysql

Solution 23 - Mysql

My solution on OSX El Capitan was:

sudo chmod ugo+w /tmp

It was broken suddenly.

The error was:

ERROR! The server quit without updating PID file

and the log showed:

Can't start server : Bind on unix socket: Permission denied

It might also be helpful to note, that under OSX there is no my.cnf file by default and not needed by default, which I did not know. Good luck!

Solution 24 - Mysql

$ sudo mysql.server restart

It works for me.

Solution 25 - Mysql

None of the answers worked for me. However, I simply did sudo mysql.server start and it worked nicely.

Also, for me, it did NOT show permissions issue in *.err file.

Solution 26 - Mysql

I had this problem on Linux, but the cause is relevant to any mysql installation. In my case, the server was crashing before startup was complete and the pid file updated. The error messages were seen when starting up mysqld directly instead of via "service mysql start".

In my case, the cause was the partition where the log files were located being full. Removing log files permitted mysql to start again. To test for this issue, go to the location of your mysql activity logs, and do df ..

Solution 27 - Mysql

all solutions above doesn't work for me. but they give me some clues to fix this error. > mysql.server start ----error The server quit without updating PID file

I installed [email protected] on my macbook mojave with homebrew > brew install [email protected]

mysql error log located in /usr/local/var/mysql/IU.lan.err,there is one line in it: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

after trying many posts in goole search engine,I turned to baidu https://blog.csdn.net/xhool/article/details/52398042 inspired by this post,I found the solution: > rm /usr/local/var/mysql/* > > mysqld --initialize

a random password for root user will be shown in bash. but the command mysql -uroot -p[theRandomPassword] cant work.so I have to reset password. create a init file with contents like this > SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

place it in any directory easy to find,such as Desktop > mysqld --init-file=[YourInitFile] &

many logs printed on your screen.

> mysql -uroot -pMyNewPass

enjoy your high-version mysql!

Solution 28 - Mysql

Happened to me because I was actually switching from MariaDB to Mysql. Switching back to MariaDB solved this.

I'm guessing the existing database wasn't compatible.

Solution 29 - Mysql

Solved this using sudo chown -R _mysql:_mysql /usr/local/var/mysql Thanks to Matteo Alessani

Solution 30 - Mysql

This error may be actually being show because mysql is already started. Try to see the current status by:

mysql.server status

Solution 31 - Mysql

While Installing from source,please follow the instruction in file INSTALL-SOURCE

where installation instruction are given in section 2.8

after installation ,check are there any process running of mysql with ps aux | grep mysql

You'll find like this

root      1817  0.0  0.0 108336  1228 ?        S    Jan21   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mail.gaurav.local.pid
mysql     2141  0.0  1.2 497660 24588 ?        Sl   Jan21   0:26 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/mail.gaurav.local.err --pid-file=/usr/local/mysql/data/mail.gaurav.local.pid --socket=/tmp/mysql.sock --port=3306
root      5659  0.0  0.0 103256   840 pts/13   S+   11:30   0:00 grep mysql
 

kill all process related to mysql,and then try to start mysql server

Solution 32 - Mysql

First mv -f /var/lib/mysql /var/lib/mysql.bak and try the command mysql_install_db --user=mysql --ldata=[destination] replace the destination with the data directory, after that start the MySQL with /etc/init.d/mysql restart

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBrajeshwarView Question on Stackoverflow
Solution 1 - MysqlmikoopView Answer on Stackoverflow
Solution 2 - MysqljanmoesenView Answer on Stackoverflow
Solution 3 - MysqlartnikproView Answer on Stackoverflow
Solution 4 - MysqlRakesh JamesView Answer on Stackoverflow
Solution 5 - MysqlCircle BView Answer on Stackoverflow
Solution 6 - MysqlphpguruView Answer on Stackoverflow
Solution 7 - MysqlKresimir PleseView Answer on Stackoverflow
Solution 8 - MysqlSuryanto RachmatView Answer on Stackoverflow
Solution 9 - MysqlLonnyLotView Answer on Stackoverflow
Solution 10 - MysqlGrimmoView Answer on Stackoverflow
Solution 11 - MysqlClaude COULOMBEView Answer on Stackoverflow
Solution 12 - MysqlAmitesh BhartiView Answer on Stackoverflow
Solution 13 - Mysqlcaarlos0View Answer on Stackoverflow
Solution 14 - MysqlPritam BanerjeeView Answer on Stackoverflow
Solution 15 - MysqlaccimeesterlinView Answer on Stackoverflow
Solution 16 - MysqlAyush GoelView Answer on Stackoverflow
Solution 17 - MysqlManiView Answer on Stackoverflow
Solution 18 - MysqlJanac MeenaView Answer on Stackoverflow
Solution 19 - MysqlwallanceView Answer on Stackoverflow
Solution 20 - MysqlAnshulView Answer on Stackoverflow
Solution 21 - Mysql0yeojView Answer on Stackoverflow
Solution 22 - Mysqlshakti singhView Answer on Stackoverflow
Solution 23 - MysqlGasgeberView Answer on Stackoverflow
Solution 24 - MysqlLucas OconView Answer on Stackoverflow
Solution 25 - Mysqlmaster_dodoView Answer on Stackoverflow
Solution 26 - MysqlEdward SchaeferView Answer on Stackoverflow
Solution 27 - Mysql何德福View Answer on Stackoverflow
Solution 28 - MysqltheredledView Answer on Stackoverflow
Solution 29 - MysqlVallieView Answer on Stackoverflow
Solution 30 - MysqlJahmicView Answer on Stackoverflow
Solution 31 - MysqlRam LahaneView Answer on Stackoverflow
Solution 32 - MysqlKarthikView Answer on Stackoverflow