MySQL is a free relational database management system (RDBMS) software which was developed by MYSQL AB, now owned by Oracle Corporation. It is one of the the primary database application on Linux used by many developer.
In this article, we will go through the steps on how to install MySQL on RedHat (RHEL 8) Linux.
The steps mentioned in this article will only work if you have enabled subscription on RedHat (RHEL 8) Linux. If you do not know how to get a free subscription then go through our RedHat (RHEL 8) Linux installation guide to enable the subscription.
MySQL is available on both OS AppStream repository and MySQL Dev Community repository for RedHat. But the easiest way to install MySQL through AppStream, so here are the step by step instructions which you can follow to install MySQL on RedHat Linux:
Outline of the post:
- Install MySQL on RedHat Linux
- Manage MySQL service on RedHat Linux
- Secure MySQL server on RedHat Linux
- How to work with MySQL server on RedHat Linux
- Update MySQL on RedHat Linux
- Install MySQL Workbench on RedHat Linux
- Remove MySQL from RedHat Linux
Install MySQL on RedHat Linux
With the introduction of Red Hat Enterprise Linux 8 (RHEL 8), the Application Stream (AppStream) repository provides all the applications you might want to run in your system. Here are the easy steps which you need to follow:
Step 1: Check if the AppStream repository is enabled on RedHat (RHEL 8) Linux using the following command.
subscription-manager repos –list-enabled
Step 2: Use the following “yum” command to install the latest version of MySQL from AppStream repository.
sudo yum -y install @mysql
After successful installation of MySQL on RedHat (RHEL 8) Linux, you will see the following message:
Now you have successfully installed MySQL on RedHat (RHEL 8) Linux. the next step is to start the service. Here are the steps which you need to follow:
How to manage MySQL service on RedHat Linux
After successful installation of MySQL, it’s time to start the MySQL server. Here are the steps which you need to follow:
Step 1: Start MySQL service using the following command.
systemctl start mysqld
Step 2: If you want to enable MySQL run at system startup then type the following command in your terminal.
systemctl enable mysqld
Step 3: Finally you can verify the status of MySQL server by using the following command.
systemctl status mysqld
How to secure MySQL server on RedHat Linux
When you are installing MySQL from “AppStream”, RedHat Linux has no password set for root user. So, you will run “mysql_secure_installation” to secure your MySQL installation by setting a root password, removing anonymous users and disallow root login remotely.