ERROR 2002 (HY000): Can't connect to local MySQL server thro

Post Reply
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

ERROR 2002 (HY000): Can't connect to local MySQL server thro

Post by a24uall »

Getting the error "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)" while I try to connect to mysql via a jailed shell enabled user.
[email protected] [~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[email protected] [~]#
Solution :
You need to specify the hostname so you can connect.
mysql -h=127.0.0.1 -u user_name -p
or
mysql -h=localhost -u user_name -p
Arun
WebhostingDevelopment.com
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Re: ERROR 2002 (HY000): Can't connect to local MySQL server

Post by a24uall »

To run any mysql command and output that to a file use
mysql -h 127.0.0.1 -p -e "select search_string from user_database.table_name;" > myoutput.txt
Post Reply

Return to “MYSQL ERRORS”