How to Install MariaDB on Ubuntu 22.04

Install MariaDB on Ubuntu 22.04

In this article, we will have explained the necessary steps to install MariaDB on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

MariaDB is a popular open-source relation database system developed by the original developer of the MySQL server and used for several well-known applications that utilize WordPress and many more.

Prerequisite:

  • Operating System with Ubuntu 22.04
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install MariaDB on Ubuntu 22.04 LTS

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade
sudo apt install software-properties-common dirmngr apt-transport-https

Step 2. Install MariaDB on Ubuntu Linux.

Installing the MariaDB on your Ubuntu 22.04 Jammy Jellyfish system is straightforward, Now import the MariaDB GPG key to verify the authenticity of the installation:

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

Then, add the MariaDB repository use this command:

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://atl.mirrors.knownhost.com/mariadb/repo/10.8/ubuntu jammy main'

After that, install the latest version of MariaDB using the below command:

sudo apt update 
sudo apt install mariadb-server

Once the installation is successful, MariaDB will be started. Use this command to check the service status:

sudo systemctl enable mariadb 
sudo systemctl status mariadb

Step 3. Securing MariaDB.

Now execute the mysql_secure_installation script to secure the MariaDB server and set a password for the root account:

sudo mysql_secure_installation

Install MariaDB on Ubuntu 22.04 LTS

Step 4. Connect to MariaDB.

You can get a MariaDB shell to create users, databases, and other related activities. To connect shell, type:

mysql -u root -p

That’s all you need to do to install MariaDB on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of the MariaDB database server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.