码迷,mamicode.com
首页 > 数据库 > 详细

mysql 5.7密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

时间:2019-03-08 00:32:11      阅读:769      评论:0      收藏:0      [点我收藏+]

标签:cut   exec   0.00   完成   validate   出现   0 rows   取值   require   

1、重新修改密码,语句如下:

mysql> alter user ‘root‘@‘localhost‘ identified by ‘123‘;
Query OK, 0 rows affected (0.00 sec)

 

2、如果修改过程出现错误(如下),转后面操作:

mysql> alter user ‘root‘@‘localhost‘ identified by ‘123‘;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

2.1、这个其实与validate_password_policy的值有关。validate_password_policy有以下取值:

技术图片

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。我只想设置root的密码为123。必须修改两个全局参数:

首先,修改validate_password_policy参数的值:

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

其次,validate_password_length(密码长度)参数默认为8,我们修改为1 :

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

2.2、完成之后再次执行修改密码语句即可成功:

mysql> alter user ‘root‘@‘localhost‘ identified by ‘123‘;
Query OK, 0 rows affected (0.00 sec)

  

 

mysql 5.7密码报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

标签:cut   exec   0.00   完成   validate   出现   0 rows   取值   require   

原文地址:https://www.cnblogs.com/stupid-chan/p/10493465.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!