CentOS7安装MySQL报错Failed to start mysqld.service: Unit not fou

时间:2022-04-27 03:38:57

1 ~]# systemctl start mysql.service
要启动MySQL数据库是却是这样的提示

1 ~]# Failed to start mysqld.service: Unit not found
解决方法如下:

首先需要安装mysql-server

1 ~]# yum install -y mysql-server
启动服务

1 ~]# systemctl start mysqld.service
添加到开机启动

1 ~]# systemctl enable mysqld.service

之后连接数据库 mysql 命令