The reliable method is to install MySQL Community Server from Oracle’s official MySQL Yum repository, not from an arbitrary third-party package. Identify the Enterprise Linux release and CPU architecture, install the matching repository-release RPM, enable exactly one MySQL release series, disable the built-in MySQL module on EL8, install mysql-community-server, start mysqld, and run mysql_secure_installation.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
CentOS 7-era machines normally use yum; newer dnf-enabled Enterprise Linux systems use dnf. The command names are interchangeable only where noted below. Repository availability and release-series names depend on the host’s EL version and architecture, so verify those before installing.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
What you need before installing
MySQL’s RPM installation is designed for CentOS and related Enterprise Linux distributions. Before changing packages, log in with an account that can use sudo and determine exactly which platform you have.
Check the operating-system release
cat /etc/centos-release
cat /etc/os-release
The output tells you whether the host is a CentOS 7-era system or an EL8-or-newer system. That distinction affects both the repository RPM you download and whether you must disable a distribution MySQL module.
#1 Best Overall
Check the architecture
uname -m
Use the repository RPM built for the reported architecture. A repository for a different architecture can install incorrectly, fail to expose packages, or produce dependency errors even when the operating-system release looks right.
Identify the package manager
command -v dnf
command -v yum
Use yum on traditional CentOS 7 installations. Use dnf on dnf-enabled systems. In the examples, replace yum with dnf whenever your host uses dnf; the MySQL documentation explicitly gives that substitution for installation commands.
Recommended Free Tools
Choose the MySQL release series first
The MySQL Yum repository is divided into separate subrepositories, one for each server release series. The current reference documentation enables the latest LTS series by default. If your application requires another major or LTS series, change the repository configuration before installing the server.
Do not leave multiple server release series enabled. Oracle’s documentation states that only one release-series subrepository should be enabled at a time. Having more than one active can make dependency resolution unpredictable and can pull client or server packages from a different series than the one you intended.
| Decision question | What to verify |
|---|---|
| Application compatibility | Does the application require a particular MySQL major version, authentication behavior, SQL feature set, or connector version? |
| Support policy | Is the selected series the one your organization intends to maintain for its support and upgrade schedule? |
| Repository availability | Does Oracle provide that series for your CentOS/EL release and CPU architecture? |
| Default versus explicit choice | If the default latest LTS series meets your requirements, leave it enabled. Otherwise, disable the default and enable the required series before installing. |
After adding the repository, list enabled MySQL entries and confirm there is one server series:
sudo yum repolist enabled | grep mysql
On dnf systems, run the equivalent:
sudo dnf repolist enabled | grep mysql
If the output shows more than one server series, use the repository-management command supplied by your distribution to disable every unwanted MySQL server subrepository, then enable only the one your application needs. List all available entries first with yum repolist all | grep mysql or dnf repolist all | grep mysql, so you use the exact IDs present on your machine rather than guessing a name.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchStep 1: Install Oracle’s repository-release RPM
Download the MySQL Community repository-release RPM that matches both the host’s EL release and architecture. Obtain it from Oracle’s official MySQL Yum repository documentation; do not substitute a repository intended for another EL generation.
Once the RPM is on the server, install it locally. The wildcard below represents the repository-release RPM you downloaded in the current directory:
sudo yum install ./mysql-community-release-*.rpm
Use this form on dnf-enabled systems:
sudo dnf install ./mysql-community-release-*.rpm
The repository-release package adds the MySQL repository definitions and Oracle’s GnuPG signing key. Read the package-manager transaction summary before confirming. If the package manager reports that the file does not match the operating system or architecture, stop and obtain the correct RPM rather than forcing installation.
Confirm that the repository is visible
Refresh the repository metadata and inspect the enabled entries:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →sudo yum makecache
sudo yum repolist enabled | grep mysql
For dnf:
sudo dnf makecache
sudo dnf repolist enabled | grep mysql
You should see the MySQL community repository for one release series. If no MySQL entry appears, the repository RPM is wrong for the host, the repository is disabled, or metadata could not be downloaded. Resolve that condition before attempting to install the server.
Step 2: Disable the EL8 MySQL module when applicable
EL8-based systems can expose a distribution-provided MySQL module that masks packages from the Oracle repository. Disable that module before installing Community Server:
sudo yum module disable mysql
On dnf:
sudo dnf module disable mysql
Confirm the transaction if prompted, then refresh metadata and check that the Oracle repository packages are visible. This step is specifically important on EL8; do not disable unrelated modules on other releases.
Step 3: Install MySQL Community Server
The server package is named mysql-community-server. It pulls in the required client, common, and shared-library components.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
sudo yum install mysql-community-server
On a dnf-enabled host:
sudo dnf install mysql-community-server
Review the proposed package list. It should correspond to the single release series you selected. If the manager proposes packages from the distribution module, packages from two MySQL series, or an unexpected architecture, cancel the transaction and correct repository configuration first.
Verify that the client was installed
The client executable should now be available:
mysql --version
The exact version string reflects the enabled release series and the repository’s current package build. This command verifies that the client is on your path; it does not prove that the server is running yet.
Step 4: Start and verify the mysqld service
MySQL uses the systemd service name mysqld. Start it with:
sudo systemctl start mysqld
Immediately inspect the service state:
sudo systemctl status mysqld
A healthy installation reports that the service is loaded and active. If you need to stop or restart it later, use the normal systemd operations:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →sudo systemctl stop mysqld
sudo systemctl restart mysqld
sudo systemctl status mysqld
Starting a service does not necessarily make it start after every reboot. If your operational policy requires automatic startup, enable it explicitly and verify the resulting state:
sudo systemctl enable mysqld
sudo systemctl is-enabled mysqld
Use enable --now only when you intentionally want to enable and start it in one operation:
sudo systemctl enable --now mysqld
Step 5: Run the initial security configuration
Run Oracle’s interactive hardening utility after the service starts:
Rank #4
sudo mysql_secure_installation
The prompts vary by MySQL release and by the state of the package installation. Read each prompt instead of blindly accepting a script written for another version. The utility is used to configure the root account and remove common insecure defaults. Record the administrative credentials in your approved password-management system, not in shell history or a shared text file.
If the utility asks whether to remove an insecure default, choose according to your deployment needs. A production server normally should not retain anonymous accounts or an unrestricted test database, but confirm that no application depends on those objects before removing them. The utility’s exact wording and sequence can change between release series, so the on-screen prompt is authoritative for the installed package.
Step 6: Test a local administrative connection
After hardening, test the client against the local server:
sudo mysql -u root -p
Enter the password configured during the security step. A successful connection opens the MySQL prompt. Exit without changing anything with:
exit
If the command cannot connect, first check sudo systemctl status mysqld. A running service is a prerequisite for a local client connection; authentication errors after a connection is established are a separate credential or account issue.
Complete installation checklist
- Confirmed the CentOS/EL release with
/etc/centos-releaseor/etc/os-release. - Confirmed the CPU architecture with
uname -m. - Selected one MySQL release series based on application compatibility, support policy, and repository availability.
- Installed the Oracle repository-release RPM for that exact EL release and architecture.
- Verified one MySQL server subrepository is enabled.
- Disabled the built-in MySQL module on EL8-based systems.
- Installed
mysql-community-server. - Started and checked the
mysqldsystemd service. - Ran
mysql_secure_installationand stored the administrator credentials safely. - Tested a local login with the installed
mysqlclient.
Troubleshooting common installation failures
The package manager cannot find mysql-community-server
- Run
yum repolist enabled | grep mysqlor the dnf equivalent. If nothing is listed, the repository-release RPM was not installed correctly or the repository is disabled. - Check that the repository RPM matches the EL release shown by
/etc/os-releaseand the architecture fromuname -m. - On EL8, run the MySQL module-disable command, refresh metadata, and retry the package query.
- Confirm that the selected release series actually has packages for this host. Repository availability is not identical across every EL version and architecture.
More than one MySQL series appears enabled
List all MySQL repository entries, identify the series you intend to use, and disable the others with the repository-management utility. Re-run the enabled-repository check until only one server series remains. Do not attempt to resolve the conflict by installing a package with a forced version; fix the repository state first.
The EL8 module keeps taking precedence
Check the module state with the package manager’s module listing, disable the distribution MySQL module, refresh metadata, and inspect the candidate package again. Installing the Oracle repository RPM alone does not necessarily override an enabled distribution module.
Best Value
systemctl start mysqld fails
- Read the complete status output:
sudo systemctl status mysqld. - Inspect the service journal for the failed start:
sudo journalctl -u mysqld --no-pager. - Check for an incomplete package transaction, conflicting repository series, or a configuration change made before the first successful start.
- After correcting the reported cause, start the service again and verify that it remains active.
Do not repeatedly restart a service that is failing without reading the error. The journal normally distinguishes a package or configuration problem from a permissions, storage, or resource problem.
The service is active, but the client cannot log in
Separate connectivity from authentication. First confirm the service is active. Then retry the local command using the account and password configured by mysql_secure_installation. An authentication failure means the server answered but rejected the credentials; it is not fixed by reinstalling the repository.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsThe repository metadata will not download
Verify DNS and outbound access from the server, check the repository entry for the correct EL release, and rerun the package manager’s metadata refresh. If the repository is temporarily unavailable, do not replace it with an unverified mirror when package authenticity matters; wait for a supported source or follow your organization’s approved mirror process.
Installing MySQL 8 on CentOS 7
“MySQL 8” is a request for a release series, not a different installation workflow. On a CentOS 7-era host, install the repository-release RPM intended for EL7 and the machine’s architecture, inspect the available MySQL subrepositories, and enable the MySQL 8 series only if Oracle provides it for that platform. Then install the same mysql-community-server package and start the same mysqld service.
Do not assume that a repository that exists for one EL generation also exists for another. Verify availability before changing the enabled series. If an application requires MySQL 8 features, test its connectors, authentication method, and SQL behavior against that series before making the production change.
Updating or changing release series safely
Changing the enabled repository is a package-management operation, not merely a configuration toggle. Before switching series, take a database backup using your organization’s normal procedure, review the target series’ compatibility requirements, and plan a maintenance window if the server must be restarted.
- Record the currently installed server and client versions with
mysql --versionand your package manager’s installed-package query. - List all available MySQL subrepositories and choose the target series.
- Disable the currently enabled server series.
- Enable only the target series.
- Refresh metadata and inspect the transaction before accepting an update or installation.
- Restart
mysqldwhen the package manager requires it, then verify the service and application connection.
Never enable several server series as a shortcut for a migration. The repository documentation’s one-series rule exists to keep dependency resolution deterministic.
What this procedure does not configure
The installation steps create a local MySQL service and apply basic account hardening. They do not, by themselves, design a backup schedule, create application databases, create least-privilege application users, expose MySQL to remote networks, configure replication, or tune workload-specific settings.
Keep remote access closed unless your architecture requires it. If remote connections are necessary, handle firewall rules, network ACLs, TLS, user host restrictions, and monitoring as separate, deliberate changes. Do not expose the root account for application traffic; create a dedicated account with only the privileges the application needs.
Quick Recap
Quick command reference
| Task | CentOS 7-style command | dnf-enabled equivalent |
|---|---|---|
| List enabled MySQL repositories | sudo yum repolist enabled | grep mysql |
sudo dnf repolist enabled | grep mysql |
| Disable the EL8 MySQL module | sudo yum module disable mysql |
sudo dnf module disable mysql |
| Install the server | sudo yum install mysql-community-server |
sudo dnf install mysql-community-server |
| Start the service | sudo systemctl start mysqld |
|
| Check the service | sudo systemctl status mysqld |
|
| Run hardening | sudo mysql_secure_installation |
|
| Test a local login | sudo mysql -u root -p |
|
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.




