Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon 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 Now×
Skip to content
VGSources
Blog

How to Upgrade MySQL to the Latest Version on a Linux VPS Without Losing Data

Upgrade MySQL on a Linux VPS safely by checking package origins and supported version paths, creating a tested backup, using the correct APT or Yum/DNF commands, and validating the restarted server, applications, replication and backups.
Length12 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no single safe “latest MySQL” command for every Linux VPS. The correct procedure depends on your distribution, the package source, the MySQL release series already installed, and the upgrade paths supported for that starting version. The safe sequence is: inventory the server, create and test a recovery point, confirm a supported version path, select the matching repository series, upgrade with apt, yum, or dnf, and then verify the restarted server and every dependent application.

A package upgrade normally preserves databases, but it can reveal incompatible configuration, authentication, SQL behavior, storage, or replication assumptions. Treat the change as a maintenance operation with a rollback plan rather than as a routine one-line update.

As an Amazon Associate I earn from qualifying purchases.

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

What “latest MySQL” means on a Linux VPS

MySQL is published in multiple release series. The official APT repository exposes choices such as MySQL 8.4, MySQL 8.0, and an innovation series; the correct choice is the series you have deliberately selected for your distribution and workload, not necessarily the numerically highest package visible somewhere online.

Your VPS distribution also controls which package manager and repository integration you use. Debian and Ubuntu normally use APT. RHEL-family systems and other Yum-compatible distributions use Yum or DNF. A distribution-maintained MySQL package, an installation from the official MySQL repository, and a fork such as MariaDB or Percona Server are different upgrade cases.

Do not change repositories until you know all three of these facts:

  • Which server implementation is running and where its packages came from.
  • Which Linux distribution and release the VPS uses.
  • Which target MySQL series is supported from your installed series.

The official APT procedure assumes an installation from the MySQL APT repository. It is not a generic in-place procedure for a nonnative repository distribution such as MariaDB or Percona Server. Mixing those packages with an Oracle MySQL repository can leave the server in an unsupported or uninstallable state.

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

Pre-upgrade checks that protect your databases

1. Record the current server and operating-system state

Run the following as a privileged user and save the output with your change record:

mysql --version
mysql -NBe "SELECT VERSION();"
cat /etc/os-release
uname -m

The first command reports the client and often the package build. The SQL query reports the server version that applications actually use. Compare them; a client binary can come from a different package than the running server.

Also record:

  • The enabled MySQL repositories and the repository that supplied the installed server.
  • Installed package names and versions.
  • Free space on the data, log, temporary, and package-cache filesystems.
  • Whether the VPS is standalone, a replication source, a replica, or part of a larger topology.
  • Scheduled backups, monitoring checks, maintenance jobs, and application maintenance windows.
  • The administrative account and authentication method you will use after the restart.

Do not infer the package origin from the version string alone. A distribution package and an official repository package may use similar names while having different configuration files, service names, and upgrade policies.

2. Create a recovery point and prove that it is usable

Make a fresh logical dump or physical backup before changing packages. If the VPS provider offers snapshots, take a snapshot as an additional recovery point, but do not treat an untested snapshot as a backup. Confirm that it completed, identify where the dump or backup is stored, and document the restore procedure on a separate system or in a controlled test.

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

Keep enough free space for the dump, package downloads, unpacked files, temporary upgrade work, and the database’s normal growth. A backup that fills the same filesystem as MySQL is not a reliable recovery plan. Record the time and scope of the backup, including whether all databases, users, grants, events, routines, and replication metadata are included.

3. Define the maintenance and rollback plan

Schedule a window long enough to stop writes, complete the package operation, restart MySQL, run checks, and restore service if necessary. Notify application owners that the server will restart automatically during the package update. Decide in advance who can stop application traffic, restore a snapshot, or perform a dump-and-restore if the in-place upgrade cannot be completed.

Do not delete the old backup or remove the old package metadata immediately after a successful restart. Retain the recovery point until application checks, scheduled jobs, and at least one backup cycle have succeeded.

Choose a supported version path before changing repositories

Major-version upgrades must follow the path documented for the exact starting and target versions. Oracle’s general rule is to move to the next release series rather than skip a series. Its example moves from 5.6 to 5.7 and then to 8.0. The fact that a repository offers a newer package does not prove that a direct jump is supported.

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.
Starting condition Action Reason
Oracle MySQL installed from the matching official repository Use that repository’s documented series-selection and upgrade procedure. The package dependencies and configuration transitions are defined for that source.
Older major series Check the official upgrade chapter and move through any required intermediate series. Skipping a release series can leave incompatible data dictionary, authentication, or configuration changes unresolved.
MariaDB, Percona Server, or another fork Follow that vendor’s migration documentation; do not point the server at an unrelated MySQL repository. The APT in-place procedure does not cover nonnative repository distributions.
Distribution-provided MySQL package Determine whether the distribution supports its own package transition or whether a planned migration is required. Package names and upgrade scripts can differ from the official MySQL repository.
Repository offers a series lower than the installed server Do not select it. The APT documentation warns against choosing a lower series than the one already installed.

If you are asking whether a 5.7 server can go straight to 8.4 or a 9.x series, do not answer from the version numbers alone. Verify the supported path for your exact build, operating-system release, and package source. If the guide requires an intermediate series, perform that upgrade and validation before proceeding. A package manager should never be used to force an unsupported downgrade or cross-fork replacement.

Upgrade Debian or Ubuntu with APT

The following flow applies when the server is an Oracle MySQL installation managed through the official MySQL APT repository. First configure or update that repository using the distribution-appropriate package and select the intended MySQL series. Do not select a lower series than the one currently installed.

  1. Confirm the repository selection. Check that the repository targets your Debian or Ubuntu release and that its MySQL series matches the supported target path. If the server is MariaDB, Percona Server, or a distribution fork, stop and use that project’s migration procedure instead.
  2. Refresh package metadata.
    sudo apt-get update
  3. Install the server meta-package explicitly.
    sudo apt-get install mysql-server

    Explicitly installing mysql-server is important. A general apt-get upgrade may update MySQL libraries and development packages without selecting the server package transition you intended. Installing the server package asks APT to update the server, client, and common database files when newer compatible packages are available.

  4. Read every package prompt. Review configuration-file replacement questions and dependency changes. Do not blindly overwrite a customized configuration. If a prompt requires a decision you cannot validate during the maintenance window, stop and restore the recovery plan rather than guessing.
  5. Allow the service restart to complete. The APT operation restarts MySQL automatically. Do not start application traffic until the service and SQL checks below pass.
  6. Capture the result. Save the installed package list, the new server version, and any warnings printed by the package operation.

After the package command finishes, a successful exit status only means that the package transaction completed. It does not prove that MySQL accepted the configuration, that tables are usable, or that applications can authenticate.

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

Upgrade RHEL-family systems with Yum or DNF

Use this flow when the VPS is configured with the official MySQL Yum repository and the repository series is supported for the installed version.

  1. Verify the enabled repository and target series. Confirm that the repository belongs to the same MySQL distribution already installed and that it does not advertise a lower series. For a fork or vendor build, use its own upgrade instructions.
  2. Update packages with the package manager provided by the operating system.
    sudo yum update

    On DNF-enabled systems, use:

    sudo dnf upgrade
  3. Target a single component only when that is intentional. If your maintenance plan calls for one installed component, target its package, such as mysql-server, instead of updating unrelated system packages. Review the proposed transaction before confirming it.
  4. Monitor the automatic restart. The Yum procedure documents an automatic MySQL server restart after the update. Wait for it to finish before reconnecting applications.
  5. Record versions and warnings. Capture the package transaction output, the server’s SQL version, and the final package list.

Yum and DNF can resolve a large dependency transaction. If the proposed operation removes the server, changes to an unexpected major series, or replaces packages from another vendor, cancel it and re-check the repository configuration and supported path.

Verify MySQL after the restart

Perform verification in this order so that a service-level problem is separated from an application-level problem.

  1. Check the service. Use the service name supplied by your distribution, commonly mysql or mysqld:
sudo systemctl status mysql

If your system uses mysqld, substitute that name. A running process is necessary but not sufficient; continue with SQL and application checks.

  1. Inspect the MySQL error log. Look for startup failures, rejected configuration directives, storage-engine errors, table warnings, authentication-plugin errors, and replication messages. Use the error-log location configured for your installation rather than assuming every distribution writes to the same path.
  2. Confirm the server version from SQL.
    mysql -NBe "SELECT VERSION();"

    Compare the result with the intended series and record it in the change record.

  3. Test an administrative connection. Verify that the expected administrative account can connect using the authentication method configured before the upgrade. Test locally first, then through the same connection path used by the application if policy allows.
  4. Run representative reads and writes. Exercise a non-destructive read from important schemas and a controlled write in a test or application-approved transaction. Check that stored routines, events, views, and scheduled tasks are present where they are expected.
  5. Check schema and table warnings. Review any warnings reported during startup or by the upgrade procedure. Do not dismiss table or index warnings; determine whether the relevant object requires the repair or migration action documented for your release.
  6. Validate applications. Confirm connection pools, authentication, migrations, background workers, queues, and API health. A database that accepts a manual login can still fail because an application uses a removed option, an old authentication plugin, or a stricter SQL behavior.
  7. Validate replication, backups, and monitoring. Check replica state and lag, scheduled backup completion, backup-agent connectivity, alerting, and metric collection. A restart can leave a replica or a scheduled job stopped even when the primary service is healthy.

Do you still need to run mysql_upgrade?

For MySQL 8.0.16 and later, the server performs the work historically associated with mysql_upgrade during startup. Do not add a routine mysql_upgrade command to a modern upgrade checklist simply because older guides include it.

Older installations may still require the utility after the server restarts. Consult the manual for the installed older release and run it only when that version’s procedure calls for it. Running a command intended for a different release can create confusion during an already sensitive transition.

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

Regardless of whether the utility is used, inspect the error log and perform the SQL, schema, application, replication, and backup checks. The absence of a required mysql_upgrade command is not the absence of post-upgrade work.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When an in-place package upgrade is not the best choice

An in-place update is usually the simplest route when the package source, operating system, and version path are aligned. A dump-and-restore or replacement VPS can be safer when you are crossing package families, changing distributions, moving away from a fork, or need a rapid rollback.

Approach Supported version jump Downtime Rollback speed Disk and memory needs Fork or distro compatibility Verification and cutover
In-place package upgrade Limited to the path supported by the installed package source and release. Usually the package transaction and automatic restart, plus validation. Fast only when a tested provider snapshot or package rollback exists. Needs headroom for packages, temporary files, logs, and backups on the same VPS. Best when staying within the same supported package family; poor choice for cross-fork replacement. Validate the existing host, then reopen application traffic.
Dump and restore on a new installation Can provide a controlled migration path when direct in-place movement is unsupported. Depends on dump size and the final write-free window; can be reduced with staged imports. Original server can remain available until cutover. Requires storage for the dump and a second environment during migration. Useful for distribution changes or moving between supported database implementations, subject to compatibility testing. Requires schema, users, grants, routines, events, application tests, and a planned cutover.
Blue-green replacement VPS Allows the new host to be built at the target series and tested independently. Final cutover only, if replication or a staged data copy is used. Very fast: direct traffic back to the original host if it remains intact. Needs a second VPS and enough capacity for synchronization and testing. Strong option when the existing host uses an old distribution or package family. Requires DNS or connection cutover planning, replication checks, and verification on both hosts.

The official manual treats copying databases to another machine as an alternative operational path. Choose it when preserving the old host for rollback is more valuable than minimizing infrastructure changes.

Troubleshooting common upgrade failures

APT, Yum, or DNF proposes a downgrade

Cancel the transaction. Check the selected repository series, enabled repositories, installed package origin, and distribution release. Never accept a lower MySQL series merely to satisfy a dependency prompt. Re-establish the supported path first.

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

The package transaction completes but MySQL will not start

Keep application traffic stopped. Check the service status and configured error log for invalid directives, permission problems, storage-engine failures, or incompatible options. Compare the active configuration with the package’s new defaults. Restore the provider snapshot or other tested backup if the cause cannot be resolved within the maintenance window.

The service starts but applications cannot authenticate

Test an administrative login and then the application account. Confirm the account exists, its grants are intact, and the authentication plugin is supported by the application’s connector. Do not solve a connector incompatibility by weakening authentication globally without a documented security decision and a tested rollback.

Tables, indexes, or schemas report warnings

Record the affected objects and follow the repair or migration action for the installed release. Test the action on a copy or during a controlled window when possible. Do not assume that a warning is harmless because ordinary queries still work.

Replication or scheduled backups are broken

Check replication status, errors, and lag on every member. Confirm that backup jobs can connect and that the next scheduled run completes. If the upgraded server is a replica, do not promote it until replication has caught up and application checks pass.

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.

The VPS runs out of disk space

Stop the upgrade rather than deleting database files or logs blindly. Free space using your documented retention policy, move the dump or package cache to approved storage, or expand the VPS volume. Reconfirm free space before retrying the package operation.

A practical runbook

  1. Announce the maintenance window and stop or quiesce application writes.
  2. Record MySQL, Linux, architecture, package origin, repositories, storage, topology, and scheduled jobs.
  3. Create and test a logical or physical backup and take a provider snapshot when available.
  4. Use the official upgrade documentation to confirm the exact supported path; do not skip a release series by assumption.
  5. Keep forked or vendor packages on their own migration path.
  6. Select the correct MySQL series in the repository, never a lower series than the installed server.
  7. Run sudo apt-get update followed by sudo apt-get install mysql-server on APT systems, or sudo yum update/sudo dnf upgrade on Yum/DNF systems.
  8. Wait for the automatic restart and check the distribution’s MySQL service.
  9. Inspect the error log, confirm SELECT VERSION(), test administrative access, run representative SQL, and validate applications.
  10. Check replication, backup jobs, monitoring, and scheduled tasks before declaring the upgrade complete.
  11. Use mysql_upgrade only when the matching older MySQL manual requires it; MySQL 8.0.16 and later perform the former work during startup.
  12. Retain the recovery point until the upgraded system has completed normal operations and a successful backup.

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.