WHAT'S NEW?
Loading...

ERROR 1820 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

This morning one of my sites using Wordpress and MySQL stopped working indicating an error in the connection to the database. Trying to connect with the client mysqlyog I obtained the following error message.


ERROR 1820 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

The problem is because mysql 5.7.4 or later will expire all user password after 360 days by default!!

How to solve this problem? Login by command line client and setup a new password

C:\wamp\bin\mysql\mysql5.7.9\bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.9

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> SET PASSWORD = PASSWORD('newpassword');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'default_password_lifetime';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| default_password_lifetime | 360   |
+---------------------------+-------+
1 row in set (0.00 sec)

You have to modify the value of this variable in order to avoid the problem again after 360 days.

mysql> set global default_password_lifetime=0;

Query OK, 0 rows affected (0.00 sec)



0 comments:

Post a Comment