I have MariaDB deployed as a pod into the k8s cluster.
DB is enabled with SSL mode which will not allow users/clients to login to DB without certs. So we can not use a username and password to login to DB. We must use only the certificates to do so.

User creation statement:

CREATE USER 'test'@'%' REQUIRE X509;
GRANT ALL ON *.* TO 'test'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Note: So we are not using any password while creating users.

Login to DB:

mysql -uroot --ssl-key=/keys/peer-key.pem --ssl-cert=/certificates/peer.pem --ssl-ca=/ca/cacerts.pem

So I tried enabling SSL mode on mariadb to the spring boot app side as shown below:


spring.datasource.url=jdbc:mariadb://IP:3306/myDB?useSSL=true&trustServerCertificate=true&serverSslCert=/certificates/peer.pem&disableSslHostnameVerification=true
spring.datasource.username=test
spring.datasource.password=
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

But I am getting an error:


Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'

Versions:

mariadb: mysql Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1
mariadb-java-client: 2.7.2
spring boot: 2.3.4

CAPTCHA