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
In my case the problem was that I had added "default-character-set=utf8" to my.cnf and that was corrupting the file. Instead change that line for "character_set_server=utf8". That should solve it, hope this helps.