MySQL or MariaDB Upgrade — Simple & Complete Guide

MySQL or MariaDB Upgrade — Simple & Complete Guide

Use this page to upgrade the server’s database engine to a newer supported version. Plan a maintenance window—the service restarts and databases may be unavailable during the upgrade.

Important:
  • Back up all databases and configuration files before you start.
  • Major downgrades are not supported. To revert, you must restore from backups.
  • Upgrades can change defaults and remove deprecated options—test your apps after completion.

Before You Start

  • Backups: Create full dumps of all databases and copy your my.cnf (or equivalent).
  • Disk Space: Ensure enough free space for packages, temporary files, and logs.
  • Compatibility: Check application requirements, ORM/driver versions, and deprecated features.
  • Replication: If you use replicas, confirm version compatibility and the correct upgrade order.
  • Maintenance Window: Notify stakeholders and schedule off-peak time.
Backup examples (run as root):
# Dump all databases with routines/events/triggers
mysqldump --all-databases --single-transaction --routines --events --triggers \
  > /root/db-backup-$(date +%F).sql

# Save current configuration
cp -a /etc/my.cnf /root/my.cnf.backup.$(date +%F)

Supported Upgrade Paths

  • Upgrade within MySQL (e.g., 5.7 → 8.0) or within MariaDB (e.g., 10.x → a newer 10.x).
  • Switching from MySQL to MariaDB is commonly supported; plan carefully.
  • Switching back from MariaDB to MySQL is typically not supported—treat it as one-way.

Run the Upgrade (Step-by-Step)

  1. Open the database upgrade page.
  2. Select the target version (MySQL or MariaDB) from the list of supported options.
  3. Read the warnings and confirm that backups are complete.
  4. Click Start Upgrade and follow the prompts.
  5. Wait while the system installs packages, migrates system tables, and restarts the service.

What the Tool Does

  • Installs the target database packages and dependencies.
  • Upgrades internal/system tables to the new format.
  • Preserves most configuration values, skipping unsupported ones where needed.
  • Restarts the service and reports status.

Verify After Upgrade

  • Confirm the service is running and the version is correct.
  • Review logs for warnings or failures.
  • Test application read/write operations and background jobs.
  • Remove or replace deprecated options in my.cnf if noted.
Quick verification commands:
# Service status
systemctl status mysqld   # or: systemctl status mariadb

# Client/server version
mysql -V

# Simple test query
mysql -e "SELECT VERSION() AS version, NOW() AS time;"

Common Issues & Tips

  • Unsupported options: Remove or replace deprecated settings (e.g., query cache in newer MySQL).
  • Authentication changes: Some versions change default auth plugins; update drivers/connectors.
  • SQL modes: Stricter defaults can expose data issues; fix data and tune SQL modes as needed.
  • Temp/Sort usage: Ensure adequate tmpdir space; review index and query plans.
  • Replication: Reconnect replicas using version-compatible steps after the primary is upgraded.

Rollback Strategy

In-place downgrades are not supported. To revert, reinstall the previous version and restore your database dumps and configuration backups taken before the upgrade.


Summary

  • Back up everything, check compatibility, and schedule downtime.
  • Select a supported target version and run the guided upgrade.
  • Let the tool handle packages, system table migration, and restart.
  • Verify with commands, test apps, and clean up deprecated configs.
  • Use backups for any rollback—no direct downgrades.
case studies

See More Case Studies