Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Dec 22 '10 at 14:25

This question came from our site for professional and enthusiast programmers.

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.

share|improve this answer
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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.