ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Issue: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)root@server [/var/lib/mysql]# tail -f /var/log/mysqld.log
tail: cannot open `/var/log/mysqld.log' for reading: No such file or directory
tail: no files remaining
root@server [/var/lib/mysql]# service mysql start
Resolution:
# cd /var/lib/mysql/
# touch mysql.sock
# chmod 1777 mysql.sock
# chown mysql.mysql mysql.sock
There is no need to create sock file. it will be created by deamon. better check your logs why MySQL doesn't start.
# /etc/init.d/mysql restart
# tail -20 /var/lib/mysql/`hostname`.err
Also add to
# nano /etc/my.cnf
err-log=/var/log/mysqld.log
And then check /var/log/mysqld.log
Also make sure that no other process is listening on port 3306 using 'netstat -lpn | grep 3306' . If there is any such process kill it and then try starting mysql.
# netstat -lpn | grep 3306
The following command can be used as such, without replacing hostname with actual hostname and not by changing the quotes.
# /etc/init.d/mysql restart
# tail -20 /var/lib/mysql/`hostname`.err
2) try to change the "Reset Local MySQL Root Password"
3) /scripts/mysqlup --force