So, this is a Centos 6.5 fresh install. After installing Virtualmin I noticed that mysqld doesn't start. It says: Another MySQL daemon already running with the same unix socket.
It is set to /var/lib/mysql/mysql.sock The mysql.sock already exists. If I delete it manually, server will start. Else, it will not.
I can't seem to understand why the .sock is not deleted before attempting to start it after a reboot.
Doing a restart of the service, won't help, although it says it is stopping it. [root@atlantis log]# service mysqld restart Stopping mysqld: [ OK ] Another MySQL daemon already running with the same unix socket. Starting mysqld: [FAILED]
The only solution is to manually delete the mysql.sock.
Any ideea?
Comments
Submitted by andreychek on Sun, 12/08/2013 - 18:31 Comment #1
Hmm, that is unusual.
What output does this command produce, when that sock file exists:
ls -l /var/lib/mysql/mysql.sock
Submitted by spooky on Mon, 12/09/2013 - 01:26 Pro Licensee Comment #2
srwxrwxrwx 1 mysql mysql 0 Dec 8 20:00 /var/lib/mysql/mysql.sock
Submitted by spooky on Mon, 12/09/2013 - 04:02 Pro Licensee Comment #3
When I delete the .sock and start mysqld, it looks the same: srwxrwxrwx 1 mysql mysql 0 Dec 9 11:11 /var/lib/mysql/mysql.sock
Yes, indeed, it is unusual... never confronted with something like this. I have even changed in my.cnf the socket file to use, I put mysqld.sock. It starts the mysqld server just fine when mysql.sock exists, but again, after a system restart.
If I do now a clean system restart, from command line using reboot for example, everything boots back in place as it should.
BUT, if the system gets a reset by itself then mysqld doesn't start. If I press the reset button on the server, when it boots mysqld doesn't starts.
Hopefully that will not happen too often, as I have discovered the problem causing the freezing/restarts (bad memory).
Submitted by andreychek on Mon, 12/09/2013 - 09:07 Comment #4
What is the output of this command:
rpm -qa | grep mysql
One thing you could do -- this is just a "hack", as they say, but it might help in cases where your server crashed.
If you edit /etc/rc.d/rc.local, you could add a line like this:
rm /var/lib/mysql/mysql.sock
That will make it so that when your server starts, that .sock file is deleted.
Submitted by spooky on Mon, 12/09/2013 - 09:27 Pro Licensee Comment #5
Isn't the rc.local executed after all the init scripts, including mysqld is executed, are executed? So in this case I'd rather modify the /etc/rc.d/rc.local/init.d/mysql init script. I will try to compare it with the one on my older server Centos 4.9.
Submitted by andreychek on Mon, 12/09/2013 - 09:54 Comment #6
You're absolutely right -- my bad! Adding that to the MySQL init script should do the trick.
Submitted by JamieCameron on Tue, 12/17/2013 - 20:23 Comment #7
FYI, I saw this on one of my systems today as well - it happened after a forced reboot, in which MySQL wasn't shut down cleanly.
Submitted by A Good Tech on Fri, 01/24/2014 - 14:24 Comment #8
I had the same issue:
Another MySQL daemon already running with the same unix socket.
Here is what I used:
SSH into your sever then:
/etc/rc.d/init.d/mysql stop
then
mv /var/lib/mysql.sock /var/lib/mysql/mysql.sock.bak
then
/etc/rc.d/init.d/mysql start
I am using CentOS 6.5, this happened during an update that froze the server. I restarted then noticed that the MySQL server was down and could not be restarted.