×


How To Install MariaDB on Ubuntu Focal Fossa

Do you need to install MariaDB on Ubuntu?

This guide is for you.


MariaDB is a popular drop-in replacement of MySQL database server with more features, new storage engines, and better performance.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Software Installation tasks on their Server.

In this context, we shall look into steps to install MariaDB 10.5 on Ubuntu 20.04.


More information about MariaDB ?

MariaDB is a database management system which is popularly used as a replacement for MySQL.

It has better features and better performance than MySQL. Moreover, it has new storage engines.

It is a free and open source software under the General Public License version 2. Also, it is maintained and developed by the MariaDB Foundation.


How to Install MariaDB 10.5 on Ubuntu 20.04 LTS ?

Generally, there are two different ways to install MariaDB on Ubuntu server.

1. Installing MariaDB from the Ubuntu repositories

2. Installing the latest version of MariaDB from the official MariaDB repositories.


1. Installing MariaDB from the Ubuntu repositories:

i. First, update the package index using the below command.

$ sudo apt update

ii. Next, install MariaDB by running the below command.

$ sudo apt install mariadb-server

iii. Finally, verify the installation. Usually, MariaDB will start automatically. However, you can run the below command to verify it.

$ sudo systemctl status mariadb

iv. In addition, you can check the MariaDB version by running the below command.

mysql -V

2. Install the latest version of MariaDB from the official MariaDB repositories

In order to install MariaDB from the MariaDB repositories, first, you need to add MariaDB repository on to the system. 

After that, the installation can be done from the APT repository:

i. First, update the system. Also, make sure to install software-properties-common package.

$ sudo apt update && sudo apt upgrade
$ sudo apt -y install software-properties-common

ii. Next, import MariaDB gpg key. For that, we run the below command to add Repository Key to the system.

$ sudo apt-key adv –fetch-keys ‘https://mariadb.org/mariadb_release_signing_key.asc’

iii. Then we add the MariaDB APT repository.

$ sudo add-apt-repository ‘deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main’

iv. Finally, install MariaDB Server on 20.04 Linux

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

v. Now, you will be asked for a confirmation to install MariaDB. For that, type y and hit Enter.

 

How to Secure MariaDB ?

In order to improve the security of the MariaDB installation, execute the following command:

$ sudo mysql_secure_installation

As a result, this script will ask you to change the root password. So make sure to enter a strong password. Also, remove the anonymous user, restrict root user access to the local machine and remove the test database.


How to Uninstall MariaDB ?

In case, you want to completely remove MariaDB from your system, you can do so easily using the following command in Terminal:

$ sudo apt-get purge mariadb-server

After running the purge command, the system will ask if you want to continue the process by providing you with the y/n option. Hit y to carry on the uninstallation process.

Then remove the packages that were automatically installed to satisfy dependencies for MariaDB. Run the following command to do so:

$ sudo apt autoremove


[Need urgent assistance with Ubuntu queries? – We are here to help you. ]


Conclusion

This article will guide you on steps to install #MariaDB from the #Ubuntu #repositories and from the official MariaDB repositories. You can install MariaDB in two different ways.

To install MariaDB on Ubuntu, follow these steps:

1. Update #packages index. sudo apt update.

2. Once the packages list is updated, install MariaDB by issuing the following command: sudo apt install mariadb-server.

3. The MariaDB service will start automatically.

The default data directory for the MariaDB database server is /var/lib/mysql. The configuration file of MariaDB database server is /etc/mysql/mariadb. conf. d/50-server.