Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was trying to stop mysql on Ubuntu to follow the steps explained here on how to reset the password: http://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html 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 stackoverflow.com Sep 2 '11 at 21:18

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

4 Answers 4

up vote 2 down vote accepted

Do such command for older ubuntu, as said in http://www.codeunit.co.za/2010/07/07/how-to-start-or-stop-mysql-server-on-ubuntu-via-the-command-line/

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

or

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

 
discard

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.