MySQL在Ubuntu設定自啟動的一個故障解決,mysqlubuntu

來源:互聯網
上載者:User

MySQL在Ubuntu設定自啟動的一個故障解決,mysqlubuntu

MySQL在Ubuntu設定自啟動的一個故障解決

作者:chszs,轉載需註明。部落客頁:http://blog.csdn.net/chszs

在解決MySQL自啟動,執行命令:

# chkconfig --listThe program 'chkconfig' is currently not installed.  You can install it by typing:apt-get install chkconfig

發現沒安裝chkconfig指令碼,安裝它:
root@i-DFAFA998:~# apt-get install chkconfigReading package lists... Done……


安裝後執行:

# chkconfig --list | grep mysqlmysql                     0:off  1:off  2:off  3:off  4:off  5:off  6:off

可見MySQL不是自啟動服務。

用chkconfig讓MySQL自啟動時,執行命令報錯:

# chkconfig -a mysql/sbin/insserv: No such file or directorymysql                     0:off  1:off  2:off  3:off  4:off  5:off  6:off

網上提供的解決方案是:

# ln -s /usr/lib/insserv/insserv /sbin/insserv

執行命令,繼續報錯

# chkconfig mysql onThe script you are attempting to invoke has been converted to an Upstartjob, but lsb-header is not supported for Upstart jobs.insserv: warning: script 'mysql' missing LSB tags and overridesinsserv: Default-Start undefined, assuming empty start runlevel(s) for script `mysql'......

繼續尋找原因,發現是:

chkconfig命令是用於RedHat/Fedora發行版的,而對於像Ubuntu之類的Debian發行版,應該使用這個命令:

sudo update-rc.d mysql defaults

驗證一下:

# chkconfig --list | grep mysqlmysql                     0:off  1:off  2:on   3:on   4:on   5:on   6:off

果然搞定了!

最後提醒一句,別忘了刪除之前建立的符號串連

# rm -f /sbin/insserv


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.