MySQLERROR 1819 (HY000): Your password does not satisfy the current policy requirements

以加强安全性,MySQL5.7乎root用户自由大成了一个密码,在error
log中,关于error
log的职位,如果设置的凡RPM包,则默认是/var/log/mysqld.log。

貌似不过经log_error设置

mysql> select @@log_error;
+---------------------+
| @@log_error         |
+---------------------+
| /var/log/mysqld.log |
+---------------------+
1 row in set (0.00 sec)

可通过# grep “password” /var/log/mysqld.log 命令获取MySQL的即密码

2016-01-19T05:16:36.218234Z 1 [Note] A temporary password is generated for root@localhost: waQ,qR%be2(5

因此该密码登录到服务端后,必须立刻改密码,不然会报如下错误:

mysql> select user();
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

假如就是改为一个简便的密码,会报以下错误:

mysql>  ALTER USER USER() IDENTIFIED BY '12345678';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

夫实际和validate_password_policy的价值有关。

validate_password_policy有以下取值:

Policy Tests Performed
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters; dictionary file

默认是1,即MEDIUM,所以刚刚起安装的密码要符合长度,且要含有数字,小写或很写字母,特殊字符。

偶,只是为着自己测试,不思密码设置得那复杂,譬如说,我才想装root的密码也123456。

总得修改两独全局参数:

首先,修改validate_password_policy参数的价

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

这么,判断密码的专业就依据密码的尺寸了。这个由于validate_password_length参数来控制。

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|                          8 |
+----------------------------+
1 row in set (0.00 sec)

validate_password_length参数默认为8,它发极致小值的界定,最小值为:

validate_password_number_count
+ validate_password_special_char_count
+ (2 * validate_password_mixed_case_count)

其中,validate_password_number_count指定了密码中数据的长度,validate_password_special_char_count指定了密码中特殊字符的长,validate_password_mixed_case_count指定了密码中大小字母之长短。

这些参数,默认值均为1,所以validate_password_length最小值为4,如果您显性指定validate_password_length的价值仅次于4,尽管未会见报错,但validate_password_length的值将设为4。如下所示:

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|                          8 |
+----------------------------+
1 row in set (0.00 sec)

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|                          4 |
+----------------------------+
1 row in set (0.00 sec)

如改动了validate_password_number_count,validate_password_special_char_count,validate_password_mixed_case_count中另外一个价,则validate_password_length将开展动态修改。

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|                          4 |
+----------------------------+
1 row in set (0.00 sec)

mysql> select @@validate_password_mixed_case_count;
+--------------------------------------+
| @@validate_password_mixed_case_count |
+--------------------------------------+
|                                    1 |
+--------------------------------------+
1 row in set (0.00 sec)

mysql> set global validate_password_mixed_case_count=2;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@validate_password_mixed_case_count;
+--------------------------------------+
| @@validate_password_mixed_case_count |
+--------------------------------------+
|                                    2 |
+--------------------------------------+
1 row in set (0.00 sec)

mysql> select @@validate_password_length;
+----------------------------+
| @@validate_password_length |
+----------------------------+
|                          6 |
+----------------------------+
1 row in set (0.00 sec)

当然,前提是validate_password插件必须就设置,MySQL5.7凡默认安装的。

这就是说怎样证明validate_password插件是否安装为?可经过查看以下参数,如果无安装,则输出将为空。

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| 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     |
+--------------------------------------+-------+
6 rows in set (0.00 sec)

 

网站地图xml地图