If you’re looking to set up a robust and efficient database management system on your Ubuntu 22.04 system, MariaDB is an excellent choice. MariaDB is an open-source database system that builds upon the foundations of MySQL, offering similar functionality and performance enhancements. This article will guide you through the process of installing, verifying, and uninstalling MariaDB on Ubuntu 22.04.

Methods of Installation

There are two primary methods for installing MariaDB on Ubuntu 22.04:

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

This method is recommended for beginners as it allows you to quickly get started with MariaDB without adding any additional repositories.

Step 1: Update apt packages

Before installing MariaDB, ensure your package list is up-to-date by running the following command in your terminal:

sudo apt update

Step 2: Install MariaDB

Now, you can install MariaDB on Ubuntu 22.04 with the following command:

sudo apt install mariadb-server -y

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

For those who prefer using the MariaDB repository for installation, follow these steps:

Step 1: Add MariaDB repository

Add the MariaDB repository to your Ubuntu 22.04 system with the following terminal commands:

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’

Step 2: Install MariaDB

Install MariaDB on your Ubuntu 22.04 system by running the following command:

sudo apt install mariadb-server -y

Verifying MariaDB Installation

To check the version of MariaDB installed on your Ubuntu 22.04 system, use the following command:

sudo mysql -v

Uninstalling MariaDB

If you decide to remove MariaDB from your system, follow these steps:

Step 1: Uninstall MariaDB

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

Step 2: Clean up Dependencies

sudo apt-get autoremove -y

MariaDB will be successfully removed from your Ubuntu 22.04 system.

Comparison Table 

MethodDescription
Default RepositoryQuick and easy installation using Ubuntu’s default repositories.
MariaDB RepositoryInstallation via MariaDB’s dedicated repository for more control.

Default Repository:

  • Ease of Use: Installing MariaDB using Ubuntu’s default repositories is straightforward and suitable for beginners;
  • Package Management: You can rely on the apt package manager to handle the installation, making it hassle-free;
  • Updates: MariaDB updates will be synchronized with your Ubuntu system’s package updates, ensuring compatibility.

MariaDB Repository:

  • Version Control: Utilizing MariaDB’s dedicated repository gives you more control over the version you want to install;
  • Latest Features: You can access the latest features and enhancements offered by MariaDB;
  • Community Support: This method may provide better community support for MariaDB-specific issues.
A man works at a computer

 

Conclusion 

In conclusion, installing MariaDB on Ubuntu 22.04 is a straightforward process with multiple options to suit your preferences. Whether you choose the simplicity of using Ubuntu’s default repositories or the flexibility of MariaDB’s dedicated repository, you’ll have a powerful open-source database management system at your fingertips.

MariaDB’s compatibility with MySQL ensures a smooth transition if you’re migrating from MySQL or looking for a robust alternative. The ease of installation, coupled with the extensive community support, makes MariaDB an excellent choice for managing your databases on Ubuntu 22.04.

With MariaDB installed, you can benefit from its performance enhancements and additional features while maintaining familiarity with SQL for data management. Whether you’re a beginner or an experienced database administrator, MariaDB on Ubuntu 22.04 provides the tools you need to handle your data efficiently.

FAQ

1. Can I run MariaDB alongside MySQL on Ubuntu 22.04?

Yes, you can run MariaDB alongside MySQL without conflicts. However, ensure they use different ports and data directories.

2. How can I secure my MariaDB installation on Ubuntu 22.04?

After installation, run sudo mysql_secure_installation to configure security settings, including setting a root password and removing anonymous users.

3. Can I migrate my MySQL databases to MariaDB on Ubuntu 22.04?

Yes, MariaDB is designed as a drop-in replacement for MySQL, so you can easily migrate your databases. Ensure you have backups and follow the MariaDB documentation for a smooth transition.

4. Are there graphical tools available for managing MariaDB on Ubuntu 22.04?

Yes, several graphical database management tools, such as phpMyAdmin and DBeaver, support MariaDB on Ubuntu 22.04, offering a user-friendly interface for database administration.

5. How do I start and stop the MariaDB service on Ubuntu 22.04?

You can use sudo systemctl start mariadb to start the service and sudo systemctl stop mariadb to stop it. Additionally, sudo systemctl enable mariadb ensures it starts automatically on boot.