我一直在尝试在Node.js应用程序和mysql之间建立连接,并且尝试了所有尝试,但均未成功。
我可以通过PHP应用程序进行连接。我的端口默认为3306
谁能帮我解决这个问题?
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'root'
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
[This is the error message I got,I can able to connect through my php application][1]
这是我收到的错误消息,我可以通过我的php应用程序进行连接
取消注释“绑定地址”并分配bind-address =“ 0.0.0.0”。有关更多信息,请参考JDBC和MySQL解决“通信链接失败”
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句