MySQL 8.4 is the first Long-Term Support (LTS) release in the MySQL 8.x cycle, launched in April 2024. This LTS status guarantees Premier Support from Oracle until April 2029 and Extended Support until April 2032. This makes it the most stable choice for production environments that require long-term continuity. As of April 2026, the latest version of MySQL 8.4 is 8.4.9.
AlmaLinux and Rocky Linux are RHEL (Red Hat Enterprise Linux) based Linux distributions that are binary-compatible. Both are widely used in server, cloud, and enterprise environments due to their long support cycles and proven stability. Oracle provides official RPM repositories to support these distributions, ensuring a smooth MySQL installation process without needing to compile from source.
System Preparation
Ensure the system meets the following requirements before starting the installation to avoid any issues.
1. Update System Packages
Update all system packages to the latest versions to ensure required dependencies are available and there are no version conflicts:
sudo dnf update -yThe server needs to be restarted if a kernel update is available, so the new kernel becomes active before proceeding with the installation.
2. Access Permissions
The account used must have sudo privileges or be logged in as root. All commands in this guide use the sudo prefix.
3. Disable Default MySQL Module (EL8 Only)
AlmaLinux 8 and Rocky Linux 8 use the DNF module system (AppStream) which includes its own MySQL version. This module must be disabled so that the official Oracle repository can be used without conflicts:
# Only for AlmaLinux 8 / Rocky Linux 8
sudo dnf module disable mysql -yThis step is not required on EL9 and EL10 because there is no active MySQL AppStream module by default.
Adding the Official MySQL Repository
Oracle provides a repository configuration RPM package that can be downloaded directly from MySQL Community Downloads. This package will automatically add the .repo file to the /etc/yum.repos.d/ directory.
1. Choose the Correct Repository Package
The RPM package must be selected according to the operating system version. The following table details the MySQL 8.4 repository file names for each version:
| Distribution | EL Version | RPM Repository File |
|---|---|---|
| AlmaLinux 10 / Rocky Linux 10 | EL10 | mysql84-community-release-el10-3.noarch.rpm |
| AlmaLinux 9 / Rocky Linux 9 | EL9 | mysql84-community-release-el9-4.noarch.rpm |
| AlmaLinux 8 / Rocky Linux 8 | EL8 | mysql84-community-release-el8-3.noarch.rpm |
Verify the system version before proceeding:
cat /etc/os-release2. Install the Repository
The repository can be added directly using dnf install with the full URL without needing to download the RPM file separately. Use the appropriate command for your system version:
AlmaLinux 10 / Rocky Linux 10 (EL10)
sudo dnf install https://dev.mysql.com/get/mysql84-community-release-el10-3.noarch.rpm -yAlmaLinux 9 / Rocky Linux 9 (EL9)
sudo dnf install https://dev.mysql.com/get/mysql84-community-release-el9-4.noarch.rpm -yAlmaLinux 8 / Rocky Linux 8 (EL8)
sudo dnf install https://dev.mysql.com/get/mysql84-community-release-el8-3.noarch.rpm -y3. Verify and Select the Repository Series
Check the active MySQL repositories after the repository RPM installation is complete:
sudo dnf repolist enabled | grep mysqlThe MySQL repository RPM package registers several series at once. The series active by default is usually the latest series, so the output may show series 9.7 (not 8.4):
mysql-9.7-lts-community MySQL 9.7 LTS Community Server
mysql-connectors-community MySQL Connectors Community
mysql-tools-9.7-lts-community MySQL Tools 9.7 LTS CommunityRun the following command to list all available MySQL repositories (both enabled and disabled):
sudo dnf repolist all | grep mysqlCaution: Default Repository Series May Differ
The default active repository may change following the latest MySQL releases. The 9.x series must be disabled first and the 8.4 series must be explicitly enabled if the goal is to install MySQL 8.4 LTS.
4. Enable the MySQL 8.4 LTS Repository
Use dnf config-manager to disable the 9.7 LTS series and enable the 8.4 LTS series:
# Disable 9.7 LTS series
sudo dnf config-manager --disable mysql-9.7-lts-community
sudo dnf config-manager --disable mysql-tools-9.7-lts-community
# Enable 8.4 LTS series
sudo dnf config-manager --enable mysql-8.4-lts-community
sudo dnf config-manager --enable mysql-tools-8.4-lts-communityVerify again that the enabled repositories are correct:
sudo dnf repolist enabled | grep mysqlOutput after reconfiguration:
mysql-8.4-lts-community MySQL 8.4 LTS Community Server
mysql-connectors-community MySQL Connectors Community
mysql-tools-8.4-lts-community MySQL Tools 8.4 LTS CommunityMySQL 8.4 Installation Process
1. Install MySQL Community Server
Run the main installation command to install MySQL Community Server along with required components:
sudo dnf install mysql-community-server -yThis process will download and install the mysql-community-server, mysql-community-client, mysql-community-common packages, and other dependencies automatically.
2. Verify Installation
Check the installed version to ensure MySQL is properly installed:
mysql --versionExpected output:
mysql Ver 8.4.9 for Linux on x86_64 (MySQL Community Server - GPL)The version number may differ depending on the latest release at the time of installation, but it must display version 8.4.x.
Service Configuration
1. Start MySQL
Start the mysqld service using systemctl:
sudo systemctl start mysqld2. Enable Auto-Start at Boot
Enable the service to run at system startup so MySQL automatically starts every time the server reboots:
sudo systemctl enable mysqldBoth commands above can be combined into one:
sudo systemctl enable --now mysqld3. Verify Service Status
Ensure the MySQL service is running normally before proceeding to the next step:
sudo systemctl status mysqldThe service is running well if the output shows status active (running):
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
Active: active (running) since Mon 2026-05-04 12:13:47 UTC; 3s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 6042 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 6109 (mysqld)
Status: "Server is operational"
Tasks: 35 (limit: 4365)
Memory: 443.7M (peak: 451.0M)
CPU: 4.875s
CGroup: /system.slice/mysqld.service
└─6109 /usr/sbin/mysqldBasic Security
MySQL 8.4 generates a temporary password for the root account upon first initialization. This step must be completed immediately before the server can be used.
1. Get the Temporary Password
The initial root password is stored in the MySQL system log. Retrieve the password using the command:
sudo grep 'temporary password' /var/log/mysqld.logThe output will include a line like the following:
2026-05-04T12:13:44.830444Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7)gs!?gMk)puCopy the password at the end of that line (example: 7)gs!?gMk)pu). This password is temporary and will be changed in the next step.
2. Run the Security Script
Run the mysql_secure_installation script to secure the MySQL installation. This script will guide you through basic security setup interactively:
sudo mysql_secure_installationThe script will ask a series of questions. Here is a guide for each option:
Enter the Temporary Password
Enter password for user root: [enter the temporary password from the log]Change Root Password
A new password must be set immediately because the old password has expired.
New password: [enter a strong new password]
Re-enter new password: [repeat the new password]MySQL 8.4 Password Policy: MySQL 8.4 uses the
validate_passwordplugin which requires passwords to meet certain criteria, namely at least 8 characters and containing uppercase letters, lowercase letters, numbers, and special characters. Example strong password:MyS3rv3r@Pass!
Advanced Security Options
# Enable password validation (choose Y for optimal security)
Would you like to setup VALIDATE PASSWORD component? [Y/n]: Y
# Password policy level (choose 0=LOW, 1=MEDIUM, 2=STRONG)
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
# Remove anonymous users
Remove anonymous users? [Y/n]: Y
# Disallow root login remotely
Disallow root login remotely? [Y/n]: Y
# Remove test database
Remove test database and access to it? [Y/n]: Y
# Reload privilege tables
Reload privilege tables now? [Y/n]: YSecurity Recommendations
Choosing Y (Yes) is recommended for all options above on production servers. Remote root access should be disabled. A dedicated database account with limited privileges should be used for application connections.
3. Verify Login with the New Password
Test login using the new root password after the script finishes:
mysql -u root -pEnter the new password when prompted. The MySQL console will open if the process is successful:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.4.9 MySQL Community Server - GPL
Type exit or quit to exit the MySQL console.
Conclusion
MySQL 8.4 LTS is a solid database choice for AlmaLinux and Rocky Linux based infrastructures because its installation process is relatively simple through the official Oracle repository. This guide has covered the important steps from system preparation, package installation, to access hardening using the standard script. Further implementations such as automated backup strategies and performance monitoring are highly recommended to maintain stability and security in production environments.




