ubuntu mysql 自动启动

编译安装mysql后,用chkconfig令命将其加入随机启动

cp mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql

出现下面的错误

insserv: warning: script 'K20acpi-support' missing LSB tags and overrides insserv: warning: current start runlevel(s) (0 6) of script umountfs' overwrites defaults (empty). insserv: warning: current start runlevel(s) (0 6) of script sendsigs' overwrites defaults (empty). insserv: warning: script 'gdm' missing LSB tags and overrides insserv: warning: script 'acpid' missing LSB tags and overrides insserv: warning: script 'hal' missing LSB tags and overrides insserv: warning: script 'udevmonitor' missing LSB tags and overrides insserv: warning: script 'cron' missing LSB tags and overrides insserv: warning: script 'sreadahead' missing LSB tags and overrides insserv: warning: script 'anacron' missing LSB tags and overrides insserv: warning: script 'httpd2' missing LSB tags and overrides insserv: warning: script 'procps' missing LSB tags and overrides insserv: warning: script 'hwclock' missing LSB tags and overrides insserv: warning: script 'usplash' missing LSB tags and overrides insserv: warning: script 'hwclock-save' missing LSB tags and overrides insserv: warning: script 'dbus' missing LSB tags and overrides insserv: warning: script 'apport' missing LSB tags and overrides insserv: warning: current start runlevel(s) (6) of script reboot' overwrites defaults (empty). insserv: warning: current start runlevel(s) (0 6) of script umountnfs.sh' overwrites defaults (empty). insserv: warning: script 'ufw' missing LSB tags and overrides insserv: warning: current start runlevel(s) (0 6) of script umountroot' overwrites defaults (empty). insserv: warning: script 'avahi-daemon' missing LSB tags and overrides insserv: warning: script 'network-manager' missing LSB tags and overrides insserv: warning: script 'atd' missing LSB tags and overrides insserv: warning: script 'module-init-tools' missing LSB tags and overrides

很明显,加入自动启动失败。到网上查询无果,最终用ubuntu自带的update-rc.d解决(chkconfig为linux自带,在部分ubuntu版本中(如8.04)被移去)

sudo update-rc.d mysql defaults
chkconfig --list mysql

=> mysql 0:off  1:off  2:on   3:on   4:on   5:on   6:off

终于正常了。

疑问:在虚拟机中可以成功用chkconfig将mysql加入到随机启动中,不知道为什么在主机中不能实现,以前在主机上也可以成功将mysql加入随机启动的啊(现在用的是ubuntu9.10)