Mysql Error:ER_NOT_SUPPORTED_AUTH_MODE

problem description

node version 8.9.2. The connection mysql8.0, shows that the connection was successful but an error was reported as
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

.

related codes

const mysql = require("mysql")

const db = mysql.createConnection({
  host: "localhost",
  user: "root",
  password: "123456",
  database: "test_self",
})

db.query("SELECT * FROM `users`", (err, data) => {
  console.log("") // ""
  if (err) {
    console.log(err) // 
  } else {
    console.log(data)
  }
})
Oct.31,2021

the client that logs in to the database is not compatible with mysql8.0. Mysql8.0 password authentication adopts a new password format

.
Menu