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”.
How to Install MySQL 8 on Rocky Linux 8 Cheat Sheet
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.
# 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.
# 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.
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.