V
V
Vladimir2020-04-26 13:50:20
MySQL
Vladimir, 2020-04-26 13:50:20

How to connect to mysql server via node.js?

Good afternoon. Please tell me how to connect to mysql server on windows, now I have an error:

ER_NOT_SUPPORTED_AUTH_MODE


The code:

const pool = new Mysql('localhost', 'root', '', 'test', false);
pool.getConnection((err, connection) => {

  if (err) {
    return console.error(err.code, 'Error')
  }
  
  console.log('Connected!')
  connection.release()

})


Mysql is a class for connecting, the main thing in it:

mysql.createPool({

           host: this.host,
           port: 3306,
           user: this.user,
           password: this.password,
           database: this.database

      })


Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question