MySQL YUM源
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装MySQL
yum -y install mysql-community-server
启动MySQL服务
systemctl start mysqld
设置MySQL服务开机自启动
systemctl enable mysqld
查看/var/log/mysqld.log文件,获取root用户的初始密码
grep 'temporary password' /var/log/mysqld.log
登录数据库
mysql -uroot -p
修改密码
set global validate_password_policy=0; #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
授予root用户远程管理权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';