Fixing mysql old_password user accounts quickly

Public

So I had a server running drupal 7 (elmsln actually) that produced 50 or so databases / database users (it's a multisite factory). I applied remi repo updates to get other deployments up to mysql / php 5.5 without issue until this one special snowflake that had users accounts created (based on the time a setting on my.cnf was set) that used the mysql old password flag. This threw all kind of issues in mysql that look like the following:

Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password] in DatabaseConnection->__construct() (line 307 of drupal-7/includes/database/database.inc).
Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password] in DatabaseConnection->__construct() (line 307 of drupal-7/includes/database/database.inc).
PDOException: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client in lock_may_be_available() (line 167 of drupal-7/includes/lock.inc).

This caused all my sites that had the OLD password hashes to brick. To fix this, and quickly, is sadly not possible because you need to know the password in order to reissue the user account. The solutions I found were basically just to delete the account and recreate it.

This is a code snippet to quickly dump out the drush bootstrapped database info

Get raw version
php
  1. drush @sites eval 'global $databases; print $databases["default"]["default"]["database"] . " " . $databases["default"]["default"]["username"] . " " . $databases["default"]["default"]["password"] . "\n"'

mysql command to run

Get raw version
sql
  1. DROP USER USERNAME@localhost;
  2. CREATE USER USERNAME@localhost IDENTIFIED BY 'PASSWORD';
  3. GRANT ALL PRIVILEGES ON DATABASE.* TO USERNAME@localhost;