Connecting to MariaDB in C# Application using raspbian

0

I've been trying to run a server on my pi3 that uses mysql (mariadb) and connects like this:

mySQLSettings.connection = new MySqlConnection("SERVER=localhost;DATABASE=servertest;UID=root;PASSWORD=;");
mySQLSettings.connection.Open();

It works perfectly fine on Windows when i use XAMPP. However when i run the app on my pi it throws me this:

Could not connect to MySQL: MySql.Data.MySqlClient.MySqlException (0x80004005): Client does not support authentication protocol requested by server; consider upgrading MariaDB client
  at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x0006e] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.NativeDriver.AuthenticateNew (System.Boolean reset) [0x000ed] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.NativeDriver.Authenticate (System.Boolean reset) [0x00040] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00344] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.Driver.Open () [0x0000c] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00058] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () [0x0001e] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () [0x000b5] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0x00051] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.MySqlPool.GetConnection () [0x00021] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0013e] in <61bbf0b98df94765b3636dc3aa92c9d7>:0
  at GameServer.MySQL.ConnectToMySQLServer () [0x00000] in <16fb46a8a2244c9e90373e583102cae7>:0

The version of MariaDB is 10.3.22 and I'm using the MySql.Data-6.4 dll

Am I missing something simple?

Thanks in advance!

c#
mysql
mariadb
raspberry-pi3
raspbian
asked on Stack Overflow May 8, 2020 by MonkeyMaa • edited May 9, 2020 by kmoser

1 Answer

0

You're using a pretty old version of MySql.Data.dll, which may not support the authentication scheme your server is using.

In this case, I'd recommend switching to MySqlConnector, which has better client support for MariaDB, including its auth_gss_client and auth_ed25519 authentication schemes (the latter in a separate package).

answered on Stack Overflow May 9, 2020 by Bradley Grainger

User contributions licensed under CC BY-SA 3.0