This question already has an answer here:
This probably has been asked before. Some passwords for the users are stored in 16 bit format. Mysql has been upgraded to 5.5, but the passwords in the table remained in a 16 bit format.
A way to tell what password scheme your MySQL is using is to run this query below, it will list each user’s password length (16 or 41):
mysql> SELECT `User`, `Host`, Length(`Password`) FROM mysql.user;
+—————-+—————–+——————–+
| User | Host | Length(`Password`) |
+—————-+—————–+——————–+
| root | localhost | 16 |
| mary | 20.20.3.2 | 16 |
| fred | localhost | 16 |
| sally | 64.56.139.194 | 16 |
| fschmidt | 64.56.139.194 | 16 |
…
To change the user to having the exact same password but stored in the newer longer format, we can do this:
mysql> SET SESSION old_passwords=FALSE;
mysql> SET PASSWORD FOR ‘visitlogger’@’64.55.129.%’=PASSWORD(‘ ‘);
mysql> flush privileges;
Now we can verify the changes:
mysql> SELECT `User`, `Host`, Length(`Password`) FROM mysql.user;
+—————-+—————–+——————–+
| User | Host | Length(`Password`) |
+—————-+—————–+——————–+
| root | localhost | 41 |
| mary | 20.20.3.2 | 41 |
| fred | localhost | 41 |
| sally | 64.56.139.194 | 41 |
| fschmidt | 64.56.139.194 | 41 |
+—————-+—————–+——————–+
Can anyone help me figuring out a way to make this changes automatically. It will be a pain to do this manually for all my users. Thank you!
</div>