Install MySQL on RHEL9 or CentOS

Install MySQL on RHEL9 or CentOS

Install MySQL on RHEL9 or CentOS


This command updates all installed packages on your RHEL9 or CentOS system to their latest versions. This ensures that you have the latest security patches and bug fixes.

Steps to install MySQL on Red Hat Enterprise Linux 9 (RHEL9) or CentOS:

1. Update the system packages:

sudo dnf update -y

2. Install the MySQL package:

sudo dnf install mysql-server

3. Start the MySQL service:

sudo systemctl start mysqld

4. Enable the MySQL service to start automatically on system boot:

sudo systemctl enable mysqld

5. Verify the MySQL installation:

sudo systemctl status mysqld

This should show that the MySQL service is running.

6. Secure the MySQL installation (optional):

The sudo mysql_secure_installation command is a MySQL script that helps improve the security of a newly installed MySQL server. Here's a detailed overview of what it does:

sudo mysql_secure_installation


This will prompt you to set a root password, remove anonymous users, disable remote root login, and remove the test database.

That's it! MySQL is now installed and running on your RHEL9 or CentOS system. You can now use the mysql command-line tool to interact with the database.

Let me know if you have any other questions!


Post a Comment