MariaDB is a popular open-source relational database management system that is a drop-in replacement for MySQL. If you're an Ubuntu 22+ user and looking to install MariaDB 10+, this article will provide you with a step-by-step guide to help you through the process.

 mariadb ubuntu

Step 1: Update System Packages.

Before installing any software, it's crucial to update the system packages to ensure you have the latest versions. Open a ssh terminal by pressing Ctrl+Alt+T and run the following commands:

sudo apt update -y
sudo apt upgrade -y

 

Step 2: Install MariaDB


To install MariaDB on Ubuntu 22+, use the following command:

sudo apt install mariadb-server

 

Step 3: Secure MariaDB Installation.


For security purposes, it is highly recommended to run the MariaDB secure installation script. This script will help you set a root password, remove anonymous users, disallow remote root login, and more. Run the following command in the terminal:

sudo mysql_secure_installation

You will be prompted to enter the root password you wish to set. Follow the on-screen prompts to configure the security options based on your preferences.

 

Step 4: Verify MariaDB Installation.

To check if MariaDB is running correctly, you can use the following command to start the MariaDB command-line interface:

sudo mysql

Notice that newer versions of mariadb may require you to substitute the word mysql by mariadb

If you successfully enter the MariaDB shell, the installation was successful.

Exit the shell typing:

> exit

 

Step 5: Basic MariaDB Configuration.

By default, MariaDB listens only on the localhost (127.0.0.1) IP address. If you want to allow connections from remote machines, you need to edit the MariaDB configuration file.

Open the file using a text editor with root privileges:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Locate the line bind-address = 127.0.0.1 and replace it with bind-address = 0.0.0.0 to allow connections from any IP address. Save the changes and exit the text editor.

 

Step 6: Restart MariaDB Service.

To apply the changes made in the configuration file, restart the MariaDB service with the following command:

sudo systemctl restart mariadb

 

Step 7: Test Remote Connection (Optional)

If you modified the MariaDB configuration to allow remote connections, you can test it from another machine. Use a MariaDB client software such as HeidiSQL or the command-line tool to connect to the MariaDB server using the IP address of your Ubuntu machine.

You have successfully installed MariaDB 10+ on your Ubuntu 22+ system. MariaDB is a robust and feature-rich database management system that can handle a wide range of applications. By following this comprehensive guide, you have gained the necessary knowledge to install and configure MariaDB, allowing you to create and manage databases effectively. Now you can leverage the power of MariaDB to develop scalable and reliable applications on your Ubuntu 22+ platform.

 

Further reading: