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

1 Answer 1


Try restarting it to see if there are any error messages.

service mysqld restart
  • It started up my application, but I'm not sure if it ended my problems... The log output in Edit1
    – siliconpi
    Oct 22, 2010 at 0:45
  • Sounds like it's not set to run at startup then. chkconfig mysqld on Oct 22, 2010 at 0:48
  • Precisely that! I did that, did a restart to check and voila!
    – siliconpi
    Oct 22, 2010 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .