Details
Description
When there is no password_last_changed field for the user in mysql.global_priv, then it is assumed to be '1970-01-01 00:00:00'
Then if we set default_password_lifetime, it is calculated from that date:
set global default_password_lifetime= 2; |
connect(con1, localhost, root); |
|
#error 1820: You must SET PASSWORD before executing this statement |
select * from mysql.global_priv where user='root'; |
11.5 |
MariaDB [information_schema]> select * from users where user like '%root%';
|
+--------------------+-----------------+--------------------------+
|
| USER | PASSWORD_ERRORS | PASSWORD_EXPIRATION_TIME |
|
+--------------------+-----------------+--------------------------+
|
| 'root'@'localhost' | NULL | NULL |
|
+--------------------+-----------------+--------------------------+
|
1 row in set (0,002 sec)
|
|
MariaDB [information_schema]> set global default_password_lifetime= 2;
|
Query OK, 0 rows affected (0,001 sec)
|
|
MariaDB [information_schema]> select * from users where user like '%root%';
|
+--------------------+-----------------+--------------------------+
|
| USER | PASSWORD_ERRORS | PASSWORD_EXPIRATION_TIME |
|
+--------------------+-----------------+--------------------------+
|
| 'root'@'localhost' | NULL | 1970-01-03 01:00:00 |
|
+--------------------+-----------------+--------------------------+
|
1 row in set (0,002 sec)
|
MariaDB [information_schema]> alter user 'root'@'localhost' password expire interval 5 DAY;
|
Query OK, 0 rows affected (0,016 sec)
|
|
MariaDB [information_schema]> select * from users where user like '%root%';
|
+--------------------+-----------------+--------------------------+
|
| USER | PASSWORD_ERRORS | PASSWORD_EXPIRATION_TIME |
|
+--------------------+-----------------+--------------------------+
|
| 'root'@'localhost' | NULL | 1970-01-06 01:00:00 |
|
+--------------------+-----------------+--------------------------+
|
1 row in set (0,003 sec)
|
|