MariaDB Database is an open source database server that is a fork of MySQL and a drop-in replacement. It’s rapidly overtaking MySQL as the database server of choice on Linux systems. For those wanting to install MariaDB 10.2 or 10.3 on Ubuntu 16.04 LTS, the steps below is a good starting point.
Ubuntu 16.04 LTS has upgraded to MariaDB 10.1. You won’t be able to upgrade via Ubuntu default repository, at least not yet. To upgrade to the latest, you must add its default repository and the steps below show you how.
When you’re ready to install MariaDB latest, follow the steps below:
Step 1: Adding MariaDB repository on Ubuntu
First, make sure software-properties-common package is installed. Just in case it’s not, run the commands below.
sudo apt-get install software-properties-common
Next, run the commands below to import MariaDB repository public key used by the package management system.
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
Finally, run the commands below to add MariaDB 10.1 repository to your Ubuntu machine.
sudo sh -c "echo 'deb https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB101.list"
The above commands add MariaDB 10.1 repository to Ubuntu with the latest packages. Remember to change the highlighted version number to the current latest.
To install MariaDB 10.2, run the commands below
sudo sh -c "echo 'deb https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB102.list"
At the time of this writing the latest current version was 10.2. The latest alpha version was 10.3
It’s recommended to upgrade to 10.1 before moving to 10.2 and up.
Step 2: Installing MariaDB latest on Ubuntu
Now that the MariaDB 10.1 repository has been added to Ubuntu, run the guides below to install the current version.
First, run the commands below to update your Ubuntu machines.
sudo apt-get update
Next, run the commands below to install MariaDB server and client.
sudo apt-get install mariadb-server mariadb-client
Doing the installation, you may be prompted to to create and confirm a new password for MariaDB root user.
Please enter and confirm a password. You’ll need this password to manage the database server.
After that, MariaDB will be fully installed on your machine.
To secure MariaDB database server, run the commands below:
When you run the above command, you’ll be prompted to create a root password, remove anonymous users, disable remote root access and delete the test database.
Follow this guide below in answering the questions:
- Enter current password for root (enter for none): Enter current password.
- Change root password? N
- Remove anonymous users? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
When you’re done, restart MariaDB and you’re done.
To verify MariaDB version, run the command below
mysql -V mysql Ver 15.1 Distrib 10.2.12-MariaDB, for debian-linux-gnu (i686) using readline 5.2
You may also like the post below: