Lesson 9 of 9 · 26m
Upgrading MySQL and MariaDB Without a Resume Event
Version compatibility, replication-first upgrades, preflight checks, rollback planning, and the differences between MySQL 8 and MariaDB upgrade paths.
Database upgrades fail in boring ways: a deprecated SQL mode, an auth plugin the client library never expected, a character-set corner case, a replication setting renamed years ago, a backup that was never rehearsed. The upgrade itself is usually the easiest command in the whole procedure. Compatibility and rollback are the project.
Treat the upgrade as a migration, even when it is in-place
Start with the release notes and upgrade checker, not the package manager. MySQL 8 introduced the upgrade checker in MySQL Shell:
util.checkForServerUpgrade('root@db1.prod.sudosecurity.org:3306')It reports removed features, obsolete settings, orphaned objects, reserved words, authentication issues, and other preflight failures. MariaDB publishes version-specific upgrade notes; read every intermediate major version notes document, not just the destination version.
Know the dialect you are actually running
MySQL and MariaDB diverged long ago. Syntax, system variables, GTID behavior, authentication plugins, optimizer features, and even upgrade tooling differ. In MySQL 8, much of what mysql_upgrade once did is handled by the server during startup. In MariaDB, mariadb-upgrade or mysql_upgrade remains part of the normal flow depending on version and packaging.
mysql --version
mariadb --versionThose commands are not redundant in mixed fleets. Confirm which client packages, server packages, and distribution repositories are in play before maintenance starts.
A sane replicated upgrade sequence
- Take a fresh verified backup and preserve binary logs.
- Upgrade one replica first.
- Run replication and application read traffic against it in a controlled way.
- Watch error logs, performance, replication lag, and application behavior.
- Upgrade remaining replicas.
- Promote an upgraded replica during maintenance.
- Rebuild or upgrade the old source after it is no longer authoritative.
- Keep the final rollback window open until smoke tests and business checks pass.
This sequence lets you test the new version on real data volume without risking the writer first. It also creates a clean rollback path: keep the old source fenced and intact until the window closes.
Do not downgrade after writes
Rollback is often misunderstood. Once clients write new-format data or execute transactions on the upgraded writer, copying back to the older version is not a supported casual operation. Your real rollback is to stop writes and return traffic to the preserved old writer before new incompatible state accumulates. After that point, rollback means restore and replay — expensive, slower, and dependent on binary logs.
Schema and application compatibility belong in rehearsal
Use a staging clone with production-like scale. Run the application's migration suite, query regression tests, background jobs, and replication chains. Pay attention to SQL modes, utf8mb4 conversion behavior, generated columns, reserved keywords, authentication plugins, and TLS requirements.
SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE, TABLE_COLLATION
FROM information_schema.TABLES
WHERE ENGINE IS NOT NULL
ORDER BY TABLE_SCHEMA, TABLE_NAME;A full inventory sounds boring until the upgrade fails on the one archive table still using a long-dead storage engine or an unexpected collation.
Field notes
- Upgrade the operating-system package repository configuration deliberately; accidental major-version jumps happen.
- Replication across versions is usually supported in one direction for a limited window — old source to newer replica is the intended upgrade shape. Verify exact compatibility.
- Capture
SHOW GLOBAL VARIABLESbefore and after. Changed defaults are silent behavior changes. - Record the exact time you allow writes on the new writer. That timestamp defines the end of cheap rollback.
Was this lesson helpful?