felixge/node-mysql — Issue #144: Error: connect ECONNREFUSED ON Database Query
Author: dadepo
Created: 2011-11-25 13:39:19+00:00
State: open

I am trying to work with Node and Mysql on my Ec2 instance but i keep encountering error when trying to connect with the Database.

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;
}
});

And i keep getting the following Error
---------------------------------------

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] (net.js:605:18)

Any idea what might be wrong?
Your Assistance would be appreciated.