node连接Mysql8.0报错:Error: ER_NOT_S

2020-01-22  本文已影响0人  soojade

报错信息:

  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还不支持。

解决方案:

  1. 在命令提示行中键入:mysql -u root -p
  2. 输入 alter user 'root'@'localhost' identified with mysql_native_password by '12345678';
Query OK, 0 rows affected (0.04 sec)
  1. 输入flush privileges;
Query OK, 0 rows affected (0.02 sec)

问题解决。

上一篇 下一篇

猜你喜欢

热点阅读