Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I reinstalled mysql on Ubuntu 12.10. Removing process works fine, but during the installation my attempt to set root password failed (because, as terminal said: the password had setted already). Then I tried to change password via safe_mode, but this action failed either, because I can't stop mysql.

When I try

sudo /etc/init.d/mysql stop

I get

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql stop

When I try

sudo service mysql stop

I get

stop: Unknown instance: 

When I try

sudo mysqladmin shutdown

I get

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!

Tell me please, what to do in this dead end?

share|improve this question

migrated from Mar 18 '13 at 7:18

This question came from our site for professional and enthusiast programmers.

up vote 8 down vote accepted

/etc/init.d/service_name stop will still stop the service, but throw the deprecation warning, since service also works to stop a process.

That said, you running service mysql stop after you already ran /etc/init.d/mysql stop didn't work simply because mysql was already stopped, hence the Unknown instance error.

Likewise, mysqladmin can't stop the server at localhost, simply because the server at localhost isn't running an instance of mysql anymore.

share|improve this answer
Many thanks for the explanation – only_dimon Mar 18 '13 at 6:19
You might want to add your two cents at my question ... – JJD Dec 9 '14 at 16:38

If you are root on the system, you can kill the process directly.

Use the command ps -a to list all the running processes. Then locate the process id of the mysql process and use the commmand kill -9 <MYSQL_PID> to kill it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.