title: Connecting to mysql with NodeJS
body: <p>It's been 6 hours since I got stuck on a login topic on a remote mysql server</p>
  <p>NodeJs code:</p>
  <pre><code>var mysql = require('mysql'); 
  
  //Config Mysql
  var con = mysql.createConnection({
      host: &quot;serv&quot;,
      user: &quot;root&quot;,
      password: &quot;admin&quot;,
      database: 'test',
  });
  
  //Connection Mysql
  con.connect(function (err) {
      if (err) throw err;
      console.log(&quot;Connected!&quot;);
  });
  </code></pre>
  <p>But i have this error :</p>
  <pre><code>Error: Packets out of order. Got: 1 Expected: 0
      at Parser._tryReadPacketHeader (L:\Code_Dev\Test\Test\node_modules\mysql\lib\protocol\Parser.js:470:15)
      at Parser.write (L:\Code_Dev\Test\Test\node_modules\mysql\lib\protocol\Parser.js:33:29)
      at Protocol.write (L:\Code_Dev\Test\Test\node_modules\mysql\lib\protocol\Protocol.js:38:16)
      at Socket.&lt;anonymous&gt; (L:\Code_Dev\Test\Test\node_modules\mysql\lib\Connection.js:88:28)
      at Socket.&lt;anonymous&gt; (L:\Code_Dev\Test\Test\node_modules\mysql\lib\Connection.js:526:10)
      at Socket.emit (events.js:315:20)
      at addChunk (_stream_readable.js:295:12)
      at readableAddChunk (_stream_readable.js:271:9)
      at Socket.Readable.push (_stream_readable.js:212:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
      --------------------
      at Protocol._enqueue (L:\Code_Dev\Test\Test\node_modules\mysql\lib\protocol\Protocol.js:144:48)
      at Protocol.handshake (L:\Code_Dev\Test\Test\node_modules\mysql\lib\protocol\Protocol.js:51:23)
      at Connection.connect (L:\Code_Dev\Test\Test\node_modules\mysql\lib\Connection.js:116:18)
      at Object.&lt;anonymous&gt; (L:\Code_Dev\Test\Test\server.js:15:5)
      at Module._compile (internal/modules/cjs/loader.js:1137:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
      at Module.load (internal/modules/cjs/loader.js:985:32)
      at Function.Module._load (internal/modules/cjs/loader.js:878:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
      at internal/main/run_main_module.js:17:47 {
    code: 'PROTOCOL_PACKETS_OUT_OF_ORDER',
    fatal: true
  }
  </code></pre>
  <p>Mysql server TCP configuration :
  tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN</p>
  <p>Could you help me ?</p>