Remove services from upstart

I have mysql installed (from repos) on a development machine (laptop) and I don't need the daemon running on every boot. I've copied /etc/init/mysql.conf to /etc/init/mysql.conf.old and then removed everything following the "start on" line. However, upon reboot, I can no longer start mysqld through upstart:

$ sudo service mysql start
start: Unknown job: mysql

This also fails (trying anything at this point):

$ sudo service mysql restart
stop: Unknown job: mysql
start: Unknown job: mysql

This is my upstart script:

# /etc/init/mysql.conf
....
start on
stop on starting rc RUNLEVEL=[016]

This is the default script:

# /etc/init/mysql.conf.old
....
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]

Everything I've read up until now suggests that this is how services can be prevented from starting at boot-time. Is there a better way to do this or did I make a mistake in the upstart script?

UPDATE: I've moved the backup conf file out of /etc/init and rebooted thinking that maybe there was a conflict but upstart still says Unknown job: mysql


Solution 1:

If you are on Ubuntu 11.04 or later, you can use the manual keyword and .override files in /etc/init to disable automatic starting:

sudo sh -c 'echo manual >> /etc/init/mysql.override'

manual effectively removes the start on stanza from the job's config.

If you are on Ubuntu 10.04, you can do this:

sudo sh -c 'echo start on never >> /etc/init/mysql.conf'

The last start on in the file will override any previous ones, so this should work, though it assumes there is no event called never.