Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

How to install MariaDB on Ubuntu 22.04

- Advertisement -

Hello, friends. We have a new version of Ubuntu, and so we will gradually bring you support to help you with it. Today, you will learn how to install MariaDB on Ubuntu 22.04.

MariaDB is a perfectly compatible fork of MySQL. It gives us a database manager, open source, free and very stable for our projects. Despite its community character, we should not lose sight of the fact that it has professional support. So, we can also apply it on a large scale.

We are going to show you how to install it on a system like Ubuntu 22.04. This post will help both newbies and programmers to refresh their knowledge about it.

Install MariaDB on Ubuntu 22.04

As it has been a short time since Ubuntu 22.04 has been released, the included version of MariaDB is a recent version. While you can, this is the best method to install such a critical component as MariaDB.

First, update the entire system

sudo apt update
sudo apt upgrade

After this, you can install MariaDB by running the following command

sudo apt install mariadb-server mariadb-client
1.- Install MariaDB on Ubuntu 22.04
1.- Install MariaDB on Ubuntu 22.04

This will start the whole installation process.

Now we will do a couple of tweaks to MariaDB to make it ready.

Configuring MariaBD on Ubuntu 22.04

- Advertisement -

After it is installed, you can verify the installed version with the following command.

mariadb --version

Sample output

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

By default, MariaDB is installed, started and enabled to start with the system. In case you want to start, stop and restart MariaDB, here are the commands to do so.

sudo systemctl start mariadb
sudo systemctl stop mariadb
sudo systemctl restart mariadb

Finally, check the status of the MariaDB.

sudo systemctl status mariadb
2.- MariaDB status
2.- MariaDB status

After this, we need to define a new key for the root user.

To achieve this, run the following script

sudo mariadb-secure-installation

As soon as you run it, you will be prompted to enter the password for the root user.

Enter current password for root (enter for none): 

As there is none defined, then press ENTER.

You will then be asked if you wish to make the switch to unix_socket to ensure that no one can access your server as root without permissions.

Switch to unix_socket authentication [Y/n].

Now we can set the root password ourselves.

Change the root password? [Y/n] 

Answer Y to set your own.

New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables...
 ... Success!

Next, you will be asked a few configuration questions where you can further secure the installation.

Remove anonymous users? [Y/n] 
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n] 
Reload privilege tables now? [Y/n] 

Answer Y to all and MariaDB will be more secure.

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

Thanks for using MariaDB!

This is enough to get you started. You can now create databases and more with MariaDB.

Conclusion

Thanks to this post, you learned how to install and configure MariaDB on Ubuntu 22.04.

MariaDB Website

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook

x