Install MySQL Version 8 on Red Hat Enterprise Linux 8 - Step by Step Process ?

MySQL is the most widely used open-source database management system, particularly in the area of application development. The main function of MySQL is to store and retrieve records and information.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related MySQL queries.

In this context, we shall look into how to install MySQL version 8 (the latest at the time of writing) via the MySQL yum repository on Red Hat Enterprise Linux (RHEL) 8.

Steps to install MySQL on your Red Hat Enterprise Linux system:

To begin, ensure that you have  sudo or root privileges for the Server.

The follow the steps given below.

1. Add the MySQL Yum Repository

First of all, run the command below to download the MySQL Yum repository package for RHEL 8:

$ wget

Next, install the downloaded MySQL Yum repository package as follows:

$ sudo yum install

Run the next command to verify that the MySQL Yum repository was successfully added:

$ yum repolist enabled | grep -i mysql

2. Install MySQL Version 8

Once the MySQL Yum repository has been successfully added, you may now install MySQL with the command below:

$ sudo yum install mysql-community-server

Note: If you get an error message indicating that a match could not be found for the mysql-community-server, then you may need to first run the next command to disable the MySQL module.

Apparently, this module hides packages provided by MySQL repositories. Once the MySQL module has been successfully disabled, you may run the previous command again to install MySQL:

$ sudo yum module disable mysql

After the installation completes successfully, run the command below to verify the version of MySQL:

$ mysql --version

3. How to Start the MySQL Server ?

Run the following command to start the MySQL server:

$ sudo systemctl start mysqld

Next, verify that the MySQL server started successfully with the command below:

$ sudo systemctl status mysqld

4. Secure the MySQL Server

Run the command below to retrieve the temporary password that was automatically created during installation for the MySQL root user:

$ sudo grep 'temporary password' /var/log/mysqld.log

Next, run the mysql_secure_installation script with the command below:

$ sudo mysql_secure_installation

When prompted, enter the temporary password you retrieved in the previous step.

You should be prompted to:

i. Set a new password

ii. Remove anonymous users

iii. Disallow root login remotely

iv. Remove test database

v. Reload the privilege tables

5. Login to MySQL

After the mysql_secure_installation script completes, you may now login to MySQL with the command below:

$ mysql -u root -p

Once logged in, let us create a sample database:

mysql> CREATE DATABASE company;
mysql> USE company;

Also, let us create a table as well as some records as follows:

mysql> CREATE TABLE departments ( dept_name varchar(25), dept_head varchar(25), dept_code char(7), PRIMARY KEY (dept_code) );
mysql> INSERT INTO departments VALUES (‘Information Technology’, ‘Linux APT’, ‘IT’), (‘Human Resources’, ‘Jane Doe’, ‘HR’), (‘Digital Marketing’, ‘Ibmi Media’, ‘DMKT’);

Now, we can display all records in the department’s table with the following query:

mysql> SELECT * FROM departments;

How to Remove or Uninstall MySQL ?

If you would like to remove MySQL at any time, run the following command on the terminal:

$ sudo yum remove mysql-community*

[Need urgent help in setting up MYSQL configuration on your Linux Server ? We are available to help you today. ]

This article covers how to Install MySQL Version 8 on Red Hat Enterprise Linux 8. Now, you should now have a fully functioning MySQL server version 8 running on your Server.

To Install MySQL 8.0 On CentOS 8 / RHEL 8:

1. Install MySQL 8.0 from MySQL Dev Community

Add the official repository of MySQL to install the MySQL community server:

$ rpm -ivh

Make sure the MySQL repository has been added and enabled by using the following command:

$ yum repolist all | grep mysql | grep enabled

To Manage MySQL server Service on Linux:

1. After the installation of MySQL, start MySQL server service using the following command:

$ systemctl start mysqld

2. The below command will Enable MySQL server at system startup:

$ systemctl enable mysqld

3. Verify that MySQL server is started using the following command:

$ systemctl status mysqld

Related Posts