Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-856

Unable to connect with mariadb from spring boot application in SSL mode

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • None
    • N/A
    • SSL
    • None

    Description

      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;
      

      So we are not using any password while creating user.

      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
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            vishalbiradar Vishal Biradar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.