- 查看临时密码:
[root@god ~]# grep password /var/log/mysqld.log
2020-09-11T10:58:46.152697Z 1 [Note] A temporary password is generated for root@localhost: p(-Jp)6d!4RW
- 登录mysql(复制刚才的临时密码)
[root@xuegod69 ~]# mysql -uroot -p
Enter password:
- 修改mysql密码策略
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_length=6;
Query OK, 0 rows affected (0.00 sec)
- 修改mysql密码
mysql> SET PASSWORD FOR root@localhost=PASSWORD(‘123456‘);
Query OK, 0 rows affected, 1 warning (0.00 sec)