CentOS 7 MySQL 5.7 yum安装

准备依赖环境

yum install -y wget yum-utils

添加yum存储库

wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm

设置yum存储库为5.7版本

yum-config-manager --enable mysql57-community
yum-config-manager --disable mysql80-community

执行安装

yum install -y mysql-community-server mysql-community-client

初始化mysql

mysqld --initialize-insecure --user=mysql

启动mysql服务

systemctl start mysqld

检查mysql服务状态

running说明启动成功。

systemctl status mysqld

登录

mysql -uroot -p

设置密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

你可能感兴趣的:(CentOS 7 MySQL 5.7 yum安装)