1

So here is the problem. I am trying to connect a .js file with my mysql Database. But when I try to connect, its throws an error 1251.

I am using mysql 8.0 and node.js(maybe there may be the problem.)

var mysql = require('mysql');
var con = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "password",
    insecureAuth: true
});

con.connect(function(err) {
    if (err) throw err;
    console.log("connected!")
});

and it shows me this error

  code: 'ER_NOT_SUPPORTED_AUTH_MODE',
  errno: 1251,
  sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
  sqlState: '08004',
  fatal: true
}

would be very thankful if you could show a way to solve it. I've tried it with set password for @user@host = Old_password("passowrd") but it throws a syntax error in the terminal.

M2DT
  • 125
  • 7

0 Answers0