title: node-webkit MySQL connection Error - ER_HANDSHAKE_ERROR: Bad handshake
body: <p>I am using Node-Webkit for creating desktop application using NodeJS.</p>
  
  <p>In this i need to get data from MySQL database. For this am using node-mysql module and the following code is used to connect MySQL server using node-mysql.</p>
  
  <pre><code>var mysql_con = require('mysql');
  var connection = mysql_con.createConnection({
        host     : input.host,
        user     : input.username,
        password : input.password,
        database : input.database
      });
      connection.connect(function(err) {
          if (err) {
              console.log('Error : '+err.stack);
          }
          console.log('Success');
      });
  </code></pre>
  
  <p>if i run in the command line of my Windows machine, connection has been established and <strong>Success</strong> has been printed in console. But if i pack and run the code in the node-webkit's nw.exe its giving the following error in web console</p>
  
  <pre><code>Error : Error: ER_HANDSHAKE_ERROR: Bad handshake
  at Handshake.Sequence._packetToError (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\sequences\Sequence.js:48:14)
  at Handshake.ErrorPacket (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\sequences\Handshake.js:101:18)
  at Protocol._parsePacket (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\Protocol.js:270:23)
  at Parser.write (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\Parser.js:77:12)
  at Protocol.write (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\Protocol.js:39:16)
  at Socket.&lt;anonymous&gt; (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\Connection.js:82:28)
  at Socket.EventEmitter.emit (events.js:104:17)
  at readableAddChunk (_stream_readable.js:156:16)
  at Socket.Readable.push (_stream_readable.js:123:10)
  at TCP.onread (net.js:520:20)
  --------------------
  at Protocol._enqueue (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\Protocol.js:135:48)
  at Protocol.handshake (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\protocol\Protocol.js:52:41)
  at Connection.connect (C:\DOCUME~1\admin\LOCALS~1\Temp\nw4480_11607\node_modules\mysql\lib\Connection.js:108:18)
  at Object.mysql.testConnection 
  </code></pre>
  
  <p>Kindly suggest me solution to establish the MySQL connection through node-webkit.</p>