java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
时间: 2023-10-25 09:34:00 浏览: 289
This error occurs when the MySQL server is configured to use the caching_sha2_password authentication plugin, but the JDBC driver used by the Java application is not compatible with this plugin.
To resolve this issue, you can do one of the following:
1. Upgrade the JDBC driver to a version that supports the caching_sha2_password authentication plugin. You can download the latest version of the JDBC driver from the MySQL website.
2. Change the MySQL server's authentication plugin to a plugin that is supported by the JDBC driver. For example, you can change the authentication plugin to mysql_native_password by running the following command in the MySQL console:
ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Replace 'username' and 'password' with the actual username and password used to connect to the MySQL server.
After making these changes, restart the MySQL server and try connecting to it from the Java application again.
阅读全文