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

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bae1-2c2bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bae1-2c2bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?