Dec 29

Have you ever looked through your server logs and seen something like this?

[MY-013360] [Server] Plugin mysql_native_password reported: ”mysql_native_password’ is deprecated and will be removed in a future release. Please use caching_sha2_password instead’

This is because, as you can see in the MySQL 8.1.0 release notes, the plugin is now deprecated.

Luckily, the warning also tells you the solution – switch to caching_sha2_password instead. However it doesn’t tell you how to do that.

This needs to be done on a per-user basis, and you also need to know the password of the user. To find out which users to update, run the following SQL:

SELECT user, host, plugin FROM mysql.user;

(Note, you can enter a SQL console on the host machine with something like mysql -u root -p)

This will give you an output something like this:

mysql> SELECT user, host, plugin FROM mysql.user ORDER BY user;
| user             | host         | plugin                |
| debian-sys-maint | localhost    | mysql_native_password |
| example_user     | localhost    | mysql_native_password |
| mysql.infoschema | localhost    | caching_sha2_password |
| mysql.session    | localhost    | mysql_native_password |
| mysql.sys        | localhost    | caching_sha2_password |
| mysqld_exporter  | localhost    | mysql_native_password |
| root             | localhost    | mysql_native_password |

As you can see, some users are configured with the mysql_native_password plugin. All we need to do is alter the users and update them to caching_sha2_password.

Here’s an example:

ALTER USER 'mysqld_exporter'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'StrongPassword';

You might want to FLUSH PRIVILEGES; once you’re done.

Tagged with:
preload preload preload