Install MYSQL 8 on ROCKY LINUX

How to Install MySQL 8 on Rocky Linux

Step 1: Update Your System

Before installing MySQL 8, ensure that your system is up-to-date by running the following command:

sudo dnf update -y

Step 2: Add MySQL Repository

Add the MySQL Yum repository by running the following command:

sudo dnf install -y https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm

Step 3: Install MySQL Server

Install MySQL Server 8 using the following command:

sudo dnf install -y mysql-community-server

Step 4: Start and Enable MySQL

After installation, start the MySQL service and enable it to start automatically on boot:

sudo systemctl start mysqld
sudo systemctl enable mysqld

Step 5: Secure Your MySQL Installation

Secure your MySQL installation by running the security script:

sudo mysql_secure_installation

Follow the prompts to set a new root password and secure your MySQL installation.

Step 6: Verify MySQL Installation

Verify the MySQL installation by logging in as the root user:

sudo mysql -u root -p

Enter the root password you set during the secure installation.

Step 7: MySQL Configuration (Optional)

If needed, customize your MySQL configuration by editing the my.cnf file located in /etc/my.cnf or /etc/mysql/my.cnf.

Step 8: Start and Enable MySQL on Boot

If MySQL is not running, start it and enable it to start automatically on boot:

sudo systemctl start mysqld
sudo systemctl enable mysqld

That's it! You've successfully installed and configured MySQL 8 on Rocky Linux. You can now use MySQL to create databases, manage user accounts, and run SQL queries on your server.

Related Articles