Chapter 17. Database Servers

download PDF

This chapter guides you through the installation and configuration of the MariaDB server, which is an open source fast and robust database server that is based on MySQL technology. The chapter also describes how to back up MariaDB data.

17.1. MariaDB

MariaDB is a relational database which converts data into structured information and provides an SQL interface for accessing data. It includes multiple storage engines and plug-ins, as well as geographic information system (GIS).

Red Hat Enterprise Linux 7 contains MariaDB 5.5 as the default implementation of a server from the MySQL databases family. Later versions of the MariaDB database server are available as Software Collections for Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7. For more information about the latest versions, see the Release Notes for Red Hat Software Collections.

17.1.1. Installing the MariaDB server

To install the MariaDB server, follow this procedure:

Installing the MariaDB server

  1. Ensure that the mariadb and mariadb-server packages are installed on the required server:

    ~]# yum install mariadb mariadb-server
  2. Start the mariadb service:

    ~]# systemctl start mariadb.service
  3. Enable the mariadb service to start at boot:

    ~]# systemctl enable mariadb.service Improving MariaDB installation security

You can improve security when installing the MariaDB server by running the mysql_secure_installation command:

~]# mysql_secure_installation

This command launches a fully interactive script, which prompts for each step in the process. The script enables to improve security in the following ways:

  • Setting a password for root accounts
  • Removing anonymous users
  • Disallowing remote (outside the local host) root logins
  • Removing test database

17.1.2. Configuring the MariaDB server for networking

To configure the MariaDB server for networking, use the [mysqld] section of the /etc/my.cnf.d/server.cnf file, where you can set the following configuration directives:

  • bind-address

    Bind-address is the address on which the server will listen.

    Possible options are: a host name, an IPv4 address, or an IPv6 address.

  • skip-networking

    Possible values are:

    0 - to listen for all clients

    1 - to listen for local clients only

  • port

    The port on which MariaDB listens for TCP/IP connections.

17.1.3. Backing up MariaDB data

There are two main ways to back up data from a MariaDB database:

  • Logical backup
  • Physical backup Logical back up

Logical backup consists of the SQL statements necessary to restore the data. This type of backup exports information and records in plain text files.

The main advantage of logical backup over physical backup is portability and flexibility. The data can be restored on other hardware configurations, MariaDB versions or Database Management System (DBMS), which is not possible with physical backups.


Logical backup can be performed only if the mariadb.service is running. Logical backup does not include log and configuration files. Physical back up

Physical backup consists of copies of files and directories that store the content.

Physical backup has the following advantages compared to logical backup:

  • Output is more compact.
  • Backup is smaller in size.
  • Backup and restore are faster.
  • Backup includes log and configuration files.

Physical backup must be performed when the mariadb.service is not running or all tables in the database are locked to prevent changes during the backup.

Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.