Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Authentication plugin 'caching_sha2_password'

Tags:

mysql

I'm new to MySql environment and installed : MySQL with the following commands:

sudo apt-get update sudo apt-get install mysql-server mysql_secure_installation 

and also installed mysql workbench.

But when I'm trying to connect my localhost getting the follow error:

"Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory"

Error Screenshot

and even this is the first time I'm posting a question in stackoverflow, sorry for my presentation errors and syntax.

like image 566
nandipati vamsi Avatar asked Apr 22 '18 07:04

nandipati vamsi


People also ask

What is caching_sha2_password?

In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password . For information about the implications of this change for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin.

What are authentication plugins?

A plugin that performs native authentication; that is, authentication based on the password hashing method in use from before the introduction of pluggable authentication in MySQL. The mysql_native_password plugin implements authentication based on this native password hashing method.

Which plugin is required for Windows authentication?

Answer. Yes, there is a GSSAPI plugin thatt can authenticate in Windows AD with Kerberos. It can also authenticate on a standalone computer.


Video Answer


1 Answers

So I found the reason for that error message (at least for my case). It's because MySQL as of version 8.04 and onwards uses caching_sha2_password as default authentication plugin where previously mysql_native_password has been used.

This obviously causes compatibility issues with older services that expect mysql_native_password authentication.

Solutions:

  1. Check for an updated version of the client service you are using (most recent workbench for instance).

  2. Downgrade the MySQL Server to a version below that change.

  3. Change the authentication plugin on a per user basis (I didn't find a global option, maybe there exists one though).

Now regarding option 3 this is as simple as altering the user:

ALTER USER user IDENTIFIED WITH mysql_native_password BY 'pw'; 

or when creating the user:

CREATE USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; 

See MySQL Server Blog

See Oracle

like image 176
meow Avatar answered Sep 17 '22 02:09

meow