注:本文来源于《  mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 》

【问题】

有时候,只是为了自己测试,不想密码设置得那么复杂,譬如只想设置root的密码为123456。

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

但是会报错:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements


【原因】

原来MySQL5.6.6版本之后增加了密码强度验证插件validate_password,相关参数设置的较为严格。
使用了该插件会检查设置的密码是否符合当前设置的强度规则,若不满足则拒绝设置。影响的语句和函数有:create user,grant,set password,password(),old password。

【解决】

1) 查看mysql全局参数配置

该问题其实与mysql的validate_password_policy的值有关。
查看一下msyql密码相关的几个全局参数:

mysql> select @@validate_password_policy;
+----------------------------+
| @@validate_password_policy |
+----------------------------+
| MEDIUM |
+----------------------------+
1 row in set (0.00 sec) mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
6 rows in set (0.08 sec)



2)参数解释

validate_password_dictionary_file
--插件用于验证密码强度的字典文件路径。
validate_password_length
--密码最小长度,参数默认为8,它有最小值的限制,最小值为:validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)
validate_password_mixed_case_count
--密码至少要包含的小写字母个数和大写字母个数。
validate_password_number_count
--密码至少要包含的数字个数。
validate_password_policy
--密码强度检查等级,0/LOW、1/MEDIUM、2/STRONG。有以下取值:
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,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
validate_password_special_char_count
--密码至少要包含的特殊字符数。

3)修改mysql参数配置

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.05 sec) mysql>
mysql>
mysql> set global validate_password_mixed_case_count=0;
Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password_number_count=3;
Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password_special_char_count=0;
Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec) mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_dictionary_file | |
| validate_password_length | 3 |
| validate_password_mixed_case_count | 0 |
| validate_password_number_count | 3 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 0 |
+--------------------------------------+-------+
6 rows in set (0.00 sec)


4)修改简单密码:


mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123');
Query OK, 0 rows affected, 1 warning (0.00 sec)

OK了,完美解决!

mysql5.7设置简单密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements的更多相关文章

  1. mysql授权报错 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    授权用户时报错,ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 原因为其实与val ...

  2. mysql5.7 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    mysql5.7初次登录使用提示 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before ...

  3. ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    为了加强安全性,MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是RPM包,则默认是/var/log/mysqld.log. 一般可通 ...

  4. mysql ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    为了加强安全性,MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是RPM包,则默认是/var/log/mysqld.log. 一般可通 ...

  5. 【转】ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    为了加强安全性,MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是RPM包,则默认是/var/log/mysqld.log. 一般可通 ...

  6. mysql错误详解(1819):ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    O(∩_∩)O哈哈~ 在学习 Mysql 的时候又遇到了新问题了 o(╥﹏╥)o 当我在准备为用户授权的时候: grant all privileges on *.* to 'root'@'%' id ...

  7. mysql5.7初始化密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before

    mysql初始化密码常见报错问题1,mysql5.6是密码为空直接进入数据库的,但是mysql5.7就需要初始密码 cat /var/log/mysqld.log | grep password1 2 ...

  8. mysql5.7初始化密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement

    mysql初始化密码常见报错问题 1,mysql5.6是密码为空直接进入数据库的,但是mysql5.7就需要初始密码 cat /var/log/mysqld.log | grep password 2 ...

  9. mysql5.7 Your password does not satisfy the current policy requirements问题解决

    安装mysql5.7rpm包,在更改密码的时候,提示错误 这是由于Mysql5.7默认对于密码的要求强度较高,设置的密码过于简单不予通过.要解决这个问题,涉及到的参数有validate_passwor ...

随机推荐

  1. Nginx下配置网站ssl实现https访问

    第一步:服务器环境,lnmp即Linux+Nginx+PHP+MySQL,本文中以我的博客为例,使用的是阿里云最低档的vps+免费的Linux服务器管理系统WDCP快速搭建的lnmp环境(同类产品还有 ...

  2. Coursera, Deep Learning 4, Convolutional Neural Networks - week2

    Case Study (Note: 红色表示不重要) LeNet-5 起初用来识别手写数字灰度图片 AlexNet 输入的是227x227x3 的图片,输出1000 种类的结果 VGG VGG比Ale ...

  3. JQuery-change/select/submit

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. if 语句

    if 判断条件的时候,如果是多个条件一起进行判断,那么就需要逻辑运算符   并且-----------and 或者-----------or 非(取反)----not   if 条件1 and 条件2 ...

  5. 数组去重的4种方法(Which one is the fastest???嘻嘻嘻....)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. imooc-free

    前端性能优化-通用的缓存SDK 依赖项 1.在hosts文件中配置  127.0.0.1 http://cc.imooc.com   就可以直接访问 http://cc.imooc.com:3000 ...

  7. pythonのSocket

    TCP/IP 三次握手 第一次 A向B 发送 syn 请求 然后B给A返回 syn + ack A收到后,给B返回ack 握手成功. Socket 网络编程 实现通信 要通过IP+Port Socke ...

  8. STL 智能指针

    转自: https://blog.csdn.net/k346k346/article/details/81478223 STL一共给我们提供了四种智能指针:auto_ptr.unique_ptr.sh ...

  9. cosmic_download-AsyncPool待修正

    # !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/16 10:02 AM # @Author : cxa # @File ...

  10. requests库入门11-重定向和请求历史

    默认情况下,除了head请求,requests会自动处理重定向 重定向就是会把url重新指定到另一个.比如github,使用http会自动重定向到https.一些公司也会使用网关啥的做重定向. r = ...