执行 npm run dev 时,错误信息如下,密码已确认没有问题。

2021-10-22 07:18:29,156 ERROR 14532 nodejs.ER_NOT_SUPPORTED_AUTH_MODEError: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
code: "ER_NOT_SUPPORTED_AUTH_MODE"
errno: 1251
sqlMessage: "Client does not support authentication protocol requested by server; consider upgrading MySQL client"
sqlState: "08004"
fatal: true
name: "ER_NOT_SUPPORTED_AUTH_MODEError"
pid: 14532
hostname: tumobideMac-mini.local

解决方法

更改密码插件为 mysql_native_password

use mysql;

alter user 'root'@'localhost' identified with mysql_native_password by '你的密码';

flush privileges;

标签: Node.js, Egg, MySQL