How to Upgrade MariaDB in CyberPanel

As of the writing of this article, there is no automatic method or page for upgrading MariaDB in CyberPanel. So, what if you want to upgrade MariaDB to the latest version?

In this article, we will discuss how to manually upgrade MariaDB in CyberPanel. Since this is a manual process, it is highly recommended to back up all your websites, or if you can create a snapshot of the server, that would be even better.

This upgrade process is done manually, so make sure you have access to the server SSH used to install CyberPanel as root, or use a user that has the necessary permissions to use sudo.

How to Upgrade MariaDB in CyberPanel

There are several steps in the process of upgrading MariaDB in CyberPanel, including:

  1. Get the MariaDB Password
  2. Shutdown MariaDB
  3. Remove MariaDB
  4. Download the Latest MariaDB Version
  5. Install and Run the Latest MariaDB
  6. Check the MariaDB Version

Before proceeding, note that this method was tested on CyberPanel version 2.3 and Ubuntu 20.04 and Ubuntu 22.04 if you are using a version and OS based on RHEL such as CentOS, AlmaLinux, Rocky Linux, then the method used to perform the update will be different.

After performing a backup and ensuring the backup file is stored in a safe place, or has been downloaded, you can proceed to the next step.

1. Get the MariaDB Password

You will need to log in to MariaDB to perform a shutdown, so first get the MySQL password using this command here

cat /etc/cyberpanel/mysqlPassword

You will then get an output, for example, like this

xCt45tNjgPmgo1root@hostname:~#

Based on that output, your MySQL or MariaDB password is xCt45tNjgPmgo1 (copy the text before root – xCt45tNjgPmgo1root@hostname:~#)

2. Shutdown MariaDB

Now that you have obtained the MariaDB password, you can log in to MariaDB using the command below, then enter your password

mysql -u root -p

Successfully logged into MariaDB? Now you can turn off or shutdown MariaDB using this command here

SET GLOBAL innodb_fast_shutdown = 1;XA RECOVER;exit;

3. Remove MariaDB

Before removing MariaDB, ensure the MariaDB service status is stopped. You can use systemctl to check the MariaDB status

systemctl status mariadb

If the status is still active, you will get an output that includes the status information, more or less like this

Active: active (running) since Fri 2023-09-08 12:18:06 CEST; 7s ago
Cara Upgrade MariaDB Cyberpanel - img - 1

Stop the MariaDB service, then check the status again and make sure it has completely stopped

systemctl stop mariadb

If the MariaDB service has completely stopped, you can remove MariaDB from the server to upgrade to the latest version

apt remove "*mariadb*" "galera*" -y

You can use grep to check whether MariaDB has been completely removed from the server or not

apt list --installed | grep -i -E "mariadb|galera"

If the output result is like the screenshot below, it means MariaDB has not been removed from your server yet.

Cara Upgrade MariaDB Cyberpanel - img - 2

4. Download the Latest MariaDB Version

You can use the command below to install MariaDB version 10.6 (currently the LTS or Long-Term Support version has reached 10.11, you can also change it to 10.11)

curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.6"

If you want to install MariaDB version 10.11, you can change version=”mariadb-10.6″ to version=”mariadb-10.11″.

Next, you can update the repository before continuing the MariaDB installation process

apt update

5. Install and Run the Latest MariaDB

Now that you have performed the update, you can install MariaDB on the server you use for CyberPanel

apt install mariadb-server libmariadb-dev -y

During the installation process, you will receive a confirmation message that looks more or less like this

Configuration file '/etc/mysql/mariadb.conf.d/50-server.cnf' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version.   What would you like to do about it ?  Your options are:    Y or I  : install the package maintainer's version    N or O  : keep your currently-installed version      D     : show the differences between the versions      Z     : start a shell to examine the situation The default action is to keep your current version.*** 50-server.cnf (Y/I/N/O/D/Z) [default=N] ?

If you get such a confirmation message, you can press the N key to keep the currently installed version.

After the process is complete, you need to perform an update one more time to download any MariaDB packages that might have been left behind

apt update && apt upgrade -y

Now you can enable and run MariaDB again on your server so that CyberPanel can work again.

systemctl enable mariadb
systemctl start mariadb

Make sure MariaDB is actually running and there are no error messages using this command

systemctl status mariadb

If the status is running, then you can proceed to upgrade MariaDB on your server

mysql_upgrade -u root -p

Enter the MySQL password you previously obtained in step number 1 to complete the update.

6. Check the MariaDB Version

To ensure MariaDB has been successfully upgraded, you can check the MariaDB version using the command below, or open the phpMyAdmin page via CyberPanel.

mysql -u root --password=password_mysql_kamu -e "SHOW VARIABLES LIKE 'version';"
Cara Upgrade MariaDB Cyberpanel - img - 3
Cara Upgrade MariaDB Cyberpanel - img - 4

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...