⏱️ 预计阅读时间: 1 分钟
- ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded
https://github.com/Homebrew/homebrew-core/issues/180498
MySQL 9 不再支持 mysql_native_password 认证方法,这可能会影响从 MySQL 8.x 升级到 MySQL 9 的用户。为了解决此问题,您需要更新 MySQL 用户表,使用新的认证方法。按照以下步骤操作:
1.- 禁用权限表:
编辑 MySQL 配置文件,通常位于 /opt/homebrew/etc/my.cnf。在 [mysqld] 部分下添加以下行以禁用权限表:
2.- 重启 MySQL:
使用 Homebrew 重启 MySQL:
3.- 以 root 用户连接 MySQL:
4.- 更新用户认证方法:
刷新权限:
5.- 检查使用 mysql_native_password 插件的用户:
6.- 将 root 用户更新为使用 caching_sha2_password 插件:
7.- 重新启用权限表:
更新后,删除或注释掉 MySQL 配置文件中的 skip-grant-tables 行。
8.- 重启 MySQL 以应用更改:
通过执行这些步骤,您应该能够在升级到 MySQL 9 后解决认证方法问题。
- err_mysqlConnect: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
使用 npm 安装 mysql2:
https://github.com/sidorares/node-mysql2
发表回复