Upgrade
MySQL-Upgrade
Upgrade Planning Pre-Upgrade Checklist 1.Backup Current Installation: Complete backup of all databases and configuration
2.Check Compatibility: Verify application compatibility with MySQL 8.4.5
3.Review Deprecated Features: Identify and update deprecated functionality
4.Test Environment: Perform upgrade in test environment first
5.Plan Downtime: Schedule maintenance window for production upgrade
Upgrade Paths
-
MySQL 8.0.x to 8.4.5: Direct upgrade supported
-
MySQL 5.7 to 8.4.5: Must upgrade to 8.0 first, then to 8.4
-
Earlier versions: Step-by-step upgrade through intermediate versions
Upgrade Procedures In-Place Upgrade
bash
# Stop MySQL service
sudo systemctl stop mysql
# Backup current installation
sudo cp -r /var/lib/mysql /var/lib/mysql_backup
# Install MySQL 8.4.5
sudo apt-get update
sudo apt-get install mysql-server-8.4
# Start MySQL and run upgrade
sudo systemctl start mysql
sudo mysql_upgrade -u root -p
Using MySQL Shell Upgrade Checker
sql
-- Check upgrade compatibility
util.checkForServerUpgrade('root@localhost:3306')
-- Verify upgrade readiness
util.checkForServerUpgrade('root@localhost:3306', {"configPath": "/etc/mysql/my.cnf"})
Post-Upgrade Tasks Verification Steps
sql
-- Check MySQL version
SELECT VERSION();
-- Verify all databases
SHOW DATABASES;
-- Check table integrity
CHECK TABLE table_name;
-- Update statistics
ANALYZE TABLE table_name;
Performance Optimization
sql
-- Update optimizer statistics
ANALYZE TABLE table_name;
-- Rebuild indexes if needed
ALTER TABLE table_name ENGINE=InnoDB;
-- Update configuration for 8.4.5 features
SET GLOBAL innodb_buffer_pool_size = 2G;
Rollback Procedures
bash
# If upgrade fails, restore from backup
sudo systemctl stop mysql
sudo rm -rf /var/lib/mysql
sudo cp -r /var/lib/mysql_backup /var/lib/mysql
sudo systemctl start mysql