Traditional ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysqld/mysqld.sock' (2)

Disk space is there. The mysqld service starts.

In UNKNOWN_MYSQL_USER@localhost as on SET NAMES Quit logs UNKNOWN_MYSQL_USER@localhost as on SET NAMES Quit

What is it?

How can you see what causes with such a UNKNOWN_MYSQL_USER ? And how can it be changed?

Yes. And where many looked. Initially, I did not start the mysqld server at all, fixed the tables, set the rights to the folders and killed the processes and so on.

Update

The problem did not go away, but I, in fact, did not know what to do. The only place I see at least something about UKNOWN_MYSQL_USER is

 /etc/init.d/mysqld -start(){ [ -x $exec ] || exit 5 # check to see if it's already running RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" -- user=UNKNOWN_MYSQL_USER ping 2>&1` if [ $? = 0 ]; then # already running, do nothing action $"Starting $prog: " /bin/true ret=0 elif echo "$RESPONSE" | grep -q "Access denied for user" 
  • Slip in question describes two problems - the inability to establish a connection with the server and an attempt to access the service from under UNKNOWN_MYSQL_USER. Now the question is relevant, do you still see the message Can't connect to local MySQL server through socket '/var/lib/mysqld/mysqld.sock'? - cheops
  • Please describe how you start MySQL, is it about the server or the console client mysql? - cheops

1 answer 1

Try this:

 mysql -h 127.0.0.1 -P 3306 -u root -p <database> 

Also (make sure it works):

 telnet 127.0.0.1 3306 

If there is no mysqld.sock file mysqld.sock can run the following commands (create a file and give rights to the folder)

 # sudo mkfifo /var/run/mysqld/mysqld.sock # sudo chown -R mysql /var/run/mysqld 

If, when trying to start, he already writes an error 111

 # mysql start ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) 

That mysql start is not really an attempt to start ..

 /etc/init.d/mysql [re]start 

And yes .. if the server is running, the address of the socket can be viewed in the .cnf file in the / etc / mysql / directory

This is probably just a configuration in the my.cnf file, in /etc/somewhere (Dependencies on the Linux distribution) .

This issue is discussed here.