MySQL 解决 Your password has expired
如题,今天连接MySQL的时候报了一个这个错,错误号1862,报错内容
Your password has expired.To log in you must change it using a client that supports expired passwords 。
记录一下。如图:

错误号1862
根据上面提示的内容,这个问题是因为密码过期了,然后提醒我们用一个支持过期密码的客户端连接。尝试用idea直接连接。

idea连接数据库
一样报密码过期,一样连不上。

报错
最后想用命令行窗口来连接吧。

命令行连接数据库
关键时刻还是靠命令行连上了。接下来改一下设置,让密码永不过期。
ALTER USER `root`@`localhost` IDENTIFIED BY '你的密码', `root`@`localhost` PASSWORD EXPIRE NEVER;
在命令行中运行上面的命令。这里我的数据库密码是root,所以在命令行输入
ALTER USER `root`@`localhost` IDENTIFIED BY 'root', `root`@`localhost` PASSWORD EXPIRE NEVER;

修改密码永不过期
重启一下MySQL。
net stop mysql
net start mysql
然后重新使用客户端连接。

sqlyog成功连接
然后用idea也试试连接

idea成功连接
两个客户端都成功连接了。