My os is 11.04.

I have apache2 & mysql installed.

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


7 Answers 7


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.

  • 2
    Apache doesn't use upstart.
    – papukaija
    May 4, 2011 at 17:40
  • Yes, my error - I converted it to use Upstart on my system... May 4, 2011 at 17:45
  • 1
    Got this error "bash: /etc/init/mysql.override: Permission denied" in both case May 4, 2011 at 17:48
  • 5
    @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'. May 4, 2011 at 18:27
  • 1
    @radek: Yes. That should work with any Ubuntu version that uses Upstart 1.3 or later. Apr 3, 2012 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


This thread will help you: https://superuser.com/questions/35151/how-do-i-stop-services-from-starting-on-boot-on-ubuntu

  • 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. May 4, 2011 at 17:37

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


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: http://forum.linode.com/viewtopic.php?t=5594

sudo mkdir /etc/init.disabled

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

And that's it.


With heavy adoption of systemd as system manager and init system for debian based distributions like ubuntu , we can now use systemctl commands to prevent a service from automatically starting at boot.

for example :

sudo systemctl disable apache2

To start using it when required , you can use:

sudo systemctl start apache2

To stop using it, you can use:

sudo systemctl stop apache2

And to see if it's running or not , you can use :

sudo systemctl status apache2


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .