Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ER_NOT_SUPPORTED_AUTH_MODE #2499

Open
alexsaelao opened this issue Jun 30, 2021 · 4 comments
Open

ER_NOT_SUPPORTED_AUTH_MODE #2499

alexsaelao opened this issue Jun 30, 2021 · 4 comments

Comments

@alexsaelao
Copy link

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

I have this problem, pleases recomend how to fix that
Thou you very much

My code:

const {
    createPool 
} = require('mysql');

const pool = createPool ({
    host: "127.0.0.1",
    user: "root",
    password: "",
    database: "api_db",
    connectionLimit: 10
})

pool.query(`SELECT * FROM po_view`, (err, result, field) => {
    if(err) {
        return console.log(err);
    } 
    return console.log(result)
})

module.exports = pool

@matonga
Copy link

matonga commented Jul 30, 2021

It looks like this node module doesn't support "caching_sha2_password" authentication. It's been introduced maybe in MySQL 8.0. In the meantime you can downgrade your mysql user:

$ sudo mysql -u root
mysql> ALTER USER the_user IDENTIFIED WITH mysql_native_password BY 'the_password';

Please keep in mind this doesn't fix the issue, it just downgrades your user password so it can be used with mysqljs' mysql node module.

@matonga
Copy link

matonga commented Jul 30, 2021

It looks like PR #2233 would solve your issue.

@matonga
Copy link

matonga commented Jul 30, 2021

It looks like I prefix my sentences with "It looks like"... 😹

@ginlink
Copy link

ginlink commented Oct 6, 2021

It looks like this node module doesn't support "caching_sha2_password" authentication. It's been introduced maybe in MySQL 8.0. In the meantime you can downgrade your mysql user:

$ sudo mysql -u root
mysql> ALTER USER the_user IDENTIFIED WITH mysql_native_password BY 'the_password';

Please keep in mind this doesn't fix the issue, it just downgrades your user password so it can be used with mysqljs' mysql node module.

It works for me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants