Description:
WHEN UPGRADE NET CONNECTOR TO 8.0.28
WHEN CONNECTING TO MYSQL SERVER AND SERVER IS STOPPED OR USING INVALID PORT RETURN INVALID INNER EXPECTION AND COMPILRE CAN`T GET IT AS MYSQLEXCEPTION
System.AggregateException: 'One or more errors occurred.'
SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:330
How to repeat:
CREATE SIMPLE WINFORM APPLICATION USING VISUAL STUDIO 2019
INSTALL MYSQL.DATA FROM NUGET PACKAGE AND SELECT VERSION 8.0.28
AND TRY THE FOLLOWING CODE
private int CheckConnection(string constr, out string ExMessage)
{
try
{
using (MySqlConnection Con = new MySqlConnection(constr))
{
Con.Open();
if (Con.State == ConnectionState.Open)
{
Con.Close();
}
}
ExMessage = string.Empty;
return 0;
}
catch (MySqlException EX)
{
ExMessage = EX.Message;
return EX.Number;
}
}
private void button1_Click(object sender, EventArgs e)
{
string MySqlConnStringss = MyConStr();
int ExNumber = CheckConnection(MySqlConnStringss, out string ExMessage);
MessageBox.Show(ExNumber.ToString() + " " + ExMessage);
}
private string MyConStr()
{
MySqlConnectionStringBuilder cons = new MySqlConnectionStringBuilder()
{
Server = "127.0.0.1",
Port = 330,
UserID = "root",
Password = "yousef",
Database = "abc",
SslMode = MySqlSslMode.None,
ConvertZeroDateTime = true,
AllowUserVariables = true
};
return cons.ToString();
}
ALTHOUGH I USING TRY TO CATCH MYSQLEXCEPTION THE EXCEPTION THROWN
IS
System.AggregateException: 'One or more errors occurred.'
SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:330
THEN REPEAT THE PREVIOUS STEPS USING MYSQL.DATA V 8.0.27
RETURN MYSQLEXCEPTION WITH EXCEPTION NUMBER AND MESSAGE COULDNOT CONNECT TO ANY OF SPECIFIED MYSQL HOSTS.
Suggested fix:
MAY BE DUE TO NEW OPTIONS
NET applications now can establish connections using multifactor authentication, such that up to three passwords can be specified at connect time. The new Password1, Password2, and Password3 connection options are available for specifying the first, second, and third multifactor authentication passwords, respectively. Password1 is a synonym for the existing Password option.