Hi, I'm Harry.
A Web Developer.

I take interest in cryptocurrencies and general web stuff.

   Check my CV




Donate via ETH: 0xd174C44e0F042eC3E9d86B09A8cFAB7E19429b81
Donate via ETH
0xd174C44e0F042eC3E9d86B09A8cFAB7E19429b81

Another MySQL daemon already running with the same unix socket

Categories: mysql
Posted: 02 July 2014

I recently had the experience of a server shutting down ungracefully, and caused MySQL to completely fall over and die. After executing service mysqld status, it showed that mysqld was not running;

# service mysqld status
mysqld is stopped

So, I needed to start it;

# service mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld:                                           [FAILED]

Wut. (Exactly!)

To fix this issue!

  • Remove the mysql.sock file (as it thinks it’s running, but it’s not - because of the ungraceful shutdown)
  • Start the service

Where is the .sock file?!

  • Typically located at /var/lib/mysql/mysql.sock
    • If it’s not there, execute locate mysql.sock

How do I remove it?

  • Run the following; rm /var/lib/mysql/mysql.sock
  • If you wish to create a backup, run the following; mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.backup

Final step, start MySQL!

  • To start MySQL, run; service mysqld start