1.下载wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
2.安装rpm包
rpm -ivh mysql80-community-release-el7-1.noarch.rpm
3.检查mysql的yum源是否安装成功:yum repolist enabled | grep “mysql.-community.”
4.使用yum install mysql-server安装(这里会有点慢)
5.启动mysql
service mysqld start
6.查看初始密码
cat /var/log/mysqld.log|grep ‘A temporary password’
7.登录mysql
mysql -uroot -p
8.这个时候会让修改密码,规则是大小写字母然后数字标点符号,自己测试
alter user ‘root’@‘localhost’ identified by ‘youpassword’;
9.修改密码验证规则
由于密码的规则性,我们可以把密码改一下
输入语句 “ SHOW VARIABLES LIKE ‘validate_password%’; ” 进行查看
然后设置这个值set global validate_password.policy = low;
在就可以使用修改密码的命令来修改8位数的密码了,没有什么限制
alter user ‘root’@‘localhost’ identified by ‘youpassword’;