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 DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Install MySQL on CentOS 7 and Newer Enterprise Linux Hosts

A practical CentOS installation guide covering the Oracle MySQL repository, Yum versus DNF, EL8 module conflicts, mysqld startup, hardening, and troubleshooting.
Length8 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The dependable way to install MySQL on CentOS is to use Oracle’s official MySQL Yum repository, select one compatible MySQL release series, install the mysql-community-server package, start the mysqld service, and run mysql_secure_installation. CentOS 7 normally uses yum; dnf-enabled Enterprise Linux systems use dnf. On EL8-based systems, disable the built-in MySQL module before installing repository packages.

Check the CentOS or Enterprise Linux host first

Repository packages are built for particular Enterprise Linux major releases and CPU architectures. Identify those details before adding a repository; using an RPM for the wrong release can leave the server package unavailable or create dependency conflicts.

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.
Host situation Package manager Important preparation
CentOS 7-era installation yum Use the repository-release RPM intended for the host’s EL7 release and architecture.
EL8-based installation Usually dnf (the yum command may also be present) Disable the distribution’s MySQL module before installing from Oracle’s repository.
Other dnf-enabled Enterprise Linux systems covered by the repository documentation dnf Match the repository RPM to the exact EL major release and CPU architecture.

You need administrative access, a working package-manager configuration, and enough disk space for the server and its dependencies. The repository RPM adds Oracle’s repository definition and its GnuPG key, allowing the package manager to verify and retrieve the MySQL RPMs.

Choose one MySQL release series

Oracle publishes each MySQL release series in a separate repository subrepository. The current reference documentation says the latest LTS series is enabled by default. If an application requires another major version, change the repository settings before installation rather than installing first and trying to replace the server later.

  • Check the application’s required MySQL major version and compatibility policy.
  • Confirm that the selected series has a repository for the host’s EL release and CPU architecture.
  • Consider the series’ lifecycle and support policy, not just the newest available package.
  • Enable only the one server series you intend to install.

After configuring the repository, inspect the enabled entries. On a Yum host, run:

sudo yum repolist enabled | grep mysql

On a dnf-enabled host, run the equivalent:

sudo dnf repolist enabled | grep mysql

The output should show the intended MySQL series and should not show multiple server release subrepositories enabled at the same time. Oracle’s documentation explicitly advises enabling only one release series. Leaving several enabled allows dependency resolution to select packages from different series and makes future updates unpredictable.

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

Add Oracle’s MySQL repository

  1. Determine the host’s Enterprise Linux major version and CPU architecture.
  2. Open Oracle’s MySQL Yum repository documentation and select the repository-release RPM that matches both values. The RPM is supplied by Oracle and includes the repository definition and signing key.
  3. Install that downloaded repository-release RPM with the host’s package manager. Use yum on CentOS 7-era systems and dnf on dnf-enabled systems.
  4. List enabled MySQL repositories with the appropriate repolist command, then select the single release series required by the application.

The exact repository-release filename changes with the EL release, architecture, and available MySQL series, so do not substitute an RPM built for another platform. If the package manager reports an architecture mismatch, stop and obtain the matching repository RPM instead of forcing installation.

Disable the EL8 MySQL module when required

EL8 systems include a distribution MySQL module. That module can mask packages from Oracle’s repository, causing the package manager to report that the desired server package cannot be found or to resolve the wrong source. Disable the module before installing the Community Server package.

With Yum syntax:

sudo yum module disable mysql

With dnf syntax:

sudo dnf module disable mysql

This step applies to EL8-based systems. On a CentOS 7-era host, there is no EL8 module to disable; proceed with repository selection and installation after confirming the enabled subrepository.

Install MySQL Community Server

Once the repository and release series are correct, install the server package. Oracle’s documented package name is mysql-community-server.

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.

CentOS 7-era command:

sudo yum install mysql-community-server

Dnf-enabled command:

sudo dnf install mysql-community-server

The package manager also installs the required client, common, and shared-library components. Review the transaction summary before accepting it. The summary should identify packages from the intended MySQL repository, not a distribution module or an unintended release series.

If the command proposes packages from more than one MySQL series, cancel the transaction and correct the repository configuration. Installing while several series are enabled can produce a mixed dependency set that is difficult to maintain.

Start and inspect the mysqld service

Installing the RPM does not replace the need to start the database service. Start the systemd unit named mysqld:

sudo systemctl start mysqld

Immediately inspect its state:

sudo systemctl status mysqld

A healthy result reports that the unit is active and running. The status output is also the first place to look when startup fails because it includes recent service messages and the process exit state.

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

Use the standard systemd operations when administering the installed server:

  • sudo systemctl stop mysqld stops the service.
  • sudo systemctl restart mysqld restarts it after a configuration change or other maintenance action.
  • sudo systemctl status mysqld displays the current state and recent messages.

Keep the spelling exact: the service is mysqld, not mysql. A status check for the wrong unit name can make a working installation appear to be missing.

Run mysql_secure_installation

After the service is running, apply the basic hardening supplied with the installation:

sudo mysql_secure_installation

The utility guides you through configuring the root account and removing common insecure defaults. Prompt wording and the questions shown vary with the MySQL release and the initial package state, so read each prompt rather than assuming that every installation presents the same sequence.

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

Record the credential or authentication choice you make for the administrative account in your normal secure operations process. Do not paste passwords into shell history, support tickets, or game-server configuration files that are readable by other users.

Verify the installation in a controlled order

Use this sequence to separate repository, package, service, and security problems:

  1. Run the appropriate repolist enabled | grep mysql command and confirm that exactly one intended MySQL series is enabled.
  2. On EL8, confirm that the built-in MySQL module was disabled before the package transaction.
  3. Check that the server installation completed without dependency or signature errors.
  4. Run sudo systemctl status mysqld and confirm that the service is active and running.
  5. Run sudo mysql_secure_installation and complete the prompts for the installed release.
  6. Test the client connection using the administrative credentials and authentication method established by the hardening utility before configuring an application.

This order matters: a failed repository selection cannot be repaired by restarting a service, and a running service does not prove that the administrative account has been configured as intended.

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

Troubleshoot the common installation failures

“No package mysql-community-server available”

  • Check the enabled repository list. The MySQL repository-release RPM may not be installed, or its subrepository may be disabled.
  • Confirm that the repository RPM matches the host’s EL major version and CPU architecture.
  • On EL8, disable the distribution MySQL module and refresh the package metadata before trying the installation again.
  • Make sure you selected a release series that is actually published for that platform.

Do not solve this error by enabling every MySQL subrepository. Select the single compatible series and verify the list again.

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

The package manager selects a distribution module or the wrong series

This usually indicates that the EL8 module remains enabled or that multiple MySQL release subrepositories are active. Disable the module on EL8 and adjust the repository settings so only the required series is enabled. Recheck the transaction summary before accepting a new installation.

The repository RPM will not install

An architecture or EL-version mismatch is the usual cause. Obtain the repository-release RPM built for the host’s actual platform. Do not force an incompatible RPM or bypass signature checking; the repository package is what supplies the correct repository metadata and GnuPG key.

systemctl start mysqld fails

Run sudo systemctl status mysqld and read the recent messages. First confirm that the package transaction completed and that the service name is spelled correctly. If the status output points to a package, configuration, permission, or data-directory problem, correct that specific condition and then retry the start command. Repeatedly restarting without reading the status output does not identify the cause.

The hardening prompts differ from a guide you are following

mysql_secure_installation changes its questions according to the installed MySQL release and package state. Follow the prompts actually displayed by your installation. The utility’s purpose remains the same: configure the root account and remove common insecure defaults, but the exact wording and available choices are not universal.

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

Choosing a release for an application or game backend

If MySQL will support a self-hosted game service or another application, let that application’s documented compatibility range drive the release choice. A newer LTS series is not automatically the right choice if the application requires an older major version. Check all four decision points before installing:

Decision point Question to answer Why it matters
Application compatibility Does the software require a specific MySQL major version? SQL behavior, authentication, and connectors can differ between major versions.
Lifecycle policy How long will the selected series receive support? A supported series reduces the need for an avoidable migration during the application’s service life.
Repository availability Is that series published for this EL release and CPU architecture? A release that is not built for the host cannot be installed through the official repository.
Operational consistency Is exactly one server series enabled? One enabled series keeps updates and dependency resolution predictable.

Install the database before pointing the application at it, and test the application’s connection with the credentials and authentication method you configured during hardening. The installation procedure establishes the server; application-specific schemas, users, ports, backups, and performance settings belong to the application’s own deployment documentation.

Copy-and-check installation checklist

  • Identify the EL major release and CPU architecture.
  • Select the matching Oracle MySQL repository-release RPM.
  • Install that RPM and inspect the enabled repository list.
  • Enable one MySQL release series only.
  • On EL8, run sudo yum module disable mysql or sudo dnf module disable mysql.
  • Install with sudo yum install mysql-community-server or sudo dnf install mysql-community-server.
  • Start the service with sudo systemctl start mysqld.
  • Verify it with sudo systemctl status mysqld.
  • Run sudo mysql_secure_installation and follow the prompts shown for your release.
  • Test an administrative client connection before configuring the application that will use the database.

What a successful result looks like

A complete installation has one compatible MySQL repository series enabled, the Community Server package installed from that repository, an active mysqld systemd service, and a root account processed through mysql_secure_installation. If any one of those conditions is missing, resolve it before treating the CentOS host as ready for an application or game backend.

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 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
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.