MySQL升级到 MySQL 8.0.34 之后,我注意到错误日志中充满了大量此类错误,当它们进入 CloudWatch 日志时,每秒数以百计的错误会造成明显的损失。
[Warning] [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'
可以看到我的所有活跃用户都在使用 mysql_native_password 插件进行以下查询
mysql> select user, host, plugin from mysql.user;
+------------------+-------------+-----------------------+
| user | host | plugin |
+------------------+-------------+-----------------------+
| user1 | % | mysql_native_password |
| user2 | % | mysql_native_password |
| user3 | % | mysql_native_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
| rdsadmin | localhost | mysql_native_password |
+------------------+-------------+-----------------------+
可以通过下面的命令修改
ALTER USER user2@'%' IDENTIFIED WITH caching_sha2_password BY 'the_password';
更新之后就正常了
mysql> select user, host, plugin from mysql.user;
+------------------+-------------+-----------------------+
| user | host | plugin |
+------------------+-------------+-----------------------+
| user1 | % | caching_sha2_password |
| user2 | % | caching_sha2_password |
| user3 | % | caching_sha2_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session | localhost | caching_sha2_password |
| mysql.sys | localhost | caching_sha2_password |
| rdsadmin | localhost | mysql_native_password |
+------------------+-------------+-----------------------+