MySQL pid ended (cannot start mysql)
Asked Answered
P

11

34

I have a clean install of MySQL (mysql-5.5.24-osx10.6-x86_64). I am on Lion (OS 10.7.4) with a Mac Pro Quad Core. I installed MySQL the GUI installer and also installed the pref pane and the startup item.

However when I run:

sudo ./bin/mysqld_safe

I get this message:

120515 17:58:19 mysqld_safe Logging to '/usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.err'.
120515 17:58:19 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.5.24-osx10.6-x86_64/data
120515 17:58:20 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.pid ended

I also cannot start MySQL from the preference pane.

Here is what I have tried so far based on the hours of Googling and research today:

Permissions issues?

This:

cd /usr/local
sudo chown mysql mysql
sudo chown mysql mysql-5.5.24-osx10.6-x86_64
sudo chown _mysql mysql
sudo chown _mysql mysql-5.5.24-osx10.6-x86_64

and

sudo chown -R /usr/local/mysql-5.5.24-osx10.6-x86_64/
sudo chown -R /usr/local/mysql

This:

sudo chown -R root:wheel /Library/StartupItems/MySQLCOM

Link issues?

This:

in /usr/local/mysql/support-files/mysql.server -- I did:

basedir="/usr/local/mysql"
datadir="/usr/local/mysql/data"

In the file /etc/rc.common add the follow line at end: /usr/local/mysql/bin/mysqld_safe --user=mysql &

This:

sudo ln -s /usr/local/mysql-5.5.24-osx10.6-x86_64 /usr/local/mysql

I also tried the removal process here and reinstalled but this did not seem to make a difference. I also launched Activity Monitor in OS X to see if any other mySQL processes were running by chance but they were not.

Nothing above worked so I am sort of at wits end. Here is the log from the .err file located at:

/usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.err

120515 18:07:43 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.pid ended
120515 18:13:01 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.5.24-osx10.6-x86_64/data
120515 18:13:01 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.5.24-osx10.6-x86_64/data/ is case insensitive
120515 18:13:01 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: Table 'mysql.plugin' doesn't exist
120515 18:13:01 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120515 18:13:01 InnoDB: The InnoDB memory heap is disabled
120515 18:13:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120515 18:13:01 InnoDB: Compressed tables use zlib 1.2.3
120515 18:13:01 InnoDB: Initializing buffer pool, size = 128.0M
120515 18:13:01 InnoDB: Completed initialization of buffer pool
120515 18:13:01 InnoDB: highest supported file format is Barracuda.
120515 18:13:01  InnoDB: Waiting for the background threads to start
120515 18:13:02 InnoDB: 1.1.8 started; log sequence number 1595675
120515 18:13:02 [ERROR] /usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: unknown option '--skip-locking'
120515 18:13:02 [ERROR] Aborting

120515 18:13:02  InnoDB: Starting shutdown...
120515 18:13:03  InnoDB: Shutdown completed; log sequence number 1595675
120515 18:13:03 [Note] /usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: Shutdown complete

120515 18:13:03 mysqld_safe mysqld from pid file /usr/local/mysql-5.5.24-osx10.6-x86_64/data/Dannys-Mac-Pro.local.pid ended

Update: I upgraded the same machine from Snow Leopard to Mountain Lion 10.8.1 and MySQL works perfectly fine now with the upgrade, I had to do nothing extra.

Phasia answered 16/5, 2012 at 1:25 Comment(5)
[ERROR] /usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysqld: unknown option '--skip-locking' - does /usr/local/mysql-5.5.24-osx10.6-x86_64/my.cnf contain anything like skip-locking? If not, does bin/mysqld_safe (which is just a shell script)? If yes, remove it and try again.Acetabulum
@DannyEnglander I've had this issue for 2 days now - how did you deal with it?Bearskin
@Bearskin unfortunately, I had to revert back to OS X 10.6 Snow Leopard and that solved the issue. I was extremely disappointed that I could not get this working on Lion. Probably one of the most frustrating things I've ever gone through...Phasia
@DannyEnglander I very much hope that someone will find a solution to this. I had this problem on Snow Leopard and the only way I resolved it last night was to Time Machine my computer back 2 weeks. Very frustrating here also.Bearskin
Update: I upgraded the same machine from Snow Leopard to Mountain Lion 10.8.1 and MySQL works perfectly fine now with the upgrade, I had to do nothing extra.Phasia
C
11

I have the same problem when installing mysql newest version mysql-5.6.10-osx10.7-x86.dmg for my MAC OS 10.7.5. Following is my solutions. First , delete the mysql installed

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*

Then, get mysql-5.1.68-osx10.6-x86.dmg , install this old version, and done!

Chaffer answered 18/3, 2013 at 8:16 Comment(2)
If you want to keep your databases, then you should backup /usr/local/mysql/data/ first!Czardas
Backing up the databases is a good idea. By the way, just overwriting the "data" folder in the new installation with the old one did not work for me, but copying the actual databases sub-folders within the old "data" folder to the new one did.Terpstra
G
10

As @AndPy says, the same with me, if you ls -l the /usr/local/var/mysql you can see that the file COMPUTER-NAME.local.err is owned by _mysql or some such.... in this case just erase the file and mysql.server start will create new one owned by your user and will start properly this time :)

If the file is already owned by your user, this wont help, you got to google more :(

Gavin answered 30/1, 2014 at 13:7 Comment(0)
R
6

I found this error on redmine bitnami stack because owner of files in directory data incorrect.

Check owner of directory /mysql/data/ must be 'mysql' user

Hope this help.

Roughage answered 19/5, 2014 at 15:45 Comment(1)
Bingo. If you're on bitnami lamp stack, chown mysql opt/bitnami/mysql/data -R (you must be logged in as root). Then start mysql with $ cd /opt/bitnami $ sudo ./ctlscript.sh restart mysqlStupidity
E
6

I had the same problem after updating to OS X Mavericks.

Starting MySQL . ERROR! The server quit without updating PID file

Like Redrick and AndPy mentioned I also had to rename (actually I deleted the file) the error file located in $ cd /usr/local/var/mysql. My error file was called localhost.err. After removing the file with $ rm localhost.err I could finally start MySQL again with $ mysql.server start.

Embryologist answered 13/10, 2014 at 15:37 Comment(0)
D
4

I had the same problem.

In /usr/local/var/mysql I found a file in the form COMPUTER-NAME.local.err. Simply changing that file name solved the problem. I could now start the mysql server with

mysql.server start

Discouragement answered 17/6, 2013 at 11:8 Comment(0)
P
3

My answer is very similar to others, but slightly different and this applies mostly to a bitnami mamp stack. The fix for me was:

sudo chown -R mysql mysql/

The mysql/ directory is the one located in Applications/<mampstack-version>/

The above sets the mysql to be the owner of the mysql directory recursively into the other directories.

Perceptive answered 24/6, 2015 at 18:1 Comment(1)
On my Linux mint, I had to do two things: sudo mkdir /var/run/mysqld and sudo chown -R mysql /var/run/mysqldPhilpott
H
2

If you want to absolutely get this thing working do the following:

You need to uninstall mysql first so do that, before you do this though, make sure you have a backup of all your DBs.

brew remove mysql

Then you need to make sure certain files are uninstalled, make a batch script of the following commands and run it:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

Go to /etc/hostconfig using your favorite editing program and remove the line MYSQLCOM=-YES-

Then run brew cleanup then install mysql using brew install mysql

After you've done this you'll probably get the same error again. Head over to the folder cd /usr/local/var/mysql/. There should be a file in there called localhost.local.err

run cat ./localhost.local.err and look in the file. You should see something similar to:

2018-03-24 15:41:49 140735679804288 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use

2018-03-24 15:41:49 140735679804288 [ERROR] Do you already have another mysqld server running on port: 3306 ?

If you do, run the command sudo lsof -i :3306 and you'll probably get something back like this:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 74 _mysql 20u IPv6 0xXXXXXXXXXXXXX 0t0 TCP *:mysql (LISTEN)

This means mysql is already running and listening on port 3306 and you need to kill it. Use top to kill the program or just use Activity Monitor to kill it. Either way once that's done go back to cd /usr/local/var/mysql/ and delete the folder localhost.local.err.

Once that's done run mysql.server start and you should get the following:

180324 15:46:18 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql SUCCESS!

And congrats. I've been trying to fix this for a week and it's such an easy fix and I just figured it out. I hate myself.

Heartless answered 24/3, 2018 at 20:1 Comment(3)
sudo rm -rf /usr/local/var/mysql I have all my databases in this directory, which I don't want to erase…Chaney
@Chaney just take a backup. This worked perfectly on macOS High Sierra.Hedonics
@AhmedHashem yup yup. That was actually the first instruction I gave in the post.Heartless
D
0

120515 18:13:01 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

  • Regarding this error, I assume that you have specified a datadir in my.cnf. If you are using a non-default data directory for MySQL, you need to move folders mysql and performance_schema (whichever exists) to the data directory specified in my.cnf. You can find these folders in mysql directory.

In MySQL 5.5+ the --skip-locking option is removed. Use --skip-external-locking instead. Refer to MySQL documentation --> http://dev.mysql.com/doc/refman/5.5/en/mysql-nutshell.html Quote: "The --enable-locking and --skip-locking server options (use --external-locking and --skip-external-locking)."

Densify answered 19/9, 2012 at 17:22 Comment(0)
E
0

Give this a whirl..

  1. Navigate to the problem's parent directory cd YOURPATH/usr/local/mysql
  2. rm -rf *.local.err (deletes file)
  3. touch YOURUSERNAME.local.pid (generates new *.local.pid file the error thrown was complaining about)
  4. cd back into your project and restart mysql using mysql.server start
Epithelium answered 25/4, 2015 at 3:45 Comment(0)
H
0

Only removing mysql-bin.index file in /usr/local/var/mysql/ helped me.

Harmonicon answered 25/4, 2016 at 7:56 Comment(0)
C
0

I've tried many hours, But this works for me, Simply change the ownership of the MySQL directory file to the user called 'mysql'.

chown -R mysql <path>/mysql-5.7.39-linux-glibc2.12-x86_64
Collocutor answered 26/7, 2022 at 16:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.