Connect to external MySql database with TLS

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
FlemmingH
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 02.08.2022, 15:15

Connect to external MySql database with TLS

Post by FlemmingH »

I have been using Zeoslib with Putty tunnel to connect to my external database and it have been working fine for years :D But then my host sells out and i'm forced to move my site to another host. After setting it all up i realize that i can't connect with SSH because the MySql server doesn't provide ftp access. The only security protocol the provider offers is TLS, but i can't find anything explanation on how to use TLS protocols in ZeosLib? Isn't it supported?
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

Re: Connect to external MySql database with TLS

Post by Fr0sT »

Umm, I don't know precisely but it should be only the matter of proper client lib configuration. Zeos has nothing to do with transport layer. Have you read corresponding MySQL docs?
MJFShark
Expert Boarder
Expert Boarder
Posts: 218
Joined: 04.06.2020, 13:59

Re: Connect to external MySql database with TLS

Post by MJFShark »

I'm no expert on MySQL or TLS however I was able to get an SSL connection (or at least connect) by using the database property:

MYSQL_SSL=TRUE

It also seemed that I had to use the mariadb client as the mysql one that I tried didn't appear to support ssl.

More info:
viewtopic.php?f=19&t=129183

-Mark
FlemmingH
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 02.08.2022, 15:15

Re: Connect to external MySql database with TLS

Post by FlemmingH »

Thanks both of you.

It seems that i don't have to be concerned then. When i read the 'Ssl_cipher' from the established connection i get 'DHE-RSA-AES256-SHA'. As i understand it that's a thumbs up on SSL connection. I didn't need to set the MYSQL_SSL=TRUE.

Hopefully i'm right in my assumption and can close this thread.
Bruce27
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 04.05.2023, 16:42

Re: Connect to external MySql database with TLS

Post by Bruce27 »

Just in case this helps anyone else, I am connecting to a remote MySQL 8.0 database using SSL. On the server, I have set up a remote user for whom SSL is required.

Using Zeoslib with Lazarus/Free Pascal (from Windows 11 Pro 64-bit), I have set up a connection with the libmariadb.dll connector.

When I DON'T include MYSQL_SSL=TRUE in the connector properties, I get a "User access denied" error.

When I DO include MYSQL_SSL=TRUE in the connector properties, I can connect without any problem.

To summarize, my set-up is:

Lazarus 2.2.2 with Free Pascal 3.2.2, all 64-bit.
MySQL 8.0.32 hosted on a remote VPS.
Zeol version 7.2.14.
libmariadb.dll connector taken from a 64-bit WAMP installation of MariaDB 10.11.
Post Reply