0

I am trying to connect my Unity multiplayer game with my MariaDB but i get the ERROR: MySqlException: Authentication method 'auth_gssapi_client' not supported by any of the available plugins. MySql.Data.MySqlClient.NativeDriver.Open () (at <13314bc2115d4bd2a5d896df29fb7179>:0) MySql.Data.MySqlClient.Driver.Open () (at <13314bc2115d4bd2a5d896df29fb7179>:0) MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) (at <13314bc2115d4bd2a5d896df29fb7179>:0)

this is my Database.cs file:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MySql.Data.MySqlClient;
using UnityEditor.Experimental.GraphView;

public class Database : MonoBehaviour
{
    private string server;
    private string database;
    private string user;
    private string password;
    private string port;

    public void Database_Initialize()
    {
        server = "IP-ADDRESS";
        port = "PORT";
        database = "DB_NAME";
        user = "USERNAME";
        password = "PASSWORD";

        // Use interpolated strings to insert the values from variables
        string connectionString = $"Server={server};Port={port};Database={database};Uid={user};Pwd={password};";
        // Use "using" pattern to make sure everything is disposed
        using (var connection = new MySqlConnection(connectionString))
        {
            connection.Open();

            string query = "INSERT INTO user (Username) VALUES ('User1')";
            using (MySqlCommand command = new(query, connection))
            {
                command.CommandTimeout = 60;
                // Use ExecuteNonQuery to execute the INSERT.
                // recordsChanged should be 1 afterwards
                int recordsChanged = command.ExecuteNonQuery();
            }
        }
    }
}

When i search for answers on the www, I only get something like: "edit the my.cnf or my.ini file" but I don't have one. I downloaded my Conenctor on this website: https://dev.mysql.com/downloads/connector/net/ and just put the MySql.Data.dll in my Plugins folder. I tried using the .Net & Mono-, as well as the Microsoft Windoes-installation.

Both show the same error.

Any ideas? Thanks in advance!

Dru.Dru
  • 59
  • 7

2 Answers2

0

MySQL Connector/.NET doesn't support auth_gssapi_client authentication, it only provides support for kerberos authentication when connecting to a MySQL Enterprise server.

You have to use mysqlconnector for ADO.net which provides support for gssapi authentication

Georg Richter
  • 5,970
  • 2
  • 9
  • 15
0

Let me make some assumptions

  1. Your user is "root".

  2. Your MariaDB version is relatively recent( 10.11+ ), such that "root" user falls back to auth_gssapi, if usual native_password authentication fails (because of the wrong password). description of the feature is here With this feature, members of Administrators group (local or Domain admins) can connect passwordless as "root".

  3. Your password is wrong.

What to do in this case is to fix the password. You can also fix the user definition, if you prefer to see other generic error :)

And, better to not use root from your application, this accounts has far too many rights.

Vladislav Vaintroub
  • 5,308
  • 25
  • 31