# 下载并安装yum源
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall mysql57-community-release-el7-7.noarch.rpm -y
# 因为密钥的问题,会导致无法安装,需要关闭
sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/mysql-community.repo
yum install mysql-server -y
# 启动Mysql实例服务
systemctl restart mysqld.service
# 设置MySQL实例服务为自启动
systemctl enable mysqld.service
# 查看mysql密码
grep 'temporary password' /var/log/mysqld.log
# 登陆数据库
-- mysql -uroot -p'password'
# 修改密码
-- ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';