How to Install mariadb 10 on ubuntu server

0
95

This tutorial will show you how to install mariaDB 10 on ubuntu server. MariaDB is a drop-in replacement for mysql database. By default, MariaDB 10 is not build in ubuntu repository so in order to install MariaDB 10 we will need to add MariaDB repository to our system.

Update Ubuntu System

First of all let’s make sure our ubuntu server is up to date

sudo apt-get update
sudo apt-get upgrade

Adding Mariadb Repository to Ubuntu System’s Repository

Before we can add mariaDB repository, we will need to add gpg key for the new repository we are about to add.

Adding gpg key for MariaDB repository

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

After that, depending on your system we can start adding MariaDB repository

For ubuntu 16.04

sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.1/ubuntu xenial main'

For ubuntu 14.04

sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.1/ubuntu trusty main'

For ubuntu 12.04

sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.1/ubuntu precise main'

Update ubuntu system’s repository

sudo apt-get update

Install MariaDB 10 on Ubuntu

After adding MariaDB repository, we can start installing MariaDB 10 by typing this command

sudo apt-get install mariadb-server

The installation will ask you MariaDB root’s password twice. Enter your password and complete MariaDB installation process.

Once MariaDB installed completely, we need to secure MariaDB installation by typing the following command.

mysql_secure_installation

You will be asked several questions

 Set root password? [Y/n]  // hit N if you already set your MariaDB root password
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

To check if MariaDB 10 successfully installed on your system type the following command

mysql -u root -p
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 1414
Server version: 10.0.26-MariaDB-1~trusty mariadb.org binary distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

Congratulation! Now you have MariaDB 10 installed on your system as database server

Running mariaDB 10 on Ubuntu server

Now that MariaDB 10 is installed, here is how to start, stop, and restart MariaDB 10 on your Ubuntu server.

starting MariaDB 10

service mysql start

stopping MariaDB 10

service mysql stop

restarting MariaDB 10

service mysql restart

 

Upgrading MariaDB 5 to MariaDB 10 on Ubuntu server

If you are following my previous tutorial then most likely you will get MariaDB 5 installed on your system instead of MariaDB 10.

In order to upgrade MariaDB 5 to MariaDB 10, you can do that by simply uninstall mariaDB 5 installed on your system

sudo apt-get remove mariadb-server

Then follow above tutorial on this post to install mariaDB 10.

Or

You don’t have to uninstall your mariaDB 5. You can simply upgrade your MariaDB installation. After adding mariadb repository to ubuntu system repository then type these commands on your ssh command line:

apt-get update
apt-get upgrade

Now you have working MariaDB 10 installed on your system. If you have any question do not hesitate to ask me on the comment bellow ^^

LEAVE A REPLY