title: Error in MySQL library for Node.js
body: <p>In my Node.js app, I am trying to connect to a MySQL database hosted on Amazon. </p>
  
  <pre><code>$ npm install mysql
  </code></pre>
  
  <p>My code looks something like this:</p>
  
  <pre><code>var mysql      = require('mysql');
  var connection = mysql.createConnection({
    host     : 'my amazon sql db',
    user     : 'me',
    password : 'secret',
    database : 'my_db'
  });
  
  connection.connect();
  
  connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
    if (err) throw err;
  
    console.log('The solution is: ', rows[0].solution);
  });
  
  connection.end();
  </code></pre>
  
  <p>I can connect to my MySQL DB using  Workbench--therefore, I am pretty sure my credentials are okay.</p>
  
  <p>When I attempt to connect I get the following error:</p>
  
  <blockquote>
    <p>Connection.js:91 Uncaught TypeError: Net.createConnection is not a function</p>
  </blockquote>
  
  <p>Debugging the code from the npm library--this is where the error is thrown in <code>connection.js</code>:</p>
  
  <pre><code>this._socket = (this.config.socketPath)
    ? Net.createConnection(this.config.socketPath)
    : Net.createConnection(this.config.port, this.config.host);
  </code></pre>
  
  <p>The <code>connection.js</code> has a dependency :</p>
  
  <pre><code>var Net  = require('net');
  </code></pre>
  
  <p>I am running Node.js locally on my Windows computer.</p>
  
  <p>Can anyone tell me what could be causing this error?</p>
  
  <p>Created a separate ticket:
  <a href="https://stackoverflow.com/questions/38089455/error-thrown-calling-node-js-net-createconnection">Error thrown calling Node.js net.createConnection</a></p>