Bug #118297 password expire and password expire interval when create user is not both work

Submitted: 29 May 2025 2:39 Modified: 29 May 2025 12:46
Reporter: jia liu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S3 (Non-critical)
Version:8.0.42, 8.4.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: password expire

[29 May 2025 2:39] jia liu
Description:
password expire and password expire interval when create user is not both work.

How to repeat:
drop user test;create user test;
select user,password_expired,password_last_changed,password_lifetime from mysql.user where user='test';
+------+------------------+-----------------------+-------------------+
| user | password_expired | password_last_changed | password_lifetime |
+------+------------------+-----------------------+-------------------+
| test | N                | 2025-05-29 10:31:27   |              NULL |
+------+------------------+-----------------------+-------------------+
-- result is correct.

drop user test;create user test password expire;
select user,password_expired,password_last_changed,password_lifetime from mysql.user where user='test';
+------+------------------+-----------------------+-------------------+
| user | password_expired | password_last_changed | password_lifetime |
+------+------------------+-----------------------+-------------------+
| test | Y                | 2025-05-29 10:32:47   |              NULL |
+------+------------------+-----------------------+-------------------+
-- result is correct.

drop user test;create user test password expire interval 30 day;
select user,password_expired,password_last_changed,password_lifetime from mysql.user where user='test';
+------+------------------+-----------------------+-------------------+
| user | password_expired | password_last_changed | password_lifetime |
+------+------------------+-----------------------+-------------------+
| test | N                | 2025-05-29 10:33:19   |                30 |
+------+------------------+-----------------------+-------------------+
-- result is correct.

drop user test;create user test password expire password expire interval 30 day;
select user,password_expired,password_last_changed,password_lifetime from mysql.user where user='test';
+------+------------------+-----------------------+-------------------+
| user | password_expired | password_last_changed | password_lifetime |
+------+------------------+-----------------------+-------------------+
| test | N                | 2025-05-29 10:34:32   |                30 |
+------+------------------+-----------------------+-------------------+
-- result is not correct.password expire is not working, we need another alter user to make it work. 

drop user test;create user test password expire interval 30 day password expire;
select user,password_expired,password_last_changed,password_lifetime from mysql.user where user='test';
+------+------------------+-----------------------+-------------------+
| user | password_expired | password_last_changed | password_lifetime |
+------+------------------+-----------------------+-------------------+
| test | Y                | 2025-05-29 10:37:00   |              NULL |
+------+------------------+-----------------------+-------------------+
-- result is not correct.password expire interval is not working, we need another alter user to make it work.

Suggested fix:
we can use password expire and password expire interval simultaneously when create user.
[29 May 2025 12:46] MySQL Verification Team
Hello jia liu, 

Thank you for the report and feedback.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 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.