{"record":{"id":"02c99dae62a641dd","repo":"vitessio/vitess","slug":"running-mysql-version-q-is-older-than-backup-mysq","errorCode":null,"errorMessage":"running MySQL version %q is older than backup MySQL version %q","messagePattern":"running MySQL version %q is older than backup MySQL version %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/backupengine.go","lineNumber":692,"sourceCode":"\tif flavorTo != flavorFrom {\n\t\treturn fmt.Errorf(\"cannot use backup between different flavors: %q vs. %q\", from, to)\n\t}\n\n\tif parsedTo == parsedFrom {\n\t\treturn nil\n\t}\n\n\t// If we're not on the same LTS stream, we have to do additional checks to see if it's safe to\n\t// to upgrade. It can only be one newer LTS version for the destination and the backup\n\t// has to be marked as upgrade safe.\n\n\t// If something is across different LTS streams and not upgrade safe, we can't use it.\n\tif !parsedFrom.isSameRelease(parsedTo) {\n\t\tif !upgradeSafe {\n\t\t\tif parsedTo.atLeast(parsedFrom) {\n\t\t\t\treturn fmt.Errorf(\"running MySQL version %q is newer than backup MySQL version %q which is not safe to upgrade\", to, from)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"running MySQL version %q is older than backup MySQL version %q\", to, from)\n\t\t}\n\n\t\t// Alright, we're across different LTS streams and the backup is upgrade safe.\n\t\t// We can only upgrade to the next LTS version.\n\t\tfor i, ltsVersion := range ltsVersions {\n\t\t\tif parsedFrom.isSameRelease(ltsVersion) {\n\t\t\t\tif i < len(ltsVersions)-1 && parsedTo.isSameRelease(ltsVersions[i+1]) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif parsedTo.atLeast(parsedFrom) {\n\t\t\t\t\treturn fmt.Errorf(\"running MySQL version %q is too new for backup MySQL version %q\", to, from)\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"running MySQL version %q is older than backup MySQL version %q\", to, from)\n\t\t\t}\n\t\t}\n\t\tif parsedTo.atLeast(parsedFrom) {\n\t\t\treturn fmt.Errorf(\"running MySQL version %q is newer than backup MySQL version %q which is not safe to upgrade\", to, from)\n\t\t}","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/backupengine.go#L674-L710","documentation":"Thrown by checkRestoreVersion when the running MySQL version is older than the version the backup was taken with, across different release streams, and the backup is not upgrade-safe. Downgrading across release streams by restoring newer data files onto an older MySQL binary is unsupported, so the restore is aborted.","triggerScenarios":"Restore where parsedTo.atLeast(parsedFrom) is false (running version strictly older than backup version), versions are not same-release, and the backup manifest lacks the upgrade-safe marker.","commonSituations":"A tablet was provisioned with an older MySQL than the one used to produce the backup (e.g. backup from 8.4.x, tablet runs 8.0.y); mixed versions after a partial rollout/rollback of a MySQL upgrade.","solutions":["Upgrade the tablet's mysqld to a version at least as new as the backup's MySQL version, then restore.","Take a fresh backup from a tablet running the older MySQL version and restore from that.","Align the fleet on one MySQL release stream so backups and tablets match.","Check the backup manifest's MySQLVersion for mis-recording if versions were expected to match."],"exampleFix":"// before: 8.4.2 backup, tablet on 8.0.36 -> error\n// after: upgrade tablet mysqld to 8.4.2 (>= backup version) and restore","handlingStrategy":"validation","validationCode":"backupVer := parseVersion(backupManifest.MySQLVersion)\nrunningVer := parseVersion(getRunningMySQLVersion())\nif !runningVer.atLeast(backupVer) {\n    return errors.New(\"tablet MySQL older than backup version: upgrade tablet or use older backup\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provision tablets with MySQL >= the version used for the backups they will restore.","Avoid rolling back MySQL upgrades while recent backups are the restore candidates.","Audit fleet MySQL versions against latest backup versions regularly."],"tags":["mysql","backup","restore","version-compatibility","downgrade"],"backgroundTag":"mysql-backup-version-incompatible","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}