linux Unit mysql.service failed to load: No such file or directory的解决办法

查看mysql服务

# /etc/init.d/mysql status  
MySQL is not running                                                                                                    failed  
mysql.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服务并未启动成功。

 

启动mysql服务,

service mysql start
Failed to issue method call: Unit mysql.service failed to load: No such file or directory. 

启动报错。

解决方法如下

# systemctl enable mysql.service  

再次启动,

# systemctl start mysql  
# ps -ef | grep mysql  
root     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.pid  
mysql    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.pid  
root     28074 25545  0 16:30 pts/1    00:00:00 grep --color=auto mysql  

启动成功

你可能感兴趣的:(linux Unit mysql.service failed to load: No such file or directory的解决办法)