For more:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
>>下载:https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
#安装repo到/etc/yum.repos.d/mysql-community.repo
# rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
#查看repolist
# yum repolist all | grep mysql
#关闭mysql8.0, 打开mysql5.7
# yum-config-manager --disable mysql80-community
# yum-config-manager --enable mysql57-community
#查看repolist
# yum repolist all | grep mysql
#安装mysql
# yum install mysql-community-server
#启动mysql
# service mysqld start
#查看mysql服务状态
# service mysqld status
#查看root密码
# grep 'temporary password' /var/log/mysqld.log
2019-05-25T09:02:42.634118Z 1 [Note] A temporary password is generated for root@localhost: k*y1eRlt7lMy
#修改root密码
# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root-123';
mysql> update mysql.user set authentication_string=password('Root-123') where user='root';
#添加远程访问
mysql> grant all privileges on *.* to root@"%" identified by "Root-123" with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql>
在客户端里修改密码:
SET PASSWORD=PASSWORD('Root-123');