Ubuntu下設定MySQL自啟動故障解決一例

來源:互聯網
上載者:User

Ubuntu下設定MySQL自啟動故障解決一例

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

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

發現沒安裝chkconfig指令碼,安裝它:

root@www.bkjia.com:~# apt-get install chkconfig
Reading package lists... Done
……

安裝後執行:

# chkconfig --list | grep mysql
mysql                    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 directory
mysql                    0:off  1:off  2:off  3:off  4:off  5:off  6:off

網上提供的解決方案是:

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

執行命令,繼續報錯

# chkconfig mysql on
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'mysql' missing LSB tags and overrides
insserv: 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 mysql
mysql                    0:off  1:off  2:on  3:on  4:on  5:on  6:off
果然搞定了!

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

# rm -f /sbin/insserv 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.