Bug #106373 Improve MY-010928 your password has expired error on the server to show the user
Submitted: 3 Feb 2022 21:52 Modified: 4 Feb 2022 6:09
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S4 (Feature request)
Version:8.0.28 OS:Any
Assigned to: CPU Architecture:Any

[3 Feb 2022 21:52] Simon Mudd
Description:
This error message in the logs is not helpful:

2022-02-03T21:44:17.145502Z 6410 [Note] [MY-010928] [Server] Your password has expired. To log in you must change it using a client that supports e
xpired passwords.

Which user is connecting? From where?

How to repeat:
Find an expired user and try to connect to the server.
See the error.

Suggested fix:
Think of this from the DBA's perspective: how do you identify which user is trying to connect: the error message shown is probably the error returned to the user, but it may also be useful for the DBA to contact the user (as it may be an application user) and indicate the password is not working. Most applications don't handle this type of issue but will fail and this assumes someone will notice  which may not be the case.

Modify the logging to something similar to:

2022-02-03T21:44:17.145502Z 6410 [Note] [MY-123456] [Server] The password for 'user'@'%' connecting from '1.2.3.4' has expired.

Where '1.2.3.4' represents the ip address (so could be IPv6) of the connecting user. Note you should provide the actual user/host part in mysql.user as there may be multiple users with the same username and thus it's important to distinguish which user's password has actually expired as it's likely they'll have different expiry dates.
[4 Feb 2022 6:09] MySQL Verification Team
Hello Simon,

Thank you for the feature request to improve logging with meaningful message!

regards,
Umesh
[4 Feb 2022 14:24] MySQL Verification Team
same as https://bugs.mysql.com/bug.php?id=104428