MySQL 8.0 - 客户端不支持服务器请求的身份验证协议; 考虑升级MySQL客户端
我是node.js和MySQL初学者,我刚开始设置并尝试一些基本代码。但是,由于某种原因,我甚至无法与服务器建立简单的连接。我使用默认设置安装最新的MySQL Community 8.0数据库和Node.JS。
这是我的node.js代码
var mysql = require('mysql'); var con = mysql.createConnection({ host: "localhost", user: "root", password: "password", insecureAuth : true }); con.connect(function(err) { if (err) throw err; console.log("Connected!"); });
以下是命令提示符中发现的错误:
C:\Users\mysql-test>node app.js C:\Users\mysql-test\node_modules\mysql\lib\protocol\Parse r.js:80 throw err; // Rethrow non-MySQL errors ^Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client at Handshake.Sequence._packetToError (C:\Users\mysql-test\node_modules\mysql\lib\protocol\sequences\Sequence.js:52:14) at Handshake.ErrorPacket (C:\Users\mysql-test\node_mo dules\mysql\lib\protocol\sequences\Handshake.js:130:18) at Protocol._parsePacket (C:\Users\mysql-test\node_mo dules\mysql\lib\protocol\Protocol.js:279:23) at Parser.write (C:\Users\mysql-test\node_modules\mys ql\lib\protocol\Parser.js:76:12) at Protocol.write (C:\Users\mysql-test\node_modules\m ysql\lib\protocol\Protocol.js:39:16) at Socket.<anonymous> (C:\Users\mysql-test\node_modul es\mysql\lib\Connection.js:103:28) at Socket.emit (events.js:159:13) at addChunk (_stream_readable.js:265:12) at readableAddChunk (_stream_readable.js:252:11) at Socket.Readable.push (_stream_readable.js:209:10) -------------------- at Protocol._enqueue (C:\Users\mysql-test\node_module s\mysql\lib\protocol\Protocol.js:145:48) at Protocol.handshake (C:\Users\mysql-test\node_modul es\mysql\lib\protocol\Protocol.js:52:23) at Connection.connect (C:\Users\mysql-test\node_modul es\mysql\lib\Connection.js:130:18)
我已经阅读了一些内容,例如:https : //dev.mysql.com/doc/refman/5.5/en/old-client.html https://github.com/mysqljs/mysql/issues/1507
但我仍然不确定如何解决我的问题。任何帮助将不胜感激:D
阿波罗的战车
明月笑刀无情