Skip to Content

failed to connect to database: Error: TLS/SSL error: Permission denied

How to solve TLS/SSL error?


Overview: This article helps in resolving the error "failed to connect to database: Error: TLS/SSL error: Permission denied" by correcting the permissions of the directory that contains the SSL/TLS certificates and keys.


Step 1: Check for the latest messages from the application log. Navigate to the log directory and tail the latest log.

root@gateway:~# cd $(awk ’/^system_folder/ {print $2}’ /usr/local/etc/ezlogin/ez.conf)/application/logs/

root@gateway:/var/www/ezlogin/application/logs# tail log-2024-09-24.php

failed to connect to database: Error: TLS/SSL error: Permission denied

Step 2: Check and correct the permission of of the directory that contains the SSL/TLS certificates and keys.

root@gateway:~# chmod 755 /path/to/ssl/tls/certificates/directory/

root@gateway:~# chmod 644 /path/to/ssl/tls/certificates/directory/client-cert.pem

Example:

root@gateway:~# chmod 755 /etc/certs/

root@gateway:~# chmod 644 /etc/certs/client-cert.pem

Step 3: If you have a cluster setup ensure that the same certificates and keys are used for both the primary and secondary nodes. Copy the certificates and keys from the primary node to the secondary node. The following certificates and keys should be copied:

root@gateway:~# cd /path/to/ssl/tls/certificates/directory/

Example: 

root@gateway:~# cd /etc/certs

root@gateway:/etc/certs# ls

ca-key.pem client-cert.pem  server-key.pem 
ca.pem     client-key.pem   server-cert.pem 


Related Articles:

Configure jump server to use SSL for MySQL

Configure ssh jump server to use SSL for Mariadb

SSL Certificate failed with MySQL SSL

Install Master/Slave Ezeelogin with MySQL SSL