1,MySQL :: Download MySQL Yum Repository
下载 rpm文件
2, yum -y install mysql80-community-release-el7-5.noarch.rpm
3 yum -y install mysql-community-server
4,启动mysql
systemctl start mysqld
5,查看mysql服务状态
systemctl status mysqld
6,查看第一次启动时的密码
grep "password" /var/log/mysqld.log
7进入mysql时,输入命令
mysql -u root -p
8,输入6步骤时看到的密码
9,设置密码,因为有密码策略,所以必须输入有符合策略的密码
alter user 'root'@'localhost' identified by 'rootRoot123.';
10,设置策略
set global validate_password.policy = 0;
set global validate_password.length=4;
11,重新设置密码
alter user 'root'@'localhost' identified by '123456';
12,新创建用户并赋值权限
create user '*******'@'%' identified by '123456';
grant all on *.* to '******'@'%';