Node-mysql2: Error: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Created on 1 Aug 2019  路  8Comments  路  Source: sidorares/node-mysql2

Since MySQL 8, a new authentication algorithm is used, which introduces a breaking change. The mysql npm package received a PR for this. Maybe this helps improving this awesome packag: https://github.com/mysqljs/mysql/pull/2233

Robert

Most helpful comment

Hey @fabiofcferreira , thanks for the offer! Happy to accept help, I'll try to write down priorities here in few minutes ( I think I already did that in previous issues, need to find and link to here )

All 8 comments

thanks @infusion , I'm aware of this and have put some initial efforts just didn't have time to finish ( I'd like to take slightly different approach to a mysqljs though ). See som related discussions in #975 #906 #820 . There is also some code in https://github.com/sidorares/node-mysql2/tree/mysql8-wip and https://github.com/sidorares/node-mysql2/tree/feature/fast-caching_sha2_password branches. Closing issue for now but feel free to add any relevant feedback here!

That's awesome news, thanks for the effort! Can you give any release date information?

Regarding mysql 8 change - not going to promise anything, it was "very close" a year ago

unfortunately very little time right now, I'm the only active maintainer and I have day job and 6 kids :)

I'll try to keep doing small releases more often, maybe I'll cut next release this coming weekend

Experiencing this issue and just wanted to add my support on this issue.

I can definitely start reading the docs and code and hopefully help you maintaining this wonderful package, what do you say? @sidorares

Hey @fabiofcferreira , thanks for the offer! Happy to accept help, I'll try to write down priorities here in few minutes ( I think I already did that in previous issues, need to find and link to here )

Ok so initial support for plugin auth landed 3 years ago ( https://github.com/sidorares/node-mysql2/pull/331 ) and I think it's time to rewrite it.

https://github.com/sidorares/node-mysql2/issues/906#issuecomment-451653763
https://github.com/sidorares/node-mysql2/issues/560

So priorities now are:

  • agree on new authPlugin api
  • implement new plugin api system, make it work for both initial plugin name and "auth swich" flows ( and also change user command )
  • move existing auth code into corresponding plugins ( mysql_native_password etc ) and call that code from main protocol in case non plugin

    • add caching_sha2_password implementation as individual plugin

Main change to authPlugin api - I want to convert handler from (name, data, cb) to probably something like (name) => (data) => Promise
First call returns a function, that way we can close over some state for subsequent calls. First and subsequent ( AuthMoreData ) calls call that function and write back result returned as Buffer or Promise ( not quite sure yet about return type, need to double check here all possible auth flows. https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake )

I'll start reading the docs (I'm new to MySQL "deep" stuff) and I'll catch up

The docs are not great . For the auth part - pay attention to initial handshake (default based on flags or plugin based), auth switch request and change user.

https://dev.mysql.com/doc/internals/en/connection-phase.html

( Actually on the second thought docs aren't too bad )

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gajus picture gajus  路  3Comments

hezjing picture hezjing  路  3Comments

MHDante picture MHDante  路  4Comments

sidorares picture sidorares  路  6Comments

magicxie picture magicxie  路  6Comments