Mysql connection error: Error: Packets out of orde

2019-07-29 11:46发布

问题:

My situation is similar to - Packets out of order. Got: 80 Expected: 0 node.js (no solutions). Works fine on local machine but fails on virtual machine.

Code as follows:

var connection = mysql.createConnection({
        host     : "xxxxx",
        port     : 22,
        user     : "root",
        password : "root",
        database : "db"
    });

Error as follows:

Error: Packets out of order. Got: 45 Expected: 0 at Parser.write (/home/webdev/PM/LT/node_modules/mysql/lib/protocol/Parser.js:42:19) at Protocol.write (/home/webdev/PM/LT/node_modules/mysql/lib/protocol/Protocol.js:39:16) at Socket. (/home/webdev/PM/LT/node_modules/mysql/lib/Connection.js:103:28) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:607:20) -------------------- at Protocol._enqueue (/home/webdev/PM/LT/node_modules/mysql/lib/protocol/Protocol.js:145:48) at Protocol.handshake (/home/webdev/PM/LT/node_modules/mysql/lib/protocol/Protocol.js:52:23) at Connection.connect (/home/webdev/PM/LT/node_modules/mysql/lib/Connection.js:130:18) at /home/webdev/PM/LT/server.js:1147:13 at Layer.handle [as handle_request] (/home/webdev/PM/LT/node_modules/express/lib/router/layer.js:76:5) at next (/home/webdev/PM/LT/node_modules/express/lib/router/route.js:100:13) at Route.dispatch (/home/webdev/PM/LT/node_modules/express/lib/router/route.js:81:3) at Layer.handle [as handle_request] (/home/webdev/PM/LT/node_modules/express/lib/router/layer.js:76:5) at /home/webdev/PM/LT/node_modules/express/lib/router/index.js:234:24 at Function.proto.process_params (/home/webdev/PM/LT/node_modules/express/lib/router/index.js:312:12)

My work for a client has come to a standstill due to this error, therefore request a solution at the earliest. Thank you.