Skip to content

MySQL - Versions

Software versioning is a critical process for evolution and improvement. New versions introduce powerful features, enhance performance, patch security vulnerabilities, and remove obsolete components. Understanding the version of MySQL you are using is essential for leveraging its full potential and ensuring your applications are secure and maintainable.

It is a strong best practice to run your applications on a stable, actively supported version of MySQL, such as the latest General Availability (GA) release, to benefit from the latest security patches and features.

MySQL has a rich history, with the 5.x series serving as the backbone of the web for many years. Each major release brought significant improvements.

  • MySQL 5.1 (2008): Introduced features like event scheduling and table partitioning.
  • MySQL 5.5 (2010): Marked a major milestone by making the high-performance, transactional InnoDB the default storage engine.
  • MySQL 5.6 (2013): Focused on performance, with improvements to the query optimizer, InnoDB, and replication.
  • MySQL 5.7 (2015): Further enhanced performance and added a native JSON data type, signaling a shift towards supporting more flexible data models.

While these versions were groundbreaking, they are now End-of-Life (EOL) and should not be used for new development. All new projects should be built on MySQL 8.x.

MySQL 8.0, first released in 2018, represents a major leap forward. It introduced a vast number of enhancements focused on performance, modern SQL features, developer experience, and reliability.

Version 8.0 brought MySQL in line with modern SQL standards, enabling more powerful and readable queries.

  • Common Table Expressions (CTEs): Using the WITH clause, you can create named temporary result sets that make complex queries cleaner and easier to read. Both recursive and non-recursive CTEs are supported.
  • Window Functions: These perform calculations across a set of table rows that are somehow related to the current row. This is incredibly useful for tasks like calculating running totals, moving averages, or ranking results without complex self-joins.
  • Improved Optimizer: The query optimizer is smarter, with features like hash joins that can dramatically speed up queries joining large tables.
  • Descending Indexes: Indexes can now be stored in descending order, eliminating the performance penalty for queries that need to sort in reverse.
  • TempTable Storage Engine: A more efficient engine for handling internal temporary tables, improving the performance of complex queries.
  • JSON Enhancements: The native JSON data type was significantly improved with new functions for searching and manipulating JSON documents directly within the database.
  • Default Expressions: Columns can now have expressions as their default values, for example, data JSON DEFAULT ('{}').
  • Reliable DDL: Atomic Data Definition Language (DDL) statements ensure that operations like CREATE, ALTER, or DROP either complete fully or not at all, preventing partially modified schemas.

What to Avoid: Deprecated and Removed Features

Section titled “What to Avoid: Deprecated and Removed Features”

With progress comes change. MySQL 8.0 deprecated or removed several older features. You should update your code to avoid them.

  • Query Cache Removed: The query cache, a feature in older versions, was removed entirely in 8.0 due to scalability issues. Modern applications should focus on query optimization and application-level caching.
  • utf8mb3 Character Set: This is the old utf8 alias and is now deprecated. Always use utf8mb4 to ensure full Unicode support, including emojis.
  • ZEROFILL Attribute: This attribute for numeric types is deprecated. Formatting numbers with leading zeros should be handled in your application code.
  • FLOAT(M,D) and DOUBLE(M,D): Specifying precision and scale for floating-point types is deprecated. Use FLOAT and DOUBLE without these arguments, or use DECIMAL for exact-value numeric data.
  • Password Management: The old PASSWORD() function was removed. Use the more secure caching_sha2_password authentication plugin.

Checking Your Version and Planning for the Future

Section titled “Checking Your Version and Planning for the Future”

You can easily check your current MySQL server version with a simple query:

SELECT VERSION();

Output might look like: 8.0.34.

For any project, you should have a strategy for keeping your database updated. Using a managed cloud database service (like Amazon RDS, Google Cloud SQL, or Azure Database for MySQL) can simplify this process, as the cloud provider often handles patches and major version upgrades for you.