Debian and Ubuntu are some of the most stable Linux distributions out there. This is because the packages that are part of the official repositories are frozen and tested many times by many people. However, this brings a consequence: that we will not be able to have the most recent versions of the programs. An example of this is MariaDB which is a vital program for many people. So, today I will show you how to install MariaDB 10.4 on Ubuntu 18.04.
MariaDB is a well-known archi Database Relationships Management System that is a MySQL fork. This is due to the purchase of Sun Mycrosystem by Oracle. It is perfectly compatible with MySQL and is available in most Linux distributions.
In Ubuntu 18.04 LTS the version of MariaDB that is available in the official repositories is 10.1, but recently has seen the release of version 10.4 with some interesting new features. Some of them are:
- The unix_socket authentication plugin is now default on Unix-like systems. This represents a considerable improvement in authentication security.
- The obsolete mysql.host table is no longer created
- User password expiry. This forces you to change it periodically.
- User accounts and global privileges are now stored in the mysql.global_priv table.
And many other news related to the creation of cLuster and Galera 4. If you want to know them, I recommend you to read the changes and improvements of version 10.4.
So, using this version on our Ubuntu 18.04 is a good idea.
Installing MariaDB 10.4 on Ubuntu 18.04
The first step is to install some necessary packages. So open a new terminal session and run the following command:
:~$ sudo apt-get install software-properties-common
The easiest way to install MariaDB on Ubuntu 18.04 is through the application repositories. To do this you have to add the GPG key of the repositories:
:~$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
At the end, we will be able to add the repository itself.
:~$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main'.
Next, the APT cache needs to be refreshed to recognize the new repository:
:~$ sudo apt update
Now, we can install MariaDB 10.4. To do this, use the following command:
:~$ sudo apt install mariadb-server
If you have it installed, just update the distribution:
:~$ sudo apt upgrade
With MariaDB installed, the first step is to define a root password and secure the installation:
:~$ sudo mysql_secure_installation
And finally check the installed version:
:~$ mysql --version
Now you can work with MariaDB. That is it.
Conclusion
MariaDB 10.4 is a good improvement over previous versions. But it is not always available in the official repositories of other Linux distributions. Today you have learned how to install it in Ubuntu 18.04.