Ubuntu 26.04

MariaDB 11.8 : SSL/TLS Setting2026/05/28

 

Configure SSL/TLS Setting on MariaDB.

[1]

Get SSL Certificate, or Create self-signed Certificate.
It uses self signed Certificate on this example.

[2] Configure MariaDB.
# copy certificates

root@www:~#
mkdir /var/lib/mariadb/pki

root@www:~#
cp /etc/ssl/private/{server.crt,server.key} /var/lib/mariadb/pki/

root@www:~#
chown -R mysql:mysql /var/lib/mariadb/pki
root@www:~#
vi /etc/mysql/mariadb.conf.d/50-server.cnf
# line 88 : specify certificates you set

ssl-cert = /var/lib/mariadb/pki/server.crt
ssl-key = /var/lib/mariadb/pki/server.key
root@www:~#
systemctl restart mariadb
# verify settings

root@www:~#
mariadb

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 11.8.6-MariaDB-5 from Ubuntu -- Please help get to 10k stars at https://github.com/MariaDB/Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# OK if status is like follows
MariaDB [(none)]> show variables like '%ssl%'; 
+---------------------+---------------------------------+
| Variable_name       | Value                           |
+---------------------+---------------------------------+
| have_openssl        | YES                             |
| have_ssl            | YES                             |
| ssl_ca              |                                 |
| ssl_capath          |                                 |
| ssl_cert            | /var/lib/mariadb/pki/server.crt |
| ssl_cipher          |                                 |
| ssl_crl             |                                 |
| ssl_crlpath         |                                 |
| ssl_key             | /var/lib/mariadb/pki/server.key |
| version_ssl_library | OpenSSL 3.5.5 27 Jan 2026       |
+---------------------+---------------------------------+
10 rows in set (0.001 sec)
[3] To connect with SSL/TLS from Clients, mysql command has [--ssl] option, however, it is enabled by default on MariaDB 10.11 client, so SSL/TLS connection is used automatically if SSL/TLS settings is enabled on Server side setting.
root@www:~#
mariadb

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 11.8.6-MariaDB-5 from Ubuntu -- Please help get to 10k stars at https://github.com/MariaDB/Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# show status
MariaDB [(none)]> show status like 'ssl_cipher'; 
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| Ssl_cipher    | TLS_AES_256_GCM_SHA384 |
+---------------+------------------------+
1 row in set (0.000 sec)

MariaDB [(none)]> exit 
Bye

# on no SSL/TLS connection

root@www:~#
mariadb --skip-ssl

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 33
Server version: 11.8.6-MariaDB-5 from Ubuntu -- Please help get to 10k stars at https://github.com/MariaDB/Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# value is empty
MariaDB [(none)]> show status like 'ssl_cipher'; 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Ssl_cipher    |       |
+---------------+-------+
1 row in set (0.000 sec)
[4] To force require users to connect with SSL/TLS, set like follows.
root@www:~#
mariadb

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 34
Server version: 11.8.6-MariaDB-5 from Ubuntu -- Please help get to 10k stars at https://github.com/MariaDB/Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# create a user who is required SSL/TLS
MariaDB [(none)]> create user resolute identified by 'password' require ssl; 
Query OK, 0 rows affected (0.00 sec)

# SSL/TLS required users are set [ssl_type] = [ANY]
MariaDB [(none)]> select user,host,ssl_type from mysql.user; 
+-------------+-----------+----------+
| User        | Host      | ssl_type |
+-------------+-----------+----------+
| mariadb.sys | localhost |          |
| root        | localhost |          |
| mysql       | localhost |          |
| ubuntu      | %         |          |
| serverworld | %         |          |
| resolute    | %         | ANY      |
+-------------+-----------+----------+
6 rows in set (0.001 sec)

# set SSL/TLS required to an existing user
MariaDB [(none)]> grant usage on *.* to 'serverworld'@'%' require ssl; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> select user,host,ssl_type from mysql.user; 
+-------------+-----------+----------+
| User        | Host      | ssl_type |
+-------------+-----------+----------+
| mariadb.sys | localhost |          |
| root        | localhost |          |
| mysql       | localhost |          |
| ubuntu      | %         |          |
| serverworld | %         | ANY      |
| resolute    | %         | ANY      |
+-------------+-----------+----------+
6 rows in set (0.000 sec)
Matched Content