1. 官网下载最新mysql的yum安装包
https://dev.mysql.com/downloads/repo/yum/
2. 安装deltarpm
yum provides '*/applydeltarpm' #查看依赖包的位置
yum -y install deltarpm #安装命令
3. 安装mysql源, 并查看安装效果
yum -y install mysql80-community-release-el7-1.noarch.rpm
yum repolist enable|grep mysql.*
4. 安装mysql服务
yum -y install mysql-community-server
5.启动mysql服务,查看运行状态
systemctl start mysqld.service #启动服务
systemctl status mysqld.service #查看运行状态
6. 查看初始化数据库的密码,登录并修改密码
grep "password" /var/log/mysqld.log
红框中是我本地的初始化密码
登录
mysql -root -p
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '********'; #密码必须大于8位,并且包含字母数字和特殊字符
7. 设置自启动
systemctl enable mysqld
systemctl daemon-reload