Nội dung
In this article, AZDIGI will guide you to upgrade the MariaDB version on CentOS Web Panel (CWP) most simply.
I. Overview
At the present time, the latest MariaDB
version is 10.5
, however, when you install CentOS Web Panel (CWP) at present time (November 2020), CentOS Web Panel (CWP) only installs theMariaDB 10.1
only for us.
Upgrading to the latest MariaDB
version will have many benefits to mention as follows:
- Improves the overall stability of
MariaDB
. - Fixed a lot of minor bugs in older versions of
MariaDB
. - Improved performance compared to older versions.
- Increased security.
- Support for many new features.
And many more benefits. With so many benefits, we absolutely have many reasons to upgrade the MariaDB CentOS Web Panel version periodically.
To upgrade the MariaDB CentOS Web Panel version, please continue reading the article.
II. Upgrade the MariaDB version on CentOS Web Panel
To upgrade the MariaDB version on CentOS Web Panel, we follow these 2 steps.
Step 1: SSH into your CentOS Web Panel server
To upgrade MariaDB to 10.5 on CentOS Web Panel, we first need to SSH into your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSH, we continue with step 2 to perform the MariaDB version check command.
Step 2: Check the MariaDB version in use
To check the MariaDB version, we have 2 methods as follows.
Method 1: Use the mysqld -V
command on the SSH interface.
Method 2: View directly on the CentOS Web Panel interface.
After knowing the version of MariaDB in use, we continue with step 3 to upgrade the MariaDB version on CentOS Web Panel.
Step 3: Upgrade the MariaDB version on CentOS Web Panel
The order to upgrade the MariaDB version on CentOS Web Panel is as follows:
First, you need to backup the my.cnf
configuration file with the following command:
cp /etc/my.cnf /etc/my.cnf.bak
Next need to uninstall the old MariaDB
version from the system with the following commands:
For MariaDB 5.5
:
service mariadb stop hoặc service mysql stop yum remove mariadb mariadb-server -y
At this point, MariaDB 5.5 will be completely deleted but the database is not deleted so you don’t need to worry.
For MariaDB 10.0/10.1/10.2
/10.X:
service mysql stop yum remove MariaDB-server MariaDB-client -y
At this time, MariaDB 10.0/10.1/10.2
will be completely deleted but the database is not deleted so you don’t need to worry.
In case you want to back up the current data, you can execute the following command:
cp -aR /var/lib/mysql/* /var/lib/mysqlbackup
Below is the image after running the uninstall command MariaDB: yum remove mariadb mariadb-server -y
.
After the uninstall is complete, we execute the following commands to install the new MariaDB version.
yum install nano epel-release -y mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo.bak vi /etc/yum.repos.d/mariadb.repo
After executing the vi /etc/yum.repos.d/mariadb.repo
command, we paste the following content:
For CentOS 7
:
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.5/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
For CentOS 8
:
[mariadb] name = MariaDB baseurl =http://yum.mariadb.org/10.5/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Then we save and execute the following commands to start the installation process.
yum clean all yum install MariaDB-server MariaDB-client net-snmp perl-DBD-MySQL -y yum update -y
The installation process takes place relatively quickly, it takes less than 10 minutes to complete.
However this is not done yet, we need to restore the my.cnf configuration file, re-enable MariaDB and update the existing database again with the following commands:
rm -rf /etc/my.cnf cp /etc/my.cnf.bak /etc/my.cnf systemctl enable mysql service mysql start mysql_upgrade
Explanation of the above commands:
- Command 1: Delete the default configuration file after installing the new MariaDB version.
- Command 2: Restore the previously backed-up configuration version.
- Command 3: Enable system startup for MariaDB/MySQL.
- Command 4: Enable the MariaDB/MySQL service.
- Command 5: Update the current database.
Please wait a moment for MariaDB to update the data as shown below.
So we have completed upgrading the MariaDB version on CentOS Web Panel. Now everything is back to normal. And you can reuse the mysqld -V
command to check the MariaDB version.
III. Summary
So in this article, AZDIGI has shown completely how to upgrade the MariaDB version on CentOS Web Panel. Depending on the case you are using CentOS 7
or CentOS 8
that you use the command correctly.
Hope this article will be of help to you. Wishing you success!
See more useful articles about CentOS Web Panel at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .