It is confirmed since a while that the MySQL server that was distributed with CentOS 6.4 and on, for now, has a so called stale socket bug.

This happens when there is an unclean/forced shutdown or restart of the box (usually due to a power failure). The mysqld daemon is being “killed” leavinf the socket in  /var/lib/mysql/mysql.sock

so when you try to (re)start the MySQL daemon it complains with the error described as

another MySQL daemon already running with the same unix socket

This bug has been corrected but until it is updated in the repo, the only (and effective) workaround is to start the myqld daemon from rc.local:

chkconfig mysqld off

vi /etc/rc.d/rc.local

and paste at the end of the file:

rm /var/lib/mysql/mysql.sock
service mysqld start

This will remove the myql.sock file before starting the MySQL daemon for whatever reason it’s there after the mysql deamon was stooped, otherwise it will produce an (insignifficant) error during startup – with a complaint that the given mysql.sock file does’t exist.

Still, until the bug is present you don’t have to worry about this issue anymore.

One thought on “Solved: Another MySQL daemon already running with the same unix socket

  1. Youre so cool! I dont suppose Ive read anything like this before. So nice to find somebody with some original thoughts on this subject. realy thank you for starting this up. this website is something that is needed on the web, someone with a little originality. useful job for bringing something new to the internet!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.