Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

494
Views
i try to connect mysql to my node js file but i receive error like this

node server.js reaady C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Parser.js:437 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\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14) at Handshake.ErrorPacket (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18) at Protocol._parsePacket (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Protocol.js:291:23) at Parser._parsePacket (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Parser.js:433:10) at Parser.write (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Parser.js:43:10) at Protocol.write (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Protocol.js:38:16) at Socket. (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\Connection.js:88:28) at Socket. (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\Connection.js:526:10) at Socket.emit (node:events:527:28) at addChunk (node:internal/streams/readable:315:12) -------------------- at Protocol._enqueue (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Protocol.js:144:48) at Protocol.handshake (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\protocol\Protocol.js:51:23) at Connection.connect (C:\Users\WINDOWS 10\Desktop\node-db\node_modules\mysql\lib\Connection.js:116:18) at Object. (C:\Users\WINDOWS 10\Desktop\node-db\server.js:13:4) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'ER_ACCESS_DENIED_ERROR', errno: 1045, sqlMessage: "Access denied for user 'root'@'localhost' (using password: YES)", sqlState: '28000', fatal: true }

const express = require("express");
const mysql = require("mysql");

const app = express();

const db = mysql.createConnection({
  host: "localhost",
  database: "db-test",
  user: "root",
  password: " ",
 
});
db.connect((err) => {
  if (err) throw err;
  console.log("database connected");
  app.get("/", (req, res) => {
    res.send("ok  route open");
  });
});

app.listen(8000, ( )  => {
  console.log("reaady");
});

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!