Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I am using Debian Etch and I have following this and tried to write a script like this to auto start mysql server at boot:

#! /bin/sh
# /etc/init.d/blah

# Some things that run always
sudo /etc/init.d/mysql start

I used update-rc.d also, but mysql server don't start at boot, why?

share|improve this question
up vote 12 down vote accepted

There's no reason for you to write this script. /etc/init.d/mysql is an init(1) script, so just use that:

# update-rc.d mysql defaults

If that doesn't work, you might need to look into the more advanced update-rc.d options. For instance, maybe you are using an uncommon runlevel, and the default runlevels for the provided mysql script don't include that.

If you were actually trying to get something to run on startup which doesn't already provide an init script, you'd need to remove the sudo bit. init scripts run as root already. You actually have to drop permissions if you need your program to run as another user.

share|improve this answer
for some unknown reason this always has stated: insserv: warning: current start runlevel(s) (3) of script 'mysql' overwrites defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 4 5 6) of script 'mysql' overwrites defaults (0 1 6). I had to update-rc.d mysql remove and then do update-rc.d mysql defaults this fixes it. If you want to know which runlevel youre running use who -r – P.scheit Jun 5 '14 at 6:07

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.