安装mysql源: yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

安装mysql-5.7: yum -y install mysql-community-server mysql-community-devel

启动mysql: systemctl start mysqld systemctl enable mysqld

查看mysql的随机密码: grep 'temporary password' /var/log/mysqld.log

进入mysql更改密码: mysql -uroot -p'eZa?x2q;&;l%'

set global validate_password_policy=0; set global validate_password_length=1; ALTER USER 'root'@'localhost' IDENTIFIED BY 'redhat';