0

I have a MVC webapp (C#) solution written in DotNet 5 which accesses a MySql database using the nuget packages MySql.Data (8.0.29) and Dapper (2.0.123) as an ORM. Everything works as expected.

I now have opened the solution in VS 2022 and upgraded all projects to DotNet 6. No changes to code or nuget packages were made. Connecting to the MySql database suddenly fails with a MySqlException:

Authentication to host 'localhost' for user 'xy' using method 'mysql_native_password' failed with message: Access denied for user 'xy'@'localhost' (using password: YES)

As mentioned before no changes were made to the solution except switching from DotNet 5 to DotNet 6. Switching back to DotNet 5 solves the problem and everything is working again.

How weird can weird get? Anybody have an idea?

Mats
  • 14,902
  • 33
  • 78
  • 110
  • Did you check compatabilities before upgrading – RiggsFolly Jul 07 '22 at 16:49
  • @RiggsFolly I did not. Mostly because the solution is not very complex and also doesn't have to many dependencies but also because I wouldn't know how to do such check :) – Mats Jul 07 '22 at 16:50
  • Do a search for something like `upgrade .net 5 to 6` and see what resources are available to assist those upgrading – RiggsFolly Jul 07 '22 at 16:54
  • try add `SslMode=none` in the connection string. refer from this post https://stackoverflow.com/questions/67588055/authentication-exception-from-c-sharp-app-when-connecting-to-mysql-8 – frank_lee Mar 02 '23 at 07:59

0 Answers0