can't start mysqld on centos because I cant find mysql.sock

Yannick picture Yannick · Dec 10, 2013 · Viewed 41.9k times · Source

Hello when I try to start up my mysqld I get this error:

[root@localhost /]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

the main reason is that my.cnf file can't find my mysql.sock file.

[root@localhost /]# mysqladmin -u root -p status

mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

When I try to search it with :

sudo find / -type s | grep mysqld.sock

I'll get

find: ‘/proc/3253/task/3253/fd/5’: Bestand of map bestaat niet 
find: ‘/proc/3253/task/3253/fdinfo/5’: Bestand of map bestaat niet
find: ‘/proc/3253/fd/5’: Bestand of map bestaat niet
find: ‘/proc/3253/fdinfo/5’: Bestand of map bestaat niet

"Bestand of map bestaat niet" == "File or directory don't exists"

I'm new at this so can anyone help me please?

Answer

Barmaley picture Barmaley · Dec 6, 2014

What a pain! I stumbled upon same problem (on RedHat) and this helped me:

service mysqld stop
rm -rf /var/lib/mysql/*
service mysqld start
mysql_secure_installation

Hope that helps. Good luck!