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

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 /opt/local/share/mysql5/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 /opt/local/var/db/mysql5
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 /opt/local/share/mysql5/mysql/mysql.server start
Starting MySQL
. SUCCESS!

Moral of the story

If your computer’s hostname changes because you move from one network to another, hilarity will ensue.  Best to stop mysqld before changing networks.

Related External Links

Advertisements

5 thoughts on “MySQL error: Manager of pid-file quit without updating file.

  1. lifesaver, thank you!

    Thought I might be staring down the wrong end of a macports re-install and a missed deadline whilst working away from home.

    Much appreciated 🙂

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s