mysql报错:Your password does not satisfy the current policy requirements

问题描述

执行sql语句grant replication slave on *.* to 'xiaoming'@'%' identified by '1234';时报错:

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

解决方案

密码不符合当前的策略要求,可能要求密码长度、大小写字母、数字或特殊字符等。
方案一:可以根据具体的要求重新设置密码,确保密码符合要求并且足够安全。
方案二:可以修改策略,允许设置简单密码

  1. 查看当前的密码策略
mysql> show variables like 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| 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      |
+--------------------------------------+--------+
 // 密码长度要求8位,验证策略是MEDIUM,就是长度,数字,大小写,特殊字符都得验证
  1. 修改密码策略
mysql> set global validate_password_policy=0; 	// 只检查长度
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=4;	// 密码长度为4
Query OK, 0 rows affected (0.00 sec)
  1. 再次查看密码策略

mysql> show variables like 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password_check_user_name    | OFF   |
| validate_password_dictionary_file    |       |
| validate_password_length             | 4     |
| validate_password_mixed_case_count   | 1     |
| validate_password_number_count       | 1     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 1     |
+--------------------------------------+-------+
  1. 执行grant replication slave on *.* to 'xiaoming'@'%' identified by '1234';即可使用简单密码1234

拓展

1、修改密码的四种方式
1)shell命令行下mysqladmin -uroot -poldpassword password newpassword
2)sql命令行下 set password = password(newpassword);
3)sql命令行下 update user set authentication_string=password(newpassword) where user=‘root’;
4)sql命令行下 alter user root@‘localhost’ identified by ‘newpassword’;//使用随机密码登录,如果要使用数据,查看数据库等操作时mysql会推荐这种写法改变密码。

2、密码策略的三个值分别代表的含义
1)LOW(0)只检查长度。
2)MEDIUM(1)检查长度,数字,大小写,特殊字符。
3)STRONG(2)检查长度,数字,大小写,特殊字符字典文件。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

在逃八阿哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值