linux下chkconfig命令的使用--設定mysql自動啟動服務

chkconfig 有五項功能:添加服務,刪除服務,清單服務,
改變啟動資訊以及檢查特定服務的啟動狀態
使用語法
usage:  chkconfig --list [name]
    chkconfig --add <name>
    chkconfig --del <name>
    chkconfig [--level <levels>] <name> <on|off|reset>
chkconfig --list 列出當前服務在各個run leves的設定狀態。
# chkconfig --list
NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
NetworkManagerDispatcher        0:off   1:off   2:off   3:off   4:off   5:off   6:off
acpid           0:off   1:off   2:off   3:on    4:on    5:on    6:off
anacron         0:off   1:off   2:on    3:on    4:on    5:on    6:off
apmd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
......

如果想要啟動mysql服務,首先查看mysqld的狀態。

# chkconfig --list mysqld
mysqld           0:off   1:off   2:
off    3:off    4:off    5:off    6:off

# chkconfig mysqld off
關閉服務
# chkconfig mysqld on 
開啟服務
也可以選擇 level 開啟服務
# chkconfig --level 345 mysqld on
mysqld           0:off   1:off   2:off   3:on    4:on    5:on    6:off

留言

這個網誌中的熱門文章

java 數字轉字串 字串轉數字

MS sqlServer資料庫移轉至MySQL-->利用MySQL WorkBench

sql server 15023 error [SQL SERVER問題: 使用者、組或角色 '*****' 在當前資料庫中已存在]