MySQL 8.4 & 9.0: New Features and Migration Guide
Explore new features in MySQL 8.4 and 9.0 including performance improvements, security enhancements, and a step-by-step migration guide for production databases..
20+ years shipping high-throughput database systems. Everything here is grounded in real deployments.
- ✓Basic knowledge of SQL (SELECT, INSERT, UPDATE, DELETE)
- ✓Familiarity with MySQL installation and configuration
- ✓Access to a MySQL server (version 8.0 or higher) for testing
- ✓Understanding of database backup and restore concepts
- MySQL 8.4 introduces instant ADD COLUMN, improved JSON functions, and new system variables.
- MySQL 9.0 adds vector support, enhanced security with TLS 1.3, and performance schema improvements.
- Migration requires careful planning: test on staging, check compatibility, and use tools like mysqlcheck.
- Key changes include removal of deprecated features like the mysql_native_password plugin.
- Both versions focus on performance, security, and developer productivity.
Think of MySQL like a car. MySQL 8.4 is a major service that adds new features (like a backup camera) and improves fuel efficiency. MySQL 9.0 is the next model year with even more advanced tech (like self-parking). Upgrading is like getting a new car—you need to check if your old accessories (applications) still fit.
MySQL has been the backbone of countless applications for decades. With the release of MySQL 8.4 and the upcoming MySQL 9.0, the database continues to evolve, offering new features that enhance performance, security, and developer experience. Whether you're running a small blog or a large-scale e-commerce platform, staying up-to-date with these versions is crucial for leveraging the latest capabilities and ensuring long-term support.
MySQL 8.4, released in April 2024, is a long-term support (LTS) release, meaning it will receive updates and security patches for several years. It introduces features like instant ADD COLUMN (no more table rebuilds for adding columns), improved JSON functions (JSON_VALUE, JSON_OVERLAPS), and new system variables for better resource management. On the other hand, MySQL 9.0, the first innovation release in the 9.x series, brings vector support for AI/ML workloads, enhanced security with TLS 1.3, and performance schema improvements for deeper insights.
Migrating to these versions requires careful planning. In this tutorial, we'll walk through the key features, provide practical examples, and outline a step-by-step migration strategy. By the end, you'll be equipped to upgrade your MySQL databases confidently, avoiding common pitfalls and taking advantage of the latest innovations.
1. Overview of MySQL 8.4 New Features
MySQL 8.4 is an LTS release that brings several significant enhancements. One of the most anticipated features is instant ADD COLUMN, which allows adding a column to a table without rebuilding the table, reducing downtime for large tables. However, this only works for columns that can be added without modifying existing rows (e.g., nullable columns or columns with a default that can be stored in the data dictionary). Another important feature is improved JSON support, including the JSON_VALUE() function for extracting values from JSON documents and JSON_OVERLAPS() for checking if two JSON documents share any key-value pairs. Additionally, MySQL 8.4 introduces new system variables like 'innodb_dedicated_server' for automatic buffer pool sizing, and 'max_execution_time' for limiting query execution time. Security enhancements include the removal of the deprecated mysql_native_password plugin (now caching_sha2_password is default) and improved TLS configuration.
2. MySQL 9.0: Innovation Release Highlights
MySQL 9.0 is the first innovation release in the 9.x series, focusing on new features for modern workloads. The standout feature is vector support, which enables storage and querying of vector embeddings for AI and machine learning applications. MySQL 9.0 introduces a new VECTOR data type and functions like VECTOR_DISTANCE() for similarity search. This allows developers to build recommendation systems, semantic search, and other AI-powered features directly in MySQL without external tools. Security improvements include TLS 1.3 support for encrypted connections, deprecation of older TLS versions, and enhanced audit logging. Performance schema gains new instruments for monitoring memory usage and thread activity. Additionally, MySQL 9.0 removes several deprecated features, including the mysql_native_password plugin (now fully removed), the GROUP BY ASC/DESC syntax, and the FLUSH QUERY CACHE statement (query cache was removed in 8.0).
3. Preparing for Migration: Pre-Upgrade Checklist
Before upgrading to MySQL 8.4 or 9.0, thorough preparation is essential to avoid downtime and compatibility issues. Start by reviewing the release notes for deprecated and removed features. For MySQL 8.4, note that the mysql_native_password plugin is deprecated; for 9.0, it's removed. Check your application's database drivers and ORM compatibility. Use the MySQL Upgrade Checker tool (mysqlcheck) to identify potential issues. This tool scans your database for incompatible syntax, data types, and configurations. Also, ensure your hardware meets the new system requirements, especially for memory and disk space. Backup your data and test the upgrade on a staging environment that mirrors production. Finally, plan for a maintenance window and have a rollback strategy.
4. Step-by-Step Migration Process
The migration process involves several steps: backup, upgrade, and post-upgrade verification. First, take a full backup using mysqldump or physical backup tools like Percona XtraBackup. Then, upgrade the MySQL binaries on your server. For in-place upgrades, stop the MySQL service, replace the binaries, and restart. Alternatively, you can use a logical upgrade by dumping and restoring data. After restarting, run mysql_upgrade to update system tables and check for compatibility. This step is crucial for MySQL 8.4 and 9.0 as they introduce new system tables and data dictionary changes. Finally, verify the upgrade by checking the version, running test queries, and monitoring logs for errors. For replication setups, upgrade replicas first, then promote them to master if needed.
5. Post-Migration Verification and Optimization
After migration, it's critical to verify that everything works correctly. Start by checking the MySQL error log for any warnings or errors. Run ANALYZE TABLE on all tables to update optimizer statistics, as the new version may have different cost models. Review slow query logs to identify any performance regressions. Update your application's database drivers to versions that support the new MySQL version. For MySQL 9.0, ensure your ORM supports the VECTOR data type if you plan to use it. Additionally, consider enabling new features like instant DDL for future schema changes. Finally, monitor replication lag if you have replicas, as the binary log format may have changed.
6. Handling Deprecated and Removed Features
MySQL 8.4 deprecates several features that are removed in 9.0. The most impactful is the mysql_native_password authentication plugin. If your application uses this plugin, you need to migrate users to caching_sha2_password. Additionally, the GROUP BY ASC/DESC syntax is deprecated; use ORDER BY instead. The FLUSH QUERY CACHE statement is removed (query cache was removed in 8.0). Also, the old temporal format (DATETIME with 2-digit year) is deprecated. To handle these changes, update your application code and database schema. For authentication migration, you can alter user accounts to use the new plugin. For SQL syntax, search for deprecated patterns and replace them.
7. Performance Improvements and Tuning
Both MySQL 8.4 and 9.0 bring performance improvements. In 8.4, the InnoDB buffer pool can be automatically sized using innodb_dedicated_server. This is especially useful for dedicated database servers. The new max_execution_time variable allows you to limit query execution time globally or per session, preventing runaway queries. In 9.0, the Performance Schema has been enhanced with new instruments for monitoring memory usage and thread activity. Additionally, the optimizer has been improved for better query plans, especially for JSON queries and window functions. To take advantage of these improvements, review your configuration and adjust settings accordingly. For example, enable innodb_dedicated_server if you have a dedicated server, and set appropriate timeouts.
8. Security Enhancements and Best Practices
Security is a major focus in both MySQL 8.4 and 9.0. MySQL 8.4 deprecates the mysql_native_password plugin, and 9.0 removes it entirely. All users should use caching_sha2_password, which provides stronger password hashing. TLS 1.3 is supported in 9.0, offering faster and more secure encrypted connections. Additionally, MySQL 8.4 introduces the 'require_secure_transport' system variable to enforce encrypted connections. Audit logging has been improved with new event fields. To enhance security, update your authentication plugins, enable TLS, and configure firewalls. Also, review user privileges and remove unnecessary grants. Use the 'SHOW GRANTS' command to audit permissions.
The Case of the Slow Migration: When Instant ADD COLUMN Wasn't Instant
- Instant ADD COLUMN only works for columns that can be added without modifying existing rows (e.g., nullable columns or columns with a default that can be stored in the data dictionary).
- Always test schema changes on a staging environment with similar data volume.
- Use pt-online-schema-change or gh-ost for large tables if instant operations are not possible.
- Monitor replication lag during schema changes.
- Read the MySQL documentation thoroughly before relying on new features.
SHOW PROCESSLIST;SELECT * FROM information_schema.INNODB_ALTER_TABLE_PROGRESS;| File | Command / Code | Purpose |
|---|---|---|
| instant_add_column.sql | ALTER TABLE employees ADD COLUMN middle_name VARCHAR(50) NULL, ALGORITHM=INSTANT... | 1. Overview of MySQL 8.4 New Features |
| vector_example.sql | CREATE TABLE products ( | 2. MySQL 9.0 |
| pre_upgrade_check.sql | mysqlcheck -u root -p --all-databases --check-upgrade | 3. Preparing for Migration |
| migration_steps.sh | mysqldump -u root -p --all-databases --routines --events --triggers > full_backu... | 4. Step-by-Step Migration Process |
| post_migration.sql | ANALYZE TABLE employees; | 5. Post-Migration Verification and Optimization |
| handle_deprecated.sql | ALTER USER 'old_user'@'%' IDENTIFIED WITH caching_sha2_password BY 'new_password... | 6. Handling Deprecated and Removed Features |
| performance_tuning.sql | SET GLOBAL innodb_dedicated_server=ON; | 7. Performance Improvements and Tuning |
| security_enhancements.sql | SET GLOBAL require_secure_transport=ON; | 8. Security Enhancements and Best Practices |
Key takeaways
Common mistakes to avoid
5 patternsAssuming instant ADD COLUMN works for all column additions.
Not updating authentication plugins before upgrading to MySQL 9.0.
Skipping pre-upgrade checks.
Upgrading replicas before the master without proper planning.
Forgetting to update optimizer statistics after upgrade.
Interview Questions on This Topic
What is instant ADD COLUMN in MySQL 8.4 and when does it work?
Frequently Asked Questions
20+ years shipping high-throughput database systems. Everything here is grounded in real deployments.
That's MySQL & PostgreSQL. Mark it forged?
4 min read · try the examples if you haven't