# 首先通过yum下载wget命令
1.yum -y install wget
# 通过wget下载MySQL存储库
2.wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
3.rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
4.通过编辑/etc/yum.repos.d/mysql-community.repo文件,去修改发行版本
5.将80的enabled更改为0,将5.7的enabled更改为1,保存即可,
#开始安装mysql
6.yum -y install mysql-server
# 启动MySQL服务
7.systemctl start mysqld.service
# 默认8.0启动后,不会生成密码,但是8.0以前需要在/var/log/mysqld.log文件中查看默认生成的密码
8.mysql -uroot
#修改密码
9.ALTER USER 'root'@'localhost' IDENTIFIED BY '@Root123';
10.
#选中库
use mysql;
#开启远程连接
update user set host='%' where user='root';
#刷新权限
FLUSH PRIVILEGES;