I\'m getting this error
ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysql.sock\' (2)
even though
There is another chance of you to get this particular error if you modify the max_connections in my.cnf file.
I also faced the same error which did not let me log in to MySQL server. In my case the problem was, I had to increase the max_connections size in
/etc/mysql/my.cnf
to
set-variable = max_connections = 5000
Due to this reason next day when I stared MySQL server it threw this error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Removing the set-variable = max_connections = 5000 segment from my.conf file did the trick. After removing that particular segment following command was used. MySQL server started up and running like previously.
sudo /etc/init.d/mysql start