I have a VM running Rocky Linux release 8.7 (Green Obsidian) and have some Perl programs that use DBI/DBD for mysql connections to a Google Cloud database that requires a SSL connection.
All the parameters (i.e., ssl cert/key/server-ca) work fine when running the mysql command line to connect to the database. However, when running the Perl programs, they fail with that error.
So it is NOT a bad certificate on the server side (at least in my case), but instead something with the Perl libraries.
Some resources talk about how mariadb is the culprit, but I was running mysql-community server and still had an issue, and I even downgraded MySQL to 5.7 from 8.0 with no luck. It turns out however that when I installed Perl libraries for perl-DBD-MySQL and perl-DBI those did a dependency install of a mariadb connector!
So basically I removed all mariadb packages, and then made sure we had the packages for:
- mysql-community-common
- mysql-community-devel
- mysql-community-libs
And then used CPAN to install the DBI and DBD::mysql packages
Then things worked! So the key I believe is to not use the yum/dnf versions for DBI/DBD that tie to mariadb, and instead install those via CPAN.
Hope this helps someone out there, because I really went through a lot of attempts on this to get it going.