ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; ...

nodejs使用MySQL模块连接数据库时报错:

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
image.png
出现这个错误的原因

最新的mysql模块并未完全支持MySQL 8的“caching_sha2_password”加密方式,而“caching_sha2_password”在MySQL 8中是默认的加密方式。

解决办法

更改加密方式:修改加密规则为普通模式,默认是严格加密模式

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
 // 'password'是你的数据库密码

你可能感兴趣的:(ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; ...)