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

AUTH_SWITCH_PLUGIN_ERROR #213

Open
1 of 3 tasks
Swellington-Soares opened this issue Jan 22, 2024 · 14 comments
Open
1 of 3 tasks

AUTH_SWITCH_PLUGIN_ERROR #213

Swellington-Soares opened this issue Jan 22, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@Swellington-Soares
Copy link

Swellington-Soares commented Jan 22, 2024

Issue checklist

Please put x inside of the box that matches your issue.

  • [x ] I am using the latest release
  • I have referenced previously reported issues
  • I have referenced available documentation and cannot resolve the issue
  • I'm certain this is an issue with oxymysql, and not with my resource

Describe the bug
A clear and concise description of what the bug is.

I'm trying to connect to the database, running only the standard fivem resources and oxmysql, but I receive the following error: AUTH_SWITCH_PLUGIN_ERROR.

Screenshots
If applicable, add screenshots to help explain your problem.

Code

    -- If applicable, include the query and relevant code

set mysql_connection_string "mysql://[email protected]/qbcore?charset=utf8mb4"

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

Server details

  • FXServer artifact
  • Operating system

FxServer: Last version
OS: Windows 10

Database details

  • MariaDB or MySQL
  • Version

MariaDB : 10.11.6

@Swellington-Soares Swellington-Soares added the bug Something isn't working label Jan 22, 2024
@Andyyy7666
Copy link

@Swellington-Soares could you provide a screenshot of the error?

@thelindat
Copy link
Member

thelindat commented Mar 6, 2024

AUTH_SWITCH_PLUGIN_ERROR

Lacking info but I assume you're talking about this.
image

I have no idea why the problem has become so prevalent recently, possibly some change in mariadb or otherwise the default database setup being provided by some GSP(s)? The error itself comes from the node-mysql2 which doesn't support the specified authentication method.

You can try creating a new user (google how to do this, I'm not providing database support).

@thelindat thelindat changed the title Connection Problemn AUTH_SWITCH_PLUGIN_ERROR Mar 6, 2024
@Swellington-Soares
Copy link
Author

Sorry for the delay, I managed to solve this problem by updating mariadb, but so far I haven't discovered the cause, as I just updated the version without changing any server configuration, and it worked normally, I'm currently using version 11.2.2-MariaDB-1 :11.2.2+maria~ubu2204. Maria DB 11.2.2 in docker container.

@VIRUXE
Copy link

VIRUXE commented Apr 14, 2024

MYSQL_NATIVE_PASSWORD plugin should be used when setting passwords to be used with oxmysql.

The latest mariadb release creates a password-less root account using gssapi. For the inexperienced, using HeidiSQL for example, to set a password on the root account, will "fix" this.

@thelindat
Copy link
Member

thelindat commented May 9, 2024

The latest mariadb release creates a password-less root account using gssapi.

Any reference for that? Seems weird they would make that change and I didn't have the issue with multiple new installations.

They don't even support the plugin for their own connectors.
https://jira.mariadb.org/browse/CONJS-72


Either way, just change your password or make a new account to fix the issue. Supported plugins are here https://github.com/sidorares/node-mysql2/blob/master/lib/auth_plugins/index.js

@VIRUXE
Copy link

VIRUXE commented May 9, 2024

I came to that conclusion after reading the documentation about gssapi, on MariaDB's website: https://mariadb.com/kb/en/authentication-plugin-gssapi/#passwordless-login-on-windows
image

Maybe I misunderstood - [MariaDB Connector/Node.js](https://mariadb.com/kb/en/nodejs-connector/) does not yet support gssapi authentication. See [CONJS-72](https://jira.mariadb.org/browse/CONJS-72) for more information.

I've been installing version 11.3.1 directly from their download section.

But anyway, yes, this can likely be closed. The fix/workaround is to just use a password.

@wapnasty
Copy link

wapnasty commented Jun 1, 2024

Setting a password did nothing.
Screenshot 2024-06-01 180130

@Tim5965
Copy link

Tim5965 commented Jun 11, 2024

Fix for this problem is to do this query in your database (with HeidiSQL or PHPadmin most times)

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MyNewPass';

@Tim5965
Copy link

Tim5965 commented Jun 11, 2024

With MariaDB btw ALTER USER root@localhost IDENTIFIED VIA mysql_native_password; SET PASSWORD = PASSWORD('MyNewPass');

@VIRUXE
Copy link

VIRUXE commented Jun 11, 2024

Fix for this problem is to do this query in your database (with HeidiSQL or PHPadmin most times)

The client you use to send a query is irrelevant to this case.

So, yes, you must set a password using the mysql_native_password plugin.

@Eightu
Copy link

Eightu commented Jul 22, 2024

Hello, I've had such a problem as well.
Here's why I'm having this problem: the first time I used XAMPP+HeidiSQL, and then I didn't set a password for root, I created the server.
So the server.cfg is a set like this : mysql_connection_string "mysql://root@localhost/mydatabasename?waitForConnections=true&charset=utf8mb4"
Then I re-created the server on a new host, using the server data and database from my previous host. But this time I switched to MariaDB with HeidiSQL and set a password for root. Since running the latest FXServer and using "Existing Server Data" to setup the server. It didn't make me enter the database password and started the server directly, making me ignore that. So there was such an error.
Solution: (server.cfg)
Change
set mysql_connection_string "mysql://root@localhost/mydatabasename?waitForConnections=true&charset=utf8mb4
To
set mysql_connection_string "mysql://root:mypassword@localhost/mydatabasename?waitForConnections=true&charset=utf8mb4"

Hope it helps.

@VIRUXE
Copy link

VIRUXE commented Jul 25, 2024

Hello, I've had such a problem as well. Here's why I'm having this problem: the first time I used XAMPP+HeidiSQL, and then I didn't set a password for root, I created the server. So the server.cfg is a set like this : mysql_connection_string "mysql://root@localhost/mydatabasename?waitForConnections=true&charset=utf8mb4" Then I re-created the server on a new host, using the server data and database from my previous host. But this time I switched to MariaDB with HeidiSQL and set a password for root. Since running the latest FXServer and using "Existing Server Data" to setup the server. It didn't make me enter the database password and started the server directly, making me ignore that. So there was such an error. Solution: (server.cfg) Change set mysql_connection_string "mysql://root@localhost/mydatabasename?waitForConnections=true&charset=utf8mb4 To set mysql_connection_string "mysql://root:mypassword@localhost/mydatabasename?waitForConnections=true&charset=utf8mb4"

Hope it helps.

HeidiSQL and XAMPP have nothing to do with this and you should NOT run XAMPP just to have MySQL/MariaDB.

Passwords must be set using mysql_native_password. That's it.

@talonlzr
Copy link

talonlzr commented Nov 10, 2024

Just a sidenote: Modern MySQL (9.x) no longer feature mysql_native_password. This was deprecated a long time ago, and is now fully removed from the codebase. This will eventually also be deprecated in MariaDB although their LTS-strategy on core authentication plugins means this will be around for another 5 or so years there unless something happens to that policy.

If this authentication scheme is the only supported one for oxmysql however, one might wanna get crackin' on implementing some of the new, modern and much more secure authentication schemes <3

@thelindat
Copy link
Member

If this authentication scheme is the only supported one for oxmysql however, one might wanna get crackin' on implementing some of the new, modern and much more secure authentication schemes <3

oxmysql is simply a resource implementing node-mysql2 and various tools; authentication is handled there and has nothing to do with me. Supported auth methods are:

  • caching_sha2_password
  • mysql_clear_password
  • mysql_native_password
  • sha256_password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants