Faced the below error when connect to MySQL Database on Azure instance with MySqlConnector

MySqlException: Access denied for user 'xxx%sss'@'10.0.0.27' (using password: YES)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable+ConfiguredValueTaskAwaiter.Ge

The IP is actually the internal IP Address of the proxy of MySQL database on Azure.

The is actually a bug for the service provided by azure. When you enable pooling, you will face this issue when a valid connection reused.

By default the MySqlConnector set ConnectionReset=true . The solution is either:

  1. Disable the connection pool by set pooling=false (Not recommanded)
  2. Disable the connection reset option by set ConnectionReset=false (Recommanded)

You can get more dedails on Pomelo.EntityFrameworkCore.MySql Not Support MySQL on Azure

BTW: This only happened when you connect to the MySQL Database on Azure server. Microsoft will shutdown the service on December 1st 2019. Check link for details.

They have a new service called Azure Database for MySQL. And all of your service will be automatically migrated to the new service befor the day. You can also open a ticket to the team to let them help migrate your service earlier.

I have tested that Azure Database for MySQL dose not have this issue.