title: Error: connect ECONNREFUSED ON Database Query
body: <p>am trying to work with Node and Mysql on my Ec2 instance but i keep encountering error when trying to connect with the Database.</p>
  
  <pre><code>var _mysql = require('mysql');
  
  var MYSQL_USER = 'root';
  var MYSQL_PASS = '**********';
  var DATABASE = 'adas';
  var TABLE = 'ep';
  
  var mysql = _mysql.createClient({
  user: MYSQL_USER,
  password: MYSQL_PASS,
  });
  
  mysql.query('use' + DATABASE, function(err) {
  if (err) {
  throw err;
  }
  });
  </code></pre>
  
  <p>And i keep getting the following Error</p>
  
  <p>node.js:201
  throw e; // process.nextTick error, or 'error' event on first tick
  ^
  Error: connect ECONNREFUSED
  at errnoException (net.js:614:11)
  at Object.afterConnect as oncomplete</p>
  
  <p>Any idea what might be wrong?
  Your Assistance would be appreciated.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Fixed. Mysql Server crashed along the way and this was not known. Once i restarted the MySQL server, everything works fine.</p>