報錯信息:
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)
問題解決。