侧边栏壁纸
博主头像
iColak's Blog

人生来来往往,来日并不方长

  • 累计撰写 107 篇文章
  • 累计创建 32 个标签
  • 累计收到 381 条评论

目 录CONTENT

文章目录

解决 Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol request

苏维歌
2022-06-06 / 0 评论 / 0 点赞 / 17 阅读 / 0 字 / 正在检测是否收录...
温馨提示:
本文最后更新于2024-07-05,若内容或图片失效,请留言反馈。 部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

node 链接 mysql 报错
error: 如下:

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
    at Handshake.ErrorPacket (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
    at Protocol._parsePacket (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\Protocol.js:291:23)
    at Parser._parsePacket (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\Parser.js:433:10)
    at Parser.write (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\Parser.js:43:10)
    at Protocol.write (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\Protocol.js:38:16)
    at Socket. (D:\workspace\node\demo1\node_modules\mysql\lib\Connection.js:91:28)
    at Socket. (D:\workspace\node\demo1\node_modules\mysql\lib\Connection.js:525:10)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    --------------------
    at Protocol._enqueue (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\Protocol.js:144:48)
    at Protocol.handshake (D:\workspace\node\demo1\node_modules\mysql\lib\protocol\Protocol.js:51:23)
    at Connection.connect (D:\workspace\node\demo1\node_modules\mysql\lib\Connection.js:119:18)
    at Object. (D:\workspace\node\demo1\mysqlConnect.js:9:12)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

原因:登录数据库的客户端跟 mysql8.0 不兼容了,mysql8.0 密码认证采用了新的密码格式

解决办法:

在系统 mysql 终端输入下面命令

//password 是你的数据库账户密码,root和host也是
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
原文地址 blog.csdn.net
0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin
  3. QQ打赏

    qrcode qq

评论区