Install MySQL8.0 on RHEL9 or CentOS9

Install MySQL on RHEL9

In this step-by-step guide, we will show you how to install MySQL 8.0 on RHEL 9 or CentOS 9, ensuring a smooth setup for your database needs.

Table of Contents

Introduction

In the dynamic landscape of database management systems, MySQL continues to be a popular choice for many developers and businesses alike. With the release of MySQL 8.0, users can benefit from enhanced security features, improved performance, and a host of new functionalities.

Install MySQL8.0 on RHEL9: Step-by-Step Instructions

Follow these steps to install MySQL8.0 on your RHEL9 or CentOS9 OS.

Step 1: Update your system

Before you begin the installation process, it’s essential to ensure that your system is up-to-date. Run the following commands in your terminal:

				
					$ sudo dnf update
				
			

This will update your system’s package repositories and install any available updates.

Step 2: Download MySQL Repository Package

MySQL 8.0 is not included in the default repositories of RHEL 9 or CentOS 9. You need to download the MySQL repository package from the official MySQL Yum repository. Use the following commands to download and install the repository package:

				
					$ sudo dnf install https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm
				
			

NOTE: The mysql80-community-release-el9-1.noarch.rpm is the latest available version as of the date of this publication. Check the MySQL Community Downloads page to ensure you have the latest version.

Step 3: Enable MySQL 8.0 Repository

Once the repository package is installed, enable the MySQL 8.0 repository with the following command:

				
					$ sudo dnf module enable mysql:8.0
				
			

Step 4: Install MySQL Server

Now, you can install MySQL 8.0 using the following command:

				
					$ sudo dnf install mysql-server
				
			

As shown below, the MySQL8.0 package and its dependencies will be installed.

Install MySQL on RHEL9

Photo by admingeek from Infotechys

Step 5: Start MySQL Service

Option #1:

Start the MySQL service and enable it to start on boot:

				
					$ sudo systemctl start mysqld
$ sudo systemctl enable mysqld
				
			

Option #2:

You can also use the --now flag to execute the two commands above at once.

				
					$ sudo systemctl enable --now mysqld
				
			

Step 6: Secure MySQL Installation

MySQL provides a script to secure your installation. Run the following command and follow the on-screen prompts to enhance the security of your MySQL server:

				
					$ sudo mysql_secure_installation
				
			

Best Practices

  • Regular Backups: Ensure regular backups of your MySQL databases to prevent data loss in case of unexpected events.

  • Use Strong Passwords: Set strong and unique passwords for MySQL users to enhance security.

  • Update Regularly: Keep MySQL and your operating system up-to-date with the latest security patches and improvements.

  • Monitor Performance: Utilize MySQL monitoring tools to track performance metrics and identify potential issues.

  • Firewall Configuration: Configure your firewall to allow traffic on the MySQL port (default is 3306) and restrict access to authorized IP addresses.

Conclusion

By following these step-by-step instructions and incorporating best practices, you can seamlessly install MySQL 8.0 on RHEL 9 or CentOS 9. Stay ahead in the realm of database management by taking advantage of the latest features and security enhancements offered by MySQL 8.0.

Was this article helpful to you? If so, let us know in the comments. We appreciate your feedback!

Related Posts

Install MariaDB on CentOS7
Commands
Install MariaDB on CentOS7

In this step-by-step guide, we will show you how to install mariaDB on CentOS7. MariaDB is a fork of MySQL relational database management systems (RDBMS). Table

Read More »

Leave a Reply

Your email address will not be published. Required fields are marked *