mysql5.7.24启动报错:ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

报错原因是:密码过期。不管你是刚刚修改密码还是什么,只要登陆都是有问题的,都是报这样子的错误。

解决方法是:

1、修改/etc/my.cnf文件,在[mysqld]下加入“skip-grant-tables”。

2、重启mysql服务器

3、登陆mysql

[root@:vg_adn_tidbCkhsTest /usr/local/src]#mysql -u root -p                   #此处直接按下enter键即可
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MySQL [(none)]> update mysql.user set password_expired='N' where user='root'
    -> ;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MySQL [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MySQL [(none)]> exit

4、修改/etc/my.cnf。把“skip”这一行内容注释掉

5、再次重启mysql服务器即可

原文地址:https://www.cnblogs.com/FengGeBlog/p/10197414.html