To install MySQL server on CentOS 8, follow these steps:
- Start by enabling the MySQL module by running the following command:
sudo dnf module enable mysql:8.0
- Next, install the MySQL server package by running the following command:
sudo dnf install mysql-server
- 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
- Now, you need to secure your MySQL installation by running the following command:
sudo mysql_secure_installation
- 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.
- Now you can test the installation by logging in to the MySQL shell using the following command:
mysql -u root -p
- 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.
- 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.