Error: Client does not support authentication protocol requested by server; consider upgrading MariaDB client
This is a fresh install of MariaDB with an imported SQL dump and I ran the query SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password').
can't reproduce, I'm using maridb server from docker:
1) start using docker run -p 3306:3306 --net=host -e MYSQL_RANDOM_ROOT_PASSWORD=1 -it mariadb
2) run script twice first time using random password from log and doing SET PASSWORD FOR 'root'@'%' = PASSWORD('password'). query and second time using password password - both times succeed
@BamItsPixel you are most likely suffering from bugged socket auth (node-mysql bug #1507)
Try adding this to your code (where config is your configuration, passed to createConnection):
config.authSwitchHandler = (unused, cb) => {
// workaround for node mysql bug #1507
if (pluginName === 'auth_socket') {
cb(null, Buffer.alloc(0));
} else {
cb(new Error("Unsupported auth plugin"));
}
};
thanks @Alexander-- for hint
Yes, as suggested by https://github.com/mysqljs/mysql/issues/1507#issuecomment-321443589 the error might be visible when CLIENT_PLUGIN_AUTH capability flag is not set and we only set it when there is authSwitchHandler in config parameters
This occurs for me when using the latest mysql docker image, MySQL version 8.x.
This is kind of a deal breaker right? I mean you can't connect to the latest MySQL server. Shouldn't this issue get the highest priortiy?
yes, it's high priority @dschnare and I already have almost ready for PR code to fix this. In the meantime solutions like https://github.com/mysqljs/mysql/pull/1962#issuecomment-390900841 should work
I appreciate your work on this @sidorares (and others). Sorry for coming across as an ass.
no problems @dschnare , happy to have you review pr so you familiar with code involved ( if you want )
@sidorares I promised myself I was going to submit a PR to fix the MySQL 8.0 issues similar to mysqljs/mysql#1962, but still haven't found time to do it. Since you are already working on it, feel free to let me know if you need any help or additional review.
Thanks @ruiquelhas , I definitely want you to have a look at PR when it's ready ( and thanks for your work on mysqljs/mysql, my code is very much based on your ). Hope it'll be much smaller, I'm trying to make it use generic auth plugin system in the client ( so that all auth types are plugins, just some of them are pre-included - api similar to https://github.com/sidorares/node-mysql2/issues/560#issuecomment-312151878 )
just update your mysql-connector-java to latest all works fine
Any news here? Thanks!
This is most common problem with Node.js mysql modules. I tried other mysql modules but unlucky attempts..
The solution given on here (code snippet above) worked for me. Try it out!
Hi,
I use a node.js framework and it's just support mysql and mysql2 npm modules. I cannot and shouldn't modify source code of framework but mysql2 module can be fixed internally by maintainers.
And also this is just a workaround. No one should be needed to implement this workaround. Mysql 8 auth methods should be supported natively.
Thanks!
Most helpful comment
Any news here? Thanks!