Can’t connect to local MySQL server through socket

on a mysql server while trying to connect from command line, i just get:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

I see that mysql is creating the socket in /var/lib/mysql/mysql.sock
So to correct the problem, I created a symlink from the actual socket to where mysql command is looking;
mkdir /var/run/mysqld
cd /var/run/mysqld
ln -s /var/lib/mysql/mysql.sock mysqld.sock

Then mysql connects from command line. What I’d like to know is, what tells command line to look for the sock at ‘/var/run/mysqld/mysqld.sock’, even though my.cnf is specifying ‘/var/run/mysql/mysql.sock’ ?

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *