Install MariaDB 10.8 on CentOS 7
If you have any other MySQL-based database management system installed on your system, go to the section below to upgrade. Therefore, to continue the installation, make sure that the system is clean.
First, update the OS and reboot the system.
yum update -y
reboot -f
Wait for the new packages to finish installing, and after restarting, add the new MariaDB repository.
We will use the official MariaDB repository for RHEL, which we will add using the following commands.
Downloading:
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
Now let's run the script that automatically installs MariaDB. We will also specify version 10.8 for installation.
bash mariadb_repo_setup --mariadb-server-version=10.8
The repository will be set up and the MariaDB GPG keys will be imported.
Let's look at the list of all available repositories in our system.
yum repolist
As you can see, MariaDB 10.8 packages are available in the newly added repository. Now let's install MariaDB 10.8 on our server.
yum install MariaDB-server MariaDB-client MariaDB-backup -y
We confirm the version of the installed packages of the server, the MariaDB client and wait for the installation to complete.
After successful installation, check the version of MariaDB installed.
rpm -qi MariaDB-server
Now you need to add the mariadb database service to autoload.
systemctl enable --now mariadb
Check the status of the service to see if it is running.
Now you can create a database with access that is convenient for you.
Upgrade from MySQL 5.7 to MariaDB 10.8
Before upgrading, it is recommended to backup the databases, copy the /var/lib/mysq/ directory or, as usual, dump the database with the command:mysqldump --all-databases > dump_databases.sql
We can use the site https://mariadb.org/download/?t=repo-config&d=CentOS+7+%28x86_64%29&v=10.8&r_m=xtom_dus and add the repository manually.
We copy the generated code into a new mariadb.repo file. We can create it with the command:
vim /etc/yum.repos.d/mariadb.repo
And paste the code copied below into it and save.
# MariaDB 10.8 CentOS repository list - created 2022-08-30 12:17 UTC
# https://mariadb.org/download/
[mariadb]
name=MariaDB
baseurl=https://mirrors.xtom.de/mariadb/yum/10.8/centos7-amd64
gpgkey=https://mirrors.xtom.de/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
Or, with the commands above, which were entered to install MariaDB 10.8, add the repository and GPG keys.
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
bash mariadb_repo_setup --mariadb-server-version=10.8
Stop the database service:
systemctl stop mariadb
Delete if version 10.2 and higher is already installed:
yum remove MariaDB-server-10.*
Install:
yum install MariaDB-server MariaDB-client MariaDB-backup
After successful installation, start the database.
systemctl start mariadb
We are upgrading the databases.
mysql_upgrade
Check with command:
rpm -qi MariaDB-server
or
mysql
If you need to load the database, use the command:
mysql < dump_databases.sql
After a successful installation or upgrade, we can enjoy the new version of MariaDB.