Bug #89349 password_lifetime set to Null for user after changing default_password_lifetime
Description:
When default_password_lifetime is set dynamically or in the configuration file and the server is restarted the value oi password_lifetime for every user in mysql.user is Null which should be the value set as default_password_lifetime according to https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_default_passwo.... The password_lifetime value is only changed when an ALTER USER statement is used to change PASSWORD EXPIRE INTERVAL
How to repeat:
Set default_password_lifetime in my.cnf
root@pikachu:~# grep default_password_lifetime /etc/mysql/my.cnf
default_password_lifetime=90
Reboot the mysql instance and check user information in mysql.user
root@pikachu:~# service mysql restart
* Stopping MySQL Community Server 5.7.18
* MySQL Community Server 5.7.18 is already stopped
* Re-starting MySQL Community Server 5.7.18
...
* MySQL Community Server 5.7.18 is started
+---------------------------------------+-------+
| Variable_name | Value |
+---------------------------------------+-------+
| default_password_lifetime | 90 |
mysql> select User,password_last_changed,password_lifetime from mysql.user;
+------------------+-----------------------+-------------------+
| User | password_last_changed | password_lifetime |
+------------------+-----------------------+-------------------+
| root | 2018-01-22 22:01:35 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| | 2017-07-05 16:26:17 | NULL |
| | 2017-07-05 16:26:17 | NULL |
| debian-sys-maint | 2017-07-05 16:26:17 | NULL |
| test | 2017-07-05 16:26:17 | NULL |
| test | 2017-07-05 16:26:17 | NULL |
| pmm | 2017-07-05 16:26:17 | NULL |
| pmm | 2017-07-05 16:26:17 | NULL |
| repl | 2017-07-05 16:26:17 | NULL |
| mysql.sys | 2017-07-05 16:26:18 | NULL |
| testuser | 2017-07-05 16:26:24 | NULL |
+------------------+-----------------------+-------------------+
Create new user and check information again
mysql> GRANT SELECT ON *.* TO 'test2'@'localhost' IDENTIFIED BY PASSWORD '*****';
mysql> select User,password_last_changed,password_lifetime from mysql.user;
+------------------+-----------------------+-------------------+
| User | password_last_changed | password_lifetime |
+------------------+-----------------------+-------------------+
| root | 2018-01-22 22:01:35 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| | 2017-07-05 16:26:17 | NULL |
| | 2017-07-05 16:26:17 | NULL |
| debian-sys-maint | 2017-07-05 16:26:17 | NULL |
| test | 2017-07-05 16:26:17 | NULL |
| test | 2017-07-05 16:26:17 | NULL |
| pmm | 2017-07-05 16:26:17 | NULL |
| pmm | 2017-07-05 16:26:17 | NULL |
| repl | 2017-07-05 16:26:17 | NULL |
| mysql.sys | 2017-07-05 16:26:18 | NULL |
| testuser | 2017-07-05 16:26:24 | NULL |
| test2 | 2018-01-22 22:04:44 | NULL |
+------------------+-----------------------+-------------------+
ALTER USER to change PASSWORD EXPIRE INTERVAL and check again
mysql> ALTER USER 'test2'@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY;
Query OK, 0 rows affected (0.00 sec)
mysql> select User,password_last_changed,password_lifetime from mysql.user;
+------------------+-----------------------+-------------------+
| User | password_last_changed | password_lifetime |
+------------------+-----------------------+-------------------+
| root | 2018-01-22 22:01:35 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| root | 2017-07-05 16:26:17 | NULL |
| | 2017-07-05 16:26:17 | NULL |
| | 2017-07-05 16:26:17 | NULL |
| debian-sys-maint | 2017-07-05 16:26:17 | NULL |
| test | 2017-07-05 16:26:17 | NULL |
| test | 2017-07-05 16:26:17 | NULL |
| pmm | 2017-07-05 16:26:17 | NULL |
| pmm | 2017-07-05 16:26:17 | NULL |
| repl | 2017-07-05 16:26:17 | NULL |
| mysql.sys | 2017-07-05 16:26:18 | NULL |
| testuser | 2017-07-05 16:26:24 | NULL |
| test2 | 2018-01-22 22:04:44 | 90 |
+------------------+-----------------------+-------------------+
15 rows in set (0.00 sec)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.