解决 Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol request

67次阅读
没有评论

共计 1780 个字符,预计需要花费 5 分钟才能阅读完成。

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.<anonymous> (D:\workspace\node\demo1\node_modules\mysql\lib\Connection.js:91:28)
    at Socket.<anonymous> (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.<anonymous> (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

正文完
觉得有用?欢迎赞赏,感谢!
post-qrcode
 0
苏维歌
版权声明:本站原创文章,由 苏维歌 于2022-06-06发表,共计1780字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码