var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
port : '3306',
password : 'root',
database : 'test'
});
connection.connect(function(err){
if(!err) {
console.log("database is connected"+database);
} else {
console.log("database is not connected"+err.message);
}
});
database
inconsole.log("database is connected"+database);
is undefined, you don't have such a variable in the scope, but seems that connection is successful – codtex