打开cmd,打开mysql后,分别执行三段代码:
1.
alter user root@localhost identified by '你的密码' password expire never;
![]()
2.
alter user root@localhost identified with mysql_native_password by '你的密码';
![]()
3.
flush privileges; // 刷新权限

最后输入exit退出mysql,再尝试连接就可以成功啦~
![]()
本文提供了一种解决MySQL中root用户密码过期的方法,通过执行三段特定的SQL语句来更新密码并刷新权限,确保数据库连接正常。
打开cmd,打开mysql后,分别执行三段代码:
alter user root@localhost identified by '你的密码' password expire never;
![]()
alter user root@localhost identified with mysql_native_password by '你的密码';
![]()
flush privileges; // 刷新权限

最后输入exit退出mysql,再尝试连接就可以成功啦~
![]()
421
535

被折叠的 条评论
为什么被折叠?
