How to Upgrade MariaDB 10.1 to MariaDB 102. on CentOS

How to Upgrade MariaDB 10.1 to MariaDB 10.2 on CentOS server

Below is step by step post that you can use to upgrade MariaDB 10.1 to MariaDB 102. on Linux CentOS.

1) Check the Current Version of MariaDB

Login to MariaDB server and then run below statement  to check the current version of MariaDB.


MariaDB > Select @@version

Output is shown below if your version of MariaDB is 10.1
+-----------------+
| @@version       |
+-----------------+
| 10.1.29-MariaDB |
+-----------------+

2) Stop MariaDB (Mysql) service

Stop the MariaDB service by using below command.
# sudo service mysql stop

3) Uninstall MariaDB 10.1 

Uninstall mariadb by using below command
# sudo yum remove MariaDB-server MariaDB-client

4) Update the Repo file with new version

Update the report file in location /etc/yum.repos.d with new path for MariaDB 10.2
# vi /etc/yum.repos.d/MariaDB.repo

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

5) Run the Installation with new version 10.2

Run the below command to install new version of MariaDB 10.2
# sudo yum install MariaDB-server MariaDB-client

6) Start MariaDB service

Start MariaDB service by using below command
# sudo service mysql start


7) Run mysql_upgrade to update databases from MariaDB 10.1 to MariaDB 10.2

Login to MariaDB and then run mysql_upgrade statement.
# mysql_upgrade -uroot -p


8) Check the version of MariaDB

Login to MariaDB and then run below statement to make sure MairaDB is upgraded successfully from 10.1 to 102.
MariaDB> Select @@version

+-----------------+
| @@version       |
+-----------------+
| 10.2.11-MariaDB |
+-----------------+

9) Validation 

Create test database, create a table and then insert data to make sure everything is working.
MariaDB> Create database TechBrothers;

 MariaDB> use TechBrothers;

MariaDB > Create table test (id int, name varchar(100));

 MariaDB > Insert into test values(1,'aamir');