Rostyslav Rava - Personal Website

How to Install MySQL 8.4 on RHEL 7

While both Red Hat Enterprise Linux and Ubuntu are Linux systems, the installation process for MySQL from the YUM repository is completely different from what was described earlier for MySQL on Ubuntu. Although RHEL 7 reached end of maintenance on June 30, 2024, it will still be under Extended Life Cycle Support until May 31, 2029. That is more than three years away, which makes it a suitable option for legacy bare-metal servers that list it as a supported operating system.

But what matters most for this post is that there is an available MySQL YUM repository for the latest long-term supported MySQL version, 8.4, for RHEL 7. The MySQL repository configuration RPM can be downloaded using curl.

curl -O https://repo.mysql.com/mysql84-community-release-el7-2.noarch.rpm

After that, install the downloaded RPM with YUM as described in the MySQL manual.

sudo yum localinstall -y mysql84-community-release-el7-2.noarch.rpm

Verification might be run with:

yum repolist enabled | grep mysql.*-community

This should show that repositories for MySQL 8.4 are available.

mysql-8.4-lts-community/x86_64       MySQL 8.4 LTS Community Server          90
mysql-connectors-community/x86_64    MySQL Connectors Community             294
mysql-tools-8.4-lts-community/x86_64 MySQL Tools 8.4 LTS Community           16

This is a good time to upgrade the system with YUM.

sudo yum upgrade

During yum upgrade, YUM may replace the stock mariadb-libs packages with MySQL Community libraries and pull in the dependencies shown in the output.

Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
---> Package mysql-community-libs.x86_64 0:8.4.8-1.el7 will be obsoleting
--> Processing Dependency: mysql-community-client-plugins >= 8.4.8-1.el7 for package: mysql-community-libs-8.4.8-1.el7.x86_64
--> Processing Dependency: mysql-community-common(x86-64) >= 8.0.11 for package: mysql-community-libs-8.4.8-1.el7.x86_64
---> Package mysql-community-libs-compat.x86_64 0:8.4.8-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-client-plugins.x86_64 0:8.4.8-1.el7 will be installed
---> Package mysql-community-common.x86_64 0:8.4.8-1.el7 will be installed
--> Finished Dependency Resolution

A typical transaction summary looks like this:

Installed:
  mysql-community-libs.x86_64 0:8.4.8-1.el7                mysql-community-libs-compat.x86_64 0:8.4.8-1.el7

Dependency Installed:
  mysql-community-client-plugins.x86_64 0:8.4.8-1.el7      mysql-community-common.x86_64 0:8.4.8-1.el7

Replaced:
  mariadb-libs.x86_64 1:5.5.68-1.el7

The system is now ready to install the MySQL server itself.

sudo yum -y install mysql-community-server

The output will show that the MySQL server package is installed:

Installed:
  mysql-community-server.x86_64 0:8.4.8-1.el7

After installation, the MySQL server needs to be started with the following command:

sudo systemctl start mysqld

The mysqld service is enabled by default, and MySQL will start automatically when the host boots.

The status of the MySQL service can be checked with the following command:

sudo systemctl status mysqld

When the service is active, it will show that MySQL Server is running.

● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2026-03-13 22:01:19 UTC; 10min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1276 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 1352 (mysqld)
   Status: "Server is operational"
   CGroup: /system.slice/mysqld.service
           └─1352 /usr/sbin/mysqld

Mar 13 22:01:17 edge systemd[1]: Starting MySQL Server...
Mar 13 22:01:19 edge systemd[1]: Started MySQL Server.

The root password for the MySQL server is generated on the first start and can be found in the error log file.

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

The command prints a line from the error log like the one below, including the temporary password. For example, it might be 8wU1k7j89l<?, containing digits, uppercase and lowercase letters, and special characters, with minimum length and complexity that satisfy MySQL password validation requirements.

2026-03-24T06:28:01.073533Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8wU1k7j89l<?

Access to the MySQL server is through the MySQL CLI client from the mysql-community-client package. Authentication uses the temporary root password from the error log. The following example connects via TCP/IP to localhost:

mysql -h localhost -u root -p
Enter password:

The following output from MySQL, showing version 8.4.8, confirms that it is properly installed and accessible.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.8

Copyright (c) 2000, 2026, 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>

The first required step is changing the root password.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'V@li1DPass!';

Entering exit and pressing Enter closes the client and ends the session with a Bye message.

mysql> exit
Bye

In this post, installing MySQL 8.4 on RHEL 7 from the MySQL YUM repository was reviewed. The installation was verified by connecting to the server and checking the version. Replacing the temporary root password after first login was covered as a separate, required step.

Tags: