How to Install MySQL 8 on Rocky Linux 8 (MySQL 8).

Hi Friends, today we will learn “how to install MySQL 8 on Rocky Linux 8”. The Rocky Linux 8 is the replacement for CentOS 8.

MySQL is the Relation Database, which stores the data. It Is open-source and widely used in the industries.

MySQL written in C and C++. It has also been tested to be a “fast, stable and true multi-user, multi-threaded SQL database server”.

So you can find the Release Notes for MySQL 8 and install MySQL 8 in CentOS and Ubuntu follow the link


How to Install MySQL 8 on Rocky Linux 8 Cheat Sheet

1: Check the REPO for MySQL 8 in Rocky Linux.

# dnf whatprovides mysql-server

2: Install MySQL 8 on Rocky Linux

# dnf install @mysql -y

3: Restart the MySQL 8 Service

# systemctl restart mysqld 

4: Enable the Services on booting

# systemctl enable mysqld

5: Configure MySQL mysql_secure_installatio

# mysql_secure_installtion

6: Check the Version

# mysql --version

Install MySQL 8 on Rocky Linux 8.

So in Rocky Linux, the installation is simple and with the help of only two commands, we can easily install MySQL 8 on Rocky Linux 8.

How to Install MySQL on Rocky Linux 8
Searched the MySQL 8 package in REPO.
# dnf whatprovides mysql-server

So the repo named “appstream” contains MySQL-Server 8 package, we have to just install MySQL 8 on Rocky Linux with the dnf command.

How to Install MySQL on Rocky Linux 8 (MySQL 8).
dnf command
# dnf install @mysql -y

So it will Install the MySQL packages with their dependencies, now we have to restart the services.

# systemctl restart mysqld

Then we will enable the services at the time of booting the server, have to use enable option in the place of the restart option.

# systemctl enable mysqld

Once done we will use “mysql_secure_installation” command to set passwords for the root user and set some basic policies.

# mysql_secure_installation 

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: "Press Enter" 
Please set the password for root here.

New password: "Enter Password" 

Re-enter new password: "Enter Password Again" 
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : N

 ... skipping.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : N

 ... skipping.
All done! 

Once done, then we will check the version for installed MySQL.

How to Install MySQL 8 on Rocky Linux 8
Check MySQL Version

You can check the MySQL version by using the mysql command, also you can see the version after login via shell.

# mysql --version
# mysql -u root -p 

So we can see the Installed MySQL 8 on Rocky Linux is “MySQL Server Version: 8.0.21 Source distribution”

The -u option is used for the user and -p option is for the password. So want to Install any version of MySQL on any distro of Linux follow this link.

So if you want to Upgrade MySQL 5.7 to 8 CentOS, Upgrade MySQL 5.6 to 5.7 Ubuntu, any quires regarding MySQL follow the link.


One Reply to “How to Install MySQL 8 on Rocky Linux 8 (MySQL 8).”

Give your valuable time