Skip to content

Migrating from MySQL 5.7 to 8.0 without breaking your app

MySQL 5.7 is end-of-life. The 8.0 upgrade is mostly safe — but the parts that are not safe will silently break SQL that ran for years. Here is the order we run it in.

MySQL 5.7 reached end of life in October 2023. If your application is still on it in 2026, the managed platform almost certainly wants you off, and the obvious answer — “just upgrade” — is right in spirit and wrong in detail. The 8.0 upgrade is mostly safe. The parts that are not safe will silently break SQL that ran on 5.7 for a decade. Here is the order we run the migration in on Cloud PaaS, and the checks that catch the breakage before it ships.

What’s happening

Between 5.7 and 8.0, MySQL changed several things at once: the default authentication plugin, the default character set, reserved words, the optimizer’s behavior on GROUP BY without ORDER BY, the removal of the query cache, and a long tail of sql_mode defaults. None of these will make the database refuse to start. All of them can make a query that returned the same rows for years quietly return different rows on 8.0.

How to verify

Run MySQL’s own pre-check utility against the 5.7 source first. On a Cloud PaaS managed MySQL, the platform exposes this; on a self-hosted source, run it directly:

mysqlsh -- util check-for-server-upgrade root@<host>:3306 \
  --target-version=8.0.36 \
  --output-format=JSON > upgrade-check.json

The output is a list of issues with severity. ERROR items are non-negotiable — they will break on 8.0. WARNING items need triage, especially around reserved words used as identifiers (every rank, system, groups column or alias needs backticks now) and tables using utf8mb3 character set (the old utf8 is being phased out in favor of utf8mb4).

Then snapshot real query behavior. On a 5.7 replica, log a representative sample of production queries with general_log, replay them against an 8.0 staging copy with the same data, and diff row counts:

mysqlslap --create-schema=app --query=replay.sql --concurrency=10 --iterations=1

Anywhere the row counts differ, you have a query whose semantics changed.

The fix

  1. Resolve every ERROR from the upgrade check on 5.7. Rename columns that collide with new reserved words; convert utf8mb3 tables to utf8mb4; drop or replace deprecated syntax.
  2. Stand up an 8.0 staging cluster as a replica of 5.7 production. Run the application against it for at least a week. Watch for slow query log entries that did not appear on 5.7 — the new optimizer occasionally picks a different plan, and one or two indexes usually need a refresh.
  3. Update the application’s connection layer for the new default authentication plugin (caching_sha2_password). PHP 7.x without the right mysqlnd build will fail to authenticate; this is the single most common failure mode we see on cutover.
  4. Cut over during a low-traffic window with the application in read-only mode for the final binlog catch-up, the same playbook as any version-jump migration. Keep the 5.7 instance running and reachable for 48 hours so a rollback is a connection-string change, not a restore.

The upgrade lands without surprise rows, and the application stops running on a database the platform has been threatening to deprecate for two years.

If you are sitting on a MySQL 5.7 that the platform is putting pressure on, our Cloud PaaS team runs this migration end to end with Deployment & Release Management — book a scoping call.