I’ve been looking at the new ALTER USER … PASSWORD EXPIRE command as I try to implement a comprehensive password policy for MySQL 5.6. There’s a few aspects of this feature that I found interesting, and thought others might benefit from what I’ve learned. Here’s a quick summary:
You can use ALTER USER … PASSWORD EXPIRE in prepared statements as of 5.6.8-rc
This is important because there’s no other way to dynamically bind ALTER USER statements to a user name and host, which is necessary if you are trying to automate anything related to password policies. This wasn’t the case with earlier 5.6 releases, but was fixed in 5.6.8-rc:
mysql> SELECT password_expired -> FROM mysql.user -> WHERE user = 'root' AND host = 'localhost'; +------------------+ | password_expired | +------------------+ | N | +------------------+ 1 row in set (0.00 sec) mysql> SET @sql = 'ALTER USER …[Read more]