I have an issue that maybe someone can help me with:
I'm trying to build a nodeJS server, working from my laptop, using node-mysql, and trying to make a remote connection to my database.
function foo (callback) {
// Connect to the database
var mysql = require('mysql');
var connection = mysql.createConnection({
host: <ipaddress>,
user: "test_developer",
password: "test_developer",
database: "test3"
});
connection.connect(function(err){
if (err){
console.log("cannot connect to database");
console.log(err);
}
else
{
console.log("connected to database");
}
});
};
// Implementation
foo(function(err, result){
console.log("Never made it here");
});
This times out with:
cannot connect to database
{ [Error: connect ETIMEDOUT]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
fatal: true
}
I believe the database is ok, I can connect with phpMyAdmin from browser.
What am I doing wrong?