Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Install Mariadb on CentOS 7

Rumi, January 21, 2020

MariaDB is an open-source relational database management system, backward compatible, binary drop-in replacement of MySQL. It is developed by some of the original developers of the MySQL and by many people in the community. With the release of CentOS 7, MySQL was replaced with MariaDB as the default database system.

If you, for any reason need to install MySQL, check the How to Install MySQL on CentOS 7 tutorial. If your application does not have any specific requirements, you should stick with MariaDB, the default database system in CentOS 7.

In this tutorial we will show you how to install the latest version of MariaDB on CentOS 7 using the official MariaDB repositories.

Prerequisites

Make sure you are logged in as a user with sudo privileges before proceeding with the tutorial.

Install MariaDB 5.5 on CentOS 7: The version of the MariaDB server provided in default CentOS repositories is version 5.5. This is not the latest version though, but it is quite stable.

Follow the steps below to install and secure MariaDB 5.5 on CentOS 7:

Install the MariaDB package using the yum package manager:

sudo yum install mariadb-server

Press y when prompted to proceed with the installation. Once the installation is complete, start the MariaDB service and enable it to start on boot using the following commands:

sudo systemctl start mariadbsudo systemctl enable mariadb

To verify that the installation was successful, check the MariaDB service status by typing:

sudo systemctl status mariadb

The output should show that the service is active and running:
Run the mysql_secure_installation script which will perform several security related tasks:

sudo mysql_secure_installation

You will be prompted to set up the root user password, remove anonymous user accounts, restrict root user access to the local machine, and remove the test database.

The steps are explained in detail. It is recommended to answer Y (yes) to all questions.

Install MariaDB 10.3 on CentOS 7

At the time of writing this article, the latest version of MariaDB is version 10.3. If you need to install any other version of MariaDB, head over to the MariaDB repositories page, and generate a repository file for a specific MariaDB version.

To install MariaDB 10.3 on CentOS 7, follow these steps:

The first step is to Enable the MariaDB repository. Create a repository file named MariaDB.repo and add the following content:

/etc/yum.repos.d/MariaDB.repo
# MariaDB 10.3 CentOS repository list - created 2018-05-25 19:02 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Install the MariaDB server and client packages using yum, same as other CentOS package:

sudo yum install MariaDB-server MariaDB-client

Yum may prompt you to import the MariaDB GPG key:

Retrieving key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Importing GPG key 0x1BB943DB:
Userid : "MariaDB Package Signing Key "
Fingerprint: 1993 69e5 404b d5fc 7d2f e43b cbcb 082a 1bb9 43db
From : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Type y and hit Enter.

Once the installation is complete, enable MariaDB to start on boot and start the service:

sudo systemctl enable mariadbsudo systemctl start mariadb

To verify the installation check the MariaDB service status by typing:

sudo systemctl status mariadb
mariadb.service - MariaDB 10.3.7 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: inactive (dead)
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/

The last step is to run the mysql_secure_installation script which will perform several security related tasks:

sudo mysql_secure_installation

The script will prompt you to set up the root user password, remove the anonymous user, restrict root user access to the local machine, and remove the test database.

All steps are explained in detail and it is recommended to answer Y (yes) to all questions. Connect to MariaDB from the command line
To connect to the MariaDB server through the terminal as the root account type:

mysql -u root -p

You will be prompted to enter the root password you have previously set when the mysql_secure_installation script was run.

Once you enter the password you will be presented with the MariaDB shell as shown below:

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.7-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Administrations Configurations (Linux) CentOSCentOS 7MariaDB

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes