When trying to start the mysqld
demon on a CentOS 6.5 box I get the following error:
[root@hardin ~]# service mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]
Which is odd because the service isn't started (it's configured to run on the default port) :
[root@hardin ~]# service mysqld status
mysqld is stopped
I'm not sure how to find the Unix socket that's causing the problem:
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 10 [ ] DGRAM 12056 /dev/log
unix 2 [ ACC ] STREAM LISTENING 8720 @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 12878 /var/run/mcelog-client
unix 2 [ ] DGRAM 9289 @/org/kernel/udev/udevd
unix 2 [ ] DGRAM 12440 @/org/freedesktop/hal/udev_event
unix 2 [ ACC ] STREAM LISTENING 12275 /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 13128 /var/run/abrt/abrt.socket
unix 2 [ ACC ] STREAM LISTENING 12415 @/var/run/hald/dbus-jQMFHN9EAI
unix 2 [ ACC ] STREAM LISTENING 12408 @/var/run/hald/dbus-YQIZ9h7s4Q
unix 2 [ ACC ] STREAM LISTENING 12371 /var/run/acpid.socket
unix 2 [ ] DGRAM 14119
unix 3 [ ] STREAM CONNECTED 13579 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 13578
unix 2 [ ] DGRAM 13521
unix 3 [ ] STREAM CONNECTED 13493
unix 3 [ ] STREAM CONNECTED 13492
unix 2 [ ] DGRAM 13130
unix 2 [ ] DGRAM 13058
unix 2 [ ] DGRAM 13023
unix 2 [ ] DGRAM 12875
unix 2 [ ] DGRAM 12840
unix 3 [ ] STREAM CONNECTED 12773 /var/run/acpid.socket
unix 3 [ ] STREAM CONNECTED 12772
unix 3 [ ] STREAM CONNECTED 12767 @/var/run/hald/dbus-YQIZ9h7s4Q
unix 3 [ ] STREAM CONNECTED 12766
unix 3 [ ] STREAM CONNECTED 12716 @/var/run/hald/dbus-YQIZ9h7s4Q
unix 3 [ ] STREAM CONNECTED 12634
unix 3 [ ] STREAM CONNECTED 12714 @/var/run/hald/dbus-YQIZ9h7s4Q
unix 3 [ ] STREAM CONNECTED 12534
unix 3 [ ] STREAM CONNECTED 12435 @/var/run/hald/dbus-jQMFHN9EAI
unix 3 [ ] STREAM CONNECTED 12434
unix 3 [ ] STREAM CONNECTED 12410 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 12409
unix 2 [ ] DGRAM 12375
unix 3 [ ] STREAM CONNECTED 12295 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 12294
unix 3 [ ] STREAM CONNECTED 12289
unix 3 [ ] STREAM CONNECTED 12288
unix 3 [ ] DGRAM 9308
unix 3 [ ] DGRAM 9307
I use this box as a Git server, running GitLab, and it used to work. After a cold boot it doesn't work any more because unicorn
can't connect to MySQL for the reason above:
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) (Mysql2::Error)
I'm wondering how to troubleshoot this and find what service is running on the MySQL port.
You can use
to see which process (if any) owns the socket and take appropriate action
If you're sure that there is no other MySQL process running, you can simply delete the
/var/lib/mysql/mysql.sock
file. When MySQL starts, if the socket doesn't exist, it will recreate it.