1.9. Migrating a MariaDB instance from a previous RHEL version to MariaDB 10.11 on RHEL 10
RHEL 10 provides MariaDB 10.11. If you run a MariaDB 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 MariaDB instance on the RHEL 8 or RHEL 9 host.
Procedure
Install the
mariadb-serverpackage:# dnf install mariadb-serverStop the service if it is already running:
# systemctl stop mariadb.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 MariaDB 10.11. 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
mariadbservice:# systemctl enable --now mariadb.serviceWhen the service starts, MariaDB automatically checks, repairs, and updates internal tables.
Verification
Establish a connection to the MariaDB server:
# mysql -u root -p -h <hostname>