How to set up MariaDB SSL and secure connections from clients

How to set up MariaDB SSL and secure connections from clients

In this tutorial, I am going to give the instructions on how to set up MariaDB server with TLS/SSL, and how to establish secure connections from the console and PHP/Python scripts.

Iam looking to set up MariaDB SSL/TLS  (Secure Sockets Layer) and secure connections from MySQL client and PHP/Python application. How do I enable SSL for MariaDB server and client running on Linux or Unix-like system?

In this tutorial, I am going to give the instructions on how to set up MariaDB server with TLS/SSL, and how to establish secure connections  from the console and PHP/Python scripts. MariaDB is a database server that offers drop-in replacement functionality for MySQL server. MariaDB is built by some of the original authors of MySQL, with assistance from the broader community of Free and open-source software developers. In addition to the core functionality of MySQL, MariaDB offers a rich set of feature enhancements, including other storage engines, server optimizations, and patches.


How to set up MariaDB SSL/TLS

Sample MySQL/MariaDB setup over SSL

I tested these instructions on RHEL/CentOS 7/8, Debian 9/10, Ubuntu 16.04/18.04/18.04 LTS, Arch Linux, and FreeBSD. However, it should work on other Linux distros too.

Step 1 – Install MariaDB

Type the command as per your Linux or Unix variant.

Install MariaDB server/client on Ubuntu/Debian Linux

Type the following apt-get command or apt command:

$ sudo apt-get install mariadb-server mariadb-client

Install MariaDB server/client on CentOS/RHEL/Fedora Linux

Type the following yum command:

$ sudo yum install mariadb-server mariadb

Fedora Linux user type the following dnf command :

$ sudo dnf install mariadb-server mariadb

Install MariaDB server/client on Arch Linux

Type the following pacman command:

$ sudo pacman -S mariadb

Install MariaDB server/client on FreeBSD unix

To install the port, run:

## cd /usr/ports/databases/mariadb100-server/ && make install clean

## cd /usr/ports/databases/mariadb100-client/ && make install clean

To add the binary package, enter:

## pkg install mariadb100-server mariadb100-client

Step 2 – Secure MariaDB

Type the following command:

$ mysql_secure_installation

Sample outputs:

Fig.01: Secure the MariaDB installation


Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Best Custom Web & Mobile App Development Company

Top Web & Mobile Application Development Company in India & USA. We specialize in Golang, Ruby on Rails, Symfony, Laravel PHP, Python, Angular, Mobile Apps, Blockchain, & Chatbots

10 Cyber Security Tools to Watch Out for in 2021 - DZone Security

In this article, take a look at ten cyber security tools to watch out for in 2021, including NMap, Wireshark, Metasploit, and more!

How to Keep Your Java Applications Secure - DZone Security

The solution to keeping your Java applications secure is simple: make sure they stay up to date. Check out the details within.

What are the top Cyber Security Threats in 2020?

Learn Cyber Defense programming by Cyber Security Training. Know how to stop tactics of ransomware, malware, social engineering, phishing by hacking course.

Cloud Security: Is it Worth it?

Storing and managing corporate data by applying the cloud is becoming more and more popular. Companies grow, and it gets too expensive, and resources consuming to store their data on traditional servers. To prove it, look at the research conducted by Google in 2019 that includes insights for the cloud computing market for the next 10 years.