MySQL is a free, open-source, and extremely popular relational database management system. It is a simple, fast, and scalable SQL-based database system that can be installed as part of a LAMP or LEMP stack. Due to its speed and efficiency, it is the best choice for e-commerce and data warehousing applications. MySQL is readily available for all Linux distributions as well as other operating systems.

In this post, we will explain how to install MySQL 8.4 on Rocky Linux 10.

Install MySQL 8.4 on Rocky Linux 8

By default, MySQL 8.4 is not included in the Rocky Linux AppStream repository. You will need to install it from MySQL repo maintained by Oracle.
First, install the MySQL repo using the command below.

dnf install https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm

Now, install MySQL 8.0 by running the following command:

dnf install mysql-community-server -y

Once MySQL is installed, you can verify the installed version of MySQL using the following command:

mysql --version

You will get the following output:

mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)

Also Read

How to Delete or Remove Databases in MySQL

Manage MySQL 8.4 Service

By default, the MySQL service is managed by systemd. You can use the systemctl command to manage it from the command line.

To start the MySQL service, run the following command:

systemctl start mysqld

Enable the MySQL service to start at system reboot with the following command:

systemctl enable mysqld

To check the status of the MySQL service, run the following command:

systemctl status mysqld

You will get the following output:

ā— mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Wed 2025-10-15 04:51:26 EDT; 2min 41s ago
 Invocation: 2f1493d9116a4fddbefcc49d5edccad5
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 41393 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 41494 (mysqld)
     Status: "Server is operational"
      Tasks: 34 (limit: 12342)
     Memory: 450.3M (peak: 468.8M)
        CPU: 4.552s
     CGroup: /system.slice/mysqld.service
             └─41494 /usr/sbin/mysqld

Secure MySQL Installation

By default, MySQL is not secured and the root password is not set.

First, retrieve the MySQL root password:

grep 'temporary password' /var/log/mysqld.log

Output.

2025-10-15T08:51:19.966898Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: RE8fgtoYKA;F

Now, secure MySQL by running the following command:

mysql_secure_installation

You will be asked to set up the VALIDATE PASSWORD component:

Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N

 ... skipping.
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) : Y
Success.


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) : Y
Success.

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) : Y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

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) : Y
Success.

All done! 

Also Read

How to Allow Remote Connection to MySQL Database Server

Connect to the MySQL Server

After securing the MySQL, you can connect to the MySQL shell using the following command:

mysql -u root -p

You will be asked to provide your root password:

Enter password: 

Provide your root password and press the Enter key. Once you are logged in, you should see the MySQL shell in the following output:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.4.6 MySQL Community Server - GPL

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

You can check the MySQL version with the following command:

mysql> SELECT VERSION ();

You will get the following output:

+------------+
| VERSION () |
+------------+
| 8.4.6     |
+------------+

Create a Database and User in MySQL

To create a database named testdb, run the following command:

mysql> CREATE DATABASE testdb;

To create a user named testuser, run the following command:

mysql> CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'securepassword';

To grant all the privileges to the testdb database, run the following command:

mysql> GRANT ALL ON testdb.* TO 'testuser'@'localhost';

Now, flush the privileges to apply the changes:

mysql> FLUSH PRIVILEGES;

To list all MySQL users, run the following command:

mysql> select user from mysql.user;

You will get the following output:

+------------------+
| user             |
+------------------+
| mysql.infoschema |
| mysql.session    |
| mysql.sys        |
| root             |
| testuser         |
+------------------+

To list all databases, run the following command:

mysql> SHOW DATABASES;

You should see the following output:

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| testdb             |
+--------------------+

Now, exit from MySQL using the following command:

mysql> EXIT;

Remove or Uninstall MySQL 8

If you don’t need to use MySQL and want to remove it from your system, run the following command:

dnf remove @mysql

After removing MySQL, remove the MySQL data directory with the following command:

rm -rf /var/lib/mysql*

Conclusion

In the above post, we showed you how to install MySQL 8.4 on Rocky Linux 10. We also explained how to create a database and user in MySQL. Try it on a dedicated server from Atlantic.Net!