Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

5 Answers 5

up vote 36 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
2  
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
1  
Got this error "bash: /etc/init/mysql.override: Permission denied" in both case –  Rahul Prasad May 4 '11 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'. –  Lukasz Stelmach May 4 '11 at 18:27
1  
@radek: Yes. That should work with any Ubuntu version that uses Upstart 1.3 or later. –  Florian Diesch Apr 3 '12 at 23:38
show 8 more comments

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

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
add comment

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
3  
The echo command will need sudo too. –  papukaija May 4 '11 at 17:41
    
@papukaija: nice catch. Thanks! –  Mark Russell May 4 '11 at 17:42
add comment

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

share|improve this answer
    
That's a pretty snazzy util. Thanks for that. –  Matt Barnes May 11 '12 at 4:38
add comment

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.

share|improve this answer
add comment

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.