Menu

How to Install MySQL 8.0 on Oracle Linux 7 (Legacy Guide)

Legacy guide to installing MySQL 8.0 on Oracle Linux 7 with the official MySQL Yum repository. Oracle Linux 7 is in Extended Support.

Posted on By Updated on
On this page

MySQL 8 is a major MySQL series that includes features such as common table expressions, window functions, atomic DDL, and JSON functions.

In this tutorial, we will install MySQL 8 on Oracle Linux 7 from the Oracle MySQL Yum repository.

Support status: Oracle Linux 7 is in Extended Support, and Oracle recommends migrating to Oracle Linux 8 or 9. MySQL 8.0 itself reached end of life in April 2026; Oracle Linux support does not extend the MySQL release lifecycle. Use this guide only for an existing host with a compatibility and support plan. To migrate the database, follow the MySQL 8.0 to 8.4 upgrade guide and verify the target platform support. For a current install, see our MySQL 8.4 guide for Oracle Linux 9 and the Oracle Linux 7 documentation. See the MySQL 8.0 release notes for the series lifecycle.

Version note: MySQL 8.4.11 and later no longer support Enterprise Linux 7, according to the MySQL 8.4.11 release notes. These steps select the MySQL 8.0 repository explicitly, following the official MySQL Yum repository instructions.

Prerequisites

Before you install MySQL, you need:

  • Oracle Linux 7 fresh installation
  • Non-root user with sudo privileges
  • Internet connection

Step 1 - Add MySQL Yum Repository

Add the current MySQL repository setup package for Enterprise Linux 7:

sudo yum install https://repo.mysql.com/mysql84-community-release-el7.rpm

The setup package enables the 8.4 LTS repository by default. Install yum-utils if yum-config-manager is not already available, then switch the server and tools repositories to MySQL 8.0:

sudo yum install yum-utils
sudo yum-config-manager --disable mysql-8.4-lts-community
sudo yum-config-manager --disable mysql-tools-8.4-lts-community
sudo yum-config-manager --enable mysql80-community
sudo yum-config-manager --enable mysql-tools-community

Step 2 - Install MySQL

Install the Oracle MySQL server package:

sudo yum install mysql-community-server

Confirm the installed version:

mysql --version

Step 3 - Start MySQL Service

Start MySQL and enable it at boot:

sudo systemctl enable --now mysqld

Step 4 - Secure the MySQL Installation

Run the mysql_secure_installation script:

sudo mysql_secure_installation

This will set root password, remove anonymous users etc.

Step 5 - Create MySQL User

Create a dedicated MySQL user for your apps:

-- Run as an administrator before logging in with the application account.
CREATE DATABASE IF NOT EXISTS mytestdb;
-- MySQL 8.0.18+ returns a generated password; save it securely for the connection test.
CREATE USER 'myuser'@'localhost' IDENTIFIED BY RANDOM PASSWORD;
-- CREATE is included for the sample table; use a separate migration account for schema changes in production.
GRANT CREATE, SELECT, INSERT, UPDATE, DELETE ON mytestdb.* TO 'myuser'@'localhost';

Step 6 - Test MySQL

Connect to the MySQL shell:

mysql -u myuser -p
SHOW DATABASES;

Step 7 - Create a Sample Table

Create a table in the sample database:

USE mytestdb;

CREATE TABLE users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(50),
  email VARCHAR(50)
);

MySQL 8.0 is installed for this legacy setup. Do not choose this EOL series for a new production deployment; plan a supported database and operating-system upgrade.

Conclusion

This procedure is intended for maintaining existing Oracle Linux 7 systems with a specific MySQL 8.0 compatibility requirement. For a new deployment, use a supported operating system and maintained MySQL LTS release; see the MySQL 8.4 guide for Oracle Linux 9.

If you want to learn more about MySQL, please use our MySQL tutorials and MySQL Reference.