9

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

Braiam
  • 67,791
  • 32
  • 179
  • 269
xst
  • 205
  • Check /var/log/syslog, it probably will tell you there are syntax problems in /etc/init/mysql.conf. You can also try 'init-checkconf /etc/init/mysql.conf' – SpamapS Aug 05 '12 at 14:36

2 Answers2

17

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.

SpamapS
  • 19,820
0

From this post: The "start on" section needs to be complete and correct in syntax.

start on runlevel [!0123456]

This line means execute when run level is not in [0,1,2,3,4,5,6] (those are the only runlevels, so this is never run).

Another option is using chkconfig as per this post.

xst
  • 205