close

[Solved] Unable to load authentication plugin ‘caching_sha2_password’. at at com.mysql.jdbc.SQLError.createSQLException

Hello Guys, How are you all? Hope You all Are Fine. Today java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password’. at at com.mysql.jdbc.SQLError.createSQLException in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How This Error Occurs ?

I am facing following error while using mysql with java.

at java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password’. at at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:868) at at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:864) at at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1746) at at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226) at at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2191) at at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222) at at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017) at at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779) at at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at at java.lang.reflect.Constructor.newInstance(Unknown Source) at at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) at at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) at at java.sql.DriverManager.getConnection(Unknown Source) at at java.sql.DriverManager.getConnection(Unknown Source) at at ch.qos.logback.core.db.DriverManagerConnectionSource.getConnection(DriverManagerConnect

How To Solve Unable to load authentication plugin ‘caching_sha2_password’. at at com.mysql.jdbc.SQLError.createSQLException Error ?

  1. How To Solve Unable to load authentication plugin 'caching_sha2_password'. at at com.mysql.jdbc.SQLError.createSQLException Error ?

    To Solve Unable to load authentication plugin 'caching_sha2_password'. at at com.mysql.jdbc.SQLError.createSQLException Error Here you are using wrong mysql_connector. So Just Use connector of same mysql version. You need just to delete your older connector and download new version mysql-connector-java.

  2. Unable to load authentication plugin 'caching_sha2_password'. at at com.mysql.jdbc.SQLError.createSQLException

    To Solve Unable to load authentication plugin 'caching_sha2_password'. at at com.mysql.jdbc.SQLError.createSQLException Error Here Mysql official document says Starting with MySQL 8.0.4, they have changed the default authentication plugin for MySQL server from mysql_native_password to caching_sha2_password. So Just run this command and your issue will be solved: ALTER USER 'your_username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_pass'; Now, your issue must be solved.

Solution 1: Just run this command

Here Mysql official document says Starting with MySQL 8.0.4, they have changed the default authentication plugin for MySQL server from mysql_native_password to caching_sha2_password. So Just run this command and your issue will be solved.

ALTER USER 'your_username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_pass';

Now, your issue must be solved.

Solution 2: Upgrade mysql-connector lib package

Just need to Upgrade mysql-connector lib package. Just like this.

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
    <version>8.0.13</version>
</dependency>

Solution 3: Use connector of same mysql version

Here you are using wrong mysql_connector. So Just Use connector of same mysql version. You need just to delete your older connector and download new version mysql-connector-java.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment