0

I am trying to authenticate and user by connecting to mysql DB where i have information of candidate id and there passwords. As watched in demos I have created in "server.js" file, in which I am trying to create a new connection and printing if connection is established.

const connection = mysql.createConnection({
     host: '51.51.x.x',
     port: 3306,
     user: 'intrinsic',
     password: 'mypassword',
     database : 'practisework'
     });
  
  connection.connect(function(err){
     (err)? console.log(err): console.log(connection);
  });

and when i run the code with node server command i got the following error.

code: 'ER_ACCESS_DENIED_ERROR',
at Protocol._enqueue (C:\Users\ISL Lohitha\Documents\CareerGuidance\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\ISL Lohitha\Documents\CareerGuidance\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\ISL Lohitha\Documents\CareerGuidance\node_modules\mysql\lib\Connection.js:116:18)
at Object.<anonymous> (C:\Users\ISL Lohitha\Documents\CareerGuidance\server.js:19:12)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
   code: 'ER_ACCESS_DENIED_ERROR',
   errno: 1045,
   sqlMessage: "Access denied for user 'intrinsic'@'175.101.99.33' (using password: YES)",
   sqlState: '28000',
   fatal: true
  }

It is routing to some unknown IP because the ip that i gave is not 175.101.99.33 which not even my local ip (192.10.65.39). I tried access the server database from my PC through MySQL workbench and it had no issues. Any help required on how to connect to database.

Lohitha Y
  • 1
  • 5
  • https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw – my_workbench Aug 04 '20 at 07:29
  • 1
    Does this answer your question? [MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)](https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw) – BUcorp Aug 04 '20 at 07:32
  • No, it doesn't help as i am able to access data from my Mysql workbench. – Lohitha Y Aug 04 '20 at 11:34

0 Answers0