Friday, July 24, 2009

Can't connect to local MySQL server through socket

/usr/local/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists

========================
Solution I:
To fix it, and if you are running cPanel just try to run the next commands:

# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

# /scripts/mysqlup --force

If its not worked add the following line in my.cnf that will helps to start the mysql

skip-innodb

then check the mysql databases.
=========================

Solution II

Go to var/lib/mysql
touch mysql.sock
chown mysql.mysql mysql.sock
chmod 777 mysql.sock

cd /tmp
ln -s /var/lib/mysql/mysql.sock mysql.sock

/etc/init.d/mysql restart

Now check the mysql

Note :: If the error persist you need to kill all existing mysql process and try.
======================

No comments:

Post a Comment