- 下载对应版本的rpm
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
- 安装对应rpm包
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
- 跳转到
/etc/yum.repos.d/
,执行yum install mysql-server
- 删除以前的配置
rm -rf /var/lib/mysql
- 启动
systemctl start mysqld
- 获取临时密码
grep 'temporary password' /var/log/mysqld.log
- 登录
- 查看密码策略
SHOW VARIABLES LIKE 'validate_password%';
- 修改密码策略
set global validate_password.policy=LOW; set global validate_password.length=6;
- 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
网友评论