node连接mysql密码是对的但是报错
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
因为mysql 默认加密规则是严格加密模式,要修改成普通模式
使用以下方法
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
// 'password'是你的数据库密码
成功后在执行
FLUSH PRIVILEGES;
然后node重新启动就ok啦