1

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
Index
  • 676
  • 1
  • 10
  • 27
  • 1
    As error says .. check whether mysqld service is running? – Rahul May 22 '14 at 20:13
  • 1
    I'm stopping mysql server (/etc/init.d/mysql stop). Why it tells me this error when mysqld is shutting down? Socket file exists – Index May 22 '14 at 20:19
  • what does `/etc/init.d/mysql status` tell you? – msturdy May 22 '14 at 20:41
  • 1
    It's not a "I think this might cover it" error. Either the service is not running or the socket file doesn't exist. – JohnP May 22 '14 at 20:46
  • 1
    @Index if you have found a solution to your issue, could you please post it and mark the question as answered? – Paradox Jun 29 '16 at 13:24
  • @Paradox server restart solved the issue. Unfortunately I do not know what was the reason of such behavior. – Index Jun 30 '16 at 15:15

0 Answers0