报错信息:
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
原因:mysql8.0以上加密方式,Node还不支持。
解决方案:
- 在命令提示行中键入:
mysql -u root -p
- 输入
alter user 'root'@'localhost' identified with mysql_native_password by '12345678';
Query OK, 0 rows affected (0.04 sec)
- 输入
flush privileges;
Query OK, 0 rows affected (0.02 sec)
问题解决。