Install MariaDB Server on Ubuntu

In the recent years MariaDB has become one of the most popular database servers. The MariaDB server is available under the terms of the GNU General Public License, version 2. It is created by the original developers of MySQL and is promised to stay open source.

Install MariaDB on Ubuntu

To install MariaDB 10.4 on Ubuntu first you need to add the repository to the system. Ubuntu uses apt for package management. Apt stores a list of repositories or software packages in the file /etc/apt/sources.list or any other file with a .list extension in the same directory. Go to the downloads page of MariaDB Foundation website in order to setup the repository mirror you need. From the menu choose the distro, release, version and mirror.

The menu will generate a code to start the repository and PGP setting. Please notice that in my case I picked Lund University repository. You might want a repository that is closer to you geographically.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://ftp.ddg.lth.se/mariadb/repo/10.4/ubuntu disco main'

After the key is imported and repository set, you can start with the installation:

sudo apt update
sudo apt install mariadb-server mariadb-common mariadb-client
systemctl status mariadb

Next step will be to secure the MariaDB server. Use the mysql_secure_installation tool to configure the vital security options. Also tool will ask to set a new password for the mysql root user.

$ sudo mysql_secure_installation

Answer Y when prompted:

Remove anonymous users? Y

Disallow root login remotely? Y

Remove test database and access to it? Y

Reload privilege tables now? Y

Similar Posts

Leave a Reply

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