28

I've tried to connect to the latest MySQL server 8.0.11 from MySQL workbench, but the error keeps popping up: Cannot connect to MySQL server, authentication plugin: caching_sha2_password: the specified module could not be found.

I tried looking at MySQL server installation videos online and replicated every step accurately, but the error persists.

Any help is greatly appreciated.

10 Answers 10

44

I had the following solution: change my.ini in a [mysqld] section like this:

#default_authentication_plugin=caching_sha2_password  (comment line!)
default_authentication_plugin=mysql_native_password   (new line)

Connect to your MySQL under root in a command line client and execute:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxx';

Where xxx is your current password.

3
  • One amendment, I had to change ... BY 'xxx' to what I'd like my new password to be, rather than what my previous password was. Jul 22, 2018 at 6:07
  • 9
    This will revert to the old password hashing system and is strongly disrecommended
    – xorinzor
    Aug 2, 2018 at 12:27
  • 2
    FYI: my.ini is AKA my.cnf.
    – Script47
    Sep 24, 2019 at 12:30
25

Try to connect your MySQL use terminal, and use this.

mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
2
  • 2
    Thanks!!! Work for me! macOS 10.13.5 + MySQL 8 (mysql Ver 8.0.11 for osx10.13 on x86_64 (Homebrew))
    – ZhengCheng
    Jul 5, 2018 at 2:01
  • Error Code: 1396. Operation ALTER USER failed for 'azhar'@'localhost' Sep 19, 2021 at 13:28
3

See:

Changes in MySQL Workbench 8.0.11 (2018-04-19, Release Candidate)

...

  • MySQL Workbench now supports the caching_sha2_password authentication plugin introduced in MySQL 8.0 (see Caching SHA-2 Pluggable Authentication). A user account can be reset to use the other available authentication types for making a connection.

...

1
  • The release candidate is indeed the way to go. You can download it from the "Development Releases" tab on the Workbench download page. May 5, 2018 at 9:55
2

After poking around I actually found a way to solve it:

During the configuration, when you reach the authentication method choose the Legacy Authentication Method.

It worked for me~!

2

I was seeing this issue with HeidiSQL, and I found a workaround in the HeidiSQL Github repository:

https://github.com/HeidiSQL/HeidiSQL/issues/163

I fixed by copying libmysql.dll from my last MySql install to my HeidiSQL folder.

1
  • It worked when I delete libmariadb.dll file from HeidiSQL folder as well as updated libmysql.dll from MySQL lib folder.
    – endo64
    Oct 11, 2018 at 13:49
1

If you have just installed mysql server. Run the installer again and it will allow you to reconfigure the options. On the third sceen it will say "Use legacy Authentication method" choose that option

1

I know it is an old post. This is just to share my experience, hoping it will be useful for someone. I also faced similar issue. We can use the portable version of Heidisql. The portable version does not have this issue.

1

using mysql_native_password is a workaround.

Your client software (MySQL Workbench) does not support the authentication plugin most probably because it is an older version.

https://tableplus.io/blog/2018/07/failed-to-load-caching-sha2-password-authentication-plugin-solved.html

follow the above link.

0

The actual reason for "caching_sha2_password" is because while installing MySQL under Authentication Method, by default Use Strong Crypted Password radio button is chosen, instead we need to give User Legacy Authentication type password option for password

Run this in MySQL WorkBench:

ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Then further edit the credential and schema to access under the below directory path:

ror_project_path/config/database.yml
0

If you are using DBeaver and getting this error when importing / restoring a database, then there is a good chance its because your DBeaver needs to be updated.

Once updated, this error went away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.