I have been trying to establish connection between Node.js application and mysql and have tried everything and couldn't succeed.
I'm able to connect through PHP application. My port is default where 3306
Can anyone help me to resolve this?
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]
This is the error message I got,I can able to connect through my php application