I have a nodejs app which get some data from mysql database in same server. I am using xampp in ubuntu 16.04. The database connection from php and phpmyadmin is fine and working nicely. But my nodejs page can not connect to mysql database and giving me
code: 'ER_ACCESS_DENIED_ERROR', errno: 1045, sqlMessage: "Access denied for user 'root'@'x.x.x.x' (using password: YES)", sqlState: '28000', fatal: true
I have given all grants to root user in mysql database.
My nodejs connection is as follows:
const mysql = require('mysql');
const moment = require('moment');
var mycon = mysql.createPool({
connectionLimit: 100,
host: 'x.x.x.x',
user: 'root',
password: 'myPass',
database: 'myDatabase',
multipleStatements: true
});
I am using node version 14.13.0 . Any suggestion regarding this painful situation?