After MySQL installs through Brew, I get an error message. Server shuts down without updating PID file

Well, I searched everything and spent a lot of time installing, uninstalling, trying to choose, but without success.

I am on Mac OS X Lion (10.7.3) and am trying to configure Python, MySQL.

I have successfully installed Python and MySQL through HomeBrew. Python works great.

After installing MySQL, I completed the first two steps - unset and 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.
+74
mysql homebrew
Mar 08 2018-12-12T00:
source share
28 answers

EDIT 2012/09/18: As indicated by Kane , make sure the mysql database is configured correctly before doing anything else. See “ PID Error Starting mysql.server? ” For more information.

Original answer saved for the story: Most likely, this is a permission issue. Check out /usr/local/var/mysql/*.err . My 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/* 
+74
Mar 14 2018-12-12T00:
source share

I found that this is a mysql folder permissions issue.

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

decided it for me.

+95
Jul 22 '14 at 12:34
source share

I ended up with a complete reinstall of mysql and it finally worked.

ATTENTION! This will delete all your databases, so save the 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! 
+51
Mar 22 '16 at 14:16
source share

I had this problem on mac 10.10.5 Yosemite

What have I done to solve this problem?

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

+28
Aug 31 '15 at 7:25
source share

November 2014: If you get this error in 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 a sock file), here’s what fixed this for me:

1) Uncomment the standard lines of the homebrew configuration file and edit as shown 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 = <UNIQUE_NUMBER_HERE_OR_LEAVE_COMMENTED_OUT> socket = /tmp/mysql.sock pid-file = /usr/local/var/mysql/[BOXNAME].local.pid .... 

BOXNAME is what you have in your system Prefs → Network as a unique identifier for your computer on the network.

2) Set permissions for all files in datadir mysql. They all belonged to [my_username]. MySQL is very picky and refuses to create a pid file if it (user _mysql) does not own the directory.

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

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

 $ sudo mysql.server start Starting MySQL . SUCCESS! 

Hope this helps. If the above does not work for you, try running the mysqld_safe binary manually in the Cellar / mysql / VERSION_ / bin / directory and check what settings (if it is running)

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

If this is done, 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 this worked for me, but it shows you where I got the settings for my.cnf configuration file from. You can also use command line options to try to troubleshoot mysqld manually.

If you are managing a MySQL server using mysqld_safe, you may need to do this to close it before trying to use the mysql.server bash helper. Eliminate the urge to kill -9 [PID] because you can damage your data.

 mysqladmin -uroot shutdown 

Good luck

+18
Nov 24 '14 at 17:19
source share

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

Delete error files (you will have to change the path depending on your installation)

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

Find information about the mysql process that is still running and killed it:

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

Now restart MySQL:

 /usr/local/mysql/support-files/mysql.server start 
+17
Feb 02 '16 at 17:45
source share

This worked for me:

 sudo chmod -R 777 /usr/local/var/mysql/ sudo /usr/local/mysql/support-files/mysql.server start 
+10
Aug 08 '15 at 9:17
source share

If I remember correctly, this is a permission issue. Try to “touch” and “chmod” the pid file or the folder in which the file is stored.

+3
Mar 09 '12 at 1:25
source share

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

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

 sudo rm /usr/local/var/mysql/*.err mysql.server start 
+3
May 6 '15 at 13:58
source share

This worked for me on 10.12.2:

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

then

 $ brew services restart mysql 
+3
Dec 22 '16 at 3:39
source share

I had a similar problem with MySQL on Mac (Mac Os X Cannot start the MySQL server. Reason: 255, as well as "ERROR! Server is shutting down without updating the PID file"). After a lengthy trial and error process, finally, to regain file permissions, Ive just done this:

run Disk Utilities.app
select my drive in the left pane
click the "Restore disk rights" button




It helped me. Hope this helps someone else.

+2
Jun 17 '15 at 4:49
source share

For me, this worked with:

 unset TMPDIR mysql_install_db --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp 
+1
Aug 21 '13 at 2:36 on
source share

What worked for me:

  • Go to mysql installation directory
  • sudo chmod -R 777 data
  • Then return one directory
  • cd support-files/
  • sudo ./mysql.server start

After that, the server started.

But the problem with this method is that I have to repeat this every time I want to start mysql. I don’t know why it started so suddenly.

+1
Aug 12 '16 at 4:29
source share

Locate usr / local / var / mysql / your_computer_name.local.err file and find out more error information

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

Probably a permission issue

  • Find if mysql is running and kill it

ps -ef | grep mysql

kill -9 PID

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

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 /

+1
May 11 '17 at 11:35 a.m.
source share

Try this (OSX)

Step 1: ps -aux | grep mysql ps -aux | grep mysql ps -aux | grep mysql ps -aux | grep mysql

Then kill the 4 digit PID number

Step 2: kill 1965

Step 3: mysql.server start

Or it will be difficult for you to find these PID numbers, try this below

Step 1 again: ps -aux | grep mysql ps -aux | grep mysql ps -aux | grep mysql ps -aux | grep mysql

Step 2 again: killall

Step 3 again: mysql.server start

+1
Nov 04 '17 at 15:35
source share

This is a file resolution issue. Check permissions and disk repair.

Osx => Cmd + Space => Disk Utilty => Check disk permissions.

The check is completed after the removal of repair permits. The mysql.server start command works successfully.

0
Jun 28 '15 at 15:30
source share
 sudo chmod -R 777 /usr/local/var/mysql/ 

works for me.

0
Jul 28 '15 at 9:13
source share

I had the same problem:

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

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

a file is created with the name localhost.pid instead of iMax0.local.pid , which was specified in the error:

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

The solution that works for me is to copy localhost.pid and rename it to iMax0.local.pid .

0
Nov 12 '15 at 10:03
source share

I had a similar problem. But the following teams saved me.

 cd /usr/local/Cellar sudo chown _mysql mysql 
0
Dec 22 '15 at 7:19
source share

My solution on OSX El Capitan was:

 sudo chmod ugo+w /tmp 

He suddenly broke.

Mistake:

 ERROR! The server quit without updating PID file 

and the magazine showed:

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

It may also be useful to note that by default in OSX there is no default my.cnf file and no default is required, which I did not know. Good luck

0
Jan 14 '16 at 11:50
source share
 $ sudo mysql.server restart 

This works for me.

0
Apr 14 '16 at 20:56 on
source share

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

Also, for me, this did not display permissions problems in the * .err file.

0
Nov 10 '16 at 17:07
source share

I had this problem on Linux, but the reason is related to any mysql installation. In my case, the server worked before the launch completed and the pid file was updated. Error messages were visible when starting mysqld directly, and not through "service mysql start".

In my case, the reason was the section in which the log files were placed. Removing the log files allowed mysql to start again. To check this issue, go to the mysql activity log location and execute df . .

0
Jun 21 '17 at 20:10
source share

If you upgraded your MySQL installation to 8.x, check if your previous version is supported for the upgrade .

If not, MySQL will not work! Remove mysql along with all configuration files in /usr/local/var/mysql (delete the entire folder). Reinstall mysql.

NOTE: reinstallation may result in data loss.

0
May 08 '19 at 8:18
source share

All the solutions above do not work for me. but they give me some tips to fix this error.

mysql.server start ---- error Server exited without updating PID file

I installed mysql@5.7 on a Mojave MacBook with homemade beer

brew install mysql@5.7

The mysql error log is in /usr/local/var/mysql/IU.lan.err, there is one line there: Cannot open and lock privilege tables: table "mysql.user" does not exist

Having tried many posts in the drone search engine, I turned to the canoe https://blog.csdn.net/xhool/article/details/52398042 inspired by this post, I found a solution:

rm / usr / local / var / mysql / *

mysqld --initialize

a random password for the root user will be shown in bash. but the mysql -uroot -p [theRandomPassword] command cannot work. Therefore, I need to reset the password. create an initialization file with this content

SET PASSWORD FOR 'root' @ 'localhost' = PASSWORD ('MyNewPass');

put it in any directory that is easy to find, for example, on your desktop

mysqld --init-file = [YourInitFile] &

many magazines are printed on your screen.

mysql -uroot -pMyNewPass

enjoy your high version of mysql!

0
Jul 31 '19 at 5:44
source share

Please check the magazine, you will receive more detailed information.

Use the command below to track the error log

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

For me, one directory is missing after the created server is started.

0
Sep 19 '19 at 2:55
source share

If installing from source, follow the instructions in the INSTALL-SOURCE file

where installation instructions are given in section 2.8

after installation, check if there is any mysql process with ps aux | grep mysql

You will find it as

 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 whole mysql related process and then try to start the mysql server

-2
Jan 22 '15 at 6:01
source share

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

-3
Aug 03 '13 at 23:09
source share



All Articles