I am getting the following error when I try to connect to mysql:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Is there a solution for this error? What might be the reason behind it?
I am getting the following error when I try to connect to mysql:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Is there a solution for this error? What might be the reason behind it?
Just edit
/etc/my.cnf
Add following lines tomy.cnf
Restart mysql and connect again
Please check whether another mysql service is running.
Try first 2, 3 solutions. Error is stil popup & If you can not find
/var/lib/mysql/mysql.sock
Check the space available in /var/
If the directory is full remove some unusefull files/directories
Probably your issue will sorted now.
Are you connecting to "localhost" or "127.0.0.1" ? I noticed that when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could try using "127.0.0.1" if the socket connector is not enabled/working.
The MySQL server is not running, or that is not the location of its socket file (check my.cnf).
Here's what worked for me: