Cannot connect to MariaDB through NodeJS

I have a LetsEncrypt cert on a ubuntu server that is working fine except that I cannot seem to connect to a remote MariaDB successfully with it through Node JS.

I have three servers:

  1. running MariaDB.
  2. running A node app with a purchased SSL cert and it connect and runs fine.
  3. has a LE cert that works fine, I can use it through Node JS except I cannot connect to my MariaDB.

It is the exact same code as #2 except for the new server options including the LE certs, as follows:

var options = {
key: fs.readFileSync(’/etc/letsencrypt/live/mydomain/privkey.pem’),
cert: fs.readFileSync(’/etc/letsencrypt/live/mydomain/fullchain.pem’),
ca: fs.readFileSync(’/etc/letsencrypt/live/mydomain/chain.pem’)

So everything seems to work except I cannot connect to the DB. And I get no errors.

Hi @thierce,

Can you give more information about how MariaDB uses the certificate? What do you mean that you “can use it through Node JS”? And what do you mean that you “cannot connect to the DB”? What do you do that works and that doesn’t work?

Hi schoen,

I would like to put this topic on ‘hold’ - if I could.
I recreated the app, bypassing https and the certs altogether and I am still having a problem - suggesting it may not be a problem with the LetsEncrypt certificates at all.

If the problem persists after more testing and I still think it is LE related, I’ll try and explain in more detail.
For now, I need to run through everything else.

Sorry if I jumped the gun!

hi @schoen

Fork knowledge.

MariaDB is a fork of MySQL.

There are two types of MySQL connections that can be run on MySQL. MySQL unecnrtyped and MySQL over TLS. The config is pretty straight forward.

The Client config can be a bit tricky. @thierce confirms that it was not core connectivity that core connectivity was not an issue I will post the config and testing I did for a project a while back.


@schoen & @ahaw021,

Thank you both for your time, however, it turned out to be a subnet issue that I was not aware of.
Totally not related to LetsEncrypt certs at all.

It is up and running and I like it a lot. I am trying to implement LE certs in every app I can - not all acceptable yet - but getting there!

Thanks guys
Feel free to delete this post if that is an option.

hi @thierce

I think it’s good to leave posts as is just so people get an idea to test netowrk etc.

Sometimes people are too quick to blame certs etc


Yup, that was me. But time is relative when you’re beating your head.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.