2

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?

Francisco
  • 10,918
  • 6
  • 34
  • 45
Jason
  • 1,787
  • 4
  • 29
  • 46
  • 1
    Is myPHPadmin running on the same machine as the database? If so, the database instance may not be listening to the network at all but just to local sockets. – Joachim Isaksson Jun 19 '14 at 11:06
  • Good thought. I tried changing bind-address in my.cnf to *, ::, and my IP, restarted mysql, and still no luck. – Jason Jun 19 '14 at 12:24

0 Answers0