/root/cpanel_profile/cpanel.config with a line such as mysql-version=10.11, then run the installer. cPanel does not offer a way to move a server from MySQL 8 to MariaDB in WHM. On a brand-new server with no databases yet, you can remove MySQL and install MariaDB with the steps below. On a server that already hosts sites, build a new server with MariaDB and move the accounts to it instead.MariaDB or MySQL: which to choose
| MariaDB | MySQL 8 | |
|---|---|---|
| Origin | Community fork of MySQL, developed by the MariaDB Foundation and MariaDB plc | Developed by Oracle |
| Compatibility | Works with most MySQL applications, including WordPress, Joomla, Magento and WooCommerce | The reference MySQL server |
| Long-term releases | LTS releases such as 10.6, 10.11 and 11.4, each supported for several years | 8.0 and the newer 8.4 LTS |
| Good reasons to choose it | You want to match existing MariaDB servers, or an application recommends it | An application requires MySQL 8 features or tests only on MySQL |
For a typical web hosting server, both work well. The most important rule is to choose before the first account is created, because switching later is hard.
Check which database server you have now
Before you change anything, confirm what the server runs and whether it already holds data:
mysql -V # version and family (MySQL or MariaDB)
grep mysql-version /var/cpanel/cpanel.config
mysql -e "SHOW DATABASES;" | wc -l # more than a handful means real data
In WHM, the same information is on the MySQL/MariaDB Upgrade page. If the server already runs the database you want, there is nothing to change.
Which versions cPanel offers
cPanel supports a list of MySQL and MariaDB versions that changes with each cPanel release, and older versions are removed when they reach end of life. Check the current list in the cPanel documentation, or on an installed server in WHM > SQL Services > MySQL/MariaDB Upgrade. Choose a long-term support release, so you are not forced to upgrade soon.
Option 1: choose the database before installing cPanel (recommended)
On a fresh AlmaLinux 9 server, before you run the cPanel installer:
mkdir -p /root/cpanel_profile
echo "mysql-version=10.11" > /root/cpanel_profile/cpanel.config
# Then install cPanel as usual
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
Replace 10.11 with the MariaDB version you want, from the list your cPanel version supports. Use 8.0 or another supported MySQL version if you prefer MySQL. If you do not set a version, the installer uses its current default. Our cPanel install guide covers the rest of the setup.
Option 2: switch a brand-new server from MySQL 8 to MariaDB
Only on a new, empty server:
This method removes MySQL and its data. cPanel does not support it, and it is not a migration: any database on the server is lost. Use it only straight after installing cPanel, before you create any account or database.
First, confirm that the server has no databases apart from the system ones:
mysql -e "SHOW DATABASES;"
# Expect only: information_schema, mysql, performance_schema, sys (and cPanel's own if present)
Then, as root:
# 1. Stop MySQL and remove the packages
systemctl stop mysqld
dnf -y remove "mysql-community-*"
# 2. Move the old data folder aside instead of deleting it
mv /var/lib/mysql /var/lib/mysql.removed-$(date +%F)
# 3. Tell cPanel which version to install
sed -i "s/^mysql-version=.*/mysql-version=10.11/" /var/cpanel/cpanel.config
grep mysql-version /var/cpanel/cpanel.config
# 4. Install MariaDB through cPanel
/usr/local/cpanel/bin/whmapi1 start_background_mysql_upgrade version=10.11
Follow the progress in the upgrade log. The folder name includes the date and time of the run:
ls -d /var/cpanel/logs/mysql_upgrade.*
tail -f /var/cpanel/logs/mysql_upgrade.*/unattended_background_upgrade.log
When the log says the upgrade is complete, check the result:
mysql -V
systemctl status mariadb
mysql -e "SELECT VERSION();"
Once MariaDB works and WHM shows the new version, you can delete the old folder you moved aside in step 2.
Option 3: a server that already has accounts
Do not use Option 2 on a server with live sites. Removing MySQL deletes their databases, and MySQL 8 data files cannot be opened by MariaDB. The safe way is:
- Order a new server and install cPanel with MariaDB, using Option 1.
- Use WHM > Transfers > Transfer Tool to copy the accounts. The databases are exported and imported as SQL, which works between MySQL and MariaDB.
- Test the sites on the new server, then change DNS.
- Keep the old server until everything has run cleanly for a few days.
If you would rather not run two servers, keep MySQL. A move that saves nothing but risks data is not worth it.
Upgrading MariaDB or MySQL later
Upgrades within the same family are supported in WHM. Before you upgrade:
- ✓ Take a full backup of every database, and check that it restores.
- ✓ Read the release notes for the new version, especially changes to SQL modes and removed features.
- ✓ Check that your applications support the new version.
- ✓ Run the upgrade in WHM > SQL Services > MySQL/MariaDB Upgrade during a quiet period.
Upgrades are one-way. You cannot go back to an older version without restoring from a backup. See our cPanel backup and restore guide.
Before you install cPanel on AlmaLinux 9
- ✓ Start from a minimal, fresh AlmaLinux 9 install with no web or database server.
- ✓ Set a fully qualified hostname, for example
server1.example.com. - ✓ Update the system with
dnf update -yand reboot if a new kernel was installed. - ✓ Make sure DNS resolution works, for example with
getent hosts securedownloads.cpanel.net. - ✓ Choose the database version as shown in Option 1.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| MariaDB is not listed in MySQL/MariaDB Upgrade | WHM only offers upgrades, not a switch from MySQL 8 | Use Option 1 on a new server, or Option 2 if the server is empty. |
| The background upgrade fails | MySQL packages or data were still present | Read the upgrade log, check that the MySQL packages are removed and /var/lib/mysql is moved aside, then run it again. |
| Sites show database connection errors | The database server is stopped | Run systemctl status mariadb and read /var/log/mysqld.log or the journal. |
| The version did not change | The version line in cpanel.config was not updated | Check grep mysql-version /var/cpanel/cpanel.config. |
To make the new database fast, see our database performance guide.
Need help with this?
Want cPanel installed with the right database from day one? Order a Cloud VPS or dedicated server with cPanel, or let our team set it up.
Frequently asked questions
Can I switch from MySQL 8 to MariaDB in WHM?
No. WHM offers upgrades within MySQL or MariaDB, but not a switch from MySQL 8 to MariaDB. Choose the database before installing, or move accounts to a new server.
How do I choose MariaDB when installing cPanel?
Create /root/cpanel_profile/cpanel.config with a line such as mysql-version=10.11 before running the installer.
Will my sites work on MariaDB?
Most PHP applications, including WordPress, Joomla and WooCommerce, work on both. Check your application’s requirements if it lists specific MySQL features.
Is it safe to delete /var/lib/mysql?
Only on a brand-new server with no databases, and even then it is safer to move the folder aside until the new database server works.
Which MariaDB version should I pick?
A long-term support release that your cPanel version lists, so you get security fixes for several years.
Related guides
- Install FFmpeg on AlmaLinux, Debian, CentOS, and Ubuntu (Updated Guide)
- Updated MARCH 2025: Fixing Blank “CPU/Memory/MySQL Usage” Page in cPanel
- How to Optimize PHP Performance in cPanel with MultiPHP Manager & CloudLinux PHP Selector
- How to Back Up and Restore a cPanel Account Over SSH
- How to Fix “/usr/bin/crontab Permissions Are Wrong” Error in cPanel
