how to stop apache2, mysql from starting automatically as computer starts?
Solution 1
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
.
Solution 2
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
Solution 3
This thread will help you: https://superuser.com/questions/35151/how-do-i-stop-services-from-starting-on-boot-on-ubuntu
Solution 4
update-rc.d is a good CLI tool to do this. The linked page has an example involving apache2
Solution 5
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.
Related videos on Youtube
Comments
-
acapuster over 1 year
My os is 11.04.
I have
apache2
&mysql
installed.How to stop apache2, mysql from starting automatically as computer starts?
-
Christopher B. Adkins about 13 yearsThis 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.
-
papukaija about 13 yearsApache doesn't use upstart.
-
Christopher B. Adkins about 13 yearsYes, my error - I converted it to use Upstart on my system...
-
acapuster about 13 yearsGot this error "bash: /etc/init/mysql.override: Permission denied" in both case
-
acapuster about 13 years@Florian: How did you convert? and whats the advantage of converting?
-
papukaija about 13 years@Rahul: You get the error as both the echo and the update-rc.d need to be run with sudo.
-
acapuster about 13 years$ sudo echo "manual" >> /etc/init/mysql.override
-
acapuster about 13 yearsGot error "bash: /etc/init/mysql.override: Permission denied"
-
Feras Kayyali about 13 years@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'
. -
Christopher B. Adkins about 13 years@Rahul: To convert it you have to write a .conf file for upstart. I just did it to learn how it is done.
-
radek about 12 years@FlorianDiesch Will that work for 11.10 as well?
-
Christopher B. Adkins about 12 years@radek: Yes. That should work with any Ubuntu version that uses Upstart 1.3 or later.
-
yuvilio almost 12 yearsI am using mariadb flavor of Mysql and found that it was still managed by sysvinit rather than Upstart. Removed it from startup by executing
sudo update-rc.d -f mysql remove
. -
Tomasz Gandor over 9 years@RahulPrasad @LukaszStelmach - this is a common pattern, but I hate
sudo su -c 'quoted commands'
, you can just usetee
, like inecho "manual" | sudo tee -a /etc/init/mysql.override
. For>
use justtee
, for>>
it'stee -a
.