Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Currently, my MySQL server starts on every server boot. For a couple reasons, this is undesirable behavior. Is there a way (on Ubuntu 10.10) to disable this behavior?

share|improve this question
up vote 1 down vote accepted

There are two Guis I can think of. From Applications -> Ubuntu Software Center search for "boot up manager". After installing you will find it in the System -> Administration -> BootUP-Manager. Another is Webmin. Webmin uses your browser. After installing point your browser to https://localhost:10000/ Look for services and work it from there.

share|improve this answer

To prevent mysql from starting on boot:

  1. Open the terminal: Ctrl+Alt+T

  2. Open the mysql.conf file: nano /etc/init/mysql.conf

  3. Comment out the "start on" line near the top of the file, the "start on" might be spread across two lines, so comment out both. (comment adding # at the beginning)

If you want to manually start mysql, use the following command:

service mysql start

Taken liberally from here.

share|improve this answer
This is a very usefull answer for more than one initiation at start up. – maniat1k Mar 22 '12 at 15:26
Tried, I have /usr/sbin/mysqld and /bin/sh /usr/bin/mysqld_safe running. Commented out everything but didn't helped. – Emin Mastizada Sep 16 '15 at 20:33

I know this question is about Ubuntu 10.10, but since 15.04 you can simply do:

sudo systemctl disable mysql

share|improve this answer
Indeed. For 15.04, this is the answer you seek. – CommandZ Dec 3 '15 at 19:03
Awesome, finally I found a solution for this! The other methods don't work to me. – rneves Mar 22 at 13:08
I can't start it again, how do I start mysql after the command? – rneves Mar 22 at 13:21
@rneves did you try enable or reenable? – thebugfinder Apr 12 at 23:48
@thebugfinder I've tried enable, I don't know about reenable, but enable forces me restart the computer to start mysql again – rneves Apr 13 at 14:56

Things have changed quite a bit in Ubuntu now. I think from version 11 onwards. MySQL is handled by Upstart while Apache still uses traditional SysV init scripts

For MySQL, you can use the new override feature in Upstart to modify the starting behaviour:

sudo echo "manual" >> /etc/init/mysql.override

For more info, see the section "Disabling a Job from Automatically Starting" in the Upstart Cookbook.

As Apache still uses the traditional SysV init scripts you can use

sudo update-rc.d -f apache2 remove

to remove the links from /etc/rcX.d or, alternatively use

sudo update-rc.d apache2 disable

which "disables" the script by changing it from a start script to a stop script. This is reversible by

sudo update-rc.d apache2 enable

Most of this information I got from here:

share|improve this answer

Or if your really laze like me you could just open a Terminal session and then type:

sudo perl -pi.orig -e 's/start\s+on/#start\s+on/' /etc/init/mysql.conf && sudo perl -pi.orig -e 's/and\s+/#and/g' /etc/init/mysql.conf

You can then just issue a reboot command then your system will boot-up without mysql started.

share|improve this answer
This command could be improved. It is adding a + leaving the line like this: #start+on blahblahblah but it works! – Lucio Dec 22 '13 at 0:41

Actually, there is also another method to accomplish this, via the sysv-rc-conf tool.

You can install it by typing

sudo apt-get install sysv-rc-conf

It allows you to take control over all available services, including running/stopping them in place and configuring services' operation per runlevel.

Edit: You have to run tis tool as root:

sudo sysv-rc-conf
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.