Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

DBeaver cannot verify the MySQL server certificate

Errorunable to find valid certification path to requested target

Short answer

DBeaver's MySQL driver is checking the server certificate and Java does not trust the CA that signed it. Import the server's CA file into a truststore with keytool and give DBeaver that truststore through driver properties, or set the CA certificate in the SSL tab. Turning verification down is only for trusted networks.

  • Applies to DBeaver 25, MySQL Connector/J 8, MySQL Server 8.4
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out who signed the server certificate, because the CA file is what the driver is missing. Ask the server for the CA file path it uses.

    mysql -u root -p -e "SHOW VARIABLES LIKE 'ssl_ca'"
  2. 2Match what you see, then jump to its fix

    1. 1The error appears only with SSL verification on (VERIFY_CA or VERIFY_IDENTITY); the server uses a self-made or private CAThe CA that signed the server certificate is not in Java's truststoreFix
    2. 2SSL is enabled for the connection but no CA Certificate path is filled inThe CA certificate is not set in DBeaver's SSL tabFix

What does the error look like?

  • unable to find valid certification path to requested target

Cause 1 of 2

The CA that signed the server certificate is not in Java's truststore

1Check

With verification on, Java checks the server certificate against its default trusted CAs, usually $JAVA_HOME/lib/security/cacerts. A private CA is not there.

keytool -list -keystore $JAVA_HOME/lib/security/cacerts | grep -i mysql

2Fix

Import the CA file (ca.pem from the server) into your own truststore, then tell the driver about it. In DBeaver open the connection, Driver properties, and add the two Connector/J properties below.

keytool -importcert -alias MySQLCACert -file ca.pem -keystore truststore -storepass mypassword

# DBeaver > Edit Connection > Driver properties
trustCertificateKeyStoreUrl = file:/path/to/truststore
trustCertificateKeyStorePassword = mypassword

3Verify

Press Test Connection in the DBeaver connection dialog.

keytool -list -keystore truststore -storepass mypassword

Confirmed by dev.mysql.com

Did this fix it?

Cause 2 of 2

The CA certificate is not set in DBeaver's SSL tab

1Check

Open the connection, add the SSL tab with the plus button, and look at the CA Certificate field and the Verify server certificate box.

ls -l /path/to/ca.pem

2Fix

Set CA Certificate to the path of the CA file, keep Verify server certificate on, and use Test Configuration.

DBeaver: Edit Connection > SSL > CA Certificate = /path/to/ca.pem

3Verify

Test Configuration reports success.

DBeaver: Test Configuration

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Keep the CA file with your connection documentation so a new laptop can import it in a minute.
  • Do not turn certificate checks off for a server on the public internet.
  • Use VERIFY_IDENTITY only when the host name in DBeaver matches the certificate.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.