1. 程式人生 > >Failed to issue method call Unit mysql service failed to load No such file or directory的解決辦法

Failed to issue method call Unit mysql service failed to load No such file or directory的解決辦法

               

Failed to issue method call: Unit mysql.service failed to load: No such file or directory的解決辦法

1、軟體環境:

OpenSUSE 13.1 x64

MySQL 5.6.20 x64

2、採用RPM包安裝MySQL 5.6.20

# rpm -ivh MySQL-server-5.6.20-1.sles11.x86_64.rpm# rpm -ivh MySQL-client-5.6.20-1.sles11.x86_64.rpm# rpm -ivh MySQL-devel-5.6.20-1.sles11.x86_64.rpm
# rpm -ivh MySQL-shared-5.6.20-1.sles11.x86_64.rpm

3、檢視MySQL服務
# /etc/init.d/mysql statusMySQL is not running                                                                                                    failedmysql.service   Loaded: not-found (Reason: No such file or directory)   Active: inactive (dead)Aug 22
15:42:26 173-168-58-139 systemd[1]: Stopped LSB: Start the MySQL database server.

可見,MySQL服務未啟動。


4、啟動MySQL服務
# /etc/init.d/mysql startredirecting to systemctl start mysqlFailed to issue method call: Unit mysql.service failed to load: No such file or directory.

報錯,無法啟動MySQL服務。

用systemctl方法

# systemctl start mysql.service
仍然報如下錯誤
Failed to issue method call: Unit mysql.service failed to load: No such file or directory. See system logs and 'systemctl status mysql.service' for details.

5、解決方法

# systemctl enable mysql.service
6、再次啟動MySQL
# systemctl start mysql# ps -ef | grep mysqlroot     27930     1  0 16:30 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/173-168-58-139.pidmysql    28045 27930  0 16:30 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/173-168-58-139.err --pid-file=/var/lib/mysql/173-168-58-139.pidroot     28074 25545  0 16:30 pts/1    00:00:00 grep --color=auto mysql
可見,MySQL已經正常執行。