nodejs与node-mysql远程连接

我有一个问题,也许有人可以帮助我:

我试图build立一个nodeJS服务器,从我的笔记本电脑,使用node-mysql,并尝试远程连接到我的数据库。

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

这超时:

 cannot connect to database { [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect', fatal: true } 

我相信数据库是好的,我可以从浏览器连接phpMyAdmin。

我究竟做错了什么?