说明:在用node后台服务器时,遇到无法连接mysql错误:1251

  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终端:
直接cmd mysql 也可以
在这里插入图片描述
输入:

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
 // 'password'是你的数据库密码

FLUSH PRIVILEGES;

在这里插入图片描述

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐