Friday, March 15, 2013

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

If you are on ubuntu and want to connect to running sql, if you are getting this error:
do:
$ps -aux | grep mysqld
you'll find some path for:
--socket = /[some path]/mysql.sock
It means your socket file is somewhere else, you need to just make a symbolic link where you system is looking for the socket file.
So do:
$cd /var/run
$sudo mkdir mysqld
$ sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock

Thats it.