October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Install MySQL on Rocky Linux 8 (Native Package or Oracle Repository)

Install MySQL on Rocky Linux 8 with the native AppStream package or Oracle’s Community repository. This guide covers module conflicts, service startup, temporary root passwords, firewall boundaries, application users and recovery steps.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On Rocky Linux 8, the simplest supported installation is the distribution package: sudo dnf install mysql-server, followed by sudo systemctl enable mysqld.service --now. Rocky’s documentation identifies MySQL 8.0 as the default native package series. If you need Oracle’s MySQL Community packages instead, disable Rocky’s enabled MySQL module first; otherwise that module can hide the Community packages and make dnf install mysql-community-server fail.

Choose the package source before installing

Rocky Linux 8 can run MySQL from its own AppStream repositories or from Oracle’s MySQL Yum repository. Both routes install a systemd-managed mysqld service, but they differ in package provenance, release timing and interaction with Rocky’s module streams. Decide first, then keep the installation consistent rather than mixing packages from both sources.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision point Rocky Linux package Oracle MySQL Yum repository
Install package mysql-server mysql-community-server
Package source Rocky Linux AppStream repositories Oracle’s MySQL Community repository, which must be configured before installation
Documented default series Rocky documentation describes MySQL 8.0 as the default native version Release series follows the enabled Oracle repository channel
Update cadence Follows Rocky’s module and errata process Follows Oracle’s repository publishing schedule
EL8 module interaction Designed to work with Rocky’s enabled modules The enabled EL8 MySQL module can mask packages from the Oracle repository; disable it first
Installed components Rocky’s server package and its dependencies Oracle’s server package installs the server plus client, common and library components

Rocky’s live AppStream inventory contains several MySQL 8.0 and 8.4 builds and separate mysql-selinux packages. Those are repository listings, not a permanent promise of one version. Check what your enabled repositories offer immediately before installation:

sudo dnf repolist
sudo dnf module list mysql
sudo dnf info mysql-server

Oracle’s packages are appropriate when you require a release line or update timing that differs from Rocky’s stream. The native package is usually the lower-friction choice for a server intended to track Rocky’s normal lifecycle.

Prerequisites and safety checks

  • Use a Rocky Linux 8 system with an account that can run sudo.
  • Confirm that the machine can reach the repository mirror or the already configured Oracle repository.
  • Check whether another MySQL or MariaDB server is already installed and whether it owns the mysqld service name.
  • Plan the data directory and backups before putting applications on the server. Do not initialize a new instance over an existing database directory unless you have a verified backup and understand the migration.
  • Decide whether MySQL will be local-only or reachable from another host. Installation itself does not require opening TCP port 3306 to the Internet.

Stop at this point if the host contains important database files and you are unsure which package created them. Package replacement and data-directory initialization are deployment operations, not harmless installer retries.

Install MySQL from Rocky Linux AppStream

1. Refresh metadata and inspect the candidate

sudo dnf makecache
sudo dnf info mysql-server

The output shows the version selected from your currently enabled repositories. Because AppStream contents change, record the exact package version in your deployment notes instead of assuming every Rocky Linux 8 installation receives the same build.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Install the server

sudo dnf install mysql-server

Read the transaction summary and accept it only when the repositories and packages are the ones you intended. The command may also install supporting libraries and the SELinux integration package selected by Rocky’s dependency metadata.

3. Enable and start the service

sudo systemctl enable mysqld.service --now

enable makes MySQL start at boot; --now starts it immediately. Verify both the current state and the boot setting:

sudo systemctl status mysqld
sudo systemctl is-enabled mysqld

A healthy service normally reports active (running). If it is inactive or failed, do not proceed to application configuration until you inspect the service log in the troubleshooting section below.

Install Oracle MySQL Community Server on EL8

1. Configure the Oracle repository

The mysql-community-server package is not supplied by Rocky’s normal AppStream repository. First install and enable the Oracle MySQL Yum repository for EL8 using Oracle’s repository instructions and select the release channel you intend to maintain. The exact repository-release package and channel can change, so do not copy an old repository URL into a new deployment without checking the current Oracle documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Disable Rocky’s MySQL module

sudo yum module disable mysql

On EL8 systems, the MySQL module is enabled by default. Oracle documents that, unless it is disabled, the module masks packages supplied by MySQL repositories. yum is the compatibility command on Rocky Linux 8; the equivalent syntax with dnf is:

sudo dnf module disable mysql

Confirm the result before installing:

sudo dnf module list mysql

The listing should show the Rocky module as disabled. Disabling the module does not uninstall an existing server and does not erase data; it changes which repository packages dependency resolution can see.

3. Install the Community server package

sudo yum install mysql-community-server

Oracle’s package brings in the server and its client, common and library components. If the command reports that no package is available, check repository configuration and module state first; repeatedly running the install command will not bypass a masked module.

4. Start and verify MySQL

sudo systemctl start mysqld
sudo systemctl status mysqld

After confirming that the service is running, enable it for future boots:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl enable mysqld

The explicit start and status commands are useful on an existing host because they separate package installation from service startup and make a failure visible immediately.

Complete first-start initialization and set the root password

When MySQL starts with an empty data directory, it initializes the server, creates root@localhost, generates SSL certificate and key files, enables the validate_password component, and writes a temporary root password to the error log. Oracle’s documented log path is /var/log/mysqld.log.

1. Retrieve the temporary password

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

Copy the password exactly, including punctuation and letter case. It is intended for the first administrative login, not for applications or permanent automation.

2. Log in locally

mysql -uroot -p

When prompted, paste the temporary password. The client may appear not to echo pasted characters; that is normal. A successful login leaves you at the MySQL prompt.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Replace the temporary password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

Use a unique password that satisfies the active validate_password policy. If MySQL rejects the value, choose a longer password with a mix of character types rather than disabling the password policy as a shortcut. Exit with quit;, then test the new credential in a fresh client session.

If no temporary password appears

A missing match usually means one of three things: the server was initialized earlier, a different log destination is configured, or the service did not complete startup. Check the service state and recent journal entries:

sudo systemctl status mysqld
sudo journalctl -u mysqld --no-pager -n 100

Do not delete the data directory merely to force a new password. If it contains databases, stop and recover the existing administrative credential or follow a documented password-recovery procedure for your exact MySQL release.

Verify the installation from the command line

Use a few independent checks before creating application schemas:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mysql --version
sudo systemctl is-active mysqld
mysql -uroot -p -e "SELECT VERSION(), @@hostname;"

The first command reports the client package version, the second checks the systemd state, and the third confirms that an authenticated connection reaches the expected server. Treat the version as a recorded fact for this host; Rocky’s AppStream and Oracle’s channels can publish different builds.

You can also inspect installed RPMs:

rpm -qa | grep -E '(^mysql|^mysql-community)'

Seeing packages from both the Rocky and Oracle families is a warning sign. Mixed package ownership can produce upgrade conflicts and should be resolved deliberately with a backup and a migration plan.

Keep MySQL local unless remote access is required

A local application can connect through the loopback interface without any firewall change. For a remote client, four controls must agree: MySQL’s bind address, the account’s allowed host, the host firewall and any network firewall or security group outside the server.

Bind only to the interfaces you need

Inspect the active MySQL configuration before changing it. If the server must accept remote traffic, set bind-address to the private interface or address used by the application, not to an unrestricted public interface. The exact configuration file can vary by package and deployment, so confirm which files the running service reads before editing. Restart MySQL after a configuration change and verify the resulting listening address with your operating system’s socket tools.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create a dedicated application account

CREATE DATABASE game_app;
CREATE USER 'game_app'@'10.20.30.%' IDENTIFIED BY 'Use-A-Unique-Secret-Here!';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX ON game_app.* TO 'game_app'@'10.20.30.%';
FLUSH PRIVILEGES;

Adjust the host pattern and privileges to the application’s actual needs. A narrower source address is safer than a broad subnet, and the application should never use root. Keep credentials in the application’s secret store rather than in source control.

Allow the firewall rule narrowly

Rocky’s firewalld workflow is:

sudo systemctl enable --now firewalld
sudo systemctl status firewalld

Permit MySQL only from a known source address or private network. For example, this rich rule allows TCP 3306 from one IPv4 address:

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10/32" port protocol="tcp" port="3306" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-all

Replace the example address with the real application host. Do not use a public “allow everyone” rule as a connectivity test. Rocky’s firewalld documentation notes that every permanent change requires a reload before it takes effect; verify the active zone and rule after reloading.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Post-install security and operations

  • Protect root: use the local root account for administration only. Create named administrator accounts when several operators need access so actions can be attributed and revoked individually.
  • Preserve encryption: the initial server setup generates SSL certificate and key files. For remote clients, configure TLS verification appropriate to your application rather than assuming a network firewall alone protects credentials.
  • Back up before changes: test a logical or physical backup and a restore on a separate environment before upgrades, module changes or schema migrations.
  • Track updates: document whether Rocky’s errata or Oracle’s repository owns the server packages. Switching sources without a compatibility review can change available release series and dependency behavior.
  • Monitor the service: alert on a failed mysqld unit, disk exhaustion, repeated authentication failures and backup errors. The systemd status command is a first check, not a substitute for ongoing monitoring.

Troubleshooting common Rocky Linux 8 installation failures

dnf install mysql-community-server says no package is available

  1. Confirm that the Oracle MySQL repository is installed and enabled.
  2. Run sudo dnf module list mysql and disable the enabled Rocky module with sudo dnf module disable mysql.
  3. Refresh metadata with sudo dnf clean all followed by sudo dnf makecache.
  4. Retry the install and inspect the repository IDs in the transaction summary.

If the package still cannot be found, the selected Oracle channel may not support your EL8 architecture or the repository configuration may be incomplete. Correct that configuration instead of downloading an unrelated RPM.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The service fails immediately after installation

Capture the failure rather than repeatedly restarting:

sudo systemctl status mysqld --no-pager
sudo journalctl -u mysqld --no-pager -b

Look for an occupied port, permission or SELinux denial, an invalid configuration line, insufficient disk space or an existing data directory created by another MySQL release. Resolve the first concrete error, then start the service again and check its status.

The temporary password command returns nothing

Check whether the data directory was already initialized and inspect the current boot’s journal. If this is an existing instance, its administrator password is not necessarily temporary and reinstalling packages will not reset it. Preserve the database files and use the recovery process documented for your installed MySQL version.

Local login works but a remote client cannot connect

  • Confirm that MySQL is listening on the intended private address rather than only on loopback.
  • Check that the MySQL account’s host part matches the client source address.
  • Verify the active firewalld zone and that the permanent rule was reloaded.
  • Check upstream network controls, security groups and routing.
  • Test with the application account, not root, so an account-host mismatch is visible.

A package upgrade proposes removing unexpected components

Stop and review the transaction. This often indicates mixed Rocky and Oracle package families or a module stream change. Record installed versions, take a verified backup, and choose one package source before continuing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which route should you use?

Choose Rocky’s mysql-server when you want the distribution-tested dependency set, ordinary Rocky update tooling and the least module administration. Choose Oracle’s mysql-community-server when you specifically need Oracle’s release channel and are prepared to manage repository configuration and the EL8 module mask. In either case, inspect the available version at installation time, record the source, complete the temporary-password change, and keep network exposure limited to known clients.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.