centos7安装mysql5.7
# 1.下载
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
# 2.安装yum源
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
# 3.查看可用版本(enable)
yum repolist all| grep mysql
# 4.修改可用版本(需要的版本enabled改为1)
vim /etc/yum.repos.d/mysql-community.repo
# 5.查看可用版本(enable)
yum repolist all| grep mysql
# 6.安装mysql
yum install -y mysql-community-server
# 查看初次启动默认密码
grep 'password' /var/log/mysqld.log
# 用默认密码登陆mysql
mysql -u root -p
# 修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxx';