首页 > 数据库 >Failed to start mysqld.service: Unit not found

Failed to start mysqld.service: Unit not found

时间:2022-11-27 10:47:45浏览次数:80  
标签:service Failed mysql start systemctl MySQL mariadb

转载自:https://blog.csdn.net/miaodichiyou/article/details/99289160

 

=========================

 

很多人对本博客的方法提出了质疑,在此我解释一下:

由于MySQL在CentOS7中收费了,所以已经不支持MySQL了,取而代之在CentOS7内部集成了mariadb,而安装MySQL的话会和MariaDB的文件冲突。所以本文建议直接安装mariadb。

具体讨论的详情大家可以参考知乎讨论:https://www.zhihu.com/question/41832866,本文不再赘述。

输入命令

systemctl start mysql.service

要启动MySQL数据库是却是这样的提示

Failed to start mysqld.service: Unit not found

解决方法如下:

首先需要安装mariadb和mariadb-server

yum -y install mariadb mariadb-devel mariadb-server

启动服务

systemctl start mariadb.service

添加到开机启动

systemctl enable mariadb.service

进行一些安全设置,以及修改数据库管理员密码

[zhaojq@localhost]$ mysql_secure_installation

mysql给root开启远程访问权限

use mysql;
select User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;

 

————————————————
版权声明:本文为CSDN博主「赵健乔」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/miaodichiyou/article/details/99289160


 

标签:service,Failed,mysql,start,systemctl,MySQL,mariadb
From: https://www.cnblogs.com/hd92/p/16929098.html

相关文章