0 how to fix Database connection Error, In description is the the code and the error

768 views mysql

I am using mysql and node.js. I am trying get a simple connection, but getting this weird error. the code i am using is this

var mysql = require('mysql');
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'password',
database: 'userlogin'

and here is the error i am getting:

and here is the error i am getting

here is some details about the server:

here is some details about the server

answered question

what is your node js version?

seems like a outdated mysql client

1 Answer


Have you tried executing this in the workbench worked for me

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

posted this

Have an answer?


Please login first before posting an answer.