适用于可以登录进入mysql数据库,想修改密码或者提示密码过期
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement
如果忘记密码可以看Linux系统MySQL忘记登录密码-CSDN博客这篇文章
方法一:
use mysql;
update user set password=password('123456') where user='root'; # mysql5.7之前
update user set authentication_string=password('123456') where user='root'; # mysql5.7之后
flush privileges;
方法二:
set password for 'root'@'localhost' = password('123456');
方法三:
mysqladmin -u用户名 -p旧的密码 password 新密码
方法四:
ALTER USER USER() IDENTIFIED BY 'Hu@12345'; # 5.7.6及之后
SET PASSWORD = PASSWORD('Hu@12345'); # 5.7.6之前
如果提示:ERROR 1819 (HY000): Your password doesnot satisfy the current policy requirements
密码需要满足8字符以上、大小写、特殊字符、数字等复杂度限制