How to Install MariaDB on Ubuntu 22.04


MariaDB is a widely used open-source database management system that is built upon the foundations of MySQL. MariaDB aims to be a drop-in replacement for MySQL, providing similar functionality and performance with some additional features and enhancements. Like MySQL, MariaDB uses SQL to manage data, and it supports a wide range of operating systems and platforms, specifically for Ubuntu 22.04.

In this blog, we will have an overview of the installation and uninstallation of MariaDB on Ubuntu 22.04 and discuss the following points:

  • Method 1: Installing MariaDB Using Ubuntu 22.04’s Default Repositories
  • Method 2: Installing MariaDB on Ubuntu 22.04 Using the MariaDB repository
  • How to Verify the Version of MariaDB on Ubuntu 22.04?
  • How to Delete/Uninstall MariaDB on Ubuntu 22.04?

Method 1: Installing MariaDB Using Ubuntu 22.04’s Default Repositories

Ubuntu comes with a set of default repositories that provide software packages that can be installed using the apt package manager. “apt” is used to perform app-based operations like searching, updating, installing, and uninstalling.

In this section, we will use Ubuntu 22.04’s default repositories to install MariaDB. This method is recommended for beginners who want to quickly get started with MariaDB without having to add any additional repositories.

Step 1: Update apt packages

For installing MariaDB on Ubuntu 22.04, you need to update the packages first. To do so, hit “CTRL+ALT+T” to open the terminal. Then, write the provided command in the terminal:

sudo apt update

Step 2: Install MariaDB

To install MariaDB on Ubuntu 22.04, run the following command in the terminal:

 

sudo apt install mariadb-server -y

Wait for the installation process to get completed: MariaDB has been installed on Ubuntu 22.04.

Method 2: Installing MariaDB on Ubuntu 22.04 Using the MariaDB repository

MariaDB provides its own repository that can be added to Ubuntu in order to download, install and update MariaDB packages. The MariaDB repository is a collection of packages that are specifically designed for the MariaDB database management system. In this approach, we will specifically use the MariaDB repository for the installation of MariaDB.

Step 1: Add MariaDB repository

Run the mentioned commands in the terminal to add the MariaDB repository to Ubuntu 22.04:

 

sudo apt update
sudo apt install software-properties-common
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mirror.nodesdirect.com/mariadb/repo/10.6/ubuntu focal main'

To continue the process, press Enter:

MariaDB’s repository has been added to your system successfully. Now, heading toward the next step.

Step 2: Install MariaDB

To install MariaDB on your Ubuntu 22.04, write the mentioned command in the terminal:

sudo apt install mariadb-server -y

MariaDB has been installed on Ubuntu 22.04 successfully.

How to Verify/Check the Version of MariaDB on Ubuntu 22.04?

To verify MariaDB’s version on your Ubuntu 22.04, execute the mentioned command in the terminal:

sudo mysql -v

It can be observed that MariaDB’s 10.6.12 version has been installed on Ubuntu 22.04.

How to Delete/Uninstall MariaDB on Ubuntu 22.04?

If you feel that you no longer need MariaDB, then follow this method to remove it from your Ubuntu 22.04.

Step 1: Uninstall MariaDB

As the first step, execute the command mentioned below:

sudo apt-get remove --purge mariadb-server mariadb-client mariadb-common -y

Wait until the uninstallation process gets completed:

Step 2: Clean up Dependencies

Finally, clean up any dependencies that were installed with MariaDB but are no longer needed:

sudo apt-get autoremove -y

MariaDB has been removed successfully from Ubuntu 22.04.

Conclusion

To install MariaDB on Ubuntu 22.04, you can use both Ubuntu’s default repository and MariaDB’s repository. To implement the first approach, update the packages, then, execute “sudo apt install mariadb-server -y” in the terminal. If you are interested to proceed with the second method, then, add the MariaDB repository to Ubuntu 22.04. As the final step, type out “sudo apt install mariadb-server -y” in the terminal. In this blog, we have checked out the method of installation, its verification, and the uninstallation process of MariaDB.

Print Friendly, PDF & Email
Categories

2 Comments

Add yours

Comments are closed.