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 even after creating a new user with mysql_native_password plugin #2333

Closed
stuyy opened this issue Apr 16, 2020 · 5 comments

Comments

@stuyy
Copy link

stuyy commented Apr 16, 2020

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested b y server; consider upgrading MySQL client at Handshake.Sequence._packetToError (C:\Users\Anson\Documents\discord-bot-database\node_m odules\mysql\lib\protocol\sequences\Sequence.js:47:14) at Handshake.ErrorPacket (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql \lib\protocol\sequences\Handshake.js:123:18) at Protocol._parsePacket (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql \lib\protocol\Protocol.js:291:23) at Parser._parsePacket (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\l ib\protocol\Parser.js:433:10) at Parser.write (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\lib\prot ocol\Parser.js:43:10) at Protocol.write (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\lib\pr otocol\Protocol.js:38:16) at Socket.<anonymous> (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\li b\Connection.js:88:28) at Socket.<anonymous> (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\li b\Connection.js:526:10) at Socket.emit (events.js:311:20) at addChunk (_stream_readable.js:294:12) -------------------- at Protocol._enqueue (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\lib \protocol\Protocol.js:144:48) at Protocol.handshake (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\li b\protocol\Protocol.js:51:23) at Connection.connect (C:\Users\Anson\Documents\discord-bot-database\node_modules\mysql\li b\Connection.js:116:18) at Object.<anonymous> (C:\Users\Anson\Documents\discord-bot-database\database\db.js:10:12) at Module._compile (internal/modules/cjs/loader.js:1158:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) at Module.load (internal/modules/cjs/loader.js:1002:32) at Function.Module._load (internal/modules/cjs/loader.js:901:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) at internal/main/run_main_module.js:18:47 { code: 'ER_NOT_SUPPORTED_AUTH_MODE', errno: 1251, sqlMessage: 'Client does not support authentication protocol requested by server; consider u pgrading MySQL client', sqlState: '08004', fatal: true }

Not sure why this isn't working, I even passed in "insecureAuth" as true and it didn't work. I'm on MySQL Server 8.0, I've googled some stuff and tried the work around, nothing works.

@ruiquelhas
Copy link
Contributor

Are you sure the user has been effectively created with the mysql_native_password plugin? You can check that with the following query.

select user, plugin from mysql.user where user = '<your_user_goes_here>'

@stuyy
Copy link
Author

stuyy commented Apr 16, 2020

Are you sure the user has been effectively created with the mysql_native_password plugin? You can check that with the following query.

select user, plugin from mysql.user where user = '<your_user_goes_here>'

Yes. I did all of that, went on Google and Stack Overflow, did what was needed. I had created my account, got the error, and then updated the plugin from caching_sha2_password to mysql_native_password. I tried it again, didn't work. I also deleted the user account, and re-created it with CREATE USER 'myuser'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'password'; and it did not work. I switched to mysql2 and everything works, but I would love to know further on why my stuff is not working.

@ruiquelhas
Copy link
Contributor

ruiquelhas commented Apr 16, 2020

I think mysql2 v2 already supports caching_sha2_password, so that might be a hint that the user account is still, in fact, using that authentication plugin. I don't think there is any other reason for that error you get, but maybe I'm missing something.

@dougwilson
Copy link
Member

Yea, that is indeed strange. This module will have the support anyhow soon and I should have a branch you can test if you like.

@pcgeek86
Copy link

pcgeek86 commented Jul 8, 2020

I'm using next-auth which depends on mysql and am running into this same problem.

https://github.com/iaincollins/next-auth

mysql> select user, plugin from mysql.user where user = 'root'
    ->
    -> ;
+------+-----------------------+
| user | plugin                |
+------+-----------------------+
| root | caching_sha2_password |
| root | mysql_native_password |
+------+-----------------------+
2 rows in set (0.01 sec)

I also ran:

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
{
    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
}

@dougwilson

@stuyy stuyy closed this as completed Jul 13, 2020
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

4 participants