Monolith
❔ Error while trying to connect to MySql using MySql .Data
While trying to connect to maria db using mysql.data i get this error:
Unhandled task exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Diagnostics.TraceInternal.get_AppName () [0x0000e] in <e804fc8285a9419784599893ed028695>:0
at System.Diagnostics.TraceInternal.TraceEvent (System.Diagnostics.TraceEventType eventType, System.Int32 id, System.String format, System.Object[] args) [0x0003d] in <e804fc8285a9419784599893ed028695>:0
at System.Diagnostics.Trace.TraceError (System.String message) [0x00000] in <e804fc8285a9419784599893ed028695>:0
at MySql.Data.MySqlClient.MySqlTrace.LogError (System.Int32 id, System.String msg) [0x00026] in <89b4d3936e0b4e49b8d299ddbfe7933d>:0 [ script:LLL_CORE_CS] at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0x0002e] in <89b4d3936e0b4e49b8d299ddbfe7933d>:0
at MySql.Data.MySqlClient.MySqlPool.GetConnection () [0x0001c] in <89b4d3936e0b4e49b8d299ddbfe7933d>:0
at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00245] in <89b4d3936e0b4e49b8d299ddbfe7933d>:0
at TestDB.Class1.DBTESTAsync () [0x0002f] in C:\Users\Maurice\source\repos\TestDB\TestDB\Class1.cs:22
Recreating Infos:Builder: dotnet on Debian 10.13
Code:using System;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace TEST.Server
{
public class ServerMain
{
public static void DBTEST()
{
var connString = "server=localhost;user=NAME;
database=NAME;port=3306;password=***";
MySqlConnection conn = new MySqlConnection(connString);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
public ServerMain()
{
DBTEST();
}
}
}
6 replies