• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install MariaDB 10.4 on CentOS/RHEL 7/6

Written by Rahul, Updated on November 20, 2019

MariaDB 10.4 stable version has been released. It is an enhanced, drop-in replacement for MySQL. MariaDB can be an 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.4 in CentOS, RHEL 7/6 and Fedora Fedora 30/29/28 systems using yum.

Step 1 – Add MariaDB Yum Repository

First add MariaDB yum repository in our system. Create a new repo file /etc/yum.repos.d/mariadb.repo in your system and add below code as per your operating system and architecture.

For CentOS/RHEL – 7

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

For CentOS/RHEL – 6

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

For Fedora – 30/29/28

Please change the version (red highlighted) in the below setting as per the version of Fedora you used. Click here to view all available repositories.

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

Step 2 – Install MariaDB Server

Let’s use the following command to install MariaDB 10.4 in your system. This will also install other dependencies automatically.

#### For CentOS/RHEL 7/6
sudo yum install MariaDB-server MariaDB-client

#### For Fedora
sudo  dnf install MariaDB-server MariaDB-client

After installing MariaDB in your system start it’s service using the following command.

## CentOS/RHEL 7 
sudo systemctl start mysql.service

## CentOS/Redhat 6 
sudo service mysql start

Step 3 – Secure MariaDB Install

You also need to secure your MariaDB installation using passwords and do some other changes. To do this run secure installation script from the command line.

sudo /usr/bin/mysql_secure_installation

The secure installation script will ask for user input as some points, follow the installation as per below output showing, All user inputs are highlighted with red color.

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] y
 ... Success!

Disallow root login remotely? [Y/n] y
 ... Success!

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...
Thanks for using MariaDB!

Step 4 – Working with MariaDB

After installing and completing the configuration, connect to a MariaDB server using the following command.

sudo mysql -u root -p

Also try to create a new database, user and assign privileges to a database.

1
2
3
4
5
6
7
8
9
10
11
## CREATE DATABASE
MariaDB [(none)]> CREATE DATABASE mydb;
## CREATE USER ACCOUNT
MariaDB [(none)]> CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'secret';
## GRANT PERMISSIONS ON DATABASE
MariaDB [(none)]> GRANT ALL ON mydb.* TO 'dbuser'@'localhost';
##  RELOAD PRIVILEGES
MariaDB [(none)]> FLUSH PRIVILEGES;

You may also required install phpMyAdmin to manage MariaDB using web interface, which provides easy way to work.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

5 Comments

  1. Avatar Joseph Mwema Reply
    October 24, 2019 at 5:26 pm

    Please update

    ## CentOS/RHEL 7
    sudo systemctl start mysql.service

    ## CentOS/Redhat 6
    sudo service mysql start

    to

    systemctl start mariadb

    or

    service mariadb start

    This will come in handy for anyone who has installed MariaDB 10.4.8

  2. Avatar Bas van Beek Reply
    October 19, 2019 at 10:19 pm

    Do not add the yum repository yourself. Instead leave it up by the MariaDB installer:

    curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
    sudo yum install MariaDB-server MariaDB-client

  3. Avatar Jackon Reply
    April 8, 2019 at 3:28 pm

    Thank you Rahull, worked went perfectly.

    I also installed phpmyadmin, following your other tutorial. https://tecadmin.net/intstall-phpmyadmin-on-centos/

    Thank you for sharing your knowledge with the community.

  4. Avatar Bob Reply
    June 6, 2018 at 8:05 pm

    I followed these directions. YUM is insisting on trying to install mariaDB 10.1 even though I specified 10.3 like you said…

  5. Avatar Muhaimin Reply
    December 20, 2014 at 6:05 am

    do you have update for centos7

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy