Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Mar 18 '13 at 7:18

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

2 Answers 2

up vote 7 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

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

 
discard

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