Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Sep 012010
 

Can't connect to local MySQL server through socket

Answer:

Sometimes when you type the mysql command, it shows:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

The cause of this problem is the MySQL socket file is not in the default location, e.g. /tmp/mysql.sock

To fix, edit the MySQL configurations, e.g. /etc/my.cnf, add the following lines

[client]
socket=/tmp/mysql.sock

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>