目录
1.删除原有的mysql
rpm -qa | grep mysql
#可能的显示情况如下
#mysql-community-libs-8.0.12-1.el7.x86_64
#mysql80-community-release-el7-1.noarch
#mysql-community-client-8.0.12-1.el7.x86_64
#mysql-community-common-8.0.12-1.el7.x86_64
#mysql-community-server-8.0.12-1.el7.x86_64
#通过下面的命令进行删除
yum remove mysql-xxx-xxx-
#查找mysql的相关文件
find / -name mysql
#根据自身的需求删除mysql的配置文件信息
rm -rf /var/lib/mysql
2.下载安装包
[root@iZwz9j1nogjvowrlo3htsyZ ~]# wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
3.下载rpm包
yum -y install mysql80-community-release-el7-3.noarch.rpm
4.安装MySQL服务
yum -y install mysql-community-server --nogpgcheck
5.启动MySQL服务
systemctl start mysqld.service
6.查看初始密码
grep "password" /var/log/mysqld.log
7.登录
mysql -u root -p
8.查看密码策略
SHOW VARIABLES LIKE 'validate_password%';
9.修改密码策略
set global validate_password.policy=0;
set global validate_password.length=1;
10.修改密码
set password = '123456';