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

My os is 11.04.

I have apache2 & mysql installed.

How to stop apache2, mysql from starting automatically as computer starts?

share|improve this question
up vote 49 down vote accepted

MySQL is handled by upstart. In 11.04 you can use the new override feature to modify the starting behaviour:

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

See the section "Disabling a Job from Automatically Starting" in the Upstart Cookbook

Apache still uses traditional SysV init scripts so you use

 update-rc.d -f apache2 remove

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

 update-rc.d apache2 disable

which "disables" the script by changing it from a start script S91apache2 to a stop script K09apache2. This is reversible by update-rc.d apache2 enable.

share|improve this answer
Apache doesn't use upstart. – papukaija May 4 '11 at 17:40
Yes, my error - I converted it to use Upstart on my system... – Florian Diesch May 4 '11 at 17:45
Got this error "bash: /etc/init/mysql.override: Permission denied" in both case – Rahul Prasad May 4 '11 at 17:48
@RAHUL It can't work becouse redirection is created by bash before executing sudo - and that why the file is created as your user, not as a root. You can use such command: sudo su -c 'echo "manual" >> /etc/init/mysql.override'. – Lukasz Stelmach May 4 '11 at 18:27
@radek: Yes. That should work with any Ubuntu version that uses Upstart 1.3 or later. – Florian Diesch Apr 3 '12 at 23:38

Interestingly, it's a different answer for each package in 11.04.

  • apache2 uses System V style init scripts. To disable it from boot:
    sudo update-rc.d -f apache2 remove
  • However, mysql uses an Upstart job, to disable it, create an "override" file:
    echo "manual" | sudo tee /etc/init/mysql.override

To learn more about override files, see: The Upstart Cookbook

share|improve this answer

This thread will help you:

share|improve this answer
This only works for services using SysV style init scripts. Ubuntu is switching to Upstart for most services so update-rc.d doesn't work anymore. – Florian Diesch May 4 '11 at 17:37

update-rc.d is a good CLI tool to do this. The linked page has an example involving apache2

share|improve this answer

It was't working for me. When trying to disable mysql in ubuntu I was receiving the message:

System start/stop links for /etc/init.d/mysql do not exist.

So I found a work around in this link:

sudo mkdir /etc/init.disabled

sudo mv /etc/init/mysql.conf /etc/init.disabled/

And that's it.

share|improve this answer

use rcconf to enable/disable a service to auto run on boot.

sudo apt-get install rcconf

Now, type sudo rcconf

And you will see list of services that are installed on your Ubuntu machine. Those marked with star are auto run during boot process. To disable Apache, MySql just navigate to it using arrows and press space bar. Then navigate to OK button using Tab key and again press Space to save configuration.

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.