I have installed XAMPP installed in my linux machine and phpmyadmin is working fine. But when I tried to start mysql using console using mysql command, I am getting the following error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket

'/var/lib/mysql/mysql.sock' (2)

The same error is getting when I try to use cake php bake console

** since I have istalled XAMPP , there is no folder named mysql in /var/lib

Can you help me?

  • Look at your MySQL configuration (my.cnf, probably in /etc/mysql) to find out where your socket is located. It might be /var/run/...
    – Konerak
    Dec 22 '10 at 8:38
  • This is not a programming question. It should be on SF
    – d-_-b
    Dec 22 '10 at 9:26

Try running your mysql daemon as root. sudo /etc/init.d/mysqld start on ubuntu for example.

  • Also try: chmod -R 755 /var/lib/mysql
    – JP19
    Dec 22 '10 at 8:46

Check whether the user that wants to connect to MySQL has the filesystem permission to open /var/lib/mysql/mysql.sock

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy