Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk9 min

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

Install MySQL on Rocky Linux 8 with the Rocky package or Oracle’s Community repository. Follow the exact commands, retrieve the temporary root password, verify mysqld, and secure remote access.
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 in that guide. If you need Oracle’s MySQL Community packages instead, disable Rocky’s enabled MySQL module first; otherwise the module can hide the Community packages and make mysql-community-server appear unavailable.

Choose the installation route first

Both routes install a working MySQL server, but they solve different administration needs. Pick one source for the server packages and keep that choice consistent with your update and support process.

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 native package Oracle MySQL Yum repository
Package command sudo dnf install mysql-server sudo yum install mysql-community-server
Package provenance Rocky Linux repositories and their dependency integration Oracle’s MySQL Community repository
Module preparation No module change is required for the documented native path Disable the EL8 MySQL module before installing
Release availability Tracks the versions exposed by enabled Rocky repositories; the documented default is MySQL 8.0 Tracks the release series selected from Oracle’s repository
Operational fit Usually the least surprising choice when the host is managed as a Rocky system Useful when you specifically need Oracle’s package stream or release timing
Updates Arrive through Rocky’s repository and module policy Arrive through Oracle’s repository policy

Rocky’s live AppStream inventory can contain several MySQL 8.0 and 8.4 builds, along with separate mysql-selinux packages. Those listings change as repositories are updated, so treat the package version visible on your host as the authoritative value for that installation date rather than assuming one permanent version number.

Prerequisites and preparation

You need a running Rocky Linux 8 system, an account allowed to use sudo, network access to the repository you select, and enough disk space for the server package and its data directory. Installation does not require opening MySQL to the network.

  • Decide whether Rocky’s native package or Oracle’s Community repository will own the MySQL packages.
  • Check which repositories and modules are enabled before troubleshooting a package-not-found error. Repository contents are a live inventory, not a fixed specification.
  • If this machine already contains a database, confirm where its data directory is and whether it is a production instance. The temporary-password procedure applies when MySQL starts with an empty data directory.
  • Plan the account that applications will use. The root account created during initialization should be reserved for administration, not embedded in application configuration.
  • Decide whether the server will accept local connections only or connections from specific application hosts. That decision determines later bind and firewall work.

Route A: install Rocky Linux’s native MySQL package

1. Install the server

sudo dnf install mysql-server

dnf resolves the server package and its dependencies from the enabled Rocky repositories. Read the transaction summary and confirm the repository and version shown match your package policy before accepting it.

2. Enable and start the service

sudo systemctl enable mysqld.service --now

This single command both enables mysqld.service for automatic startup and starts it immediately. Enabling the unit matters after a reboot; starting it matters for the current session.

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

3. Confirm the service state

sudo systemctl status mysqld

Look for an active, running state. If the unit is failed or inactive, keep the status output available while working through the troubleshooting section; do not open a firewall port until the local service is healthy.

Route B: install Oracle’s MySQL Community packages

EL8 systems, including Rocky Linux 8, include a MySQL module that is enabled by default. Oracle documents that this enabled module can mask packages supplied by the MySQL repository. The module must therefore be disabled before you install mysql-community-server.

1. Disable the built-in MySQL module

sudo yum module disable mysql

Review the transaction and confirm that the module is being disabled, not that an unrelated package is being removed. This changes module resolution so the Community repository’s package names can be selected.

2. Install the Community server package

sudo yum install mysql-community-server

Oracle’s package installation includes the server together with client, common, and library components. The exact release shown by yum depends on the enabled Oracle repository configuration at the time you run the command.

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

3. Start and inspect MySQL

sudo systemctl start mysqld
sudo systemctl status mysqld

The documented Oracle sequence starts the service and then checks its state. If this host should start MySQL automatically after reboot, enable the unit as a separate operational decision:

sudo systemctl enable mysqld

Do not install both the native and Community server packages as competing owners of the same installation. If you change routes later, plan a package migration and data backup instead of layering one package family over the other.

What happens on the first startup

When MySQL starts with an empty data directory, it initializes the server. Oracle’s installation documentation describes several effects of that initialization:

  • SSL certificate and key files are generated.
  • The validate_password component is enabled.
  • A root@localhost account is created.
  • A temporary root password is written to the MySQL error log.

Retrieve that one-time password from the log:

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

Copy the password exactly, including punctuation and letter case. Then connect locally as root and let the client prompt for it:

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

At the Enter password: prompt, enter the temporary value. A successful login places you at the MySQL prompt. Change the password immediately:

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

Use a password that satisfies the active password-validation rules. The example is only a syntax demonstration; replace it with a unique secret stored in your organization’s credential system.

If no temporary password is shown

The temporary-password message is tied to initialization of an empty data directory. First verify that mysqld actually started and inspect the status output. If the server is using an existing data directory, it may not perform first-time initialization and therefore may not emit a new temporary password. Do not delete the data directory to force the message: that would destroy the existing database.

Verify the installation locally

Use the service unit as the first health check:

sudo systemctl status mysqld

Then test an authenticated local client session:

mysql -uroot -p

If the client connects after you set the new password, the server is accepting local connections and the credentials are valid. Keep administrative access local while you decide whether remote clients are necessary.

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

Record the package stream and version

Because Rocky’s AppStream inventory changes, record the package version and repository selected on your host as part of your deployment notes. Commands such as dnf info mysql-server for the native route or the package information shown during yum install mysql-community-server reveal what was selected. Do not describe a live repository listing as a guaranteed version for every Rocky Linux 8 installation.

Firewall and remote connections

Installing MySQL does not require exposing a database port. A local application can connect without any inbound firewall rule, and leaving the service private is the safer default.

Check firewalld before changing it

sudo systemctl enable --now firewalld
sudo systemctl status firewalld

Rocky’s firewalld workflow uses firewall-cmd. If remote clients are genuinely required, define the narrowest rule that permits the application hosts and MySQL port, rather than making the database reachable from every address. Apply a permanent rule with firewall-cmd, then reload the firewall:

sudo firewall-cmd --permanent --add-service=mysql
sudo firewall-cmd --reload

The service rule above is a starting point only; restrict the source addresses in your environment when your network design requires it. Rocky’s documentation notes that every permanent firewall change requires a reload before it takes effect.

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.

Keep the network boundary intentional

  • Bind MySQL to an interface appropriate for the deployment instead of listening on every interface by default.
  • Allow only the application network or host addresses that need database access.
  • Use encrypted connections when traffic crosses an untrusted network; first-start initialization creates SSL material, but your client and server policy still determine whether it is required.
  • After a configuration change, restart the service deliberately and recheck sudo systemctl status mysqld.

A failed remote connection can come from several independent layers: MySQL may be stopped, the server may be listening only locally, the firewall may reject the source, or the MySQL account may not be authorized for that client host. Check those layers in that order instead of opening the port broadly.

Security and operating decisions after installation

Use application-specific accounts

Create separate, least-privilege accounts for applications rather than placing the administrative root credentials in a connection string. Grant only the databases and operations each application needs, and document who owns password rotation.

Protect the root credential

The temporary password is an initialization credential, not a long-term secret. Change it before handing the server to an application team, and store the replacement outside shell history and source code. Keep administrative logins local or behind a controlled management network whenever possible.

Plan backups before production traffic

A successful package installation says nothing about recoverability. Define backup frequency, retention, off-host storage, and restore testing before treating the server as production infrastructure. Include the MySQL data directory, configuration, account-management process, and the key material required by your connection policy.

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

Define an update policy

The native route follows Rocky’s repository and module cadence; the Community route follows Oracle’s repository cadence. Choose who reviews updates, where they are tested, and how a rollback or restore is performed. Recheck the enabled repositories whenever a package version differs from what you expected.

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

Troubleshooting common installation failures

“No package mysql-community-server available”

On EL8, the enabled MySQL module can mask packages from Oracle’s repository. Run the module-disable command before the install command:

sudo yum module disable mysql
sudo yum install mysql-community-server

If the package is still unavailable, verify that the Oracle repository is enabled and that the system can reach it. A repository that is disabled, unreachable, or configured for a different platform cannot provide the package.

The native package version is not the one expected

Rocky’s package inventory is live. Multiple MySQL 8.0 and 8.4 builds may appear in AppStream over time, and the native documentation’s statement that MySQL 8.0 is the default describes that documented context, not an immutable promise. Inspect the enabled repositories and record the version selected by your transaction.

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.

mysqld will not start

Start with:

sudo systemctl status mysqld

Confirm that the package installation completed, that the data directory is accessible, and that no other process is already occupying the required resources. If the service was initialized previously, preserve its data while diagnosing the failure; deleting files to repeat initialization is not a repair procedure.

The temporary-password grep returns nothing

Check the exact log path and service state, then determine whether this was really a first start with an empty data directory. The initialization message is not expected every time an existing server is restarted. Do not guess a password or reset a live data directory simply because the message is absent.

Local login works but remote login fails

Separate the problem into service, listener, firewall, and account authorization. Confirm mysqld is running, verify that the server is configured to accept connections on the intended interface, check the narrowly scoped firewalld rule, and ensure the account is permitted from the client host. Installation alone does not grant remote access.

Firewall changes appear ineffective

Permanent firewalld changes are not active until the firewall is reloaded. Run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo firewall-cmd --reload

Then inspect the active firewall configuration and test only from an authorized source. If the service is still unreachable, return to the MySQL listener and account checks rather than adding a public rule.

A practical deployment sequence

For a new Rocky Linux 8 host, the following order keeps package, service, credential, and network decisions separate:

  1. Select either the Rocky package route or the Oracle Community route.
  2. Inspect enabled repositories and modules so the selected package source is unambiguous.
  3. Install the package; for Oracle’s route, disable the MySQL module first.
  4. Enable and start mysqld, then verify its status.
  5. On an empty data directory, retrieve the temporary password from /var/log/mysqld.log, log in locally, and run ALTER USER to set the permanent root password.
  6. Test a local authenticated connection before changing network exposure.
  7. Keep the server private unless a documented application requirement needs remote access.
  8. If remote access is required, restrict the listener and source addresses, make the firewalld rule permanent, reload firewalld, and test from an authorized client.
  9. Create application-specific accounts, document backups, and record the package stream and update owner.

This sequence avoids the most common EL8 mistake—installing the Community package while the built-in module is still masking it—and avoids treating an open database port as part of installation.

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.

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

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair 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.