• Home
  • Knowledgebase
  • Blog
  • Home
  • Knowledgebase
  • Blog
home/Knowledge Base/Centos/How To Install MariaDB on CentOS 7

How To Install MariaDB on CentOS 7

27 views 0 October 11, 2022 host_know_user

Introduction

MariaDB is an open-source database management system that is widely included as part of the popular LEMP stack (Linux, Nginx, MySQL/MariaDB, PHP/Python/Perl). To manage its data, it employs a relational database and SQL (Structured Query Language). MariaDB is a MySQL fork maintained by the original MySQL developers. It’s intended to be a replacement for MySQL, uses several mysql-related commands, and is the default package on CentOS 7.

This guide will show you how to install the most recent version of MariaDB on a CentOS 7 server.

Prerequisites

     To follow this tutorial, you will need:

            A CentOS 7 with a non-root user with sudo privileges.

Step 1 : Installing MariaDB

      Yum will be used to install the MariaDB package, and we will press y when requested to confirm that we want to proceed:

# sudo yum install mariadb-server

Once the installation is complete, use the following command to start the daemon:

# sudo systemctl start mariadb

Because systemctl does not display the results of all service management actions, we’ll use the following command to ensure we succeeded:

# sudo systemctl status mariadb

If MariaDB was successfully started, the output should include the words “Active: active (running)” and the final line should look like this:

jan 15 13:09:36 centos-512mb-sfo2-01 systemd[1]: Started MariaDB database server.

Next, use the systemctl enable command to guarantee that MariaDB starts upon boot, which will build the appropriate symlinks.

# sudo systemctl enable mariadb
Output :
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

After that, we’ll focus on safeguarding our installation.

Step 2: Protect the MariaDB Server

MariaDB provides a security script that can be used to adjust some of the less secure default configurations for things like remote root logins and sample users. To run the security script, use the following command:

# sudo mysql_secure_installation

Every step of the script is explained in depth. The first screen asks for the root password, which hasn’t been set, so we’ll enter it as it suggests. We’ll then be required to enter that root password, which we will do.

Then, for the remaining questions, we’ll accept all of the security suggestions by pressing Y and then ENTER, which will remove anonymous users, disable remote root login, delete the test database, and reload the privilege tables.

Finally, now that we’ve protected the installation, we’ll check to see if it’s operational.

Step 3: Put the Installation to the Test

We may verify and obtain information about our installation by connecting to the mysqladmin tool, which is a client that allows us to conduct administrative commands. Connect to MariaDB as root (-u root), prompt for a password (-p), and return the version with the following command.

# mysqladmin -u root -p version You should see something like this:

Output :
mysqladmin Ver 9.0 Distrib 5.5.50-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Server version 5.5.50-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 4 min 4 sec

Threads: 1 Questions: 42 Slow queries: 0 Opens: 1 Flush tables: 2 Open tables: 27 Queries per second avg: 0.172

This shows that the installation was successful.

Conclusion

                  In this tutorial, we’ve installed and secured MariaDB on a CentOS 7 server. 

Was this helpful?

Yes  No
Related Articles
  • How to Set Up and Secure phpMyAdmin on a CentOS 7 Server Using Apache
  • How To Install WordPress on CentOS 7
  • How To install Git on Centos 7
  • How To Install Nginx on CentOS 7
  • How To Create a New User and Grant Permissions in MySQL
  • How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7

Didn't find your answer? Contact Us

Leave A Comment Cancel reply

Centos
  • How To Install MariaDB on CentOS 7
  • How To Set Up SSH Keys on  CentOS 7
  • How To Set Up Apache Virtual Hosts on CentOS 7
  • How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7
  • How To Create a New User and Grant Permissions in MySQL
  • How To Install Nginx on CentOS 7
  • How To install Git on Centos 7
  • How To Install WordPress on CentOS 7
  • How to Set Up and Secure phpMyAdmin on a CentOS 7 Server Using Apache
All Categories
  • Centos
  • container
  • Ubuntu
  • Debian
  • Linux Basics

  How To Create a New User and Grant Permissions in MySQL

How To Install Nginx on CentOS 7  

Support
  • Live chat
  • Knowledge Base
  • Blog
Manual Head Office
Toll free : 1800 572 8782
  • Copyright 2022 Hostzop Expert Solutions. All Rights Reserved.