# SQL communication TLS/SSL encryption and error self\_signed\_cert\_in\_chain solution

**URL:** https://discourse.nodered.org/t/sql-communication-tls-ssl-encryption-and-error-self-signed-cert-in-chain-solution/47954
**Category:** General
**Created:** [2 July 2021 21:08 UTC](https://discourse.nodered.org/t/sql-communication-tls-ssl-encryption-and-error-self-signed-cert-in-chain-solution/47954 "2021-07-02T21:08:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nikolay](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@Nikolay](https://discourse.nodered.org/u/Nikolay)
#### Post date: [2 July 2021 21:08 UTC](https://discourse.nodered.org/t/sql-communication-tls-ssl-encryption-and-error-self-signed-cert-in-chain-solution/47954/1 "2021-07-02T21:08:47Z")

</div>

I was using the node-red-contrib-stackhero-mysql as I wanted secure SSL connection to a mariadb 10.x. The first issue was that on Debian/Ubuntu a custom SSL library is used for Mariadb and not the openssl library and it did not work as there was a cipher issue (you may compile mariadb with openssl to be used but I just switched to another Linux 😄 ). I installed mariadb 10.x on centos7 but not now I saw a new issue after solving the first because I was using a not public CA signed certificate and using the solution for HTTP communication like " NODE\_TLS\_REJECT\_UNAUTHORIZED=0 " did not help at all. Finally looking at [mysql - npm](https://www.npmjs.com/package/mysql) and the "SSL options" I got the idea to add to the main.js file under """\<home/user or root\>node-red/node\_modules/node-red-contrib-stackhero-mysql/src"" this code " ssl: {rejectUnauthorized: false}, " (I insatalled node-red during being a root user so this is why it was under root not home/\<user\_dir\>).

```auto
 // Note: the connection is not done here
  this.pool = mysql.createPool({
    host: config.host,
    port: config.port,
    user: this.credentials.user,
    password: this.credentials.password,
    database: config.database,
    waitForConnections: true,
    connectionLimit: 5,
    queueLimit: 0,
    connectTimeout: 1000,
    ssl: config.tls ? {} : false,
    ssl: {rejectUnauthorized: false},

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [31 August 2021 21:09 UTC](https://discourse.nodered.org/t/sql-communication-tls-ssl-encryption-and-error-self-signed-cert-in-chain-solution/47954/2 "2021-08-31T21:09:22Z")

</div>

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