MySQL is one of the most popular relational database management systems (RDBMS) used to store and manage data. Currently, MySQL 8.0 is available in the default AlmaLinux 9 repository. However, if you need MySQL 9.0 for specific purposes—such as in the case of one of my clients—you can manually download and install it using the RPM packages provided by MySQL.

Here are the steps to install MySQL 9.0 on AlmaLinux 9.

Step 1: Download the MySQL 9.0 Package

MySQL provides RPM packages in a bundled format, which you can download directly from the official website. Run the following command to download it:

wget https://cdn.mysql.com/archives/mysql-9.0/mysql-9.0.1-1.el9.x86_64.rpm-bundle.tar

Step 2: Extract the MySQL Package

After downloading, create a new directory to store the RPM files and extract the contents of the bundle:

mkdir mysql-9.0.1
tar xvf mysql-9.0.1-1.el9.x86_64.rpm-bundle.tar -C mysql-9.0.1
cd mysql-9.0.1

Step 3: Install MySQL Packages

Once inside the mysql-9.0.1 directory, install all RPM packages using:

dnf install *.rpm

The installation process may require additional dependencies. Be sure to confirm the installation if prompted.

Step 4: Enable and Start the MySQL Service

After the installation is complete, enable the MySQL service to start on system boot and then start the service:

systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld

Ensure the service is running with the status active (running).

Step 5: Retrieve the Temporary MySQL Password

MySQL automatically generates a temporary password for the root account. To retrieve it, run:

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

The output will look something like this:

2025-05-31T07:49:03.079101Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Eo3sr#!?g?hy

Take note of this temporary password, as it will be used for the initial login.

Step 6: Secure the MySQL Installation

Run mysql_secure_installation to secure the MySQL installation:

mysql_secure_installation

Follow these steps:

  1. Enter the temporary password obtained earlier.
  2. Set a strong new root password.
  3. Remove anonymous users (Remove anonymous users? [Y/n] → Y).
  4. Disallow root login remotely (Disallow root login remotely? [Y/n] → Y).
  5. Remove the test database (Remove test database and access to it? [Y/n] → Y).
  6. Reload privilege tables (Reload privilege tables now? [Y/n] → Y).

Step 7: Verify MySQL Installation

To ensure MySQL is working properly, log in to MySQL using the new root password:

mysql -u root -p

Enter the root password, then run the following command to check the MySQL version:

SELECT VERSION();

If successful, the output should look like:

+-----------+
| VERSION() |
+-----------+
| 9.0.1     |
+-----------+

Conclusion

We have successfully installed MySQL 9.0 on AlmaLinux 9. Although it is not available in the default repository, we can manually download and install it using RPM packages from the official MySQL site. Always secure your MySQL installation with mysql_secure_installation and regularly update your system.

If you encounter issues, make sure there are no conflicts with previous MySQL installations and that all dependencies are satisfied. Good luck!