MariaDB ia an enhanced, drop-in replacement for MySQL. MariaDB can be a better choice for choice for database professionals looking for a robust, scalable, and reliable SQL server. MariaDB has a number of updated features over MySQL. Use below links to read features comparison between MariaDB and MySQL
This article will help you to Install MariaDB 10.2 in Ubuntu 16.04 and 14.04 LTS and Other Systems using the Apt package manager, For older version use Apt-get command.
Step 1 – Backup Databases
MariaDB 10.2 has been released with various upgrades and configuration changes than previous releases. So, If you have already running older MariaDB version, It’s recommended to take all databases backups before upgrading.
Visit here to find the changes and upgrades in MariaDB 10.2.
Step 2 – Add Apt Repository
You can find the MariaDB Apt configuration file from the official website. Import the package singin key for MaraiDB packages on your system.
$ sudo apt install software-properties-common $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
After this, create a new Apt configuration file for MariaDB with the following command. You can use any text editor than vim.
$ sudo vim /etc/apt/sources.list.d/mariadb.list
And add the following values to the configuration file as per your Ubuntu version. To check your Ubuntu system version run ‘lsb-release -a’ command.
For Ubuntu 16.04 “Xenial”
deb [arch=amd64,i386] http://mirror.jmu.edu/pub/mariadb/repo/10.2/ubuntu xenial main deb-src http://mirror.jmu.edu/pub/mariadb/repo/10.2/ubuntu xenial main
For Ubuntu 14.04 “Trusty”
deb [arch=amd64,i386] http://mirror.jmu.edu/pub/mariadb/repo/10.2/ubuntu trusty main deb-src http://mirror.jmu.edu/pub/mariadb/repo/10.2/ubuntu trusty main
For Other Ubuntu Versions
For other versions of Ubuntu. Click here to find suitable repository for your system.
Step 3 – Install MariaDB Server in Ubuntu
After adding the repository in your system and use following commands to install MariaDB-server on your Ubuntu system. This will remove any previous version of MariaDB packages and install latest packages on the system. Make sure you have proper backups of databases before running below commands.
$ sudo apt update $ sudo apt install mariadb-server
While installing MariaDB using above command installer will prompt for MariaDB root account password twice like below snapshot.
Step 4 – Login To MariaDB
After completing installation you can connect to MariaDB using following command. When prompted, use the password entered during installation of MariaDB.
mysql -u root -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 10.2.6-MariaDB-10.2.6+maria~xenial mariadb.org binary distribution Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Step 5 – Manage MariaDB Service
Some times we need to stop or start MariaDB service. Use the following commands to stop, start, check status and restart MariaDB servic.
$ sudo systemctl stop mysql.service
# To Stop MariaDB service$ sudo systemctl start mysql.service # To Start MariaDB service$ sudo systemctl status mysql.service # To Check MariaDB service status$ sudo systemctl restart mysql.service # To Stop then Start MariaDB service