Bug #66874 Unable to prepare ALTER USER
Submitted: 19 Sep 2012 14:50 Modified: 2 Oct 2012 15:27
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Prepared statements Severity:S4 (Feature request)
Version:5.6.7 OS:Any
Assigned to: CPU Architecture:Any

[19 Sep 2012 14:50] Todd Farmer
Description:
Unlike other account management statements, ALTER USER ... PASSWORD EXPIRE cannot be prepared:

mysql> prepare stmt from 'ALTER USER \'\'@localhost PASSWORD EXPIRE';
ERROR 1295 (HY000): This command is not supported in the prepared statement prot
ocol yet
mysql> prepare stmt from 'CREATE USER test@localhost';
Query OK, 0 rows affected (0.04 sec)
Statement prepared

mysql> prepare stmt from 'DROP USER test@localhost';
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> prepare stmt from 'GRANT ALL ON *.* TO test@localhost';
Query OK, 0 rows affected (0.02 sec)
Statement prepared

This is very unfortunate, because it's probably the most useful of all account management statements to execute in a stored procedure, and there's no other way to dynamically set the target user/host (short of direct manipulation of mysql.user table and FLUSH PRIVILEGES).

How to repeat:
Try to prepare ALTER USER ... PASSWORD EXPIRE.

Suggested fix:
Enable prepare of ALTER USER ... PASSWORD EXPIRE.
[2 Oct 2012 15:27] Paul Dubois
Noted in 5.6.8, 5.7.0 changelogs. 

ALTER USER now can be used as a prepared statement.