1.下载安装repo

# 打开网站
https://dev.mysql.com/downloads/repo/yum/
# 下载
mysql80-community-release-el7-3.noarch.rpm
# 安装
rpm -ivh mysql80-community-release-el7-3.noarch.rpm

2.更换yum可用community版本

# 查找当前可用版本
yum repolist enabled | grep "mysql.*-community.*"
# 列出可用版本
yum repolist all | grep mysql
# 安装yun-config-manager
yum -y install yum-utils
# 关闭和启用可安装版本
yum-config-manager --disable mysql57-community
yum-config-manager --enable mysql56-community

3.安装

yum repolist enabled | grep mysql
yum install mysql-community-server

4.启动

service mysqld start
systemctl enable mysqld

5.保护MySQL安装

# 执行命令
mysql_secure_installation

6.创建个人账号

mysql -uroot -p
GRANT ALL privileges ON *.* TO 'tab'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 
flush privileges;

7.开启防火墙

firewall-cmd --add-port=3306/tcp
firewall-cmd --add-port=3306/tcp --permanent

8.默认密码查找

grep 'temporary password' /var/log/mysqld.log