Page 1 of 1

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

Posted: Sun Nov 04, 2012 9:38 am
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

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

Posted: Sun Nov 04, 2012 9:42 am
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