How to Install MySQL Server on Red Hat Enterprise Linux 9

How to Install MySQL Server on Red Hat Enterprise Linux 9

MySQL is a free and open-source database management system. It is written in C and C++ and was released in 1995. It is cross-platform and can be installed on Linux, Solaris, macOS, and FreeBSD.

63% of database users use MySQL. It is used by WordPress (a content management system), Shopify (an e-commerce platform), and Twitter (a social media giant). It is mostly used by web applications and online publishing. It is based on a client-server model.

Some of the features of MySQL are listed below:

  • Flexible and easy to use
  • High performance
  • An industry standard
  • Secure

In this tutorial, we are discussing the method to install MySQL server on Red Hat Enterprise Linux 9.

Prerequisite

  • RHEL 9 instance
  • Root account or user with sudo privileges

Install Mysql server on Red Hat Enterprise Linux 9

On the terminal, run the following with sudo or root login.

sudo yum install mysql-server

Start MySql service

Start the MySQL service as follows:

sudo systemctl start mysqld.service

Check MySQL version

Run the below command to check MySQL version.

mysql --version

Above screenshot shows, MySQL version 8 is installed.

Enable MySQL service to start at boot

Execute the below command to enable MySQL service to start the boot time.

systemctl enable mysqld.service

Set the root password

At this point MySQL service is installed with empty root password. Run the following command to set the root password and the other parameters.

sudo Mysql_secure_installation

Login with root

Now you can login with root account as follows. You will be prompted to enter root password:

mysql -u root -p

Remove MySQL server from Red Hat Enterprise Linux 9.

In order to remove or uninstall MySQL server from Red Hat Enterprise Linux 9, you would run:

sudo yum remove mysql-server

Conclusion

We have shown you the installation and uninstallation of MySQL on Red Hat Enterprise Linux 9. Keep visiting Linux World.