Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load authentication plugin 'caching_sha2_password' [duplicate]

I'm getting error

Cannot establish a connection to jdbc:mysql://localhost:3306/world?zeroDateTimeBehavior=convertToNull using com.mysql.jdbc.Driver (Unable to load authentication plugin 'caching_sha2_password'.)

in netbean established the connection.

enter image description here

like image 744
Vijay Kumar Avatar asked May 05 '18 20:05

Vijay Kumar


People also ask

What is caching_sha2_password?

caching_sha2_password supports connections over secure transport. If you follow the RSA configuration procedure given later in this section, it also supports encrypted password exchange using RSA over unencrypted connections.

What is Mysql_native_password?

The mysql_native_password authentication plugin is the default authentication plugin that will be used for an account created when no authentication plugin is explicitly mentioned and old_passwords=0 is set.


1 Answers

The newer versions of MySQL default to caching_sha2_password. If you want to disable it then follow below steps

  1. Login in to your MYSQL console as root user like below.

eg mysql -u YOUR_ROOT_USER_NAME -p YOUR_ROOT_USER_PASSWORD

  1. Then execute the command by replacing YOUR_ROOT_USER_NAME and YOUR_ROOT_USER_PASSWORD

ALTER USER 'YOUR_ROOT_USER_NAME'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_ROOT_USER_PASSWORD';

You will no longer get any 'caching_sha2_password' exception while connecting for any client after this.

like image 94
utpal416 Avatar answered Oct 04 '22 04:10

utpal416