Description:
I have a source code as the following
On_StartUp()
{
myConnection = new MySqlConnection(....);
myConnection.Open()
}
// Loop for this function
Timer_Event()
{
CheckConnection();
// read data from database
MySqlCommand objCommand = new MySqlCommand(strCommand, myConnection);
MySqlReader objReader = objCommand.ExecuteReader();
.....
}
CheckConnection()
{
if(!myConnection.Ping())
{
myConnection.Open();
}
}
How to repeat:
At the nights, or weekends, the below exception some time occur:
Authentication to host '' for user '_user' using method 'mysql_native_password' failed with message: Reading from the stream has failed.
At MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
At MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
At MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
At MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
At MySql.Data.MySqlClient.NativeDriver.Open()
At MySql.Data.MySqlClient.Driver.Open()
At MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
At MySql.Data.MySqlClient.MySqlConnection.Open()