Mysql问题:Failed to stop mysqld.service: Unit mysqld.service not loaded

1 环境:ubuntu

2 问题描述
停止mysql服务,输入命令:

service mysqld stop

出现如下报错:

root@iZ2ze8qk0tdrzqj7sd1kZ:/usr/bin#  service mysqld stop
Failed to stop mysqld.service: Unit mysqld.service not loaded.

3 解决
输入命令:

systemctl enable mysql.service

执行结果:

root@iZ2ze8qk0tdrzqj7sd1kZ:~# systemctl enable mysql.service
Synchronizing state of mysql.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable mysql
insserv: can not symlink(../init.d/aegis, ../rc2.d/S02aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc3.d/S02aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc4.d/S02aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc5.d/S02aegis): File exists

停止mysql服务,再次输入命令:

systemctl stop mysql

4 验证
查询mysql进程,输入命令:

ps -aux|grep mysql

执行结果:

root@iZ2ze8qk0tdrzqj7sd1kZ:~# ps -aux|grep mysql
root      4765  0.0  0.0  14224  1088 pts/0    S+   15:20   0:00 grep --color=auto mysql

没有mysql进程,说明mysql已经关闭。