MYSQL的版本为8.0+的时候 , 用NODEJS查询数据库报错:
第一句错误信息:
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Handshake.Sequence._packetToError (/Users/。。。。。/路径
解决方案:
//指定mysql模块能够支持的加密方式:
//下面的代码会修改原先你的密码,新的密码会变成123456
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';