How to install MySQL on Oracle Linux 8.5

To Install MySQL On Oracle Linux 8.5

Introduction

MySQL is a relational database management system (RDBMS) developed by Oracle that is based on structured query language (SQL) that provides numerous Unix utilities in a single executable file.

Installation Steps:

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

 [root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"

Step 2: Download the MySQL community release rpm file by using the below command

[root@linuxhelp ~]# curl -sSLO https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm

Step 3: Long list the files by using the below command

 [root@linuxhelp ~]# ll
total 20
-rw-------. 1 root root  1358 Aug 23 19:37 anaconda-ks.cfg
-rw-r--r--. 1 root root  1745 Aug 23 20:49 initial-setup-ks.cfg
-rw-r--r--. 1 root root 10928 Sep  2 20:41 mysql80-community-release-el7-5.noarch.rpm

Step 4: Verify the Downloaded File by using the below command

[root@linuxhelp ~]# md5sum mysql80-community-release-el7-5.noarch.rpm
e2bd920ba15cd3d651c1547661c60c7c  mysql80-community-release-el7-5.noarch.rpm

Step 5: Install the Package by using the below command

[root@linuxhelp ~]# sudo rpm -ivh mysql80-community-release-el7-5.noarch.rpm
warning: mysql80-community-release-el7-5.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql80-community-release-el7-5  ################################# [100%]

Step 6: Install the MySQL server by using the below command

 [root@linuxhelp ~]# sudo yum install mysql-server
MySQL 8.0 Community Server                            3.2 MB/s | 2.4 MB     00:00    
MySQL Connectors Community                            142 kB/s |  51 kB     00:00    
MySQL Tools Community                                 1.3 MB/s | 711 kB     00:00    
Dependencies resolved.
======================================================================================
 Package            Arch   Version                                Repository     Size
======================================================================================
Installing:
 mysql-server       x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream  25 M
Installing dependencies:
 mariadb-connector-c-config
                    noarch 3.1.11-2.el8_3                         ol8_appstream  15 k
mysql              x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream  12 M


 mysql-common       x86_64 8.0.26-1.module+el8.4.0+20311+30d12931 ol8_appstream 134 k
Enabling module streams:
 mysql                     8.0                                                       
Transaction Summary
======================================================================================
Install  7 Packages
Downloading Packages:
(1/7): mariadb-connector-c-config-3.1.11-2.el8_3.noar  69 kB/s |  15 kB     00:00    
(2/7): mysql-common-8.0.26-1.module+el8.4.0+20311+30d 901 kB/s | 134 kB     00:00    
(3/7): mecab-0.996-1.module+el8.0.0+5253+1dce7bb2.9.x 644 kB/s | 397 kB     00:00    
(4/7): mysql-errmsg-8.0.26-1.module+el8.4.0+20311+30d 995 kB/s | 598 kB     00:00    
(5/7): protobuf-lite-3.5.0-13.el8.x86_64.rpm          1.2 MB/s | 149 kB     00:00    
(6/7): mysql-8.0.26-1.module+el8.4.0+20311+30d12931.x 4.2 MB/s |  12 MB     00:02    
(7/7): mysql-server-8.0.26-1.module+el8.4.0+20311+30d 3.9 MB/s |  25 MB     00:06    
Installed:
  mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                    
  mecab-0.996-1.module+el8.0.0+5253+1dce7bb2.9.x86_64                                 
  mysql-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64                                 
  mysql-common-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64                          
  mysql-errmsg-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64                          
  mysql-server-8.0.26-1.module+el8.4.0+20311+30d12931.x86_64                          
  protobuf-lite-3.5.0-13.el8.x86_64                                                   
Complete!

Step 7: Start the MySQL daemon with the below command

[root@linuxhelp ~]# sudo systemctl start mysqld

Step 8: Check the status of MySQL by using the below command

 [root@linuxhelp ~]# sudo systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: d>
   Active: active (running) since Fri 2022-09-02 20:46:10 IST; 25s ago
  Process: 39809 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=>
  Process: 39685 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=>
  Process: 39661 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/>
 Main PID: 39765 (mysqld)
   Status: "Server is operational"
Sep 02 20:46:10 linuxhelp systemd[1]: Started MySQL 8.0 database server.

Step 9: Use the below command to run the security script

[root@linuxhelp ~]# sudo mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
All done! 

Step 10: We can verify our installation and get information about it by connecting with the mysqladmin tool

[root@linuxhelp ~]# mysqladmin -u root -p version
Enter password: 
mysqladmin  Ver 8.0.26 for Linux on x86_64 (Source distribution)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version		8.0.26
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/var/lib/mysql/mysql.sock
Uptime:			2 min 38 sec
Threads: 2  Questions: 14  Slow queries: 0  Opens: 133  Flush tables: 3  Open tables: 49  Queries per second avg: 0.088

Step 11: Use the following command to login MySQL

[root@linuxhelp ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.26 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

Conclusion

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

FAQ
Q
What is MySQL best for?
A
MySQL is ideal for storing application data, specifically web application data.
Q
Why MySQL is needed?
A
MySQL is the world's most popular open source database is that it provides comprehensive support for every application development need.
Q
How reliable is MySQL?
A
MySQL has a well-earned and established a reputation for reliability among its 5 million user community.
Q
What are the limitations of the MySQL database?
A
The internal representation of a MySQL table has a maximum row size limit of 65,535 bytes.
Q
Can MySQL use multiple CPUs?
A
MySQL is fully multithreaded and makes use of all CPUs made available to it