使用 Node.js、Navicat 和 MySQL 来编写后端接口时报错

69 阅读1分钟

Error connecting to MySQL: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

一个很简单的办法: 在 MySQL 中为您连接的用户更新密码并使用 mysql_native_password 插件。

在 MySQL 命令行或 Navicat 中执行以下命令:(我是在navicat中执行的,)

ALTER USER 'your_username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
  • 将上面的命令中的 your_username 替换为实际的用户名,your_password 替换为实际的密码。

image.png

查询-新建查询 image.png

image.png 这样就可以了,很简单,不可以的话再找下别的方法吧