I am running a node app with mysql as my database(also using sequelize as ORM). Whenever I run the "app.js" file with "node" command, I get an error:
{ [Error: connect ECONNREFUSED 127.0.0.1:3306] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 3306, fatal: true }
my code in the app.js file:
var mysql = require("mysql");
var connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "password",
database: "openshare"
});
connection.connect(function(err){
if(err){
console.log(err);
} else {
console.log("no errors");
}
});
via sespler
No comments:
Post a Comment