node MySql8.0 ER_NOT_SUPPORTED_AUTH_MODE 问题

在 node 环境下运行 mysql 由于版本不兼容会报如下错误:

Error: 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‘,

其他博客会告诉你, 由于 nodejs 和 mysql 8.0 版本 不兼容什么的, 改这个

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘一堆可能不生效的代码‘;
flush privileges;
 
但是我这里不奏效,索性
npm i mysql8.0 -S
搞定!!!
 

node MySql8.0 ER_NOT_SUPPORTED_AUTH_MODE 问题

上一篇:Gin框架结合gorm实现mysql增删改查


下一篇:strace详解及实战