1.启动mysql
mysqld_safe --skip-grant-tables
2.清空mysql密码
# mysql -u root
mysql> use mysql;
mysql> update user set authentication_string='' where user='root';
mysql> select Host,User,authentication_string from user;
mysql> flush privileges;
mysql> exit
3.设置密码级别
# SHOW VARIABLES LIKE 'validate_password%';
The output should be something like that :
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 6 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
+--------------------------------------+-------+
then you can set the password policy level lower, for example:
SET GLOBAL validate_password_length = 6;
SET GLOBAL validate_password_number_count = 0;
4. 再修改密码
mysql> alter user 'root'@'localhost'IDENTIFIED BY 'MyNewPas';
mysql> flush privileges;