How to install Mariadb via Yum repo on Centos 7

Run these command below:

vi /etc/yum.repos.d/MariaDB.repo

Once you have your MariaDB.repo entry, add it to a file under /etc/yum.repos.d/, (We suggest something like /etc/yum.repos.d/MariaDB.repo). An example MariaDB.repo file for CentOS 7 is:

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

The example file above includes a gpgkey line to automatically fetch the GPG key we use to sign the repositories. This key enables yum and rpm to verify the integrity of the packages it downloads.
and run:

yum update
yum install mariadb