Mysql 5.7 错误号码1862 Your password has expired. To log in you must change it using a client...

编程知识 更新时间:2023-05-02 19:07:45

由于mysql5.7改变了默认的强制更新密码策略,今天突然网站打不开了。打开日志发现提示:


错误号码1862

Your password has expired. To log in you must change it using a client that supports expired passwords.


打开mysql command line shell

如果用之前的脚本:

update mysql.user set password=PASSWORD('newpassword') where  User='root';

会提示

mysql error You must reset your password using ALTER USER statement before executing this statement.

正确的姿势应该是:依次执行下列语句

1. 更新密码

SET PASSWORD = PASSWORD('newpassword');


2. 设置密码永不过期(可选)

ALTER USER 'root' PASSWORD EXPIRE NEVER;

3. 刷新

flush privileges;

完成上面三个操作后,退出。用新密码重新连接即可。



更多推荐

Mysql 5.7 错误号码1862 Your password has expired. To log in you must change it using

本文发布于:2023-04-28 04:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/3c2dbb8bcc69f7a72a0b9d9ea83ee752.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:号码   错误   Mysql   change   client

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 107707文章数
  • 27238阅读数
  • 0评论数