2.9. Migrating a MySQL instance from a previous RHEL version to MySQL 8.4 on RHEL 10
RHEL 10 provides MySQL 8.4. If you run a MySQL instance on a previous RHEL version, you can set up RHEL 10 on a new host and migrate the instance to it.
Prerequisites
- You set up RHEL 10 on a new host.
- You performed a file system backup of the MySQL instance on the RHEL 8 or RHEL 9 host.
Procedure
Install the
mysql8.4-serverpackage:# dnf install mysql8.4-serverStop the service if it is already running:
# systemctl stop mysqld.service-
Copy the content of the
/var/lib/mysql/directory from the previous host to the same location on the RHEL 10 host. -
Copy the configuration files from the previous host to the
/etc/my.cnf.d/directory, and ensure that the files includes only options valid for MySQL 8.4. For details, see the upstream documentation. Restore the SELinux context:
# restorecon -rv /var/lib/mysql/ # restorecon -rv /etc/my.cnf.d/Ensure the correct ownership of
/var/lib/mysql/and its subdirectories:# chown -R mysql:mysql /var/lib/mysql/Enable and start the
mysqldservice:# systemctl enable --now mysqld.serviceWhen the service starts, MySQL automatically checks, repairs, and updates internal tables.
Verification
Establish a connection to the MySQL server:
# mysql -u root -p -h <hostname>