MySQL 8 on CentOS Stream 8: Legacy Installation Guide
Legacy reference for MySQL 8.0 on CentOS Stream 8. Both are end of life; CentOS Stream 8 repositories are archived without security updates.
On this page
This page is a historical reference for MySQL 8.0 on CentOS Stream 8. CentOS Stream 8 reached end of life on May 31, 2024, and its released packages were moved to the CentOS Vault, where they receive no further updates. The DNF commands below use the former repository setup and may fail unless the host’s repository configuration has been changed to use the archive. Do not use this system or MySQL series for a new or internet-facing production deployment.
Support status: CentOS Stream 8 ended on May 31, 2024, and MySQL 8.0 reached end of life in April 2026. The CentOS project confirms that Stream 8 packages are archived and no longer updated in its end-date announcement; Oracle documents the MySQL 8.0 end of life in its release notes. For a supported CentOS Stream release, use our MySQL 8.4 guide for CentOS Stream 9. To migrate an existing MySQL 8.0 server, follow the MySQL 8.0 to 8.4 upgrade guide.
Prerequisites
Before we proceed with the installation, ensure you have the following prerequisites in place:
-
Access to a CentOS Stream 8 Server: You should have SSH access to a CentOS Stream 8 server. If you don’t have one yet, consider setting up a virtual machine or using a cloud server.
-
Root or Sudo Access: You need root or sudo privileges on the server to install and configure MySQL.
-
Update Your System: Ensure your CentOS Stream 8 system is up to date by running the following command:
sudo dnf update
Step 1: Adding the MySQL Yum Repository
MySQL provides official Yum repositories that simplify the installation process. Follow these steps to add the repository:
-
Download the MySQL Yum Repository configuration RPM:
sudo dnf install https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm -
Once the RPM is downloaded, enable the MySQL repository:
sudo dnf config-manager --enable mysql80-community
Step 2: Installing MySQL Server
With the repository added, you can now proceed with the MySQL installation:
-
Install MySQL Server and the client using this command:
sudo dnf install mysql-community-server -
Start the MySQL service and set it to start on boot:
sudo systemctl start mysqld sudo systemctl enable mysqld -
Retrieve the initial MySQL root password using the following command:
sudo grep 'temporary password' /var/log/mysqld.log | awk '{print $NF}'Make a note of this password; you will need it to log in to MySQL in the next step.
-
Secure your MySQL installation by running the MySQL secure installation script:
sudo mysql_secure_installationFollow the prompts to configure your MySQL installation’s security settings, including changing the root password if desired.
Step 3: Accessing MySQL
You can access the MySQL shell using the following command:
mysql -u root -p
You will be prompted to enter the root password you obtained in the previous step.
Step 4: Creating a Database and Table
Let’s create a sample database and table within MySQL:
-
After logging in to MySQL, create a new database called
test_db:CREATE DATABASE test_db; -
Switch to the newly created database:
USE test_db; -
Create a sample table, for instance, a simple “users” table:
CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL ); -
You can then verify the table creation using:
SHOW TABLES;
Conclusion
Congratulations! You’ve successfully installed MySQL 8 on your CentOS Stream 8 server, obtained the initial root password, and created a sample database and table. MySQL is a powerful database management system that you can now use to develop applications and manage data effectively. Remember to maintain your MySQL installation by applying updates and adhering to best practices for database security.
If you want to learn more about MySQL, please use our MySQL tutorials and MySQL Reference.