Here's how to install the MySQL server on Red Hat Enterprise Linux 8 (RHEL 8):
1. Add the MySQL Yum Repository (Optional):
While you can install MySQL from the default repositories, it might not be the latest version. To ensure you get the newest version, you can add the official MySQL Yum repository.
Go to the MySQL Yum Repository download page: [download mysql yum repository ON dev.mysql.com]
Select the appropriate MySQL version (e.g., mysql80-community-release) for your platform (el8 for RHEL 8).
Download the
.rpm
package.Install the downloaded package:
sudo yum install mysql80-community-release-el8.noarch.rpm # Replace mysql80 with your chosen version number
2. Disable Default MySQL Module (EL8 Only):
RHEL 8 includes a default MySQL module that might conflict with the official repository. To avoid issues, disable it:
sudo yum module disable mysql
3. Install MySQL Server:
Use dnf
(the package manager for RHEL 8) to install the mysql-community-server
package:
sudo dnf install mysql-community-server
4. Start and Enable MySQL Service:
Start the MySQL server and enable it to automatically start at boot:
sudo systemctl start mysqld
sudo systemctl enable mysqld
5. Secure the MySQL Installation (Recommended):
Run the mysql_secure_installation
script to improve MySQL security. This script guides you through setting a root password, removing anonymous users, and disabling remote root logins.
sudo mysql_secure_installation
Follow the prompts carefully, setting a strong password for the root user and answering "yes" to remove anonymous users and disable remote root logins.
That's it! You've successfully installed and secured the MySQL server on your RHEL 8 system.
0 Comments