HomeDATABASEHow To Install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04

How To Install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04

Greetings and welcome to this guide on how to install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04. MariaDB is an open-source relational database management system (RDBMS) that is designed to be a drop-in replacement for MySQL. It was created as a community-driven fork of MySQL by the original developers of MySQL after concerns arose over the acquisition of MySQL by Oracle Corporation.

MariaDB offers many of the same features as MySQL, including support for multiple programming languages and platforms, as well as high availability and scalability. However, MariaDB also includes additional features and enhancements, such as improved performance, better security, and support for new storage engines and data types.

MariaDB 10.0.0 was released over 10 years ago(12 November 2012). This gives rise to several questions such as “will there be MariaDB 11.0.0?” It is time to say the answer is “yes” This is because there is MariaDB Server 11.0 Alpha preview available for download.

MariaDB 11.0 comes with a lot of features and enhancements. These include:

In our previous guide, we went through how To Install MariaDB 10.6 on Ubuntu 22.04|20.04|18.04. Today we will walk through how to install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04.

1. Update Your Ubuntu 22.04|20.04|18.04 System

Ensure that your system and the available packages are updated to the latest version.

sudo apt update && sudo apt -y upgrade

Check if a system reboot is required:

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

Once upgraded, proceed as shown below.

2. Add MariaDB APT repository on Ubuntu 22.04|20.04|18.04

The first step requires us to add the MariaDB APT repository on Ubuntu 22.04|20.04|18.04. This requires cURL installed:

sudo apt install curl -y

Now add the MariaDB repo:

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

Sample Output:

# [info] Checking for script prerequisites.
# [info] MariaDB Server version 11.0 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

3. Install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04

From the added repo, we can easily install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04. The command for this is:

sudo apt update 
sudo apt install mariadb-server mariadb-client

Dependency Tree:

Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  gir1.2-goa-1.0
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl
  libdbd-mariadb-perl libdbi-perl libfcgi-perl libhtml-template-perl libmariadb3 libpmem1
  libreadline5 libsigsegv2 libterm-readkey-perl mariadb-client-compat mariadb-client-core
  mariadb-common mariadb-server-compat mariadb-server-core pv socat
Suggested packages:
  gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
  libipc-sharedcache-perl mailx mariadb-test doc-base
The following NEW packages will be installed:
  galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl
  libdbd-mariadb-perl libdbi-perl libfcgi-perl libhtml-template-perl libmariadb3 libpmem1
  libreadline5 libsigsegv2 libterm-readkey-perl mariadb-client mariadb-client-compat
  mariadb-client-core mariadb-common mariadb-server mariadb-server-compat
  mariadb-server-core pv socat
0 upgraded, 24 newly installed, 0 to remove and 101 not upgraded.
Need to get 30.2 MB of archives.
After this operation, 257 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Once installed, verify the version:

$ mariadb -V
mariadb from 11.0.1-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using readline 5.2

4. Harden the MariaDB 11.0 on Ubuntu 22.04|20.04|18.04

After installing, we need to harden the instance by setting a password for the root user and perform other security-related operations.

To secure the instance, use the command:

sudo mariadb-secure-installation

Proceed as shown:

Enter current password for root (enter for none): Press Enter
OK, successfully used password, moving on...
.....
Switch to unix_socket authentication [Y/n] y
...
Change the root password? [Y/n] y
New password: Set root password
Re-enter new password: Re-enter the password
Password updated successfully!
....
Remove anonymous users? [Y/n] y
....
Disallow root login remotely? [Y/n] y
....
Remove test database and access to it? [Y/n] y
...
Reload privilege tables now? [Y/n] y
 ... Success!
...
Thanks for using MariaDB!

After this, you should have your MariaDB 11 instance secure. Now proceed and test if all is working as desired.

5. Test MariaDB 11.0 on Ubuntu 22.04|20.04|18.04

It is time to test and ascertain if the installed MariaDB 11 is working correctly. First login to the shell using the root user:

mariadb -u root -p

Sample Output:

From the above output, we have successfully logged into the MariaDB 11 shell. To check the MariaDB version, use:

MariaDB [(none)]> SELECT VERSION();
+---------------------------------------+
| VERSION()                             |
+---------------------------------------+
| 11.0.1-MariaDB-1:11.0.1+maria~ubu2004 |
+---------------------------------------+
1 row in set (0.000 sec)
MariaDB [(none)]> 

We will create a test database here:

CREATE DATABASE testdb;

We can also create a user with privileges to access the created DB:

CREATE USER 'db_user'@'localhost' IDENTIFIED BY 'Passw0rd!';
GRANT ALL PRIVILEGES ON testdb.* TO 'db_user'@'localhost';

To view the users, use the command:

mysql> SELECT User, Host FROM mysql.user;
+-------------+-----------+
| User        | Host      |
+-------------+-----------+
| db_user     | localhost |
| mariadb.sys | localhost |
| mysql       | localhost |
| root        | localhost |
+-------------+-----------+
4 rows in set (0.001 sec)

To delete a user, use the command with the below syntax:

DROP USER 'username'@'host';

To add tables to the created database, we can use:

USE testdb;

CREATE TABLE playground (
    equip_id serial PRIMARY KEY,
    type varchar (50) NOT NULL,
    color varchar (25) NOT NULL,
    location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),
    install_date date
);

Now insert data into the table:

INSERT INTO playground (type, color, location, install_date) VALUES ('slide', 'blue', 'south', '2017-04-28');
INSERT INTO playground (type, color, location, install_date) VALUES ('swing', 'yellow', 'northwest', '2018-08-16');

View if the data has been added:

mysql> SELECT * FROM playground;
+----------+-------+--------+-----------+--------------+
| equip_id | type  | color  | location  | install_date |
+----------+-------+--------+-----------+--------------+
|        1 | slide | blue   | south     | 2017-04-28   |
|        2 | swing | yellow | northwest | 2018-08-16   |
+----------+-------+--------+-----------+--------------+
2 rows in set (0.000 sec)

Verdict

That is the end of this guide on how to install MariaDB 11.0 on Ubuntu 22.04|20.04|18.04. I hope this was informative.

Related posts:

How To Install MariaDB 10.6 on Ubuntu 22.04|20.04|18.04

Install MariaDB Database on Rocky Linux 9|AlmaLinux 9

How To Install PHP Composer on Ubuntu 22.04|20.04|18.04

Klinsmann Öteyo
Klinsmann Öteyo
Self proclaimed Geek
- Advertisment -

Recent posts

LEAVE A REPLY

Please enter your comment!
Please enter your name here