由于mysql5.7改变了默认的强制更新密码策略,提示:错误号码1862
Your password has expired. To log in you must change it using a client that supports expired passwords.
正确的姿势应该是:依次执行下列语句
1. 更新密码
SET PASSWORD = PASSWORD('newpassword');
2. 设置密码永不过期(可选)
ALTER USER 'root'@'localhost' PASSWORD EXPIRE;
3. 刷新
flush privileges;
完成上面三个操作后,退出。用新密码重新连接即可。