Bootstrap

mysql中出现Unit mysql.service could not be found 的解决方法

前言

出现这种bug
Unit mysql.service could not be found

因为bug被我修复好了,在这里引用一下网友的bug截图
在这里插入图片描述

1. 原理

之所以使用命令行service mysqld status出现Unit mysql.service could not be found的bug

原因如下:
安装好了mysql之后
发现在init.d的配置中没有mysql的服务
所以使用service mysqld status,就会因为其找不到mysql或者mysqld的服务

根据上面的原理
可以给出方案如下:

  1. 如果没安装mysql,重新安装好mysql,查看其init.d中有没有mysql的服务
  2. 如果安装了mysql,在init.d中还是没有这个mysql的服务,那么通过全局搜索mysql的服务(可能被装到其他地方了),再将其复制到init.d中即可
;