Blog Untuk Semua

Everything for Everyone

MySQL error: Manager of pid-file quit without updating file.

Tinggalkan komentar

So I was working at home over the weekend using MySQL on my MacBook running OS X 10.6 (Snow Leopard), put my computer to sleep then came in to the office this morning and opened it back up.

At one point I had to restart MySQL (which up to this point was running fine), and received this error:

$ sudo /usr/share/mysql/mysql.server start
Starting MySQL
.................................................................
ERROR! Manager of pid-file quit without updating file.

After a good 20 minutes spent on Google trying various things (hunting down the mysql.plugin file to verify its permissions, removing my my.cnf file, verifying my .pid file was getting erased, etc), I finally stumbled upon the answer: MySQL was still running under a different hostname.

It happened like this

  • At home, my computer’s hostname was set to SDF1.local
  • I put my computer to sleep, MySQL remained running
  • When I got to work, my computer’s hostname changed to laptop-134.workdomain
  • When I issued the MySQL restart command, mysql.server sent the shutdown command (and subsequent start command) using my current hostname, laptop-134.workdomain — but the current mysqld process was running under my old hostname of SDF1.local.

Bash shows the remnants of the battle:

$ ls -l /var/lib/mysql/
total 41128
-rw-rw----   1 _mysql  _mysql     15566 Aug 14 23:20 Gabriels-MacBook.local.err
-rw-rw----   1 _mysql  _mysql       771 Aug 15 21:18 SDF1.local.err
-rw-rw---- 1 _mysql _mysql 5 Aug 15 21:17 SDF1.local.pid
... snip ...
-rw-rw----   1 _mysql  _mysql     53778 Aug 16 12:33 laptop-134.workdomain.err
... snip ...

The fix

In the Terminal, saw the current running mysqld process and took note of the process ID:

$ ps aux | grep mysql | grep -v grep
_mysql    1929   0.0  0.4  2502344  18788 s000  S     9:17PM   0:21.13 /opt/local/libexec/mysqld --basedir=/opt/local --datadir=/opt/local/var/db/mysql5 --user=_mysql --log-error=/opt/local/var/db/mysql5/SDF1.local.err --pid-file=/opt/local/var/db/mysql5/SDF1.local.pid --socket=/opt/local/var/run/mysql5/mysqld.sock --port=3306
root      1837   0.0  0.0  2435464    856 s000  S     9:17PM   0:00.03 /bin/sh /opt/local/lib/mysql5/bin/mysqld_safe --datadir=/opt/local/var/db/mysql5 --pid-file=/opt/local/var/db/mysql5/SDF1.local.pid

Killed the process that was running with the _mysql user:

$ sudo kill 1929

Success!

$ sudo /usr/share/mysql/mysql.server start
Starting MySQL
. SUCCESS!

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s