Linux中配置MySQL隨系統的啟動和關閉同步

來源:互聯網
上載者:User

1.MySQL啟動同步:
在檔案/etc/rc.d/rc.local中添加如下兩行:
echo "Starting MySQL Server"
/etc/rc.d/init.d/mysql.server start

2.MySQL關閉同步:
在檔案/etc/rc.d/rc.halt開頭插入如下兩行:
echo "Stopping MySQL Server"
/etc/rc.d/init.d/mysql.server stop

說明:
1.檔案/etc/rc.d/init.d/mysql.server是從mysql的安裝子目錄support-files下拷貝過來的;

2.由於mysql.server預設認為mysql安裝於目錄/usr/local/mysql下,如果你的mysql不是安裝在這個目錄下,請建立符合連結,比如:

ln -s /var/log/bak/mysql-5.0.51a-linux-i686-glibc23/ /usr/local/mysql

3.這種方式配置的服務隨系統的啟動和關閉同步,適用於IPCop等應用及其精簡的系統,不適於一般的發行版,因為一般的發行版是在/etc/rc.d/rc3.d/、/etc/rc.d/rc0.d/和/etc/rc.d/rc6.d/中的指令碼來同步服務的啟動和關閉。 

相關文章

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.