Client does not support authentication protocol requested by server; consider upgrading MySQL client

node查询数据库的时候报错

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

在网上找了一下,最后确定导致这个错误的原因是我安装的mysql 8默认是“caching_sha2_password”的加密方式,但是目前node中的mysql模块不支持。

所以说解决这个问题还是需要将数据库密码换成node支持的“mysql_native_password”加密方式的密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root123';
Query OK, 0 rows affected (0.02 sec)

这样就好啦!

猜你喜欢

转载自blog.csdn.net/promiseCao/article/details/107096971