i am new to nodejs ,while creating a connection to the database i got this errors
C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\Parser.js:80 throw err; // Rethrow non-MySQL errors ^
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'Root'@'localhost' (using password: YES) at Handshake.Sequence._packetToError (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\sequences\Sequence.js:52:14) at Handshake.ErrorPacket (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\sequences\Handshake.js:103:18) at Protocol._parsePacket (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\Protocol.js:279:23) at Parser.write (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\Parser.js:76:12) at Protocol.write (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\Protocol.js:39:16) at Socket. (C:\Users\devashis khandelwal\node_modules\mysql\lib\Connection.js:103:28) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) -------------------- at Protocol._enqueue (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\Protocol.js:145:48) at Protocol.handshake (C:\Users\devashis khandelwal\node_modules\mysql\lib\protocol\Protocol.js:52:23) at Connection.connect (C:\Users\devashis khandelwal\node_modules\mysql\lib\Connection.js:130:18) at Object. (C:\Users\devashis khandelwal\node files\demo_db_connection.js:9:5) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10)
var mysql = require('mysql');
var con = mysql.createConnection({
host : 'localhost',
user : 'Root',
password : 'my_pass',
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
});