mysql 5.7 出现password过期的解决方案

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

该问题提示很明显,说密码已过期。
按照网上的说法,操作了一遍。步骤如下:
1、在my.cnf 的[mysqld] 部分加入 skip-grant-tables 参数。
[mysqld]
skip-grant-tables
2、重启mysql数据库,然后登陆修改密码不过期。
update mysql.user set password_expired='N';
3、查看mysql的状态。(这个在修改之前也应该看看状态是啥),更改之后password_expired为N。
select host,user,password_expired,account_locked from mysql.user;

4、最后去修改my.cnf文件,注释掉skip-grant-tables参数,重启mysql修改密码。
按照以上的步骤之后,navicat是可以连接的,但是服务器的项目就无法连接。
琢磨了很久还是没有搞明白为啥?一直纠结了很久。后来想了一种很笨的办法。
直接在my.cnf设置default_password_lifetime=0,然后重启mysql服务器即可。

你们有没有遇到这样的问题?如果不修密码的前提下,有没有办法可以直接解决这个问题?
相关推荐
-
PHP8种变量类型的详细讲解2025-02-22 00:32:24
-
php+apache 和 php+nginx的区别2025-02-22 00:21:27
-
PHP:与workerman结合实现定时任务2025-02-22 00:15:57
-
Nginx的Rewrite规则与实例2025-02-22 00:15:39
-
MySql中身份证字段的简单脱敏介绍2025-02-22 00:15:36