How To Install MariaDB 11.7 on Ubuntu 24.04|22.04|20.04

Welcome to our guide on how to install MariaDB 11.7 on Ubuntu 24.04|22.04|20.04. MariaDB is a type of SQL Database that was forked from MySQL. Since we stated above that MariaDB is a type of SQL, it would only be fair if we started by defining what an SQL Database is. An SQL Database is short form for Structured Query Language, often used in the management of relational databases. It is considered to be a collection of tables used for storing particular set of organized data.

SQL was developed in the 1970s for purposes of getting through to IBM’s System R database system. With SQL you could access many records with a single command. Even the current databases used depend on SQL as the backbone for enabling each one of us to perform functions such as retrieval, creation, deletion, and updating of data. All these brings us to one of our Relational Database Management System, MariaDB, the latest being MariaDB 11.7.

MariaDB 11.7 Features

Below are some of the features that this version of MariaDB bags;

  • Vectors: Vectors are a feature that allow MariaDB Server to perform as a relational vector database. Previously available in the special Vector preview release, it has now been added to MariaDB Community Server 11.7.1 with various enhancements.
  • InnoDB: Defaults change – the innodb_snapshot_isolation system variable now defaults to ON, previously was OFF
  • Optimizer: Fix crash caused by query containing constant having clause.
  • JSON: JSON_TABLE now properly unquotes strings and default values now allows non-string literals.
  • mariadbd no longer hangs on startup when --init-file target does not exist.
  • LOAD DATA INFILE with geometry data no longer fails.
  • Fix heap-use-after-free in group_concat with compressed or GIS columns.
  • Trigger now works correctly with bulk update.
  • Fix assertion failure in find_producing_item upon a query from a view.
  • Add new setting, –quick-max-column-width to the mariadb client for use in –quick mode.

Install MariaDB 11.7 on Ubuntu 24.04|22.04|20.04

Since you now have a brief description of where MariaDB began and how it was formed, plus its use, we can then proceed to look at how its installation is done in an Ubuntu system. Below is a step by step process on how to install MariaDB 11.7 on Ubuntu;

Step 1. Update your System

First you need to ensure that your system is up to date by utilizing the commands shown below;

sudo apt update
sudo apt upgrade -y

Check if reboot is required.

[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2. Install needed Dependencies

Before you begin the installation process, you need to first install the following packages for later use;

sudo apt install gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates -y

If you have them already installed, the output below represents that;

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
lsb-release is already the newest version (12.0-2).
lsb-release set to manually installed.
ca-certificates is already the newest version (20240203).
ca-certificates set to manually installed.
The following additional packages will be installed:
  python3-software-properties
The following NEW packages will be installed:
  apt-transport-https gnupg2
The following packages will be upgraded:
  python3-software-properties software-properties-common
2 upgraded, 2 newly installed, 0 to remove and 71 not upgraded.
Need to get 52.9 kB of archives.
After this operation, 68.6 kB of additional disk space will be used.
Get:1 http://ke.archive.ubuntu.com/ubuntu noble/universe amd64 apt-transport-https all 2.7.14build2 [3974 B]
Get:2 http://ke.archive.ubuntu.com/ubuntu noble-updates/main amd64 software-properties-common all 0.99.49.1 [14.4 kB]
Get:3 http://ke.archive.ubuntu.com/ubuntu noble-updates/main amd64 python3-software-properties all 0.99.49.1 [29.7 kB]
Get:4 http://ke.archive.ubuntu.com/ubuntu noble/universe amd64 gnupg2 all 2.4.4-2ubuntu17 [4748 B]
Fetched 52.9 kB in 0s (355 kB/s)
...

Step 3. Add MariaDB APT Repository

To import the signing key and add the MariaDB APT repository, run the commands below consecutively on your terminal;

curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo bash mariadb_repo_setup --mariadb-server-version=11.7

Notice specified MariaDB version 11.7 in --mariadb-server-version argument. You should get an output similar to the one below;

# [info] Checking for script prerequisites.
# [warning] Found existing file at /etc/apt/sources.list.d/mariadb.list. Moving to /etc/apt/sources.list.d/mariadb.list.old_1
# [info] MariaDB Server version 11.7 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

Step 4. Install MariaDB 10.7 on Ubuntu

Since you have added the key and repository in the previous step, it is important to update your system first before you go ahead with the installation, this is to ensure the repository was added successfully and there are no errors to fix, so run the command below first;

sudo apt update

The update command should come out clean like as shown below;

Hit:2 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Hit:1 https://downloads.mariadb.com/Tools/ubuntu noble InRelease
Hit:5 http://archive.ubuntu.com/ubuntu noble-security InRelease
Get:6 https://dlm.mariadb.com/repo/mariadb-server/11.7/repo/ubuntu noble InRelease [7,728 B]
Get:7 https://dlm.mariadb.com/repo/maxscale/latest/apt noble InRelease [6,384 B]
Fetched 14.1 kB in 1s (16.0 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Since our repository was added successfully just as shown from the output above, we can then proceed to install MariaDB on Ubuntu using the command shown below;

sudo apt install mariadb-server mariadb-client
...
Selecting previously unselected package mariadb-client-compat.
Preparing to unpack .../19-mariadb-client-compat_1%3a11.7.1+maria~ubu2404_all.deb ...
Unpacking mariadb-client-compat (1:11.7.1+maria~ubu2404) ...
Selecting previously unselected package mariadb-server-compat.
Preparing to unpack .../20-mariadb-server-compat_1%3a11.7.1+maria~ubu2404_all.deb ...
Unpacking mariadb-server-compat (1:11.7.1+maria~ubu2404) ...
Selecting previously unselected package pv.
Preparing to unpack .../21-pv_1.8.5-2build1_amd64.deb ...
Unpacking pv (1.8.5-2build1) ...
Setting up libconfig-inifiles-perl (3.000003-2) ...
Setting up galera-4 (26.4.20-ubu2404) ...
Setting up libmysqlclient21:amd64 (8.0.40-0ubuntu0.24.04.1) ...
Setting up libclone-perl:amd64 (0.46-1build3) ...
Setting up libfcgi0t64:amd64 (2.4.2-2.1build1) ...
Setting up libhtml-tagset-perl (3.20-6) ...
Setting up liblwp-mediatypes-perl (6.04-2) ...
Setting up libfcgi-bin (2.4.2-2.1build1) ...
Setting up libencode-locale-perl (1.05-3) ...
Setting up socat (1.8.0.0-4build3) ...
Setting up libio-html-perl (1.004-3) ...
Setting up libmariadb3:amd64 (1:11.7.1+maria~ubu2404) ...
Setting up libtimedate-perl (2.3300-2) ...
Setting up pv (1.8.5-2build1) ...
Setting up libfcgi-perl (0.82+ds-3build2) ...
Setting up liburing2:amd64 (2.5-1build1) ...
Setting up liburi-perl (5.27-1) ...
Setting up libdbi-perl:amd64 (1.643-4build3) ...
Setting up libhttp-date-perl (6.06-1) ...
Setting up mariadb-client-core (1:11.7.1+maria~ubu2404) ...
Setting up libdbd-mysql-perl:amd64 (4.052-1ubuntu3) ...
Setting up libhtml-parser-perl:amd64 (3.81-1build3) ...
Setting up mariadb-server-core (1:11.7.1+maria~ubu2404) ...
Setting up libhttp-message-perl (6.45-1ubuntu1) ...
Setting up mariadb-client (1:11.7.1+maria~ubu2404) ...
Setting up mariadb-client-compat (1:11.7.1+maria~ubu2404) ...
Setting up libcgi-pm-perl (4.63-1) ...
Setting up libhtml-template-perl (2.97-2) ...
Setting up mariadb-server (1:11.7.1+maria~ubu2404) ...
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
Setting up libcgi-fast-perl (1:2.17-1) ...
Setting up mariadb-server-compat (1:11.7.1+maria~ubu2404) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.3) ...

Step 5. Secure MariaDB Installation

Once we have successfully installed MariaDB on Ubuntu, we ought to secure it by running the command shown below;

sudo mariadb-secure-installation

Below is the whole output and how you should answer the questions asked for a proper secured MariaDB installation;


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Step 6. Check MariaDB Status

You can check the status of your MariaDB by running the command below;

systemctl status mariadb

The representation below, shows that our MariaDB is up and running, check below;

mariadb.service - MariaDB 11.7.1 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Fri 2025-01-10 05:28:50 UTC; 6min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 6725 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 6727 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && echo _WSREP_START_POSITION=$VAR > /run/mysqld/wsrep-start-posi>
    Process: 6762 ExecStartPost=/bin/rm -f /run/mysqld/wsrep-start-position (code=exited, status=0/SUCCESS)
    Process: 6764 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 6749 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 10 (limit: 46372)
     Memory: 92.8M (peak: 97.0M)
        CPU: 1.814s
     CGroup: /system.slice/mariadb.service
             └─6749 /usr/sbin/mariadbd

Jan 10 05:28:49 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:49 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jan 10 05:28:49 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:49 0 [Note] Plugin 'FEEDBACK' is disabled.
Jan 10 05:28:49 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:49 0 [Note] Plugin 'wsrep-provider' is disabled.
Jan 10 05:28:49 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:49 0 [Note] InnoDB: Buffer pool(s) load completed at 250110  5:28:49
Jan 10 05:28:50 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:50 0 [Note] Server socket created on IP: '127.0.0.1'.
Jan 10 05:28:50 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:50 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
Jan 10 05:28:50 ubuntu-server mariadbd[6749]: 2025-01-10  5:28:50 0 [Note] /usr/sbin/mariadbd: ready for connections.
Jan 10 05:28:50 ubuntu-server mariadbd[6749]: Version: '11.7.1-MariaDB-ubu2404'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
Jan 10 05:28:50 ubuntu-server systemd[1]: Started mariadb.service - MariaDB 11.7.1 database server.
Jan 10 05:28:50 ubuntu-server /etc/mysql/debian-start[6779]: Checking for insecure root accounts.
lines 1-29/29 (END)

To enable MariaDB to start when the server is rebooted, ensure to run the command shown below;

sudo systemctl enable mariadb

Step 7. Start and Check MariaDB Version

The command below not only shows you the MariaDB version but also starts it. Run the command below;

mysql -u root -p

Below is a representation of the output;

cloudspinx@ubuntu-server:~$ mysql -u root -p
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 11.7.1-MariaDB-ubu2404 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)]>

Step 8. Configure and Use MariaDB

Since we are done with the installation of MariaDB, it is fair to also show you how you can use the just installation Relational Database Management System. The first thing we will do is to create a test database named testdb1;

MariaDB [(none)]> CREATE DATABASE testdb1;
Query OK, 1 row affected (0.002 sec)

Run the command below to show the just created database. Below is also the output;

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| testdb1            |
+--------------------+
5 rows in set (0.001 sec)

Below is how you can utilize MariaDB for basic usage, the statements starting with # highlights what the command it shows next does;

#Create a user named user1 by utilizing the command:

MariaDB [(none)]> CREATE USER 'user1'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.002 sec)

#Grant privileges on testdb1 to user1 using command below:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON testdb1.* TO 'user1'@'localhost';
Query OK, 0 rows affected (0.001 sec)

#Refresh the privileges granted with the command:

MariaDB [(none)]> FLUSH privileges;
Query OK, 0 rows affected (0.001 sec)

#Show grants for user1 using the command below:

MariaDB [(none)]> SHOW GRANTS FOR 'user1'@'localhost';
+--------------------------------------------------------------------------------------------------------------+
| Grants for user1@localhost                                                                                   |
+--------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON `testdb1`.* TO `user1`@`localhost`                                                   |
+--------------------------------------------------------------------------------------------------------------+

#Specify that you are now using the created database testdb1:

MariaDB [(none)]> USE testdb1;
Database changed

#Create table on testdb1, depending on the type of table you want to create, below is an example of how to do it, use the format:

MariaDB [testdb1]> CREATE TABLE course (code INT, name VARCHAR(25), day VARCHAR(15));
Query OK, 0 rows affected (0.007 sec)

#Insert data to the table you just created above, check below;

MariaDB [testdb1]> INSERT INTO course (code,name,day) VALUES(001,"Maths","Monday");
Query OK, 1 row affected (0.001 sec)

The above window has been our wrap up! We hope you enjoy.

Conclusion

We have completed our tutorial on how to install MariaDB 11.7 on Ubuntu. On this tutorial, we managed to give you a brief description on what SQL is, a brief background history about MariaDB and the new features associated with the latest MariaDB 11.7 . Moreover, we managed to take you through an exhaustive step by step process on how to install MariaDB on Ubuntu. We did not just stop there, we continued to give you insights on how to secure MariaDB installation and advanced to the usage of MariaDB by creating a test database, creating a user, granting privileges to the user on the test database and finally creating a table and inserting data to the table. This sums up all that our article entails.

Check below for related articles;

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Podman, is short for (the POD manager). It’s an open source containerization tool, used to develop, manage and run containers. […]

PostgreSQL is one of the world’s most advanced open-source relational database systems. Since its first release, it has continued to […]

The first thing you want to do is ensure you are using a reputable web form builder and service. It […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.