This section summarizes what has been added to, deprecated in, and removed from MySQL 8.0. A companion section lists MySQL server options and variables that have been added, deprecated, or removed in MySQL 8.0. See Section 1.5, “Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 8.0”.
The following features have been added to MySQL 8.0:
Data dictionary. MySQL now incorporates a transactional data dictionary that stores information about database objects. In previous MySQL releases, dictionary data was stored in metadata files and nontransactional tables. For more information, see Chapter 14, MySQL Data Dictionary.
Atomic data definition statements (Atomic DDL). An atomic DDL statement combines the data dictionary updates, storage engine operations, and binary log writes associated with a DDL operation into a single, atomic transaction. For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.
Upgrade procedure. Previously, after installation of a new version of MySQL, the MySQL server automatically upgrades the data dictionary tables at the next startup, after which the DBA is expected to invoke mysql_upgrade manually to upgrade the system tables in the
mysql
schema, as well as objects in other schemas such as thesys
schema and user schemas.As of MySQL 8.0.16, the server performs the tasks previously handled by mysql_upgrade. After installation of a new MySQL version, the server now automatically performs all necessary upgrade tasks at the next startup and is not dependent on the DBA invoking mysql_upgrade. In addition, the server updates the contents of the help tables (something mysql_upgrade did not do). A new
--upgrade
server option provides control over how the server performs automatic data dictionary and server upgrade operations. For more information, see Section 2.11.3, “What the MySQL Upgrade Process Upgrades”.Security and account management. These enhancements were added to improve security and enable greater DBA flexibility in account management:
The grant tables in the
mysql
system database are nowInnoDB
(transactional) tables. Previously, these wereMyISAM
(nontransactional) tables. The change of grant table storage engine underlies an accompanying change to the behavior of account-management statements. Previously, an account-management statement (such asCREATE USER
orDROP USER
) that named multiple users could succeed for some users and fail for others. Now, each statement is transactional and either succeeds for all named users or rolls back and has no effect if any error occurs. The statement is written to the binary log if it succeeds, but not if it fails; in that case, rollback occurs and no changes are made. For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.A new
caching_sha2_password
authentication plugin is available. Like thesha256_password
plugin,caching_sha2_password
implements SHA-256 password hashing, but uses caching to address latency issues at connect time. It also supports more connection protocols and does not require linking against OpenSSL for RSA key pair-based password-exchange capabilities. See Section 6.4.1.3, “Caching SHA-2 Pluggable Authentication”.The
caching_sha2_password
andsha256_password
authentication plugins provide more secure password encryption than themysql_native_password
plugin, andcaching_sha2_password
provides better performance thansha256_password
. Due to these superior security and performance characteristics ofcaching_sha2_password
, it is now the preferred authentication plugin, and is also the default authentication plugin rather thanmysql_native_password
. For information about the implications of this change of default plugin for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin.MySQL now supports roles, which are named collections of privileges. Roles can be created and dropped. Roles can have privileges granted to and revoked from them. Roles can be granted to and revoked from user accounts. The active applicable roles for an account can be selected from among those granted to the account, and can be changed during sessions for that account. For more information, see Section 6.2.10, “Using Roles”.
MySQL now incorporates the concept of user account categories, with system and regular users distinguished according to whether they have the
SYSTEM_USER
privilege. See Section 6.2.11, “Account Categories”.Previously, it was not possible to grant privileges that apply globally except for certain schemas. This is now possible if the
partial_revokes
system variable is enabled. See Section 6.2.12, “Privilege Restriction Using Partial Revokes”.The
GRANT
statement has anAS
clause that specifies additional information about the privilege context to use for statement execution. This syntax is visible at the SQL level, although its primary purpose is to enable uniform replication across all nodes of grantor privilege restrictions imposed by partial revokes, by causing those restrictions to appear in the binary log. See Section 13.7.1.6, “GRANT Syntax”.user
[WITH ROLE]MySQL now maintains information about password history, enabling restrictions on reuse of previous passwords. DBAs can require that new passwords not be selected from previous passwords for some number of password changes or period of time. It is possible to establish password-reuse policy globally as well as on a per-account basis.
It is now possible to require that attempts to change account passwords be verified by specifying the current password to be replaced. This enables DBAs to prevent users from changing password without proving that they know the current password. It is possible to establish password-verification policy globally as well as on a per-account basis.
Accounts are now permitted to have dual passwords, which enables phased password changes to be performed seamlessly in complex multiple-server systems, without downtime.
These new capabilities provide DBAs more complete control over password management. For more information, see Section 6.2.15, “Password Management”.
MySQL now supports FIPS mode, if compiled using OpenSSL, and an OpenSSL library and FIPS Object Module are available at runtime. FIPS mode imposes conditions on cryptographic operations such as restrictions on acceptable encryption algorithms or requirements for longer key lengths. See Section 6.5, “FIPS Support”.
The SSL context the server uses for new connections now is reconfigurable at runtime. This capability may be useful, for example, to avoid restarting a MySQL server that has been running so long that its SSL certificate has expired. See Server-Side Runtime Configuration for Encrypted Connections.
OpenSSL 1.1.1 supports the TLS v1.3 protocol for encrypted connections, and MySQL now supports TLS v1.3 as well, if compiled using OpenSSL 1.1.1 or higher. See Section 6.3.5, “Encrypted Connection Protocols and Ciphers”.
MySQL now sets the access control granted to clients on the named pipe to the minimum necessary for successful communication on Windows. Newer MySQL client software can open named pipe connections without any additional configuration. If older client software cannot be upgraded immediately, the new
named_pipe_full_access_group
system variable can be used to give a Windows group the necessary permissions to open a named pipe connection. Membership in the full-access group should be restricted and temporary.
Resource management. MySQL now supports creation and management of resource groups, and permits assigning threads running within the server to particular groups so that threads execute according to the resources available to the group. Group attributes enable control over its resources, to enable or restrict resource consumption by threads in the group. DBAs can modify these attributes as appropriate for different workloads. Currently, CPU time is a manageable resource, represented by the concept of “virtual CPU” as a term that includes CPU cores, hyperthreads, hardware threads, and so forth. The server determines at startup how many virtual CPUs are available, and database administrators with appropriate privileges can associate these CPUs with resource groups and assign threads to groups. For more information, see Section 8.12.5, “Resource Groups”.
Table encryption management. Table encryption can now be managed globally by defining and enforcing encryption defaults. The
default_table_encryption
variable defines an encryption default for newly created schemas and general tablespace. The encryption default for a schema can also be defined using theDEFAULT ENCRYPTION
clause when creating a schema. By default, a table inherits the encryption of the schema or general tablespace it is created in. Encryption defaults are enforced by enabling thetable_encryption_privilege_check
variable. The privilege check occurs when creating or altering a schema or general tablespace with an encryption setting that differs from thedefault_table_encryption
setting, or when creating or altering a table with an encryption setting that differs from the default schema encryption. TheTABLE_ENCRYPTION_ADMIN
privilege permits overriding default encryption settings whentable_encryption_privilege_check
is enabled. For more information, see Defining an Encryption Default for Schemas and General Tablespaces.InnoDB enhancements. These
InnoDB
enhancements were added:The current maximum auto-increment counter value is written to the redo log each time the value changes, and saved to an engine-private system table on each checkpoint. These changes make the current maximum auto-increment counter value persistent across server restarts. Additionally:
A server restart no longer cancels the effect of the
AUTO_INCREMENT = N
table option. If you initialize the auto-increment counter to a specific value, or if you alter the auto-increment counter value to a larger value, the new value is persisted across server restarts.A server restart immediately following a
ROLLBACK
operation no longer results in the reuse of auto-increment values that were allocated to the rolled-back transaction.If you modify an
AUTO_INCREMENT
column value to a value larger than the current maximum auto-increment value (in anUPDATE
operation, for example), the new value is persisted, and subsequentINSERT
operations allocate auto-increment values starting from the new, larger value.
For more information, see Section 15.6.1.4, “AUTO_INCREMENT Handling in InnoDB”, and InnoDB AUTO_INCREMENT Counter Initialization.
When encountering index tree corruption,
InnoDB
writes a corruption flag to the redo log, which makes the corruption flag crash safe.InnoDB
also writes in-memory corruption flag data to an engine-private system table on each checkpoint. During recovery,InnoDB
reads corruption flags from both locations and merges results before marking in-memory table and index objects as corrupt.The
InnoDB
memcached plugin supports multipleget
operations (fetching multiple key-value pairs in a single memcached query) and range queries. See Section 15.19.4, “InnoDB memcached Multiple get and Range Query Support”.A new dynamic variables,
innodb_deadlock_detect
, may be used to disable deadlock detection. On high concurrency systems, deadlock detection can cause a slowdown when numerous threads wait for the same lock. At times, it may be more efficient to disable deadlock detection and rely on theinnodb_lock_wait_timeout
setting for transaction rollback when a deadlock occurs.The new
INFORMATION_SCHEMA.INNODB_CACHED_INDEXES
table reports the number of index pages cached in theInnoDB
buffer pool for each index.InnoDB
temporary tables are now created in the shared temporary tablespace,ibtmp1
.The
InnoDB
tablespace encryption feature supports encryption of redo log and undo log data. See Redo Log Encryption, and Undo Log Encryption.InnoDB
supportsNOWAIT
andSKIP LOCKED
options withSELECT ... FOR SHARE
andSELECT ... FOR UPDATE
locking read statements.NOWAIT
causes the statement to return immediately if a requested row is locked by another transaction.SKIP LOCKED
removes locked rows from the result set. See Locking Read Concurrency with NOWAIT and SKIP LOCKED.SELECT ... FOR SHARE
replacesSELECT ... LOCK IN SHARE MODE
, butLOCK IN SHARE MODE
remains available for backward compatibility. The statements are equivalent. However,FOR UPDATE
andFOR SHARE
supportNOWAIT
,SKIP LOCKED
, andOF
options. See Section 13.2.10, “SELECT Syntax”.tbl_name
OF
applies locking queries to named tables.tbl_name
ADD PARTITION
,DROP PARTITION
,COALESCE PARTITION
,REORGANIZE PARTITION
, andREBUILD PARTITION
ALTER TABLE
options are supported by native partitioning in-place APIs and may be used withALGORITHM={COPY|INPLACE}
andLOCK
clauses.DROP PARTITION
withALGORITHM=INPLACE
deletes data stored in the partition and drops the partition. However,DROP PARTITION
withALGORITHM=COPY
orold_alter_table=ON
rebuilds the partitioned table and attempts to move data from the dropped partition to another partition with a compatiblePARTITION ... VALUES
definition. Data that cannot be moved to another partition is deleted.The
InnoDB
storage engine now uses the MySQL data dictionary rather than its own storage engine-specific data dictionary. For information about the data dictionary, see Chapter 14, MySQL Data Dictionary.mysql
system tables and data dictionary tables are now created in a singleInnoDB
tablespace file namedmysql.ibd
in the MySQL data directory. Previously, these tables were created in individualInnoDB
tablespace files in themysql
database directory.The following undo tablespace changes are introduced in MySQL 8.0:
By default, undo logs now reside in two undo tablespaces that are created when the MySQL instance is initialized. Undo logs are no longer created in the system tablespace.
As of MySQL 8.0.14, additional undo tablespaces can be created in a chosen location at runtime using
CREATE UNDO TABLESPACE
syntax.CREATE UNDO TABLESPACE tablespace_name ADD DATAFILE 'file_name.ibu';
Undo tablespaces created using
CREATE UNDO TABLESPACE
syntax can be dropped at runtime usingDROP UNDO TABLESPACE
syntax.DROP UNDO TABLESPACE tablespace_name;
ALTER UNDO TABLESPACE
syntax can be used to mark an undo tablespace as active or inactive.ALTER UNDO TABLESPACE tablespace_name SET {ACTIVE|INACTIVE};
A
STATE
column that shows the state of a tablespace was added to theINFORMATION_SCHEMA.INNODB_TABLESPACES
table. An undo tablespace must be in anempty
state before it can be dropped.The
innodb_undo_log_truncate
variable is enabled by default.The
innodb_rollback_segments
variable defines the number of rollback segments per undo tablespace. Previously,innodb_rollback_segments
specified the total number of rollback segments for the MySQL instance. This change increases the number of rollback segments available for concurrent transactions. More rollback segments increases the likelihood that concurrent transactions use separate rollback segments for undo logs, resulting in less resource contention.
Default values for variables that affect buffer pool preflushing and flushing behavior were modified:
The
innodb_max_dirty_pages_pct_lwm
default value is now 10. The previous default value of 0 disables buffer pool preflushing. A value of 10 enables preflushing when the percentage of dirty pages in the buffer pool exceeds 10%. Enabling preflushing improves performance consistency.The
innodb_max_dirty_pages_pct
default value was increased from 75 to 90.InnoDB
attempts to flush data from the buffer pool so that the percentage of dirty pages does not exceed this value. The increased default value permits a greater percentage of dirty pages in the buffer pool.
The default
innodb_autoinc_lock_mode
setting is now 2 (interleaved). Interleaved lock mode permits the execution of multi-row inserts in parallel, which improves concurrency and scalability. The newinnodb_autoinc_lock_mode
default setting reflects the change from statement-based replication to row based replication as the default replication type in MySQL 5.7. Statement-based replication requires the consecutive auto-increment lock mode (the previous default) to ensure that auto-increment values are assigned in a predictable and repeatable order for a given sequence of SQL statements, whereas row-based replication is not sensitive to the execution order of SQL statements. For more information, see InnoDB AUTO_INCREMENT Lock Modes.For systems that use statement-based replication, the new
innodb_autoinc_lock_mode
default setting may break applications that depend on sequential auto-increment values. To restore the previous default, setinnodb_autoinc_lock_mode
to 1.Renaming a general tablespace is supported by
ALTER TABLESPACE ... RENAME TO
syntax.The new
innodb_dedicated_server
variable, which is disabled by default, can be used to haveInnoDB
automatically configure the following options according to the amount of memory detected on the server:This option is intended for MySQL server instances that run on a dedicated server. For more information, see Section 15.8.12, “Enabling Automatic Configuration for a Dedicated MySQL Server”.
The new
INFORMATION_SCHEMA.INNODB_TABLESPACES_BRIEF
view provides space, name, path, flag, and space type data forInnoDB
tablespaces.The zlib library version bundled with MySQL was raised from version 1.2.3 to version 1.2.11. MySQL implements compression with the help of the zlib library.
If you use
InnoDB
compressed tables, see Section 2.11.4, “Changes in MySQL 8.0” for related upgrade implications.Serialized Dictionary Information (SDI) is present in all
InnoDB
tablespace files except for global temporary tablespace and undo tablespace files. SDI is serialized metadata for table and tablespace objects. The presence of SDI data provides metadata redundancy. For example, dictionary object metadata may be extracted from tablespace files if the data dictionary becomes unavailable. SDI extraction is performed using the ibd2sdi tool. SDI data is stored inJSON
format.The inclusion of SDI data in tablespace files increases tablespace file size. An SDI record requires a single index page, which is 16KB in size by default. However, SDI data is compressed when it is stored to reduce the storage footprint.
The
InnoDB
storage engine now supports atomic DDL, which ensures that DDL operations are either fully committed or rolled back, even if the server halts during the operation. For more information, see Section 13.1.1, “Atomic Data Definition Statement Support”.Tablespace files can be moved or restored to a new location while the server is offline using the
innodb_directories
option. For more information, see Section 15.6.3.8, “Moving Tablespace Files While the Server is Offline”.The following redo logging optimizations were implemented:
User threads can now write concurrently to the log buffer without synchronizing writes.
User threads can now add dirty pages to the flush list in a relaxed order.
A dedicated log thread is now responsible for writing the log buffer to the system buffers, flushing system buffers to disk, notifying user threads about written and flushed redo, maintaining the lag required for the relaxed flush list order, and write checkpoints.
System variables were added for configuring the use of spin delay by user threads waiting for flushed redo:
innodb_log_wait_for_flush_spin_hwm
: Defines the maximum average log flush time beyond which user threads no longer spin while waiting for flushed redo.innodb_log_spin_cpu_abs_lwm
: Defines the minimum amount of CPU usage below which user threads no longer spin while waiting for flushed redo.innodb_log_spin_cpu_pct_hwm
: Defines the maximum amount of CPU usage above which user threads no longer spin while waiting for flushed redo.
The
innodb_log_buffer_size
variable is now dynamic, which permits resizing of the log buffer while the server is running.
For more information, see Section 8.5.4, “Optimizing InnoDB Redo Logging”.
As of MySQL 8.0.12, undo logging is supported for small updates to large object (LOB) data, which improves performance of LOB updates that are 100 bytes in size or less. Previously, LOB updates were a minimum of one LOB page in size, which is less than optimal for updates that might only modify a few bytes. This enhancement builds upon support added in MySQL 8.0.4 for partial update of LOB data.
As of MySQL 8.0.12,
ALGORITHM=INSTANT
is supported for the followingALTER TABLE
operations:Adding a column. This feature is also referred to as “Instant
ADD COLUMN
”. Limitations apply. See Section 15.12.1, “Online DDL Operations”.Adding or dropping a virtual column.
Adding or dropping a column default value.
Changing the index type.
Renaming a table.
Operations that support
ALGORITHM=INSTANT
only modify metadata in the data dictionary. No metadata locks are taken on the table, and table data is unaffected, making the operations instantaneous. If not specified explicitly,ALGORITHM=INSTANT
is used by default by operations that support it. IfALGORITHM=INSTANT
is specified but not supported, the operation fails immediately with an error.For more information about operations that support
ALGORITHM=INSTANT
, see Section 15.12.1, “Online DDL Operations”.As of MySQL 8.0.13, the
TempTable
storage engine supports storage of binary large object (BLOB) type columns. This enhancement improves performance for queries that use temporary tables containing BLOB data. Previously, temporary tables that contained BLOB data were stored in the on-disk storage engine defined byinternal_tmp_disk_storage_engine
. For more information, see Section 8.4.4, “Internal Temporary Table Use in MySQL”.As of MySQL 8.0.13, the
InnoDB
data-at-rest encryption feature supports general tablespaces. Previously, only file-per-table tablespaces could be encrypted. To support encryption of general tablespaces,CREATE TABLESPACE
andALTER TABLESPACE
syntax was extended to include anENCRYPTION
clause.The
INFORMATION_SCHEMA.INNODB_TABLESPACES
table now includes anENCRYPTION
column that indicates whether or not a tablespace is encrypted.The
stage/innodb/alter tablespace (encryption)
Performance Schema stage instrument was added to permit monitoring of general tablespace encryption operations.Disabling the
innodb_buffer_pool_in_core_file
variable reduces the size of core files by excludingInnoDB
buffer pool pages. To use this variable, thecore_file
variable must be enabled and the operating system must support theMADV_DONTDUMP
non-POSIX extension tomadvise()
, which is supported in Linux 3.4 and later. For more information, see Section 15.8.3.8, “Excluding Buffer Pool Pages from Core Files”.As of MySQL 8.0.13, user-created temporary tables and internal temporary tables created by the optimizer are stored in session temporary tablespaces that are allocated to a session from a pool of temporary tablespaces. When a session disconnects, its temporary tablespaces are truncated and released back to the pool. In previous releases, temporary tables were created in the global temporary tablespace (
ibtmp1
), which did not return disk space to the operating system after temporary tables were dropped.The
innodb_temp_tablespaces_dir
variable defines the location where session temporary tablespaces are created. The default location is the#innodb_temp
directory in the data directory.The
INNODB_SESSION_TEMP_TABLESPACES
table provides metadata about session temporary tablespaces.The global temporary tablespace (
ibtmp1
) now stores rollback segments for changes made to user-created temporary tables.As of MySQL 8.0.14,
InnoDB
supports parallel clustered index reads, which can improveCHECK TABLE
performance. This feature does not apply to secondary index scans. Theinnodb_parallel_read_threads
session variable must be set to a value greater than 1 for parallel clustered index reads to occur. The default value is 4. The actual number of threads used to perform a parallel clustered index read is determined by theinnodb_parallel_read_threads
setting or the number of index subtrees to scan, whichever is smaller.As of 8.0.14, when the
innodb_dedicated_server
variable is enabled, the size and number of log files are configured according to the automatically configured buffer pool size. Previously, log file size was configured according to the amount of memory detected on the server, and the number of log files was not configured automatically.As of 8.0.14, the
ADD DATAFILE
clause of theCREATE TABLESPACE
statement is optional, which permits users without theFILE
privilege to create tablespaces. ACREATE TABLESPACE
statement executed without anADD DATAFILE
clause implicitly creates a tablespace data file with a unique file name.By default, when the amount of memory occupied by the TempTable storage engine exceeds the memory limit defined by the
temptable_max_ram
variable, the TempTable storage engine begins allocating memory-mapped temporary files from disk. As of MySQL 8.0.16, this behavior is controlled by thetemptable_use_mmap
variable. Disablingtemptable_use_mmap
causes the TempTable storage engine to useInnoDB
on-disk internal temporary tables instead of memory-mapped files as its overflow mechanism. For more information, see Internal Temporary Table Storage Engine.As of MySQL 8.0.16, the
InnoDB
data-at-rest encryption feature supports encryption of themysql
system tablespace. Themysql
system tablespace contains themysql
system database and the MySQL data dictionary tables. For more information, see Section 15.6.3.9, “InnoDB Data-at-Rest Encryption”.The
innodb_spin_wait_pause_multiplier
variable, introduced in MySQL 8.0.16, provides greater control over the duration of spin-lock polling delays that occur when a thread waits to acquire a mutex or rw-lock. Delays can be tuned more finely to account for differences in PAUSE instruction duration on different processor architectures. For more information, see Section 15.8.8, “Configuring Spin Lock Polling”.
Character set support. The default character set has changed from
latin1
toutf8mb4
. Theutf8mb4
character set has several new collations, includingutf8mb4_ja_0900_as_cs
, the first Japanese language-specific collation available for Unicode in MySQL. For more information, see Section 10.10.1, “Unicode Character Sets”.JSON enhancements. The following enhancements or additions were made to MySQL's JSON functionality:
Added the
->>
(inline path) operator, which is equivalent to callingJSON_UNQUOTE()
on the result ofJSON_EXTRACT()
.This is a refinement of the column path operator
->
introduced in MySQL 5.7;col->>"$.path"
is equivalent toJSON_UNQUOTE(col->"$.path")
. The inline path operator can be used wherever you can useJSON_UNQUOTE(JSON_EXTRACT())
, suchSELECT
column lists,WHERE
andHAVING
clauses, andORDER BY
andGROUP BY
clauses. For more information, see the description of the operator, as well as JSON Path Syntax.Added two JSON aggregation functions
JSON_ARRAYAGG()
andJSON_OBJECTAGG()
.JSON_ARRAYAGG()
takes a column or expression as its argument, and aggregates the result as a singleJSON
array. The expression can evaluate to any MySQL data type; this does not have to be aJSON
value.JSON_OBJECTAGG()
takes two columns or expressions which it interprets as a key and a value; it returns the result as a singleJSON
object. For more information and examples, see Section 12.20, “Aggregate (GROUP BY) Functions”.Added the JSON utility function
JSON_PRETTY()
, which outputs an existingJSON
value in an easy-to-read format; each JSON object member or array value is printed on a separate line, and a child object or array is intended 2 spaces with respect to its parent.This function also works with a string that can be parsed as a JSON value.
For more detailed information and examples, see Section 12.17.8, “JSON Utility Functions”.
When sorting
JSON
values in a query usingORDER BY
, each value is now represented by a variable-length part of the sort key, rather than a part of a fixed 1K in size. In many cases this can reduce excessive usage. For example, a scalarINT
or evenBIGINT
value actually requires very few bytes, so that the remainder of this space (up to 90% or more) was taken up by padding. This change has the following benefits for performance:Sort buffer space is now used more effectively, so that filesorts need not flush to disk as early or often as with fixed-length sort keys. This means that more data can be sorted in memory, avoiding unnecessary disk access.
Shorter keys can be compared more quickly than longer ones, providing a noticeable improvement in performance. This is true for sorts performed entirely in memory as well as for sorts that require writing to and reading from disk.
Added support in MySQL 8.0.2 for partial, in-place updates of
JSON
column values, which is more efficient than completely removing an existing JSON value and writing a new one in its place, as was done previously when updating anyJSON
column. For this optimization to be applied, the update must be applied usingJSON_SET()
,JSON_REPLACE()
, orJSON_REMOVE()
. New elements cannot be added to the JSON document being updated; values within the document cannot take more space than they did before the update. See Partial Updates of JSON Values, for a detailed discussion of the requirements.Partial updates of JSON documents can be written to the binary log, taking up less space than logging complete JSON documents. Partial updates are always logged as such when statement-based replication is in use. For this to work with row-based replication, you must first set
binlog_row_value_options=PARTIAL_JSON
; see this variable's description for more information.Added the JSON utility functions
JSON_STORAGE_SIZE()
andJSON_STORAGE_FREE()
.JSON_STORAGE_SIZE()
returns the storage space in bytes used for the binary representation of a JSON document prior to any partial update (see previous item).JSON_STORAGE_FREE()
shows the amount of space remaining in a table column of typeJSON
after it has been partially updated usingJSON_SET()
orJSON_REPLACE()
; this is greater than zero if the binary representation of the new value is less than that of the previous value.Each of these functions also accepts a valid string representation of a JSON document. For such a value,
JSON_STORAGE_SIZE()
returns the space used by its binary representation following its conversion to a JSON document. For a variable containing the string representation of a JSON document,JSON_STORAGE_FREE()
returns zero. Either function produces an error if its (non-null) argument cannot be parsed as a valid JSON document, andNULL
if the argument isNULL
.For more information and examples, see Section 12.17.8, “JSON Utility Functions”.
JSON_STORAGE_SIZE()
andJSON_STORAGE_FREE()
were implemented in MySQL 8.0.2.Added support in MySQL 8.0.2 for ranges such as
$[1 to 5]
in XPath expressions. Also added support in this version for thelast
keyword and relative addressing, such that$[last]
always selects the last (highest-numbered) element in the array and$[last-1]
the next to last element.last
and expressions using it can also be included in range definitions. For example,$[last-2 to last-1]
returns the last two elements but one from an array. See Searching and Modifying JSON Values, for additional information and examples.Added a JSON merge function intended to conform to RFC 7396.
JSON_MERGE_PATCH()
, when used on 2 JSON objects, merges them into a single JSON object that has as members a union of the following sets:Each member of the first object for which there is no member with the same key in the second object.
Each member of the second object for which there is no member having the same key in the first object, and whose value is not the JSON
null
literal.Each member having a key that exists in both objects, and whose value in the second object is not the JSON
null
literal.
As part of this work, the
JSON_MERGE()
function has been renamedJSON_MERGE_PRESERVE()
.JSON_MERGE()
continues to be recognized as an alias forJSON_MERGE_PRESERVE()
in MySQL 8.0, but is now deprecated and is subject to removal in a future version of MySQL.For more information and examples, see Section 12.17.4, “Functions That Modify JSON Values”.
Implemented “last duplicate key wins” normalization of duplicate keys, consistent with RFC 7159 and most JavaScript parsers. An example of this behavior is shown here, where only the rightmost member having the key
x
is preserved:mysql> SELECT JSON_OBJECT('x', '32', 'y', '[true, false]', > 'x', '"abc"', 'x', '100') AS Result; +------------------------------------+ | Result | +------------------------------------+ | {"x": "100", "y": "[true, false]"} | +------------------------------------+ 1 row in set (0.00 sec)
Values inserted into MySQL
JSON
columns are also normalized in this way, as shown in this example:mysql> CREATE TABLE t1 (c1 JSON); mysql> INSERT INTO t1 VALUES ('{"x": 17, "x": "red", "x": [3, 5, 7]}'); mysql> SELECT c1 FROM t1; +------------------+ | c1 | +------------------+ | {"x": [3, 5, 7]} | +------------------+
This is an incompatible change from previous versions of MySQL, where a “first duplicate key wins” algorithm was used in such cases.
See Normalization, Merging, and Autowrapping of JSON Values, for more information and examples.
Added the
JSON_TABLE()
function in MySQL 8.0.4. This function accepts JSON data and returns it as a relational table having the specified columns.This function has the syntax
JSON_TABLE(
, whereexpr
,path
COLUMNScolumn_list
) [AS]alias
)expr
is an expression that returns JSON data,path
is a JSON path applied to the source, andcolumn_list
is a list of column definitions. An example is shown here:mysql> SELECT * -> FROM -> JSON_TABLE( -> '[{"a":3,"b":"0"},{"a":"3","b":"1"},{"a":2,"b":1},{"a":0},{"b":[1,2]}]', -> "$[*]" COLUMNS( -> rowid FOR ORDINALITY, -> -> xa INT EXISTS PATH "$.a", -> xb INT EXISTS PATH "$.b", -> -> sa VARCHAR(100) PATH "$.a", -> sb VARCHAR(100) PATH "$.b", -> -> ja JSON PATH "$.a", -> jb JSON PATH "$.b" -> ) -> ) AS jt1; +-------+------+------+------+------+------+--------+ | rowid | xa | xb | sa | sb | ja | jb | +-------+------+------+------+------+------+--------+ | 1 | 1 | 1 | 3 | 0 | 3 | "0" | | 2 | 1 | 1 | 3 | 1 | "3" | "1" | | 3 | 1 | 1 | 2 | 1 | 2 | 1 | | 4 | 1 | 0 | 0 | NULL | 0 | NULL | | 5 | 0 | 1 | NULL | NULL | NULL | [1, 2] | +-------+------+------+------+------+------+--------+
The JSON source expression can be any expression that yields a valid JSON document, including a JSON literal, a table column, or a function call that returns JSON such as
JSON_EXTRACT(t1, data, '$.post.comments')
. For more information, see Section 12.17.6, “JSON Table Functions”.
Data type support. MySQL now supports use of expressions as default values in data type specifications. This includes the use of expressions as default values for the
BLOB
,TEXT
,GEOMETRY
, andJSON
data types, which previously could not be assigned default values at all. For details, see Section 11.7, “Data Type Default Values”.Optimizer. These optimizer enhancements were added:
MySQL now supports invisible indexes. An invisible index is not used by the optimizer at all, but is otherwise maintained normally. Indexes are visible by default. Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. See Section 8.3.12, “Invisible Indexes”.
MySQL now supports descending indexes:
DESC
in an index definition is no longer ignored but causes storage of key values in descending order. Previously, indexes could be scanned in reverse order but at a performance penalty. A descending index can be scanned in forward order, which is more efficient. Descending indexes also make it possible for the optimizer to use multiple-column indexes when the most efficient scan order mixes ascending order for some columns and descending order for others. See Section 8.3.13, “Descending Indexes”.MySQL now supports creation of functional index key parts that index expression values rather than column values. Functional key parts enable indexing of values that cannot be indexed otherwise, such as
JSON
values. For details, see Section 13.1.15, “CREATE INDEX Syntax”.In MySQL 8.0.14 and later, trivial
WHERE
conditions arising from constant literal expressions are removed during preparation, rather than later on during optimization. Removal of the condition earlier in the process makes it possible to simplify joins for queries with outer joins having trivial conditions, such as this one:SELECT * FROM t1 LEFT JOIN t2 ON condition_1 WHERE condition_2 OR 0 = 1
The optimizer now sees during preparation that 0 = 1 is always false, making
OR 0 = 1
redundant, and removes it, leaving this:SELECT * FROM t1 LEFT JOIN t2 ON condition_1 where condition_2
Now the optimizer can rewrite the query as an inner join, like this:
SELECT * FROM t1 LEFT JOIN t2 WHERE condition_1 AND condition_2
For more information, see Section 8.2.1.8, “Outer Join Optimization”.
In MySQL 8.0.16 and later, MySQL can use constant folding at optimization time to handle comparisons between a column and a constant value where the constant is out of range or on a range boundary with respect to the type of the column, rather than doing so for each row at execution time. For example, given a table
t
with aTINYINT UNSIGNED
columnc
, the optimizer can rewrite a condition such asWHERE c < 256
toWHERE 1
(and optimize the condition away altogether), orWHERE c >= 255
toWHERE c = 255
.See Section 8.2.1.13, “Constant-Folding Optimization”, for more information.
Beginning with MySQL 8.0.16, the semi-join optimizations used with
IN
subqueries can now be applied toEXISTS
subqueries as well. In addition, the optimizer now decorrelates trivially-correlated equality predicates in theWHERE
condition attached to the subquery, so that they can be treated similarly to expressions inIN
subqueries; this applies to bothEXISTS
andIN
subqueries.For more information, see Section 8.2.2.1, “Optimizing IN and EXISTS Subquery predicates with Semi-Join Transformations”.
Common table expressions. MySQL now supports common table expressions, both nonrecursive and recursive. Common table expressions enable use of named temporary result sets, implemented by permitting a
WITH
clause precedingSELECT
statements and certain other statements. For more information, see Section 13.2.13, “WITH Syntax (Common Table Expressions)”.Window functions. MySQL now supports window functions that, for each row from a query, perform a calculation using rows related to that row. These include functions such as
RANK()
,LAG()
, andNTILE()
. In addition, several existing aggregate functions now can be used as window functions (for example,SUM()
andAVG()
). For more information, see Section 12.21, “Window Functions”.Lateral derived tables. A derived table now may be preceded by the
LATERAL
keyword to specify that it is permitted to refer to (depend on) columns of preceding tables in the sameFROM
clause. Lateral derived tables make possible certain SQL operations that cannot be done with nonlateral derived tables or that require less-efficient workarounds. See Section 13.2.11.9, “Lateral Derived Tables”.Aliases in single-table DELETE statements. In MySQL 8.0.16 and later, single-table
DELETE
statements support the use of table aliases.Regular expression support. Previously, MySQL used the Henry Spencer regular expression library to support regular expression operators (
REGEXP
,RLIKE
). Regular expression support has been reimplemented using International Components for Unicode (ICU), which provides full Unicode support and is multibyte safe. TheREGEXP_LIKE()
function performs regular expression matching in the manner of theREGEXP
andRLIKE
operators, which now are synonyms for that function. In addition, theREGEXP_INSTR()
,REGEXP_REPLACE()
, andREGEXP_SUBSTR()
functions are available to find match positions and perform substring substitution and extraction, respectively. Theregexp_stack_limit
andregexp_time_limit
system variables provide control over resource consumption by the match engine. For more information, see Section 12.5.2, “Regular Expressions”. For information about ways in which applications that use regular expressions may be affected by the implementation change, see Regular Expression Compatibility Considerations.Internal temporary tables. The
TempTable
storage engine replaces theMEMORY
storage engine as the default engine for in-memory internal temporary tables. TheTempTable
storage engine provides efficient storage forVARCHAR
andVARBINARY
columns. Theinternal_tmp_mem_storage_engine
session variable defines the storage engine for in-memory internal temporary tables. Permitted values areTempTable
(the default) andMEMORY
. Thetemptable_max_ram
variable defines the maximum amount of memory that theTempTable
storage engine can use before data is stored to disk.Logging. Error logging was rewritten to use the MySQL component architecture. Traditional error logging is implemented using built-in components, and logging using the system log is implemented as a loadable component. In addition, a loadable JSON log writer is available. To control which log components to enable, use the
log_error_services
system variable. For more information, see Section 5.4.2, “The Error Log”.Backup lock. A new type of backup lock permits DML during an online backup while preventing operations that could result in an inconsistent snapshot. The new backup lock is supported by
LOCK INSTANCE FOR BACKUP
andUNLOCK INSTANCE
syntax. TheBACKUP_ADMIN
privilege is required to use these statements.Replication. The following enhancements have been made to MySQL Replication:
MySQL Replication now supports binary logging of partial updates to JSON documents using a compact binary format, saving space in the log over logging complete JSON documents. Such compact logging is done automatically when statement-based logging is in use, and can be enabled by setting the new
binlog_row_value_options
system variable toPARTIAL_JSON
. For more information, see Partial Updates of JSON Values, as well as the description ofbinlog_row_value_options
.
Connection management. MySQL Server now permits a TCP/IP port to be configured specifically for administrative connections. This provides an alternative to the single administrative connection that is permitted on the network interfaces used for ordinary connections even when
max_connections
connections are already established. See Section 8.12.4.1, “How MySQL Handles Client Connections”.Configuration. The maximum permitted length of host names throughout MySQL has been raised to 255 ASCII characters, up from the previous limit of 60 characters. This applies to, for example, host name-related columns in the data dictionary,
mysql
system schema, Performance Schema,INFORMATION_SCHEMA
, andsys
schema; theMASTER_HOST
value for theCHANGE MASTER TO
statement; theHost
column inSHOW PROCESSLIST
statement output; host names in account names (such as used in account-management statements and inDEFINER
attributes); and host name-related command options and system variables.Caveats:
The increase in permitted host name length can affect tables with indexes on host name columns. For example, tables in the
mysql
system schema that index host names now have an explicitROW_FORMAT
attribute ofDYNAMIC
to accommodate longer index values.Some file name-valued configuration settings might be constructed based on the server host name. The permitted values are constrained by the underlying operating system, which may not permit file names long enough to include 255-character host names. This affects the
general_log_file
,log_error
,pid_file
,relay_log
, andslow_query_log_file
system variables and corresponding options. If host name-based values are too long for the OS, explicit shorter values must be provided.Although the server now supports 255-character host names, connections to the server established using the
--ssl-mode=VERIFY_IDENTITY
option are constrained by maximum host name length supported by OpenSSL. Host name matches pertain to two fields of SSL certificates, which have maximum lengths as follows: Common Name: maximum length 64; Subject Alternative Name: maximum length as per RFC#1034.
Plugins. Previously, MySQL plugins could be written in C or C++. MySQL header files used by plugins now contain C++ code, which means that plugins must be written in C++, not C.
C API. The MySQL C API now supports asynchronous functions for nonblocking communication with the MySQL server. Each function is the asynchronous counterpart to an existing synchronous function. The synchronous functions block if reads from or writes to the server connection must wait. The asynchronous functions enable an application to check whether work on the server connection is ready to proceed. If not, the application can perform other work before checking again later. See Section 28.7.12, “C API Asynchronous Interface”.
Additional Target Types for Casts. The functions
CAST()
andCONVERT()
now support conversions to typesDOUBLE
,FLOAT
, andREAL
. Added in MySQL 8.0.17. See Section 12.10, “Cast Functions and Operators”.JSON Schema Validation. MySQL 8.0.17 adds two functions
JSON_SCHEMA_VALID()
andJSON_SCHEMA_VALIDATION_REPORT()
for validating JSON documents again JSON schemas.JSON_SCHEMA_VALID()
returns TRUE (1) if the document validates against the schema and FALSE (0) if it does not.JSON_SCHEMA_VALIDATION_REPORT()
returns a JSON document containing detailed information about the results of the validation. The following statements apply to both of these functions:The schema must conform to Draft 4 of the JSON Schema specification.
required
attributes are supported.External resources and the
$ref
keyword are not supported.Regular expression patterns are supported; invalid patterns are silently ignored.
See Section 12.17.7, “JSON Schema Validation Functions”, for more information and examples.
JSON_OVERLAPS() and MEMBER OF(). MySQL 8.0 also provides additional functionality for obtaining information about the contents of JSON documents. The
JSON_OVERLAPS()
function compares two JSON objects or arrays, returning true (1) if they contain any key-value pairs or array elements in common, and false (0) if they do not. TheMEMBER OF()
operator returns true (1) if a given value exists as an element of a specified array, false (0) if it does not. Both of these are available in MySQL 8.0.17 and later. For more information and examples, see Section 12.17.3, “Functions That Search JSON Values”.hintable time_zone. As of MySQL 8.0.17, the
time_zone
session variable is hintable usingSET_VAR
.
The following features are deprecated in MySQL 8.0 and may be or will be removed in a future series. Where alternatives are shown, applications should be updated to use them.
For applications that use features deprecated in MySQL 8.0 that have been removed in a higher MySQL series, statements may fail when replicated from a MySQL 8.0 master to a higher-series slave, or may have different effects on master and slave. To avoid such problems, applications that use features deprecated in 8.0 should be revised to avoid them and use alternatives when possible.
The
utf8mb3
character set is deprecated. Please useutf8mb4
instead.Because
caching_sha2_password
is the default authentication plugin in MySQL 8.0 and provides a superset of the capabilities of thesha256_password
authentication plugin,sha256_password
is deprecated and will be removed in a future MySQL version. MySQL accounts that authenticate usingsha256_password
should be migrated to usecaching_sha2_password
instead.The
validate_password
plugin has been reimplemented to use the server component infrastructure. The plugin form ofvalidate_password
is still available but is deprecated and will be removed in a future version of MySQL. MySQL installations that use the plugin should make the transition to using the component instead. See Section 6.4.3.3, “Transitioning to the Password Validation Component”.The
ALTER TABLESPACE
andDROP TABLESPACE
ENGINE
clause is deprecated.The
PAD_CHAR_TO_FULL_LENGTH
SQL mode is deprecated.AUTO_INCREMENT
support is deprecated for columns of typeFLOAT
andDOUBLE
(and any synonyms). Consider removing theAUTO_INCREMENT
attribute from such columns, or convert them to an integer type.The
UNSIGNED
attribute is deprecated for columns of typeFLOAT
,DOUBLE
, andDECIMAL
(and any synonyms). Consider using a simpleCHECK
constraint instead for such columns.FLOAT(
andM
,D
)DOUBLE(
syntax to specify the number of digits for columns of typeM
,D
)FLOAT
andDOUBLE
(and any synonyms) is a nonstandard MySQL extension. This syntax is deprecated.The
ZEROFILL
attribute is deprecated for numeric data types, as is the display width attribute for integer data types. Consider using an alternative means of producing the effect of these attributes. For example, applications could use theLPAD()
function to zero-pad numbers up to the desired width, or they could store the formatted numbers inCHAR
columns.For string data types, the
BINARY
attribute is a nonstandard MySQL extension that is shorthand for specifying the binary (_bin
) collation of the column character set (or of the table default character set if no column character set is specified). In MySQL 8.0, this nonstandard use ofBINARY
is ambiguous because theutf8mb4
character set has multiple_bin
collations, so theBINARY
attribute is deprecated and support for it will be removed in a future MySQL version. Applications should be adjusted to use an explicit_bin
collation instead.The use of
BINARY
to specify a data type or character set remains unchanged.The nonstandard C-style
&&
,||
, and!
operators that are synonyms for the standard SQLAND
,OR
, andNOT
operators, respectively, are deprecated. Applications that use the nonstandard operators should be adjusted to use the standard operators.NoteUse of
||
is deprecated unless thePIPES_AS_CONCAT
SQL mode is enabled. In that case,||
signifies the SQL-standard string concatenation operator).The
JSON_MERGE()
function is deprecated. UseJSON_MERGE_PRESERVE()
instead.The
SQL_CALC_FOUND_ROWS
query modifier and accompanyingFOUND_ROWS()
function are deprecated. See theFOUND_ROWS()
description for information about an alternative strategy.Support for
TABLESPACE = innodb_file_per_table
andTABLESPACE = innodb_temporary
clauses withCREATE TEMPORARY TABLE
is deprecated as of MySQL 8.0.13.The mysql_upgrade client is deprecated because its capabilities for upgrading the system tables in the
mysql
system schema and objects in other schemas have been moved into the MySQL server. See Section 2.11.3, “What the MySQL Upgrade Process Upgrades”.The
--no-dd-upgrade
server option is deprecated. It is superseded by the--upgrade
option, which provides finer control over data dictionary and server upgrade behavior.The
mysql_upgrade_info
file, which is created data directory and used to store the MySQL version number, is deprecated and will be removed in a future MySQL version.
The following items are obsolete and have been removed in MySQL 8.0. Where alternatives are shown, applications should be updated to use them.
For MySQL 5.7 applications that use features removed in MySQL 8.0, statements may fail when replicated from a MySQL 5.7 master to a MySQL 8.0 slave, or may have different effects on master and slave. To avoid such problems, applications that use features removed in MySQL 8.0 should be revised to avoid them and use alternatives when possible.
The
innodb_locks_unsafe_for_binlog
system variable was removed. TheREAD COMMITTED
isolation level provides similar functionality.The
information_schema_stats
variable, introduced in MySQL 8.0.0, was removed and replaced byinformation_schema_stats_expiry
in MySQL 8.0.3.information_schema_stats_expiry
defines an expiration setting for cachedINFORMATION_SCHEMA
table statistics. For more information, see Section 8.2.3, “Optimizing INFORMATION_SCHEMA Queries”.Code related to obsoleted
InnoDB
system tables was removed in MySQL 8.0.3.INFORMATION_SCHEMA
views based onInnoDB
system tables were replaced by internal system views on data dictionary tables. AffectedInnoDB
INFORMATION_SCHEMA
views were renamed:Table 1.1 Renamed InnoDB Information Schema Views
Old Name New Name INNODB_SYS_COLUMNS
INNODB_COLUMNS
INNODB_SYS_DATAFILES
INNODB_DATAFILES
INNODB_SYS_FIELDS
INNODB_FIELDS
INNODB_SYS_FOREIGN
INNODB_FOREIGN
INNODB_SYS_FOREIGN_COLS
INNODB_FOREIGN_COLS
INNODB_SYS_INDEXES
INNODB_INDEXES
INNODB_SYS_TABLES
INNODB_TABLES
INNODB_SYS_TABLESPACES
INNODB_TABLESPACES
INNODB_SYS_TABLESTATS
INNODB_TABLESTATS
INNODB_SYS_VIRTUAL
INNODB_VIRTUAL
After upgrading to MySQL 8.0.3 or later, update any scripts that reference previous
InnoDB
INFORMATION_SCHEMA
view names.The following features related to account management are removed:
Using
GRANT
to create users. Instead, useCREATE USER
. Following this practice makes theNO_AUTO_CREATE_USER
SQL mode immaterial forGRANT
statements, so it too is removed.Using
GRANT
to modify account properties other than privilege assignments. This includes authentication, SSL, and resource-limit properties. Instead, establish such properties at account-creation time withCREATE USER
or modify them afterward withALTER USER
.IDENTIFIED BY PASSWORD '
syntax forauth_string
'CREATE USER
andGRANT
. Instead, useIDENTIFIED WITH
forauth_plugin
AS 'auth_string
'CREATE USER
andALTER USER
, where the'
value is in a format compatible with the named plugin.auth_string
'Additionally, because
IDENTIFIED BY PASSWORD
syntax was removed, thelog_builtin_as_identified_by_password
system variable is superfluous and was removed.The
PASSWORD()
function. Additionally,PASSWORD()
removal means thatSET PASSWORD ... = PASSWORD('
syntax is no longer available.auth_string
')The
old_passwords
system variable.
The query cache was removed. Removal includes these items:
The
FLUSH QUERY CACHE
andRESET QUERY CACHE
statements.These system variables:
query_cache_limit
,query_cache_min_res_unit
,query_cache_size
,query_cache_type
,query_cache_wlock_invalidate
.These status variables:
Qcache_free_blocks
,Qcache_free_memory
,Qcache_hits
,Qcache_inserts
,Qcache_lowmem_prunes
,Qcache_not_cached
,Qcache_queries_in_cache
,Qcache_total_blocks
.These thread states:
checking privileges on cached query
,checking query cache for query
,invalidating query cache entries
,sending cached result to client
,storing result in query cache
,Waiting for query cache lock
.The
SQL_CACHE
SELECT
modifier.
These deprecated query cache items remain deprecated, but have no effect, and will be removed in a future MySQL release:
SQL_NO_CACHE
SELECT
modifier.The
ndb_cache_check_time
system variable.
The
have_query_cache
system variable remains deprecated, always has a value ofNO
, and will be removed in a future MySQL release.The data dictionary provides information about database objects, so the server no longer checks directory names in the data directory to find databases. Consequently, the
--ignore-db-dir
option andignore_db_dirs
system variables are extraneous and are removed.The
tx_isolation
andtx_read_only
system variables have been removed. Usetransaction_isolation
andtransaction_read_only
instead.The
sync_frm
system variable has been removed because.frm
files have become obsolete.The
secure_auth
system variable and--secure-auth
client option have been removed. TheMYSQL_SECURE_AUTH
option for themysql_options()
C API function was removed.The
multi_range_count
system variable is removed.The
log_warnings
system variable and--log-warnings
server option have been removed. Use thelog_error_verbosity
system variable instead.The global scope for the
sql_log_bin
system variable was removed.sql_log_bin
has session scope only, and applications that rely on accessing@@GLOBAL.sql_log_bin
should be adjusted.The
metadata_locks_cache_size
andmetadata_locks_hash_instances
system variables are removed.The unused
date_format
,datetime_format
,time_format
, andmax_tmp_tables
system variables are removed.These deprecated compatibility SQL modes are removed:
DB2
,MAXDB
,MSSQL
,MYSQL323
,MYSQL40
,ORACLE
,POSTGRESQL
,NO_FIELD_OPTIONS
,NO_KEY_OPTIONS
,NO_TABLE_OPTIONS
. They can no longer be assigned to thesql_mode
system variable or used as permitted values for the mysqldump--compatible
option.Removal of
MAXDB
means that theTIMESTAMP
data type forCREATE TABLE
orALTER TABLE
is treated asTIMESTAMP
, and is no longer treated asDATETIME
.The deprecated
ASC
orDESC
qualifiers forGROUP BY
clauses are removed. Queries that previously relied onGROUP BY
sorting may produce results that differ from previous MySQL versions. To produce a given sort order, provide anORDER BY
clause.The
EXTENDED
andPARTITIONS
keywords for theEXPLAIN
statement have been removed. These keywords are unnecessary because their effect is always enabled.These encryption-related items are removed:
The
ENCRYPT()
function.The
DES_ENCRYPT()
, andDES_DECRYPT()
functions, the--des-key-file
option, thehave_crypt
system variable, theDES_KEY_FILE
option for theFLUSH
statement, and theHAVE_CRYPT
CMake option.
In place of the removed encryption functions: For
ENCRYPT()
, consider usingSHA2()
instead for one-way hashing. For the others, consider usingAES_ENCRYPT()
andAES_DECRYPT()
instead.In MySQL 5.7, several spatial functions available under multiple names were deprecated to move in the direction of making the spatial function namespace more consistent, the goal being that each spatial function name begin with
ST_
if it performs an exact operation, or withMBR
if it performs an operation based on minimum bounding rectangles. In MySQL 8.0, the deprecated functions are removed to leave only the correspondingST_
andMBR
functions:These functions are removed in favor of the
MBR
names:Contains()
,Disjoint()
,Equals()
,Intersects()
,Overlaps()
,Within()
.These functions are removed in favor of the
ST_
names:Area()
,AsBinary()
,AsText()
,AsWKB()
,AsWKT()
,Buffer()
,Centroid()
,ConvexHull()
,Crosses()
,Dimension()
,Distance()
,EndPoint()
,Envelope()
,ExteriorRing()
,GeomCollFromText()
,GeomCollFromWKB()
,GeomFromText()
,GeomFromWKB()
,GeometryCollectionFromText()
,GeometryCollectionFromWKB()
,GeometryFromText()
,GeometryFromWKB()
,GeometryN()
,GeometryType()
,InteriorRingN()
,IsClosed()
,IsEmpty()
,IsSimple()
,LineFromText()
,LineFromWKB()
,LineStringFromText()
,LineStringFromWKB()
,MLineFromText()
,MLineFromWKB()
,MPointFromText()
,MPointFromWKB()
,MPolyFromText()
,MPolyFromWKB()
,MultiLineStringFromText()
,MultiLineStringFromWKB()
,MultiPointFromText()
,MultiPointFromWKB()
,MultiPolygonFromText()
,MultiPolygonFromWKB()
,NumGeometries()
,NumInteriorRings()
,NumPoints()
,PointFromText()
,PointFromWKB()
,PointN()
,PolyFromText()
,PolyFromWKB()
,PolygonFromText()
,PolygonFromWKB()
,SRID()
,StartPoint()
,Touches()
,X()
,Y()
.GLength()
is removed in favor ofST_Length()
.
The functions described in Section 12.16.4, “Functions That Create Geometry Values from WKB Values” previously accepted either WKB strings or geometry arguments. Geometry arguments are no longer permitted and produce an error. See that section for guidelines for migrating queries away from using geometry arguments.
The parser no longer treats
\N
as a synonym forNULL
in SQL statements. UseNULL
instead.This change does not affect text file import or export operations performed with
LOAD DATA
orSELECT ... INTO OUTFILE
, for whichNULL
continues to be represented by\N
. See Section 13.2.7, “LOAD DATA Syntax”.PROCEDURE ANALYSE()
syntax is removed.The client-side
--ssl
and--ssl-verify-server-cert
options have been removed. Use--ssl-mode=REQUIRED
instead of--ssl=1
or--enable-ssl
. Use--ssl-mode=DISABLED
instead of--ssl=0
,--skip-ssl
, or--disable-ssl
. Use--ssl-mode=VERIFY_IDENTITY
instead of--ssl-verify-server-cert
options. (The server-side--ssl
option remains unchanged.)For the C API,
MYSQL_OPT_SSL_ENFORCE
andMYSQL_OPT_SSL_VERIFY_SERVER_CERT
options formysql_options()
correspond to the client-side--ssl
and--ssl-verify-server-cert
options and are removed. UseMYSQL_OPT_SSL_MODE
with an option value ofSSL_MODE_REQUIRED
orSSL_MODE_VERIFY_IDENTITY
instead.The
--temp-pool
server option was removed.The
--ignore-builtin-innodb
server option andignore_builtin_innodb
system variable are removed.The server no longer performs conversion of pre-MySQL 5.1 database names containing special characters to 5.1 format with the addition of a
#mysql50#
prefix. Because these conversions are no longer performed, the--fix-db-names
and--fix-table-names
options for mysqlcheck, theUPGRADE DATA DIRECTORY NAME
clause for theALTER DATABASE
statement, and theCom_alter_db_upgrade
status variable are removed.Upgrades are supported only from one major version to another (for example, 5.0 to 5.1, or 5.1 to 5.5), so there should be little remaining need for conversion of older 5.0 database names to current versions of MySQL. As a workaround, upgrade a MySQL 5.0 installation to MySQL 5.1 before upgrading to a more recent release.
The mysql_install_db program has been removed from MySQL distributions. Data directory initialization should be performed by invoking mysqld with the
--initialize
or--initialize-insecure
option instead. In addition, the--bootstrap
option for mysqld that was used by mysql_install_db was removed, and theINSTALL_SCRIPTDIR
CMake
option that controlled the installation location for mysql_install_db was removed.The generic partitioning handler was removed from the MySQL server. In order to support partitioning of a given table, the storage engine used for the table must now provide its own (“native”) partitioning handler. The
--partition
and--skip-partition
options are removed from the MySQL Server, and partitioning-related entries are no longer shown in the output ofSHOW PLUGINS
or in theINFORMATION_SCHEMA.PLUGINS
table.Two MySQL storage engines currently provide native partitioning support—
InnoDB
andNDB
; of these, onlyInnoDB
is supported in MySQL 8.0. Any attempt to create partitioned tables in MySQL 8.0 using any other storage engine fails.Ramifications for upgrades. The direct upgrade of a partitioned table using a storage engine other than
InnoDB
(such asMyISAM
) from MySQL 5.7 (or earlier) to MySQL 8.0 is not supported. There are two options for handling such a table:Remove the table's partitioning, using
ALTER TABLE ... REMOVE PARTITIONING
.Change the storage engine used for the table to
InnoDB
, withALTER TABLE ... ENGINE=INNODB
.
At least one of the two operations just listed must be performed for each partitioned non-
InnoDB
table prior to upgrading the server to MySQL 8.0. Otherwise, such a table cannot be used following the upgrade.Due to the fact that table creation statements that would result in a partitioned table using a storage engine without partitioning support now fail with an error (ER_CHECK_NOT_IMPLEMENTED), you must make sure that any statements in a dump file (such as that written by mysqldump) from an older version of MySQL that you wish to import into a MySQL 8.0 server that create partitioned tables do not also specify a storage engine such as
MyISAM
that has no native partitioning handler. You can do this by performing either of the following:Remove any references to partitioning from
CREATE TABLE
statements that use a value for theSTORAGE ENGINE
option other thanInnoDB
.Specifying the storage engine as
InnoDB
, or allowInnoDB
to be used as the table's storage engine by default.
For more information, see Section 23.6.2, “Partitioning Limitations Relating to Storage Engines”.
System and status variable information is no longer maintained in the
INFORMATION_SCHEMA
. These tables are removed:GLOBAL_VARIABLES
,SESSION_VARIABLES
,GLOBAL_STATUS
,SESSION_STATUS
. Use the corresponding Performance Schema tables instead. See Section 26.12.13, “Performance Schema System Variable Tables”, and Section 26.12.14, “Performance Schema Status Variable Tables”. In addition, theshow_compatibility_56
system variable was removed. It was used in the transition period during which system and status variable information inINFORMATION_SCHEMA
tables was moved to Performance Schema tables, and is no longer needed. These status variables are removed:Slave_heartbeat_period
,Slave_last_heartbeat
,Slave_received_heartbeats
,Slave_retried_transactions
,Slave_running
. The information they provided is available in Performance Schema tables; see Migrating to Performance Schema System and Status Variable Tables.The Performance Schema
setup_timers
table was removed, as was theTICK
row in theperformance_timers
table.The
libmysqld
embedded server library is removed, along with:The
mysql_options()
MYSQL_OPT_GUESS_CONNECTION
,MYSQL_OPT_USE_EMBEDDED_CONNECTION
,MYSQL_OPT_USE_REMOTE_CONNECTION
, andMYSQL_SET_CLIENT_IP
optionsThe mysql_config
--libmysqld-libs
,--embedded-libs
, and--embedded
optionsThe CMake
WITH_EMBEDDED_SERVER
,WITH_EMBEDDED_SHARED_LIBRARY
, andINSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR
optionsThe (undocumented) mysql
--server-arg
optionThe mysqltest
--embedded-server
,--server-arg
, and--server-file
optionsThe mysqltest_embedded and mysql_client_test_embedded test programs
The mysql_plugin utility was removed. Alternatives include loading plugins at server startup using the
--plugin-load
or--plugin-load-add
option, or at runtime using theINSTALL PLUGIN
statement.The resolveip utility is removed. nslookup, host, or dig can be used instead.
The resolve_stack_dump utility is removed. Stack traces from official MySQL builds are always symbolized, so there is no need to use resolve_stack_dump.
The following server error codes are not used and have been removed. Applications that test specifically for any of these errors should be updated.
ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE ER_BINLOG_ROW_RBR_TO_SBR ER_BINLOG_ROW_WRONG_TABLE_DEF ER_CANT_ACTIVATE_LOG ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION ER_CANT_CREATE_FEDERATED_TABLE ER_CANT_CREATE_SROUTINE ER_CANT_DELETE_FILE ER_CANT_GET_WD ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF ER_CANT_SET_WD ER_CANT_WRITE_LOCK_LOG_TABLE ER_CREATE_DB_WITH_READ_LOCK ER_CYCLIC_REFERENCE ER_DB_DROP_DELETE ER_DELAYED_NOT_SUPPORTED ER_DIFF_GROUPS_PROC ER_DISK_FULL ER_DROP_DB_WITH_READ_LOCK ER_DROP_USER ER_DUMP_NOT_IMPLEMENTED ER_ERROR_DURING_CHECKPOINT ER_ERROR_ON_CLOSE ER_EVENTS_DB_ERROR ER_EVENT_CANNOT_DELETE ER_EVENT_CANT_ALTER ER_EVENT_COMPILE_ERROR ER_EVENT_DATA_TOO_LONG ER_EVENT_DROP_FAILED ER_EVENT_MODIFY_QUEUE_ERROR ER_EVENT_NEITHER_M_EXPR_NOR_M_AT ER_EVENT_OPEN_TABLE_FAILED ER_EVENT_STORE_FAILED ER_EXEC_STMT_WITH_OPEN_CURSOR ER_FAILED_ROUTINE_BREAK_BINLOG ER_FLUSH_MASTER_BINLOG_CLOSED ER_FORM_NOT_FOUND ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED ER_FRM_UNKNOWN_TYPE ER_GOT_SIGNAL ER_GRANT_PLUGIN_USER_EXISTS ER_GTID_MODE_REQUIRES_BINLOG ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST ER_HASHCHK ER_INDEX_REBUILD ER_INNODB_NO_FT_USES_PARSER ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR ER_LOAD_DATA_INVALID_COLUMN_UNUSED ER_LOGGING_PROHIBIT_CHANGING_OF ER_MALFORMED_DEFINER ER_MASTER_KEY_ROTATION_ERROR_BY_SE ER_NDB_CANT_SWITCH_BINLOG_FORMAT ER_NEVER_USED ER_NISAMCHK ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR ER_NO_FILE_MAPPING ER_NO_GROUP_FOR_PROC ER_NO_RAID_COMPILED ER_NO_SUCH_KEY_VALUE ER_NO_SUCH_PARTITION__UNUSED ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED ER_ORDER_WITH_PROC ER_PARTITION_SUBPARTITION_ERROR ER_PARTITION_SUBPART_MIX_ERROR ER_PART_STATE_ERROR ER_PASSWD_LENGTH ER_QUERY_ON_MASTER ER_RBR_NOT_AVAILABLE ER_SKIPPING_LOGGED_TRANSACTION ER_SLAVE_CHANNEL_DELETE ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT ER_SLAVE_MUST_STOP ER_SLAVE_WAS_NOT_RUNNING ER_SLAVE_WAS_RUNNING ER_SP_GOTO_IN_HNDLR ER_SP_PROC_TABLE_CORRUPT ER_SQL_MODE_NO_EFFECT ER_SR_INVALID_CREATION_CTX ER_TABLE_NEEDS_UPG_PART ER_TOO_MUCH_AUTO_TIMESTAMP_COLS ER_UNEXPECTED_EOF ER_UNION_TABLES_IN_DIFFERENT_DIR ER_UNSUPPORTED_BY_REPLICATION_THREAD ER_UNUSED1 ER_UNUSED2 ER_UNUSED3 ER_UNUSED4 ER_UNUSED5 ER_UNUSED6 ER_VIEW_SELECT_DERIVED_UNUSED ER_WRONG_MAGIC ER_WSAS_FAILED
The deprecated
INFORMATION_SCHEMA
INNODB_LOCKS
andINNODB_LOCK_WAITS
tables are removed. Use the Performance Schemadata_locks
anddata_lock_waits
tables instead.NoteIn MySQL 5.7, the
LOCK_TABLE
column in theINNODB_LOCKS
table and thelocked_table
column in thesys
schemainnodb_lock_waits
andx$innodb_lock_waits
views contain combined schema/table name values. In MySQL 8.0, thedata_locks
table and thesys
schema views contain separate schema name and table name columns. See Section 27.4.3.9, “The innodb_lock_waits and x$innodb_lock_waits Views”.InnoDB
no longer supports compressed temporary tables. Wheninnodb_strict_mode
is enabled (the default),CREATE TEMPORARY TABLE
returns an error ifROW_FORMAT=COMPRESSED
orKEY_BLOCK_SIZE
is specified. Ifinnodb_strict_mode
is disabled, warnings are issued and the temporary table is created using a non-compressed row format.InnoDB
no longer creates.isl
files (InnoDB
Symbolic Link files) when creating tablespace data files outside of the MySQL data directory. Theinnodb_directories
option now supports locating tablespace files created outside of the data directory.With this change, moving a remote tablespace while the server is offline by manually modifying an
.isl
file is no longer supported. Moving remote tablespace files is now supported by theinnodb_directories
option. See Section 15.6.3.8, “Moving Tablespace Files While the Server is Offline”.The following
InnoDB
file format variables were removed:innodb_file_format
innodb_file_format_check
innodb_file_format_max
innodb_large_prefix
File format variables were necessary for creating tables compatible with earlier versions of
InnoDB
in MySQL 5.1. Now that MySQL 5.1 has reached the end of its product lifecycle, these options are no longer required.The
FILE_FORMAT
column was removed from theINNODB_TABLES
andINNODB_TABLESPACES
Information Schema tables.The
innodb_support_xa
system variable, which enables support for two-phase commit in XA transactions, was removed.InnoDB
support for two-phase commit in XA transactions is always enabled.Support for DTrace was removed.
The
JSON_APPEND()
function was removed. UseJSON_ARRAY_APPEND()
instead.Support for placing table partitions in shared
InnoDB
tablespaces was removed in MySQL 8.0.13. Shared tablespaces include theInnoDB
system tablespace and general tablespaces. For information about identifying partitions in shared tablespaces and moving them to file-per-table tablespaces, see Section 2.11.5, “Preparing Your Installation for Upgrade”.Support for setting user variables in statements other than
SET
was deprecated in MySQL 8.0.13. This functionality is subject to removal in MySQL 9.0.The
--ndb
perror option was removed. Use the ndb_perror utility instead.The
innodb_undo_logs
variable was removed. Theinnodb_rollback_segments
variables performs the same function and should be used instead.The
Innodb_available_undo_logs
status variable was removed. The number of available rollback segments per tablespace may be retrieved usingSHOW VARIABLES LIKE 'innodb_rollback_segments';
As of MySQL 8.0.14, the previously deprecated
innodb_undo_tablespaces
variable is no longer configurable. For more information, see Section 15.6.3.4, “Undo Tablespaces”.Support for the
ALTER TABLE ... UPGRADE PARTITIONING
statement has been removed.As of MySQL 8.0.16, support for the
internal_tmp_disk_storage_engine
system variable has been removed; internal temporary tables on disk now always use theInnoDB
storage engine. See Storage Engine for On-Disk Internal Temporary Tables,for more information.