-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Error: ER_NOT_SUPPORTED_AUTH_MODE with auth_socket #1507
Comments
What auth modes do you have configured for your server? |
I'm working on local, and I didn't set any auth mode, maybe the default mode have been changed in the update of my-sql server? Or what is the default of this mysql-driver then I set it in my config? |
Problem solved!
http://stackoverflow.com/a/36234358/1431224 Changing plugin to mysql_native_password solved the problem :)! |
I just installed 5.17.13 on Ubuntu and was able to connect just fine without changing anything. I'm not sure how to proceed. Would it be possible to provide a packet capture of the traffic between this module and your server? Do other Node.js modules like "mysql2" work? |
could you console.log server hello packet? Add |
Haha, we all replied at the same time :) I'm not sure why mine worked out of the box, but glad to get this figured out. |
@abou7mied what was the old value for |
Actually I didn't try to figure out what was the old value, I just liked the part when I changed the plugin then it worked 😄 Thanks all guys for your concern |
Just ran into the same issue. The root user by default (if you didn't set any password during installation) appears to be:
In my case, I solved the problem by fixing my nodejs code to stop using root user to connect. |
#1507 (comment) worked for me. Don't forget to |
#1507 (comment) worked for me, too. 👯♂️ and need flush privileges; after follow #1507 (comment) |
@dougwilson Just in case this is totally happening, I think we should reopen the issue? |
From my understanding there is nothing to change in the module. If you have an idea of what to change, please feel free to submit a PR :) |
Maybe some one will add something if there's and issue to show for it. |
or add it to install instructions... |
Does mysql or any other node lib support |
@joe-angell relatively easy to add with mysql2 and |
I'm not sure that the issue is really resolved. How do we connect to mysql with auth_socket? I'm specifically trying to get auth_socket working in place of password authentication, but I'm not sure if it's supported in this module. |
I'll raise a PR to support pluggable auth plugin in mysqljs which is compatible with mysql2. And then add a auth_socket method can be considered. |
@mnakama I did a bit of research on how auth_socket works and dump notes here:
node bindings for SO_PEERCRED: looks like this is not part of libuv so requires binary module The above is probably for server side of plugin. |
@sidorares @mnakama , I've read the MySQL server code. This may be a server level auth plugin which do not need client to do something(Not sure yet). But the ER_NOT_SUPPORTED_AUTH_MODE will be always thrown when client driver do not support CLIENT_PLUGIN_AUTH , I assume that after my pull request #1776 is merged, it will be fixed automatically. |
Ah, that makes sense @elemount . Yea, your PR implemented the CLIENT_PLUGIN_AUTH, so if that is what is the underlying cause, then that would fix it. Setting up a server with this plugin enabled would validate this. |
@dougwilson , I just checked out PR #1776 and tried it. auth_socket works perfectly with this. Merging the PR would fix this issue. Thanks @elemount =) Steps I used to test auth_socketOn the server side: CREATE USER 'client'@'localhost' IDENTIFIED WITH auth_socket;
GRANT all ON *.* TO 'client'@'localhost';
FLUSH PRIVILEGES; On the node.js client: let sql = mysql.createPool({
multipleStatements: true,
charset: 'UTF8_GENERAL_CI',
connectionLimit: 10,
socketPath: '/run/mysqld/mysqld.sock',
user: 'client', // this needs to match the node.js process user
//password: (not used with auth_socket),
}); Then execute queries as usual. @sidorares Correct, there is no need for SO_PEERCRED on the client side. No password needed, either. It's essentially the linux equivalent of the security guard who knows you by your face. For those interested, this is the only official documentation I found: It seems they left out the client part of the documentation completely. It says "None, see discussion", but I don't see a discussion anywhere on the page. EDIT: It looks like I need the "user" parameter after all. It needs to match the node.js process user. Otherwise, the client tries to use "" as a username and fails. |
Is there any chance this gets solved soon? As I understand this, I have to switch to another library to support logging in with the default root user? The linked pull request is in the making for 4 months already so will probably need another 6 months until merged in? Edit: Sorry if I sound snarky, I am exhausted from bug hunting and in general I love working with mysqljs. Edit 2: Does anyone know any node mysql library that supports this? |
@Badestrand Yeah, not sure what happened with the pull request. I used the pull request's commit in our main development branch, and it seems to work fine. I recommend trying it out yourself and possibly helping @elemount get the PR cleaned up. A possible alternative would be to find/use a python mysql library that is more mature. If you want the code to be part of master branch, check out PR #1776. I think it just needs to be cleanly rebased onto master before it'll be accepted. I'd work on it myself, but I no longer have a need for it. @dougwilson @elemount Please correct me if I'm wrong. |
I use this to fix it: |
This one worked for me:
|
I'm not sure what the status of this request is, but I thought I'd add my input. I'm getting the same error trying to connect to a MySQL 8.0 database. It looks like for MySQL 8.0, the default authentication plugin is https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html I've verified that my server (running from the |
This is a request for support for auth_socket (as specified in the issue title), not for caching_sha2_password. The issue is clear what this is for. I'm locking this because the path forward is open a pull request with an implementation not just comment me too over and over :) |
Yesterday I upgraded my ubuntu distribution an MySql Server was updated too.
But when I connect I get this error
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
My connection code:
I tried to set
insecureAuth: true
but no changesThe text was updated successfully, but these errors were encountered: