Install MariaDB 10.11 on Ubuntu 22.04

This guide intends to teach you to Install MariaDB 10.11 LTS on Ubuntu 22.04.

MariaDB is an open-source database to help store and organize data. It’s similar to other popular database software like MySQL but has some unique features and improvements.

The current LTS version which is maintained for five years is MariaDB 10.11. Let’s see how to install it on your Ubuntu 22.04.

Steps To Install MariaDB 10.11 on Ubuntu 22.04

To install MariaDB 10.11, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 22.04.

Now follow the steps below to complete this guide.

MariaDB 10.11 Installation on Ubuntu 22.04

First, you need to install the required packages and dependencies on your server with the following command:

sudo apt install curl software-properties-common dirmngr ca-certificates apt-transport-https -y

Import MariaDB 10.11 GPG Key & Repository

At this point, you need to import the MariaDB 10.11 GPG key and Repository by using the following curl command:

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.11

In your output you will see:

Output
# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.11 is valid
# [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
# [info] Adding trusted package signing keys...
# [info] Running apt-get update...
# [info] Done adding trusted package signing keys

Then, update your local package index with the following command:

sudo apt update

Installing MariaDB 10.11

To install MariaDB, you must install the client and the server packages. To do this, run the command below:

sudo apt install mariadb-server mariadb-client -y

Verify your MariaDB installation by checking its version:

mariadb --version
Output
mariadb  Ver 15.1 Distrib 10.11.2-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

MariaDB will start automatically on your server. To check that it is active and running on your server, run the following command:

sudo systemctl status mariadb
Output
● mariadb.service - MariaDB 10.11.2 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Tue 2023-05-09 10:05:38 UTC; 32s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 8313 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 14 (limit: 4575)
     Memory: 78.6M
        CPU: 845ms
     CGroup: /system.slice/mariadb.service
             └─8313 /usr/sbin/mariadbd

Also, you can enable your MariaDB service to start on boot:

sudo systemctl enable mariadb

Run MariaDB Secure Installation Script

At this point, you can secure your MariaDB 10.11 installation on Ubuntu 22.04 by running a security script.

To do this, use the following command:

sudo mysql_secure_installation

You will be asked to set a root password for your MariaDB and from there enter yes to answer other questions.

Now you can access your MariaDB shell with the command below:

sudo mysql -u root -p

Enter your root password and press enter.

Output
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 39
Server version: 10.11.2-MariaDB-1:10.11.2+maria~ubu2204 mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Remove MariaDB 10.11 from Ubuntu 22.04

If you no longer wish to use MariaDB and want to remove it in full, execute the following command:

sudo apt autoremove mariadb-server mariadb-client --purge -y

Note, this will remove MariaDB completely including all database data.

To remove the bash script repository, use the following command.

# sudo rm /etc/apt/sources.list.d/mariadb.list
# sudo apt update

For more information, you can visit the MariaDB Documentation Page.

Conclusion

At this point, you have learned to Install MariaDB 10.11 LTS on Ubuntu 22.04.

Hope you enjoy it. You may be interested in these articles on the orcacore blog page:

Install and Use Metasploit on Ubuntu 22.04

Install and Use SQLite on Ubuntu 22.04

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!