I use CentOS on my server and node.js throws error
CONNECTION error: { [Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)]
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
fatal: true }
my local version on Ubuntu doesn't throw this error and php can connect to this DB with same credentials.
I use this code to connect to DB
var connect_params = require('./connect');
var express = require('express'),
app = express(),
mysql = require('mysql'),
connectionpool = mysql.createPool(connect_params.connection);
and my connect.js
var connection = {
host: 'localhost',
user: 'user',
password: 'password',
database: 'mydb'
};
exports.connection = connection;