Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 was trying to stop mysql on Ubuntu to follow the steps explained here on how to reset the password: the problem is whenever I kill mysqld process, it gets spawned again.

Any idea how to force stopping it or figuring out what's starting it?

share|improve this question

migrated from Sep 2 '11 at 21:18

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

up vote 2 down vote accepted

Do such command for older ubuntu, as said in

sudo /etc/init.d/mysql stop

And for newest ubuntu, the upstart program manages mysqld running all time... use command as said here

sudo initctl stop mysql


sudo stop mysql 
share|improve this answer

The mysql process is probably started by some daemon control software which also automatically respawns it. Try using ps to determine its parent process, which will give you a hint how to stop it:

ps -fC mysqld

and look into the PPID column. If it's a 1, the process is owned directly by init and a simple kill should suffice to stop it. If not, use something like

ps -fp 1234

to display the process that sired the mysql process, it will probably be responsible for its respawn.

share|improve this answer

To install MySql database:

sudo apt-get install mysql-server

To start MySql server:

/etc/init.d/mysql start

To stop MySql server:

/etc/init.d/mysql stop

To restart MySql server:

/etc/init.d/mysql restart

To check the status of MySql server:

/etc/init.d/mysql status

share|improve this answer
will it work on ubuntu 11.04 or 11.10 or 12.04 or .. ? – osgx Aug 31 '11 at 23:31

The later versions of Ubuntu uses Upstart for its init system. Its been a while, but I think the syntax to stop a service would be something like:

stop servicename
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.