[linux] mysql啟動失敗解法

指令 service mysql start
出錯,mysql無法啟動,看到mysql: unrecognized service錯誤訊息

遇到的情境如下:

[root@localhost ~]# service mysql start
mysql: unrecognized service
[root@localhost ~]# service mysql restart
mysql: unrecognized service
 
[root@localhost ~]# rpm -q mysql   查詢發現mysql已經正常安裝
mysql-5.1.52-jason.1

[root@localhost ~]# /etc/rc.d/init.d/mysqld start                   ----直接啟動沒問題
Starting mysqld:  [  OK  ]

 
[root@localhost ~]# ls  /etc/rc.d/init.d/mysqld  -l
-rwxr-xr-x 1 root root 5509 Dec 18 02:31 /etc/rc.d/init.d/mysqld

[root@localhost ~]# chkconfig mysqld on                            ----設置mysql開機啟動

[root@localhost ~]# chmod 755 /etc/rc.d/init.d/mysqld        ----修改mysqld執行權限

[root@localhost ~]# service mysqld start                             ----搞定
Starting mysqld:  [  OK  ]
[root@localhost ~]# service mysqld start
Starting mysqld:  [  OK  ]
[root@localhost ~]# service mysqld status
mysqld (pid 9487) is running...