在C#应用程序中使用raspbian连接到MariaDB。

问题描述 投票:0回答:1

我一直试图在我的pi3上运行一个使用mysql(mariadb)的服务器,并像这样连接。

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

当我使用XAMPP时,它在Windows上运行得非常好。然而,当我在我的pi上运行应用程序时,它向我抛出了这个问题。

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

MariaDB的版本是10.3.22 而我使用的是MySql.Data -6.4 dll。

我是不是漏掉了一些简单的东西?

先谢谢你了!

c# mysql mariadb raspberry-pi3 raspbian
1个回答
0
投票

你使用的是MySql.Data.dll的老版本,它可能不支持你的服务器所使用的验证方案。

在这种情况下,我建议换成以下版本 MySqlConnector,它对MariaDB有更好的客户端支持,包括它的 auth_gss_clientauth_ed25519 的认证方案(后者在 分装).

© www.soinside.com 2019 - 2024. All rights reserved.