Sometimes, when you run Java, an error is called Unable to load authentication plugin ‘caching_sha2_password’. at at com.mysql.jdbc.SQLError.createSQLException appears, and you don’t know how to fix it.
Don’t worry! We will show you all the answers right here in the following blog post, so make sure you read to the end of it. Let’s begin!
How It Appears?
We encountered the error when we were using Java, and it appears as follows.
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 Fix The Error?
You must be using the incorrect mysql connector. So the solution is to try a compatible connection with the same version as mysql. Remove your precious connector and download the latest version of mysql-connector-java.
According to the official documentation, the standard validation plugin has been changed from mysql_native_password to catching_sha2_password.
Run the command ALTER USER ‘your_username’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘your_new_pass’ to solve the error.
We have an error line that appears in our official Mysql documentation, so to fix it, we put in this command.
ALTER USER 'your_username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_pass';
Upgrade the mysql-connector-lib library with this command.
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> <version>8.0.13</version> </dependency>
You may be using the incorrect mysql connector. So, to fix it, use a connection that is compatible with the same version as MySQL. Remove the old connection and download the new version.
The article is how the Unable to load authentication plugin ‘caching_sha2_password’. at at com.mysql.jdbc.SQLError.createSQLException error occurs and the possible solutions to fix it.
If you have any questions about the article, please feel free to let us know in the comment section below to support you with the best answers. Thank you for your time!
- How to use correctly “useMemo vs. useEffect + useState”Hello everyone, today I will talk about useMemo in Reactjs. Talk about Reactjs programmers, you’ve probably used React hooks, specifically here useMemo, it’s quite familiar but not everyone understands and uses it properly so… Today we will learn its usage in this case “useMemo vs. useEffect + useState”. Let’s started! Difference between “useMemo vs. useEffect […]
- Definition about Basic Math Functions.Java, which is an important programming language, is a popular program computer in the world. Java is also used for: mobile applications (especially Android apps; desktop applications; web applications; web servers and application servers; database connection; and much more. Above the key information of Java, we have the answer for why we use Java. Moreover, […]
- The simple way to fix “Unable to resolve dependency tree” in ReactjsEach of these pieces of code can depend on a lot of other open source code, fortunately when library management tools came out, otherwise it would take a lot of work to manage these libraries. With npm, the work will be much simpler, they help you make the management much simpler. The libraries are all […]
- Instruction about “Arrays within a Class”.Before you know about the “Arrays within a Class”, we will help to identify the necessary information of object oriented programming language. It is a useful definition in this program language before you can explore the classes and objects that Arrays within a Class belong to. If you have been waiting for our instruction, we […]
- Tips On Handling The Error “ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’”One of the common problems that developers face when working with Android devices is the error – The emulator process for AVD Pixel_C_API_30 was killed. This problem can usually be solved by changing the AVD configuration or upgrading the device driver. This blog will help you to fix this issue. How To Handle The Error […]