30

When I try to connect MySQL (8.0) database with Visual Studio 2018 I get this error message

"Authentication method 'caching_sha2_password' not supported by any of the available plugins"

Also I am unable to retrieve Database name. I use mysql-for-visualstudio-1.2.7 and mysql-connector-net-8.0.11 for connection. Is there any possible way to fix it.

akshat
  • 1,219
  • 1
  • 8
  • 24
vikash vishnu
  • 337
  • 1
  • 4
  • 11
  • The error message I get in a separate dialogue box is "Authentication method 'caching_sha2_password' not supported by any of the available plugins". – vikash vishnu May 01 '18 at 17:56
  • Duplicate issue with this one. https://stackoverflow.com/questions/49931541/mysql-changing-authentication-type-from-standard-to-caching-sha2-password – Travelling Steve Jun 27 '18 at 21:48

9 Answers9

32

1st

Modify the MySql Server:

  1. Open MySQL Installer - Community
  2. Select Product MySQL Server
  3. Click on Quick configure in last column
  4. Click on next untill you will not point to Authentication method
  5. On Authentication method tab- select Use Legacy Authentication method
  6. Click on next and finish

Now you can login with normal password

2nd

If you are using .net framework 4.5.2 you can easy upgrade reference of MySQL.Data:

  1. Visulastudio> Tools> Nuget Package Manager>Manage nuget package for solution
  2. Go to Browse tab, Write Search textbox mysql and enter first mysql.data package will come, install it

Now login, issue will resolved

Andronicus
  • 25,419
  • 17
  • 47
  • 88
Sameer Bahad
  • 555
  • 5
  • 4
  • I'm using db-up and the above option did not work... The second option is not possible because mysql is an dependency of db-up. Any other ideas? – Tijl .Reynhout Oct 23 '19 at 19:36
  • 2
    Already found an answer. Apparently you can also choose the authentication method for each user. and this user was set to the new authentication method. Made a new user with standard authentication method – Tijl .Reynhout Oct 23 '19 at 19:41
10

This is a new authentication method used in MySQL version 8.0 as compared to mysql_native_password, which is the legacy method. In order to make this work, you will need to upgrade your MySQL Client library to version 8.0.

So, use the following link and get the version 8.0.11 or higher.

https://dev.mysql.com/downloads/connector/net/

SolutionGuy
  • 131
  • 2
  • 4
    This does not work. After installing the complete Windows release version 8.0.11 from mysql-installer-community-8.0.11.0.msi the exception is still thrown. Reinstalling just the latest version of Connector/Net from mysql-connector-net-8.0.11.msi also results in the same exception. There is no release candidate (the release candidate for MySql Workbench is needed to resolve the same issue with that tool). – Donald Rich Jul 10 '18 at 11:53
6

I had the same issue. Fixed it by removing the reference to MySQL.Data then re-adding it.

Jason Wynn
  • 61
  • 1
6

Update the Pomelo.EntityFrameworkCore.MySql Nuget Package to 2.0.0.1 instead of 2.0.0

2.0.0.1 is more stable than 2.0.0 and 2.0.1

habib
  • 2,366
  • 5
  • 25
  • 41
Ebram
  • 1,042
  • 1
  • 13
  • 26
2

Just update your nuget package for MySql.Data

2

Our old .NET Framework 4.6.2 project began throwing this exception, when someone came back to using it after we updated MySQL server version few months ago.

So at first, as others recommend, I updated all packages via NuGet Package Manager (including MySql.Data to v8.0.24) - didn't seem to help at first. Then in project properties updated project target framework to .NET Framework 4.7.2 - still nothing.

Then I noticed the connection string had this providerName parameter:

<connectionStrings>
   <add name="___" providerName="MySql.Data.MySqlClient" connectionString="server=___;user id=___;password=___;database=___;"/>
</connectionStrings>

so I tried removing the .MySqlClient part from it, leaving it

providerName="MySql.Data"

and for some reason it worked:) Maybe updating the MySql.Data package was part of the solution and the .MySqlClient is some obsolete property. No idea.

1

Do you hardly need the authentication method in MySQL to be 'caching_sha2_password'? If not, why don't you just switch it to 'Standard'? You can check this in the "User and Privileges" settings and look for the Authentication Type.

evilom
  • 573
  • 6
  • 19
0

I faced the same error while i was trying to connect my client machine to the Server. I had to connect to MySQL server hosted on the Server. I have got this to working. Followed the following steps:

  1. Download the latest MySQL community version i.e 8.0.18.0 installed. Make sure that the same version of MySQL is installed in the server machine. Please note that either the same version of MySQL are installed in client machine and server machine or else client machine should have higher version of MySQL installed.
  2. With the help of MySQL installer make sure that you installed 'Developer' version in your client machine, so as to have MySQL server, SQL.net, mySQL for visual studio e.t.c all will get installed in it.
  3. We are using .Net framework 4.5.2 in latest MySQL community. So, make sure you using Visual studio 2019. Build UiConfigEDItor source code in Visual Studio 2019 so that it will have support for higher version .Net framework 4.5.
  4. Now, copy all files (mysqlData.dll in particular) from SQL installed workspace(C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2) to Visual Studio 2019 workpace (C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE).
  5. Log off you machine and now open UIConfigEditor source code in visual studio 2019.

Now in Solution Explore->References->Add References->Go to Assemblies tsb-> Extensions->Search for mysql.data.dll(make sure that its there)->check that option. Please note that mysql.data.dll is of version 8.0.18.0 in this case.

slfan
  • 8,950
  • 115
  • 65
  • 78
  • wait a minute... from where vs 2019 comes into play? we are just installing on production machine not developer PC – TAHA SULTAN TEMURI Jul 29 '20 at 08:20
  • 1
    This should not be marked as the answer. This is a specific solution to a specific client build to a generic question that anyone landing on this page from a search would not find useful and it also fails to answer the "why" of the issue. There are better answers here that should be marked. – Bryan W Aug 13 '21 at 18:12
-5

Sometimes, it has a silly reason. In my case, I forgot to create my database in MySQL. Sometimes, one my forgot to run database daemon.

Not every scary error message is because of a scary situation.

Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126