/usr/bin/mysqladmin: connect to server at 'localhost' failed

8.5k Views Asked by At

When type stop command ( /etc/init.d/mysql stop) to mysql server I'm getting following error:

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

Inspite of error mysqld stops. Could you please help me understand what it tries to do and how to fix this error?

Looked at /etc/init.d/mysql script and tried to manually run command with mysqladmin:

/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf shutdown 2

And it works fine without any output. mysqld stops.

After /etc/init.d/mysql stop

/etc/init.d/mysql status
 * MySQL is stopped.

When mysqld running:

/etc/init.d/mysql status
 * /usr/bin/mysqladmin  Ver 8.41 Distrib 5.0.51a, for debian-linux-gnu on x86_64Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,and you are welcome to modify and redistribute it under the GPL license

Server version          5.0.51a-3ubuntu5.7
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock
Uptime:                 4 sec

Threads: 2  Questions: 71  Slow queries: 0  Opens: 55  Flush tables: 1  Open tables: 49  Queries per second avg: 17.750
0

There are 0 best solutions below