Error:
An occasional fault is found and an error is reported when initializing the database connection pool:
public key is not available client side (option serverRsaPublicKeyFile not set)
Detailed error reporting contents are as follows:
2022-08-24 16:35:08.008 ERROR 233504 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
java.sql.SQLTransientConnectionException: Could not connect to address=(host=127.0.0.1)(port=3306)(type=master) : RSA public key is not available client side (option serverRsaPublicKeyFile not set)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:79)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
After a long time of troubleshooting, it was finally found that the reason is:
the database used in the project is MySQL 8.0.X, but the connection driver used is MariaDB (MariaDB was used before). pom file dependencies are as follows:
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.6.1</version>
</dependency>
Solution:
Just change the driver to MySQL
pom.xml dependency
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
application.yml driver and URL configuration.
spring:
datasource:
driver: driver: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/databaseName?serverTimezone=GMT%2B8&characterEncoding=utf8
Read More:
- How to Solve Error: Rsa Public Key not Find
- Error [err] is reported when redirecting_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
- Ubuntu ODBC MySQL 8 OPTION NOT Work [How to Solve]
- MYSQL Slave is not configured or failed to initialize properly. You must at least set –server-id
- [Solved] MySQL Error: Client does not support authentication protocol requested by server
- MYSQL Index Key Length 1071 – Specified key was too long; max key length is 3072 bytes
- Navicat connected to Mysql error: Client does not support authentication protocol requested by server;
- [Solved] EOS7.6 Error: Init DB failed [Specified key was too long; max key length is 767 bytes…
- Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 – Connection is not available, request timed out after 30005ms.
- [MySQL] Note that MySQL5.1 does not support utf8mb4 Error 1115: Unknown character set:’utf8mb4′
- [Solved] Description: Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- [Solved] com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
- Mybatis Error setting non null for parameter #15 with JdbcType null Could not set parameters for
- [Solved] Error: ER_HOST_NOT_PRIVILEGED: Host ‘x.x.x.x‘ is not allowed to connect to this MySQL server
- Error creating foreign key in MySQL: 1215 cannot add the foreign key constraint
- Hive install initialization error: Error: Duplicate key name ‘PCS_STATS_IDX‘ (state=42000,code=1061)
- [Solved] ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate
- [Solved] MySQL: Syntax error or access violation: 1055 Expression #1 of SELECT list is not …
- How to Solve Embulk Error: OutputPlugin’bigquery’ is not found