Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Can't connect to local MySQL server through socket  (Read 2982 times)

0 Members and 1 Guest are viewing this topic.

Aby

  • Guest
Can't connect to local MySQL server through socket
« on: November 04, 2013, 08:16:45 pm »
/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.
======================