Centos安装mysqlFailed to start mysqld.service: Unit not found
由于MySQL在CentOS7中收费了,所以已经不支持MySQL了,取而代之在CentOS7内部集成了mariadb,而安装MySQL的话会和MariaDB的文件冲突。所以本文建议直接安装mariadb。
输入命令
systemctl start mysql.service
要启动MySQL数据库是却是这样的提示
Failed to start mysqld.service: Unit not found
解决方法如下:
首先需要安装mariadb-server
yum install -y mariadb-server
启动服务
systemctl start mariadb.service
添加到开机启动
systemctl enable mariadb.service
进行一些安全设置,以及修改数据库管理员密码
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;