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

In my laptop I have installed a LAMP environment for developing PHP apps. I would like to prevent these services (Apache, Mysql,..) starting on boot.

For apache is pretty simple to avoid it: sudo update-rc.d -f apache2 remove

but for mysqld I couldn't find a way to do the same.

I have googled it for a couple of days trying to get a solution for this but I didn't found it.


share|improve this question
possible duplicate of What's the recommend way to enable / disable services? – Lekensteyn Feb 27 '12 at 20:11

Are you using mysql-server-5.1 from ubuntu repos?

In the file /etc/init/mysql.conf you will find some line like the following:

start on (net-device-up
          and local-filesystems
          and runlevel [2345])
stop on runlevel [016]

Moving the '2' from start to stop should do the trick:

start on (net-device-up
          and local-filesystems
          and runlevel [345])
stop on runlevel [0126]
share|improve this answer
In general you can just comment out the whole "start on" statement if you don't want a service to be started at boot time. – Florian Diesch Apr 13 '11 at 17:19
Great! Thanks for the solution – Fran Diéguez Apr 13 '11 at 18:31
Great answer and nice question! Thanks, it is solved my problem. – antivirtel Apr 13 '11 at 19:35
Note that in Ubuntu 11.04 and later you can also do this without editting the file directly by adding /etc/init/mysql.override and adding the keyword 'manual' – SpamapS Feb 27 '12 at 23:45

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.