How to install MySQL server on CentOS 8 Linux

To install MySQL server on CentOS 8, follow these steps:

  1. Start by enabling the MySQL module by running the following command:
sudo dnf module enable mysql:8.0
  1. Next, install the MySQL server package by running the following command:
sudo dnf install mysql-server
  1. After the installation is complete, start the MySQL service and enable it to start automatically on boot with the following commands:
sudo systemctl start mysqld
sudo systemctl enable mysqld
  1. Now, you need to secure your MySQL installation by running the following command:
sudo mysql_secure_installation
  1. The command will prompt you to set a root password and some other security-related options. Follow the prompts and make sure you set a strong password.
  2. Now you can test the installation by logging in to the MySQL shell using the following command:
mysql -u root -p
  1. You will be prompted to enter the root password you set during the secure installation. Once you enter the correct password, you will be logged in to the MySQL shell.
  2. You can now create new databases, users and tables, and manage your data with SQL commands.

Note: If you are facing any issues with the above commands, please make sure that you have SELinux set to permissive mode or disabled.

Leave a Comment