1.下载并安装MySQL官方的Yum Repository
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server --nogpgcheck
2.启动 MySQL 数据库
systemctl start mysqld.service
3.查看MySQL初始密码
grep "password" /var/log/mysqld.log
4.登录数据库
mysql -uroot -p
5.修改MySQL默认密码
set global validate_password_policy=0; #修改密码安全策略为低(只校验密码长度,至少8位)
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
6.授予root用户远程管理权限GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';
7.输入exit退出数据库