Skip to content

Switching a cPanel server from MySQL to MariaDB without a one-way door

MariaDB is wire-compatible with MySQL, not data-file compatible. The switch is a dump-and-restore in disguise, and once you cross the version barrier, MySQL cannot read MariaDB data.

Most new cPanel installs default to MariaDB, but plenty of older hosts are still on MySQL 5.7 or 8.0 and the operator wants to move to MariaDB for tooling consistency or licensing peace of mind. cPanel’s MySQL/MariaDB Upgrade tool calls this “switching engines” but underneath it is a full database export, package swap, and re-import. There is no in-place flip — the data file formats diverge after a certain version, and MariaDB 10.x cannot read MySQL 8.0 data files. The good news is the wizard scripts the whole thing; the bad news is that if any part fails, you are restoring from your own backup, not from cPanel’s.

What’s happening

MySQL and MariaDB shared a common ancestor and have drifted. MySQL 8.0 introduced an InnoDB data dictionary that lives outside the .ibd files; MariaDB kept the legacy frm/ibd format. Wire protocol stays compatible (a MySQL client connects to MariaDB and vice versa), but on-disk you cannot mount MySQL 8 data files under MariaDB. Therefore the switch is:

  1. mysqldump every database from MySQL.
  2. Stop and uninstall MySQL.
  3. Install MariaDB.
  4. Restore the dumps into MariaDB.
  5. Run mysql_upgrade.

cPanel’s wizard does steps 1–5 in sequence. The risk window is between steps 1 and 4 — if anything goes wrong, you have a server with no working database and need your own backup.

How to verify

Before:

mysql -e "SELECT VERSION()"
mysql -e "SELECT @@version_comment"
du -sh /var/lib/mysql
df -h /var/lib/mysql
whmapi1 list_dbs | wc -l
mysql -e "SELECT TABLE_SCHEMA, COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('mysql','information_schema','performance_schema','sys') GROUP BY TABLE_SCHEMA"

The first two confirm you are actually on MySQL, not already on MariaDB. The size and free space matter because the wizard temporarily holds both the dump and the restored data — peak disk usage is roughly 2.5x normal. The schema count is your post-switch verification baseline.

The fix

  1. Take an independent backup before launching the wizard. The wizard’s own dump is on the same disk; if the disk fills or the host reboots, you need a copy that survives. Push to off-host storage: mysqldump --all-databases --single-transaction --routines --triggers --events --hex-blob | gzip | ssh backup-host 'cat > /backups/pre-mariadb-$(date +%F).sql.gz'.
  2. Free up disk. You need 1.5x the current /var/lib/mysql size free during the switch. Clear old slow logs, drop unused databases, or temporarily mount additional storage.
  3. Pick a MariaDB target version intentionally. Don’t accept “latest” without checking — if you’re on MySQL 5.7, jumping to MariaDB 10.11 covers the most ground. If you’re on MySQL 8.0, MariaDB 10.11 is still the most equivalent feature-wise.
  4. Disable cPanel auto-updates: WHM > Update Preferences > Manual. Notify the team. Communicate maintenance window to customers — this is a 30–60 minute outage on a busy host.
  5. Run the wizard: WHM > MySQL/MariaDB Upgrade > select MariaDB 10.11. The progress UI shows each phase. Do not close the tab; let it complete.
  6. Verify post-switch:
    mysql -e "SELECT VERSION()"  # MariaDB-x.y.z
    mysql -e "SHOW DATABASES"  # same count as before
    whmapi1 list_dbs | grep -c "name:"  # matches pre-switch
    journalctl -u mariadb -p err --since "30 minutes ago"  # clean
  7. Run application smoke tests. WordPress, WooCommerce, Magento, custom apps — load admin pages and perform a write. MariaDB’s stricter SQL_MODE will catch broken queries that MySQL silently passed.
  8. Update tooling: any external script that hardcodes mysql_install_db or queries mysql.user should be reviewed. MariaDB uses mysql_install_db from the MariaDB package; the binary is in a different path on some installs.
  9. No rollback. Once the wizard completes, going back to MySQL means dump-and-restore again, with a longer migration window. Plan accordingly.

For cPanel hosts where the MySQL-to-MariaDB switch is a takeover prerequisite, Stack Harbor’s environment management team scripts the dump-package-restore sequence with off-host backup verification and a parallel target host warmed up to receive the dump if the wizard misbehaves.