This is NOT a duplicate of Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
The issue there was of insufficient disk space. No such problem here.
I have a mysql setup on a Redhat Centos 5.5 system, which was working fine until I restarted it.
The webapplication spits out:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
when trying to connect to it.
I'm not able to run:
root@server [~]# /usr/bin/mysql_secure_installation ... Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Irrespective of what I enter (root password, earlier mysql password, or blank), it still says the same thing.
root@server [~]# cat /var/log/mysqld.log 101021 18:37:34 mysqld ended
Edit1: After doing service mysqld restart
101022 00:43:46 mysqld started 101022 0:43:46 InnoDB: Started; log sequence number 0 2820714 101022 0:43:46 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.0.77' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution