Cyberithub

How to Install MariaDB 5.5 Server on RHEL 7/CentOS 7 Linux with Easy Steps

Advertisements

In this article, I will take you through 6 Simple and Easy Steps to Install MariaDB Server on Linux(RHEL/CentOS 7/8). MariaDB is an open source MySQL based relational database management system. It is probably the most popular database currently in use on Linux Based Platforms due to its various features over other databases. It offers better storage engine along with faster caching and query performance. For more info, check MariaDB Official Website. We will look into the detailed steps required to Install MariaDB 5.5 Server on RHEL 7/CentOS 7 Servers.

How to Install MariaDB 5.5 Server on RHEL 7/CentOS 7 Linux with Easy Steps 2

How to Install MariaDB 5.5. Server on RHEL 7/CentOS 7 Linux

Also Read: Solved: netstat command not found error on Linux(RHEL / CentOS / Ubuntu / OpenSUSE)

Step 1: Prerequisites

a) You need to have a running RHEL 7/CentOS 7 System.

b) You should have yum tool installed in your Server. You can check Top 22 YUM command examples in RedHat/CentOS 7 to know more about yum command.

c) You need to have root or sudo access to run privileged commands. Please Check How to Add User to Sudoers to know more about providing sudo access to the User.

Step 2: Update Your Server

Before going through the steps to install MariaDB 5.5 Server on RHEL 7/CentOS 7, it is always recommended to update your Server first by using yum update -y command as shown below.

[root@localhost ~]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package grub2-tools-extra.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2-tools-extra.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package grub2-tools-minimal.x86_64 1:2.02-0.81.el7.centos will be updated
---> Package grub2-tools-minimal.x86_64 1:2.02-0.86.el7.centos will be an update
---> Package iprutils.x86_64 0:2.4.17.1-3.el7 will be updated
---> Package iprutils.x86_64 0:2.4.17.1-3.el7_7 will be an update
---> Package kernel.x86_64 0:3.10.0-1127.19.1.el7 will be installed
---> Package kernel-tools.x86_64 0:3.10.0-1127.el7 will be updated
---> Package kernel-tools.x86_64 0:3.10.0-1127.19.1.el7 will be an update
---> Package kernel-tools-libs.x86_64 0:3.10.0-1127.el7 will be updated
---> Package kernel-tools-libs.x86_64 0:3.10.0-1127.19.1.el7 will be an update
---> Package libcurl.x86_64 0:7.29.0-57.el7 will be updated
---> Package libcurl.x86_64 0:7.29.0-57.el7_8.1 will be an update
---> Package lvm2.x86_64 7:2.02.186-7.el7 will be updated
---> Package lvm2.x86_64 7:2.02.186-7.el7_8.2 will be an update
---> Package lvm2-libs.x86_64 7:2.02.186-7.el7 will be updated
---> Package lvm2-libs.x86_64 7:2.02.186-7.el7_8.2 will be an update
---> Package microcode_ctl.x86_64 2:2.1-61.el7 will be updated
---> Package microcode_ctl.x86_64 2:2.1-61.10.el7_8 will be an update
---> Package python-firewall.noarch 0:0.6.3-8.el7 will be updated
---> Package python-firewall.noarch 0:0.6.3-8.el7_8.1 will be an update
---> Package python-perf.x86_64 0:3.10.0-1127.el7 will be updated
---> Package python-perf.x86_64 0:3.10.0-1127.19.1.el7 will be an update
---> Package rsyslog.x86_64 0:8.24.0-52.el7 will be updated
---> Package rsyslog.x86_64 0:8.24.0-52.el7_8.2 will be an update
---> Package selinux-policy.noarch 0:3.13.1-266.el7 will be updated
---> Package selinux-policy.noarch 0:3.13.1-266.el7_8.1 will be an update
---> Package selinux-policy-targeted.noarch 0:3.13.1-266.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-266.el7_8.1 will be an update
---> Package systemd.x86_64 0:219-73.el7.1 will be updated
---> Package systemd.x86_64 0:219-73.el7_8.9 will be an update
---> Package systemd-libs.x86_64 0:219-73.el7.1 will be updated
---> Package systemd-libs.x86_64 0:219-73.el7_8.9 will be an update
---> Package systemd-sysv.x86_64 0:219-73.el7.1 will be updated
---> Package systemd-sysv.x86_64 0:219-73.el7_8.9 will be an update
---> Package tzdata.noarch 0:2019c-1.el7 will be updated
---> Package tzdata.noarch 0:2020a-1.el7 will be an update
---> Package yum-plugin-fastestmirror.noarch 0:1.1.31-53.el7 will be updated
---> Package yum-plugin-fastestmirror.noarch 0:1.1.31-54.el7_8 will be an update

Step 3: Install MariaDB 5.5 Server

After successfully updating the Server you can now install MariaDB 5.5 on RHEL 7/CentOS 7 box using yum install mariadb-server -y command as shown below. This will search, download and install MariaDB Server packages along with its dependencies from enabled Repository.

[root@localhost ~]# yum install mariadb-server -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.65-1.el7 will be installed
--> Processing Dependency: mariadb(x86-64) = 1:5.5.65-1.el7 for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(vars) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(strict) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(Sys::Hostname) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(POSIX) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(File::Temp) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(File::Path) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(File::Copy) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(File::Basename) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Processing Dependency: /usr/bin/perl for package: 1:mariadb-server-5.5.65-1.el7.x86_64
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.65-1.el7 will be installed
--> Processing Dependency: perl(Exporter) for package: 1:mariadb-5.5.65-1.el7.x86_64
---> Package perl.x86_64 4:5.16.3-295.el7 will be installed
--> Processing Dependency: perl-libs = 4:5.16.3-295.el7 for package: 4:perl-5.16.3-295.el7.x86_64
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-295.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-295.el7.x86_64
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
mariadb-server x86_64 1:5.5.65-1.el7 base 11 M
Installing for dependencies:
mariadb x86_64 1:5.5.65-1.el7 base 8.7 M
perl x86_64 4:5.16.3-295.el7 base 8.0 M
perl-Carp noarch 1.26-244.el7 base 19 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-6.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
perl-Encode x86_64 2.51-7.el7 base 1.5 M
perl-Exporter noarch 5.68-3.el7 base 28 k



Transaction Summary
========================================================================================================================================================================
Install 1 Package (+36 Dependent packages)

Total download size: 33 M
Installed size: 147 M
Downloading packages:
(1/37): perl-Carp-1.26-244.el7.noarch.rpm | 19 kB 00:00:00
(2/37): perl-5.16.3-295.el7.x86_64.rpm | 8.0 MB 00:00:03
(3/37): mariadb-5.5.65-1.el7.x86_64.rpm | 8.7 MB 00:00:03
(4/37): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(5/37): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(6/37): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00
(7/37): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00:00
(8/37): perl-Exporter-5.68-3.el7.noarch.rpm | 28 kB 00:00:00
(9/37): perl-File-Path-2.09-2.el7.noarch.rpm | 26 kB 00:00:00
(10/37): perl-File-Temp-0.23.01-3.el7.noarch.rpm | 56 kB 00:00:00
(11/37): perl-Getopt-Long-2.40-3.el7.noarch.rpm | 56 kB 00:00:00
(12/37): perl-Filter-1.49-3.el7.x86_64.rpm | 76 kB 00:00:00
(13/37): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm | 38 kB 00:00:00
(14/37): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(15/37): perl-PathTools-3.40-5.el7.x86_64.rpm | 82 kB 00:00:00
(16/37): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(17/37): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(18/37): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm | 87 kB 00:00:00
(19/37): perl-Pod-Escapes-1.04-295.el7.noarch.rpm | 51 kB 00:00:00
(20/37): mariadb-server-5.5.65-1.el7.x86_64.rpm | 11 MB 00:00:04
(21/37): perl-Pod-Usage-1.63-3.el7.noarch.rpm | 27 kB 00:00:00
(22/37): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm | 36 kB 00:00:00
(23/37): perl-Pod-Simple-3.28-4.el7.noarch.rpm | 216 kB 00:00:00
(24/37): perl-Storable-2.45-3.el7.x86_64.rpm | 77 kB 00:00:00
(25/37): perl-Encode-2.51-7.el7.x86_64.rpm | 1.5 MB 00:00:00
(26/37): perl-Text-ParseWords-3.29-4.el7.noarch.rpm | 14 kB 00:00:00
(27/37): perl-Socket-2.010-5.el7.x86_64.rpm | 49 kB 00:00:00
(28/37): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm | 45 kB 00:00:00
(29/37): perl-Time-Local-1.2300-2.el7.noarch.rpm | 24 kB 00:00:00
(30/37): perl-parent-0.225-244.el7.noarch.rpm | 12 kB 00:00:00
(31/37): perl-macros-5.16.3-295.el7.x86_64.rpm | 44 kB 00:00:00
(32/37): perl-threads-1.87-4.el7.x86_64.rpm | 49 kB 00:00:00
(33/37): perl-podlators-2.5.1-3.el7.noarch.rpm | 112 kB 00:00:00
(34/37): perl-constant-1.27-2.el7.noarch.rpm | 19 kB 00:00:00
(35/37): perl-threads-shared-1.43-6.el7.x86_64.rpm | 39 kB 00:00:00
(36/37): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:01
(37/37): perl-libs-5.16.3-295.el7.x86_64.rpm | 689 kB 00:00:02
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 4.6 MB/s | 33 MB 00:00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:perl-parent-0.225-244.el7.noarch 1/37
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 2/37
Installing : perl-podlators-2.5.1-3.el7.noarch 3/37
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 4/37
Installing : 1:perl-Pod-Escapes-1.04-295.el7.noarch 5/37

Installed:
mariadb-server.x86_64 1:5.5.65-1.el7

Dependency Installed:
mariadb.x86_64 1:5.5.65-1.el7 perl.x86_64 4:5.16.3-295.el7 perl-Carp.noarch 0:1.26-244.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.el7
perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-Encode.x86_64 0:2.51-7.el7
perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7
perl-Filter.x86_64 0:1.49-3.el7 Install MariaDB 5.5 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7
perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PathTools.x86_64 0:3.40-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7 perl-Pod-Escapes.noarch 1:1.04-295.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
perl-Socket.x86_64 0:2.010-5.el7 perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7
perl-Time-HiRes.x86_64 4:1.9725-3.el7 Install MariaDB 5.5 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7
perl-libs.x86_64 4:5.16.3-295.el7 perl-macros.x86_64 4:5.16.3-295.el7 perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7

Complete!

Step 4: Enable and Start MariaDB Server

After installing MariaDB if you check the status using systemctl status mariadb command then you can see by default it does not start the service after installation. So you need to start it manually and then enable it.

[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead)

You can start the mariadb service by using systemctl start mariadb command as shown below. If there is any error in starting the MariaDB service then it will show on the output.

[root@localhost ~]# systemctl start mariadb

Then enable the service by using systemctl enable mariadb command as shown below.

[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

Once started you can check and verify the service status using systemctl status mariadb command as shown below.

[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-14 04:25:48 EDT; 23s ago
Main PID: 5748 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─5748 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─5910 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-fil...

Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: MySQL manual for more instructions.
Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: Please report any problems at http://mariadb.org/jira
Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: The latest information about MariaDB is available at http://mariadb.org/.
Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: You can find additional information about the MySQL part at:
Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: http://dev.mysql.com
Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: Consider joining MariaDB's strong and vibrant community:
Oct 14 04:25:47 localhost.localdomain mariadb-prepare-db-dir[5666]: https://mariadb.org/get-involved/
Oct 14 04:25:47 localhost.localdomain mysqld_safe[5748]: 201014 04:25:47 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Oct 14 04:25:47 localhost.localdomain mysqld_safe[5748]: 201014 04:25:47 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Oct 14 04:25:48 localhost.localdomain systemd[1]: Started MariaDB database server.

Step 5: Secure Your MariaDB Server

After every installation, it is always recommended to first secure your MySQL Server by using mysql_secure_installation tool as shown below. By using this tool, you can setup the root password, allow/remove the anonymous user access, allow/disallow the root login remotely, keep/delete the test database.

[root@localhost ~]# mysql_secure_installation

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

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

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

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

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

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

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

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

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

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

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

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Step 6: Login to MariaDB Server

Once MySQL setup is ready, you can try to login using mysql -u root -p command as shown below. Here I am using root(-u) user to login to database as you can see in the below output. You can enable and use any user with sufficient privileges to login to database. If you are not providing any hostname(-h) then by default it will take localhost as your hostname. If you don't want to provide password with -p option then you can simply use -p option without any argument, It will prompt you to provide the password.

[root@localhost bkp_mysql]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.65-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.

MariaDB [(none)]>

 

 

 

 

Popular Recommendations:-

5 Examples to Turn Off SELinux Temporarily or Permanently on RHEL 8/CentOS 8

Useful C Program to List Network Interfaces using only 30 Lines of Code

Best Explanation of Wrapper Classes in Java: Autoboxing and Unboxing with Examples

5 Best Ways to Become root user or Superuser in Linux (RHEL/CentOS/Ubuntu)

How to Install PHP on RedHat/CentOS 7 with Easy Steps

7 Easy Steps to Install PHP on RHEL 8/CentOS 8

Easy Steps to Install Java on Ubuntu 20.04

Best Steps to Install Java on RHEL 8/CentOS 8

Leave a Comment