All Collections
CyberPanel VPS
How to Change the MariaDB Version on CyberPanel VPS
How to Change the MariaDB Version on CyberPanel VPS

Upgrading and downgrading MariaDB (MySQL) package on CyberPanel VPS

Updated over a week ago

There might be the case when you need to upgrade or downgrade the MariaDB (MySQL) package on your VPS. For example, when currently installed version on your server is not supported by your website's CMS.

As an example, in the steps below we will cover a downgrade from MariaDB 10.5 to MariaDB 10.4. You can perform an upgrade or downgrade to any other available version by replacing the version number in the SSH commands.

Step 1 - Back Up Your Databases

First, connect to your server using SSH and check the MySQL password using the following command:

cat .db_password

This will display the content of the .db_password file. Take note of it. Next, create a fresh database backup:

mysqldump -u root -p --all-databases > databasedump.sql

When asked to enter the password, use the one you retrieved from the .db_password file.

Step 2 - Remove the Current MariaDB Version

After creating a backup, you can safely remove the MariaDB version.

1. Stop the MariaDB service:

systemctl stop mariadb

2. Uninstall MariaDB:

yum remove mariadb mariadb-server

3. Remove data and configuration files (optional):

rm -rf /etc/my.cnf
rm -rf /var/lib/mysql

Step 3 - Install the Required MariaDB Version

Now, follow these steps to install the upgraded/downgraded version:

1. Open the file using a text editor such as vim or nano:

vim /etc/yum.repos.d/MariaDB.repo 

2. Update the file to the following content:

name = MariaDB
baseurl =

3. Update the yum cache index:

yum makecache fast

4. Install the new version:

yum install MariaDB-server MariaDB-client

5. Enable and start MariaDB:

systemctl enable mariadb
systemctl start mariadb

6. Secure MariaDB:


Follow the prompts to set a root password and secure the installation. Note that this is the password used to log in to the MariaDB server as a root user.

Use the mysql --version command to verify that the version of MariaDB has changed:


Step 4 - Import Your Databases

Finally, import your database backup:

mysql -u root -p root < databasedump.sql

And restart MariaDB:

systemctl restart mariadb

That's it, your MariaDB version is successfully updated and your databases restored.

Additional Resources

Did this answer your question?