There might be a Scenario that you are running your web application from So long which is pointing to your MariaDB (say Version 10.1.43). Now you planning to migrate your application to your dedicated Server in AWS. Whn you are trying to Install the cPanel It Comes Up with Mysql 5.7 Database which is causing an issue in your application, as your database is compatible with 10.1.43 version of MariaDB. In this Case It’s easy to Install MariaDB Database instead of MySQL in WHM/cPanel for your applications and It is also easy to Upgrade the MariaDB Version but It’s not quite Straight forward to downgrade the MariaDB Version in WHM. This is something which you can not control from the WHM Console.
So in this blog we will See how we can change the cPanel MySQL Version to MariaDB and how to Upgrade and Downgrade the MariaDB Version based on the application requirement.
1. Change cPanel Database from MySQL to MariaDB.
First of all check the current Version of Database Installed and associated to your cPanel. For this, Login to your WHM Console and Search for Mysql/MariaDB Upgrade. When you click on It, you will be able to see the current version of Database Installed.
You can also check the version of Database from PhpMyadmin. Search and Click on it from cPanel.
Note: Once upgraded to MariaDB you will not be able to see the option of rollback to MySQL again.
Now click the checkbox next to each warning to indicate that you understand the potential consequences of this upgrade and Click on Continue.
Now Select Unattended Upgrade from the Upgrade type and Click on Continue to Upgrade. cPanel will automatically change the database type to MariaDB 10.2 from MySQL. go ahead and verify it once the Upgrade process is completed.
2. Downgrade the Version of MariaDB from 10.2 to 10.1.43 (or any)
Now you have MariaDB Instead of MySQL, but you have some application dependencies and you need to have MariaDB v10.1.43 Instead of 10.2. This downgrade process you won’t be able to do it from the WHM. In order to downgrade, let’s login to the Linux Server and elevate permission to root user.
$ sudo su -
Check the Installed MariaDB Packages.
# yum list installed MariaDB-client MariaDB-common MariaDB-compat MariaDB-devel MariaDB-server MariaDB-shared
Delete all MariaDB 10.2 packages.
# yum remove MariaDB-client MariaDB-common MariaDB-compat MariaDB-devel MariaDB-server MariaDB-shared
Check MariaDB Service. It should not be running.
# sudo service maridb status
Now, move all the MariaDB file to /tmp location.
# mv /var/lib/mysql /tmp
Now if will go to the cPanel Account, your would not be able to see MySQL, PHPMyadmin and Other Mysql Services. All must have dissappeared at this point of time.
Now Let’s add yum repository for MariaDB 10.1.43 Version. For other Version, get the Yum Repository from the MariaDB Docs here.
# vim /etc/yum.repos.d/MariaDB102.repo
Delete v10.2 base Url and add new repo as shown below.
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Save and Exit. Now Install all packages of MariaDB again, this time it will be 10.1.43 refering to the repos we have created.
# yum repolist # yum install MariaDB-client MariaDB-common MariaDB-compat MariaDB-devel MariaDB-server MariaDB-shared
Once packages are installed, go ahead and verify the MariaDB Service status.
# service mariadb status
Wait for few mins, All those Icons will again be visible in cPanel.
Note: All Users, databases, and db dumps will be deleted, you have to create the database and restore it from the dumps.
Verify the MariaDB Version, It should be downgraded to 10.1.43.
If you are facing an Issue Opening PhpMyadmin from cpanel with error “Access Denied” then Just go to your WHM Console, Search for “Mysql root password” and reset Database root password. After this try opening the Phpmyadmin again.
Note: Create database, Users and restore it from the dumps.
If you Like Our Content here at Devopsage, then please support us by sharing this post.
Also, Please comment on the post with your views and let us know if any changes need to be done.