Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Migrate to MySQL 8 on a Linux VPS Safely

A practical MySQL 5.7-to-8.0 VPS migration runbook covering logical dump-and-restore, supported APT and Yum/DNF upgrades, testing, cutover validation and rollback.
Length12 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The safest MySQL 5.7-to-8.0 migration on a Linux VPS is a rehearsed move with a verified backup, not an untested package command. First inventory the server and choose between a logical dump-and-restore and a supported in-place package upgrade. Test the chosen route on a representative VPS, keep a copy of the backup off-server, and schedule production downtime for the final cutover. MySQL 8.0 cannot be downgraded normally to 5.7 or to an earlier 8.0 release, so your pre-upgrade backup is the rollback plan.

What changes when you move to MySQL 8?

MySQL 8 is a major release change. The server, SQL behavior, authentication, collations, reserved words, plugins and client interfaces may differ from MySQL 5.7. SQL exported from the older server can fail when a feature has been changed, deprecated or removed. Treat the migration as both a data move and an application-compatibility project.

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Oracle describes a logical upgrade as exporting SQL from the old instance with a utility such as mysqldump or mysqlpump, installing the new server and applying that SQL to the new instance. An in-place upgrade keeps the existing data directory and updates packages, but it is supported only for an installation and repository path that MySQL explicitly supports.

Choose logical migration or in-place upgrade

Use the following decision table before changing a package or stopping production writes.

Decision factor Logical dump and restore In-place package upgrade
Changing VPS, Linux distribution or installation layout Best fit. Install a clean MySQL 8 target and import the SQL. Usually unsuitable because the existing installation and data directory are not being carried to a supported target in the same way.
Changing from MariaDB, Percona Server or another fork Preferred starting point; review exported SQL and fork-specific features. Use only when the exact vendor and repository path document a supported upgrade.
Downtime Depends on dump, transfer and import duration; a final dump requires writes to stop or be coordinated. Usually shorter package-maintenance downtime, but the server restarts after the update.
Rollback Restore the pre-migration backup to a MySQL 5.7 server or revert the original VPS snapshot after stopping MySQL 8. Restore the pre-upgrade backup or snapshot; do not rely on downgrading packages.
Large data volume Requires enough time and temporary storage for export, transfer and import; rehearse the duration. Avoids a full SQL transfer but still needs a tested upgrade path and conversion work.
SQL compatibility work Import errors are visible during the restore and can be corrected before cutover. Compatibility problems appear during startup or application testing on the upgraded data directory.
Plugins, keyrings and encryption Reinstall and configure them on the target, then verify access to encrypted data. Confirm that every installed plugin, keyring setting and encryption component is supported by the selected 8.0 packages.
Testability Easy to repeat on a disposable VPS with the same dump. Clone or snapshot the complete installation and rehearse the package sequence.

If the host, distribution or database engine is changing, choose logical migration unless the vendor documentation for your exact combination says otherwise. If you are staying on the same supported Linux installation and MySQL repository path, an in-place upgrade may be appropriate after a full rehearsal.

Inventory the current VPS

Make a written inventory before taking a backup. It becomes the checklist for rebuilding the target and diagnosing differences after cutover.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Record the current MySQL version and release, Linux distribution and release, CPU architecture, and the location of the data directory.
  • Identify how MySQL was installed: the distribution package, MySQL APT or Yum repository, a binary tarball, a container, or a MariaDB/Percona-derived installation.
  • List every application database, the mysql system database, users, grants, authentication plugins, stored procedures and functions, scheduled events, triggers and views.
  • Document replication topology, read-only replicas, scheduled jobs, backup timers, service overrides and monitoring checks.
  • Record keyring or encryption configuration, custom plugins, TLS certificates, socket and port settings, character sets, collations and SQL modes.
  • List every application connector and language interface, including PHP MySQL extensions, Perl DBD::mysql, JDBC, ODBC or framework-specific drivers.
  • Measure database size, free disk space, dump location, expected transfer speed and the longest acceptable maintenance window.

Save configuration files and service definitions separately from the database backup. A clean target can then be rebuilt without guessing which options were locally customized.

Back up and rehearse recovery

Take a complete backup before changing packages or stopping the old server. Include all application databases and the mysql system database; the latter contains account and privilege information needed to reproduce access. Keep at least one copy outside the VPS so a damaged disk, failed package transaction or accidental deletion does not destroy both the live data and its recovery copy.

Verify that the backup is readable and perform a trial restore on a disposable Linux VPS. A file that was created successfully is not proof that it can be imported. Check that the restored server starts, users can authenticate, routines and events exist, and representative application queries return expected results. Record how long the restore takes and how much temporary disk space it needs.

MySQL states that a downgrade from 8.0 to 5.7, or from one 8.0 release to an earlier 8.0 release, is unsupported. Consequently, the pre-upgrade backup, snapshot or a separately preserved old VPS is the rollback mechanism. Do not plan to install older packages over a modified MySQL 8 data directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test compatibility on a representative instance

Oracle recommends performing the procedure on test systems first and then on production. Clone a representative database, not an empty schema. Include the largest tables, unusual data, routines, events, generated columns, views, authentication methods and the queries that matter to your application.

Run the test sequence

  1. Create a test VPS with the target Linux family and the same storage class, memory and MySQL 8 repository series you intend to use in production.
  2. Restore a recent copy of the old data, or use the logical dump that will be used for the final migration.
  3. Install or upgrade to MySQL 8 using the selected procedure, then inspect the startup and error logs before connecting the application.
  4. Run schema migrations and application initialization exactly as production will run them.
  5. Exercise authentication, reads, writes, transactions, reporting queries, background jobs, stored routines and scheduled events.
  6. Check for failures caused by reserved words, SQL modes, character sets, collations, generated columns, authentication plugins or removed and deprecated features.
  7. Rebuild or reinstall language interfaces after the release change. MySQL specifically calls out interfaces such as PHP MySQL extensions and Perl DBD::mysql; do not assume an existing binary module remains compatible.
  8. Measure import time, startup time, query latency and application error rates. Use those measurements to set the production maintenance window.

Resolve errors in the exported SQL, schema migrations or application code before scheduling production. The --force option shown in the dump example allows the dump process to continue past some errors; it does not make the resulting migration safe.

Logical migration: dump, install and restore

Logical migration is the most portable route when you are changing hosts, distributions or database forks. It also gives you a clean target and a repeatable restore.

1. Prepare the old server

Confirm that the old server is healthy, has enough space for the dump and that no backup or schema job will alter data unexpectedly during export. For a consistent production export, use the transaction and locking options appropriate to your storage engines and workload; rehearse those options on the test VPS rather than inventing a new command during the outage.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Export databases, routines and events

The official example for a complete SQL export is:

mysqldump -u root -p --add-drop-table --routines --events --all-databases --force > data-for-upgrade.sql

--all-databases includes the mysql system database as well as application schemas. --routines and --events preserve stored procedures, functions and scheduled events. If your application depends on triggers, views, tablespaces, encryption metadata or other installation-specific objects, verify in the test restore that the chosen utility and options captured them. Keep the command output and error messages; review every reported error.

3. Transfer and protect the dump

Copy the SQL file to storage outside the source VPS and to the target only over an authenticated, protected channel. Restrict file permissions because the dump can contain credentials, personal data and all application records. Confirm the file size and, where your operational process supports it, a checksum at the source and destination.

4. Install and initialize MySQL 8 on the target

Install MySQL 8 with the distribution-supported method, initialize the data directory as required by that distribution, enable the service and start it with systemd where applicable. Apply the target configuration for ports, sockets, TLS, keyrings, memory and storage only after confirming that each option is valid for MySQL 8. Do not copy an old configuration wholesale without reviewing removed or changed variables.

5. Import and inspect errors

Import the dump with a MySQL client that matches the target server. Capture the client output and server error log. Stop and investigate syntax, privilege, character-set, collation, plugin or object-definition errors instead of treating a completed command as proof of success. Correct the SQL or target configuration, reset the test instance if necessary, and repeat until the restore is clean and reproducible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Recreate and verify access

Check that users, grants, authentication plugins, routines, events, triggers, views and scheduled jobs are present. If an object could not be carried across, recreate it deliberately on MySQL 8 and document the change. Reinstall any required plugins and verify keyring or encryption access before exposing the server to the application.

7. Validate the restored data

Compare table and row counts, selected checksums or application-level invariants between source and target. Run representative read and write transactions, including transactions that exercise foreign keys, generated columns, reporting views and background workers. Validate the application with the same connector versions that will be used after cutover.

In-place upgrade with APT on Ubuntu or Debian

Use this route only when the installation came from a supported APT path and the MySQL repository documents the upgrade. In the MySQL APT setup, select the MySQL 8.0 release series before updating package metadata. Do not select a lower series than the one already installed; that would be an unsupported downgrade operation.

  1. Take and verify the full backup described above, and rehearse the package sequence on a clone or test VPS.
  2. Open the MySQL APT repository configuration and select the 8.0 series for the matching Linux distribution.
  3. Update package metadata:
sudo apt-get update
  1. Install or update the server package:
sudo apt-get install mysql-server
  1. Expect the server to restart after the package update. Watch the package output and the MySQL error log for startup failures.
  2. After the service is available, verify the version, accounts, grants, plugins, scheduled events, replication and application connections before reopening traffic.

APT does not turn an unsupported installation into a supported one. If the existing server came from a fork, a tarball or a custom data-directory layout, use a logical migration or follow the exact vendor procedure for that installation instead.

In-place upgrade with Yum or DNF on Enterprise Linux or Fedora

For systems using the MySQL Yum repository, the 5.7 subrepository must be disabled and the 8.0 series enabled before updating. Leaving 5.7 selected does not automatically move the installation to 8.0.

  1. Verify the backup and complete a test upgrade on a representative clone.
  2. In the repository configuration, disable the MySQL 5.7 subrepository and enable the MySQL 8.0 subrepository.
  3. Update the server with the package manager used by the distribution:
sudo yum update mysql-server

or:

sudo dnf upgrade mysql-server
  1. Expect a service restart after the package update. Review the transaction output and startup log for conversion or configuration errors.
  2. Verify SELECT VERSION(), users, grants, plugins, replication, scheduled jobs and application smoke tests before directing production traffic to the upgraded server.

Cut over with controlled downtime

For a logical move, schedule a maintenance window long enough for the final export, transfer, import and validation measured during rehearsal. Announce the write freeze, stop or drain application workers that can write to MySQL, and prevent background jobs from changing data while the final dump is taken. If replication or another catch-up mechanism is part of your design, confirm its lag and failure behavior before the window.

  1. Put the application into maintenance or read-only mode and stop write-producing workers.
  2. Take the final consistent dump or complete the planned replication catch-up.
  3. Import or finish the package upgrade on the target and inspect logs.
  4. Run the validation checklist: version, service health, accounts and grants, row counts or invariants, routines, events, replication, connector connectivity and representative transactions.
  5. Change the application connection endpoint, DNS record or configuration to the MySQL 8 server.
  6. Re-enable workers and writes gradually while monitoring errors, latency, connections, locks and disk usage.
  7. Keep the old server powered off or isolated until the agreed rollback period has passed; do not allow accidental writes to both servers.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Post-upgrade verification checklist

  • Server: SELECT VERSION() reports the intended MySQL 8 release, the service starts after reboot, and the error log is free of unresolved conversion or plugin failures.
  • Accounts: Application users can authenticate with the expected plugin, have the intended grants and cannot access accounts that should have been removed.
  • Data: Critical table counts, checksums or business invariants match the source, and recent writes are visible from the application.
  • SQL behavior: Queries using generated columns, reserved words, SQL modes, character sets and collations have passed the representative test suite.
  • Programmability: Stored routines, triggers, views and scheduled events exist and execute successfully.
  • Operations: Backups, monitoring, log rotation, TLS, keyring access, replication and scheduled maintenance jobs run against the new instance.
  • Clients: PHP MySQL extensions, Perl DBD::mysql and other connectors have been rebuilt or reinstalled as recommended for the release change.

Do you need to run mysql_upgrade?

From MySQL 8.0.16 onward, mysql_upgrade is not a separate required step. The server performs those upgrade tasks during startup. Do not add an obsolete standalone command to an otherwise correct runbook. Instead, inspect startup output and error logs, then perform the account, schema, routine and application checks listed above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rollback when MySQL 8 breaks the application

Stop writes as soon as a serious post-cutover fault is confirmed. Preserve the MySQL 8 logs and the failing query or application error so the cause can be diagnosed without changing more data.

  1. Put the application back into maintenance mode and stop workers.
  2. Prevent traffic from reaching the MySQL 8 instance.
  3. Restore the pre-upgrade backup to a MySQL 5.7 server or revert the preserved pre-upgrade VPS snapshot. Do not attempt an ordinary package downgrade of the modified MySQL 8 data directory.
  4. Validate the restored server with authentication, grants, row counts and representative transactions.
  5. Point the application back to the restored endpoint, then reconcile any writes that occurred after the cutover from logs or application records.
  6. Investigate the compatibility failure on a disposable clone, correct the SQL, connector, plugin or configuration issue, and repeat the test before another production attempt.

A rollback can lose writes made after the migration point unless you have a separately tested change-capture or reconciliation process. Define that data-loss boundary in the maintenance plan before the first cutover.

Troubleshooting common migration failures

The package manager keeps installing MySQL 5.7

On Yum or DNF, the 5.7 subrepository is probably still enabled. Disable it and enable the 8.0 series before running the update. On APT, reopen the repository configuration and select 8.0, then run sudo apt-get update so package metadata reflects the selection.

The server fails during startup

Read the MySQL error log and systemd status output. Check incompatible configuration variables, missing plugins, keyring or encryption access, permissions on the data directory and disk space. Restore the pre-upgrade backup if the cause cannot be corrected safely inside the maintenance window.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The import reports syntax or object errors

Review the exact statement and error, then test the statement on the disposable MySQL 8 instance. Features changed, deprecated or removed between releases may require edited SQL, a schema change or an application query change. Do not suppress errors merely because the dump command used --force.

Users can no longer connect

Compare the restored or upgraded accounts, authentication plugins, grants, host patterns and TLS requirements with the connector’s capabilities. Rebuild or reinstall the client interface where necessary, including PHP MySQL extensions or Perl DBD::mysql.

Scheduled work stopped

Check that events, cron or systemd timers, replication jobs and application workers were included in the inventory and restored on the target. Confirm the event scheduler setting and inspect its execution history and the server error log.

The target has the wrong data

Stop writes, compare row counts and selected checksums with the source, and identify whether the problem came from an inconsistent export, an incomplete import or writes that continued during the cutover. Restore the verified backup or repeat the migration from a clean test-proven procedure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Production runbook

  1. Inventory version, distribution, installation source, data directory, plugins, encryption, replication, jobs and connectors.
  2. Select logical migration or a documented in-place path based on the host and repository change.
  3. Create an all-database backup that includes mysql, copy it off-server and prove that it restores.
  4. Clone production, perform the complete migration and exercise the application.
  5. Resolve SQL, connector, authentication and plugin issues; measure the elapsed time.
  6. Schedule the maintenance window and communicate the write freeze and rollback boundary.
  7. Perform the final dump or supported package switch, then validate before reopening traffic.
  8. Monitor the new instance and retain the old system or backup until the rollback period ends.

“Downgrade from MySQL 8.0 to MySQL 5.7, or from a MySQL 8.0 release to a previous MySQL 8.0 release, is not supported.” — Oracle MySQL, Before You Begin

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.