1. 程式人生 > >Mysql 8.0.1修改密碼策略

Mysql 8.0.1修改密碼策略

文件2對修改mysql的密碼策略做了很好的總結,但,注意一點,在mysql8.0.1中密碼策略變數的變化;由“_”連線符改變為"."連線符;如下:

validate_password_length
改變為:
validate_password.length

修改步驟:

Step 1: 檢視password密碼策略的變數名

SHOW VARIABLES LIKE 'validate_password%';

結果:

+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password.check_user_name      ON
| validate_password.dictionary_file    |       |
| validate_password.length             | 6     |
| validate_password.mixed_case_count   | 2     |
| validate_password.number_count       | 1     |
| validate_password.policy             | LOW   |
| validate_password.special_char_count | 1     |
+--------------------------------------+-------+

Step 2: 修改validate_password.policy引數的值

set global validate_password.policy=0;

Step 3: 修改validate_password.length引數的值來設定密碼的最小長度(這個值是由mix_case_count number_count special_char_count需大於等於這三個值和的最小值)

set global validate_password.length=4;