I\'m running a server on c9.io using Node.js and trying to connect to Mysql I guess I get this error:
Error: getaddrinfo ENOTFOUND
This code works for me.
var mysql = require('mysql');
var con = mysql.createConnection({
host: '127.0.0.1',
port: '3306',
user: 'yourUsername',
password: '**********'
});
con.connect(function(err){
if(err) throw err;
console.log('connected!');
});
the host and port name find them in your mysql server. in-place of '127.0.0.1' you can use 'localhost'