Connect liquibase to mysql with ssl (equire_secure_transport=ON)

Trying to connect to mysql database
it has require_secure_transport=ON

I modified my db url to include useSSL=true
and added ca-cert to the java certificate store,

Still it is not working

Below is the sample command*

bash liquibase–changeLogFile=change_file_1.0.sql --url=jdbc:mysql://db.company.com:3306/sys?useSSL=true --username= --password= --driver=com.mysql.jdbc.Driver --classpath=mysql-connector-java-5.1.13.jar --logLevel=debug update

Please help.

Hello,

Try to do it the same way as on the official documentation : Using Liquibase with MYSQL | Liquibase Docs


Regards,
Ahmed.

Hi Ahmed,
Thank you for your reply.

I am doing the same way as mentioned in official documentation.
Can you point me out where I am wrong.
I would highly appreciate it as I am stuck on this.

Regards,
Anuraj

Hi,

I tried to make the configuration using mysql of phpmyadmin.

1- I added this line in the file my.ini :
[mysqld]

default_time_zone=’+00:00’

default-time-zone=+00:00
2- I downloaded mysql driver fromthis link Central Repository: mysql/mysql-connector-java/8.0.17
3- I created a changelog test.xml:

4- I installed the changelog using this command :

liquibase --changeLogFile=./test.xml --url=jdbc:mysql://localhost:3306/test?useUnicode=true --driver=com.mysql.cj.jdbc.Driver --classpath=./mysql-connector-java-8.0.17.jar --username=root update

Regards,
Ahmed

Hi Ahmed,

Thank you for the reply.

I think I am not clear in explaining the problem at hand. Let me re-iterate it.
I am not facing issue while connecting to normal db. It works perfectly fine the way you have shown.

Problem arises when I have ssl enabled on database, that when I add useSSL=true in my db url string
Although I am adding correct certificate to trust store, connection could not be established.

Regards,
Anuraj

Hello,

I have updated my command like this:

liquibase --changeLogFile=./test.xml --url=“jdbc:mysql://localhost:3306/test?autoReconnect=true&useSSL=true” --driver=com.mysql.cj.jdbc.Driver --classpath=./mysql-connector-java-8.0.17.jar --username=root update

It’s working fine.

Regards,
Ahmed

Hi Ahmed,

Thank you for your reply.

I can see you are working with localhost.
Could you please point out how did you pass certificate to connect through ssl?

Regards,
Anuraj

Hello,

Those are two links that may help you :

https://docs.liquibase.com/workflows/database-setup-tutorials/cockroachdb.html
https://www.cockroachlabs.com/docs/v20.2/cockroach-cert.html

Regards,
Ahmed.

Hi @anuraj-centime

I’m not a pro in MySQL so please bear with me. Could you please tell me if you are able to connect to your DB with useSSL=true setting manually? By manually I mean without using Liquibase.

If not, could you please check this article and then try the same with liquibase.

Thanks,
Rakhi Agrawal