由于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
发布评论