Bug #72696 mysql cli should suggest connect-expired-password when error 1862 occurs
Submitted: 20 May 2014 20:05 Modified: 1 Oct 2015 17:07
Reporter: Morgan Tocker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[20 May 2014 20:05] Morgan Tocker
Description:
When the mysql cli program is used in batch mode, it can produce a confusing error message when trying to change the password on expired password accounts:

$ mysql -u root --password=$mysql_secret -e "SET PASSWORD = PASSWORD('mynewpassword');"  
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.  

(The program is actually capable, but requires interactive use, or the option --connect-expired-password set.)

How to repeat:
See above.

Suggested fix:
I would like to suggest that the MySQL cli program capture the error code 1862 back from the server, realize batch mode is set, and then suggest setting --connect-expired-password or using the program in interactive mode.

For example:
$ mysql -u root --password=$mysql_secret -e "SET PASSWORD = PASSWORD('mynewpassword');"  
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.  
This can be achieved by using mysql --connect-expired-password or using the mysql command line program interactively.
[17 Jul 2015 14:29] Georgi Kodinov
Thanks for the reasonable feature request.
[1 Oct 2015 17:07] Paul DuBois
Noted in 5.7.9, 5.8.0 changelogs.

When the mysql client was used to connect to the server in batch mode
using an account with an expired password, the error message was not
meaningful. mysql now reports "Please use --connect-expired-password
option or invoke mysql in interactive mode" in this case.