How to Install and Configure MariaDB on Oracle Linux 8.5

To Install And Configure MariaDB On Oracle Linux 8.5

Introduction:

MariaDB is an open-source relational database management system (DBMS) that is a consistent drop-in replacement for the extensively used MySQL database technology

Installation Procedure:

Step 1: Check the Oracle linux Version by using the below command

[root@localhost linuxhelp]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.5

Step 2: Install MariaDB Server by using the below command

[root@localhost linuxhelp]# yum -y install mariadb-server
Last metadata expiration check: 1 day, 9:11:10 ago on Wed 11 May 2022 09:58:52 PM IST.
Dependencies resolved.
Package                 Arch   Version                                       Repository     Size
Installing:
 mariadb-server          x86_64 3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b ol8_appstream  16 M
Installing dependencies:
 mariadb                 x86_64 3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b ol8_appstream 6.0 M
 mariadb-common          x86_64 3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b ol8_appstream  64 k
 mariadb-connector-c     x86_64 3.1.11-2.el8_3                                ol8_appstream 200 k
mariadb-errmsg          x86_64 3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b ol8_appstream 234 k

Transaction Summary
Install  6 Packages
Total download size: 23 M
Installed size: 122 M
Installed:
  mariadb-3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b.x86_64                                    
  mariadb-common-3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b.x86_64                             
  mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                       
  mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                
  mariadb-errmsg-3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b.x86_64                             
  mariadb-server-3:10.3.32-2.0.1.module+el8.5.0+20629+e1b20d6b.x86_64                             
Complete!

Step 3: Enable the MariaDB service by using the below command

[root@localhost linuxhelp]# systemctl enable mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

Step 4: Start the MariaDB service by using the below command

 [root@localhost linuxhelp]# systemctl start mariadb

Step 5: Check the status of MariaDB service by using the below command

 [root@localhost linuxhelp]# systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-05-13 07:10:57 IST; 12s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 34661 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 10472)
   Memory: 80.3M
   CGroup: /system.slice/mariadb.service
           └─34629 /usr/libexec/mysqld --basedir=/usr

Step 6: Install MariaDB server by using the below command

[root@localhost linuxhelp]# 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] y
 ... Success!


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 7: Login to the MariaDB database by using the below command

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

Step 8: Create the sample database by using the below command

MariaDB [(none)]> create database test;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.000 sec

Step 9: Enter the database using the below command

MariaDB [(none)]> use test;
Database changed

Step 10: Create the table in the name of Checklist by using the below command

MariaDB [test]> create table checklist (Sno int, Name varchar(20), version int);
Query OK, 0 rows affected (0.005 sec)

Step 11: Insert the values inside the Tables by using the below commands.

MariaDB [test]> insert into checklist values ('1' , 'Oracle', '8.5');
Query OK, 1 row affected (0.002 sec)

Step 12: To list inside the table’s creation by using the below command.

MariaDB [test]> select * from checklist;
+------+--------+---------+
| Sno  | Name   | version |
+------+--------+---------+
|    1 | Oracle |       9 |
+------+--------+---------+
1 row in set (0.001 sec)

Step 13: To create a user and grant all privileges by using the below command

MariaDB [test]> CREATE USER 'user1'@'localhost'IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.001 sec)

MariaDB [test]> GRANT ALL PRIVILEGES ON test.* TO'user1'@localhost;
Query OK, 0 rows affected (0.000 sec)

MariaDB [test]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)
MariaDB [test]> exit
Bye

Step 14: Login as user in MariaDB by the below command

[root@localhost linuxhelp]# mysql -u user1 -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.3.32-MariaDB MariaDB Server
MariaDB [(none)]> exit
Bye

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install and configure MariaDB on Oracle Linux 8.5. Your feedback is much welcome.

FAQ
Q
Is MariaDB good for large databases?
A
MariaDB can be part of the database infrastructure for Big Data.
Q
What port does MariaDB use?
A
MariaDB uses Port 3306
Q
What type of database is MariaDB?
A
MariaDB is an open-source relational database management system (DBMS)
Q
Does MySQL use multiple cores?
A
Yes. MySQL is fully multithreaded and makes use of all CPUs made available to it.
Q
Is MariaDB faster than MySQL?
A
When it comes to performing queries or replication, MariaDB is faster than MySQL.