No cache version.

Caching disabled. Default setting for this page:enabled (code DEF204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher dans le manuel MySQL

1.4 What Is New in MySQL 8.0

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”.

Features Added 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”.

  • 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 now InnoDB (transactional) tables. Previously, these were MyISAM (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 as CREATE USER or DROP 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 the sha256_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, “Caching SHA-2 Pluggable Authentication”.

      The caching_sha2_password and sha256_password authentication plugins provide more secure password encryption than the mysql_native_password plugin, and caching_sha2_password provides better performance than sha256_password. Due to these superior security and performance characteristics of caching_sha2_password, it is now the preferred authentication plugin, and is also the default authentication plugin rather than mysql_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.3.4, “Using Roles”.

    • 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.3.8, “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.6, “FIPS Support”.

    • 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 server 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”.

  • 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 an UPDATE operation, for example), the new value is persisted, and subsequent INSERT operations allocate auto-increment values starting from the new, larger value.

      For more information, see Section, “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 multiple get 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 the innodb_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 the InnoDB 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 Data Encryption, and Undo Log Data Encryption.

    • InnoDB supports NOWAIT and SKIP LOCKED options with SELECT ... FOR SHARE and SELECT ... 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 replaces SELECT ... LOCK IN SHARE MODE, but LOCK IN SHARE MODE remains available for backward compatibility. The statements are equivalent. However, FOR UPDATE and FOR SHARE support NOWAIT, SKIP LOCKED, and OF tbl_name options. See Section 13.2.10, “SELECT Syntax”.

      OF tbl_name applies locking queries to named tables.

    • ADD PARTITION, DROP PARTITION, COALESCE PARTITION, REORGANIZE PARTITION, and REBUILD PARTITION ALTER TABLE options are supported by native partitioning in-place APIs and may be used with ALGORITHM={COPY|INPLACE} and LOCK clauses.

      DROP PARTITION with ALGORITHM=INPLACE deletes data stored in the partition and drops the partition. However, DROP PARTITION with ALGORITHM=COPY or old_alter_table=ON rebuilds the partitioned table and attempts to move data from the dropped partition to another partition with a compatible PARTITION ... 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 single InnoDB tablespace file named mysql.ibd in the MySQL data directory. Previously, these tables were created in individual InnoDB tablespace files in the mysql 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.

        1. CREATE UNDO TABLESPACE tablespace_name ADD DATAFILE 'file_name.ibu';

        Undo tablespaces created using CREATE UNDO TABLESPACE syntax can be dropped at runtime using DROP UNDO TABLESPACE syntax.

        1. DROP UNDO TABLESPACE tablespace_name;

        ALTER UNDO TABLESPACE syntax can be used to mark an undo tablespace as active or inactive.


        A STATE column that shows the state of a tablespace was added to the INFORMATION_SCHEMA.INNODB_TABLESPACES table. An undo tablespace must be in an empty 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 new innodb_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, set innodb_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 have InnoDB 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 for InnoDB 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, “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 in JSON 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, “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:

      • 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 following ALTER 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.

      • Modifying the definition of an ENUM or SET column.

      • 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. If ALGORITHM=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 by internal_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 tablespace encryption feature supports general tablespaces. Previously, only file-per-table tablespaces could be encrypted. To support encryption of general tablespaces, CREATE TABLESPACE and ALTER TABLESPACE syntax was extended to include an ENCRYPTION clause.

      The INFORMATION_SCHEMA.INNODB_TABLESPACES table now includes an ENCRYPTION 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.

    • To reduce the size of core files, the innodb_buffer_pool_in_core_file variable can be disabled to prevent InnoDB buffer pool pages from being written to 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 index reads, which improves performance of non-locking SELECT COUNT(*) FROM tbl_name queries and CHECK TABLE operations. The innodb_parallel_read_threads session variable must be set to a value greater than 1 for parallel index reads to occur. The default value is 4. The actual number of threads used to perform a parallel index read is determined by the innodb_parallel_read_threads setting or the number of index subtrees to scan, whichever is smaller. The pages read into the buffer pool during the scan are kept at the tail of the buffer pool LRU list so that they can be discarded quickly when free buffer pool pages are required.

    • 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 the CREATE TABLESPACE statement is optional, which permits users without the FILE privilege to create tablespaces. A CREATE TABLESPACE statement executed without an ADD DATAFILE clause implicitly creates a tablespace data file with a unique file name.

  • Character set support.  The default character set has changed from latin1 to utf8mb4. The utf8mb4 character set has several new collations, including utf8mb4_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 calling JSON_UNQUOTE() on the result of JSON_EXTRACT().

      This is a refinement of the column path operator -> introduced in MySQL 5.7; col->>"$.path" is equivalent to JSON_UNQUOTE(col->"$.path"). The inline path operator can be used wherever you can use JSON_UNQUOTE(JSON_EXTRACT()), such SELECT column lists, WHERE and HAVING clauses, and ORDER BY and GROUP BY clauses. For more information, see the description of the operator, as well as JSON Path Syntax.

    • Added two JSON aggregation functions JSON_ARRAYAGG() and JSON_OBJECTAGG(). JSON_ARRAYAGG() takes a column or expression as its argument, and aggregates the result as a single JSON array. The expression can evaluate to any MySQL data type; this does not have to be a JSON value. JSON_OBJECTAGG() takes two columns or expressions which it interprets as a key and a value; it returns the result as a single JSON object. For more information and examples, see Section 12.20, “Aggregate (GROUP BY) Functions”.

    • Added the JSON utility function JSON_PRETTY(), which outputs an existing JSON 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.7, “JSON Utility Functions”.

    • When sorting JSON values in a query using ORDER 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 scalar INT or even BIGINT 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 any JSON column. For this optimization to be applied, the update must be applied using JSON_SET(), JSON_REPLACE(), or JSON_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() and JSON_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 type JSON after it has been partially updated using JSON_SET() or JSON_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, and NULL if the argument is NULL.

      For more information and examples, see Section 12.17.7, “JSON Utility Functions”.

      JSON_STORAGE_SIZE() and JSON_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 the last 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 renamed JSON_MERGE_PRESERVE(). JSON_MERGE() continues to be recognized as an alias for JSON_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:

      1. mysql> SELECT JSON_OBJECT('x', '32', 'y', '[true, false]',
      2.      >                     'x', '"abc"', 'x', '100') AS Result;
      3. +------------------------------------+
      4. | Result                             |
      5. +------------------------------------+
      6. | {"x": "100", "y": "[true, false]"} |
      7. +------------------------------------+
      8. 1 row in set (0.00 sec)

      Values inserted into MySQL JSON columns are also normalized in this way, as shown in this example:

      1. mysql> CREATE TABLE t1 (c1 JSON);
      3. mysql> INSERT INTO t1 VALUES ('{"x": 17, "x": "red", "x": [3, 5, 7]}');
      5. mysql> SELECT c1 FROM t1;
      6. +------------------+
      7. | c1               |
      8. +------------------+
      9. | {"x": [3, 5, 7]} |
      10. +------------------+

      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(expr, path COLUMNS column_list) [AS] alias), where expr is an expression that returns JSON data, path is a JSON path applied to the source, and column_list is a list of column definitions. An example is shown here:

      1. mysql> SELECT *
      2.     -> FROM  
      3.     ->   JSON_TABLE(
      4.     ->     '[{"a":3,"b":"0"},{"a":"3","b":"1"},{"a":2,"b":1},{"a":0},{"b":[1,2]}]',
      5.     ->     "$[*]" COLUMNS(
      6.     ->       rowid FOR ORDINALITY,
      7.     ->  
      8.     ->       xa INT EXISTS PATH "$.a",
      9.     ->       xb INT EXISTS PATH "$.b",
      10.     ->      
      11.     ->       sa VARCHAR(100) PATH "$.a",
      12.     ->       sb VARCHAR(100) PATH "$.b",
      13.     ->      
      14.     ->       ja JSON PATH "$.a",      
      15.     ->       jb JSON PATH "$.b"
      16.     ->     )  
      17.     ->   ) AS  jt1;
      18. +-------+------+------+------+------+------+--------+
      19. | rowid | xa   | xb   | sa   | sb   | ja   | jb     |
      20. +-------+------+------+------+------+------+--------+
      21. |     1 |    1 |    1 | 3    | 0    | 3    | "0"    |
      22. |     2 |    1 |    1 | 3    | 1    | "3"  | "1"    |
      23. |     3 |    1 |    1 | 2    | 1    | 2    | 1      |
      24. |     4 |    1 |    0 | 0    | NULL | 0    | NULL   |
      25. |     5 |    0 |    1 | NULL | NULL | NULL | [1, 2] |
      26. +-------+------+------+------+------+------+--------+

      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, and JSON 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 use the outer join optimization for queries with outer joins containing trivial conditions, such as this one:

      1. 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:

      1. 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:

      1. SELECT * FROM t1 LEFT JOIN t2 WHERE condition_1 AND condition_2

      For more information, see Section, “Outer Join Optimization”.

  • 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 preceding SELECT 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(), and NTILE(). In addition, several existing aggregate functions now can be used as window functions; for example, SUM() and AVG(). For more information, see Section 12.21, “Window Functions”.

  • 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. The REGEXP_LIKE() function performs regular expression matching in the manner of the REGEXP and RLIKE operators, which now are synonyms for that function. In addition, the REGEXP_INSTR(), REGEXP_REPLACE(), and REGEXP_SUBSTR() functions are available to find match positions and perform substring substitution and extraction, respectively. The regexp_stack_limit and regexp_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 the MEMORY storage engine as the default engine for in-memory internal temporary tables. The TempTable storage engine provides efficient storage for VARCHAR and VARBINARY columns. The internal_tmp_mem_storage_engine session variable defines the storage engine for in-memory internal temporary tables. Permitted values are TempTable (the default) and MEMORY. The temptable_max_ram variable defines the maximum amount of memory that the TempTable 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 and UNLOCK INSTANCE syntax. The BACKUP_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 to PARTIAL_JSON. For more information, see Partial Updates of JSON Values, as well as the description of binlog_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, “How MySQL Handles Client Connections”.

  • 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.

Contents Haut

Features Deprecated in MySQL 8.0

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 use utf8mb4 instead.

  • Because caching_sha2_password is the default authentication plugin in MySQL 8.0 and provides a superset of the capabilities of the sha256_password authentication plugin, sha256_password is deprecated and will be removed in a future MySQL version. MySQL accounts that authenticate using sha256_password should be migrated to use caching_sha2_password instead.

  • The validate_password plugin has been reimplemented to use the server component infrastructure. The plugin form of validate_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, “Transitioning to the Password Validation Component”.

  • The ALTER TABLESPACE and DROP TABLESPACE ENGINE clause is deprecated.

  • The PAD_CHAR_TO_FULL_LENGTH SQL mode is deprecated.

  • The JSON_MERGE() function is deprecated. Use JSON_MERGE_PRESERVE() instead.

  • Support for TABLESPACE = innodb_file_per_table and TABLESPACE = innodb_temporary clauses with CREATE TEMPORARY TABLE is deprecated as of MySQL 8.0.13.

Contents Haut

Features Removed in MySQL 8.0

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. The READ COMMITTED isolation level provides similar functionality.

  • The information_schema_stats variable, introduced in MySQL 8.0.0, was removed and replaced by information_schema_stats_expiry in MySQL 8.0.3.

    information_schema_stats_expiry defines an expiration setting for cached INFORMATION_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 on InnoDB system tables were replaced by internal system views on data dictionary tables. Affected InnoDB INFORMATION_SCHEMA views were renamed:

    Table 1.1 Renamed InnoDB Information Schema Views

    Old Name New Name

    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, use CREATE USER. Following this practice makes the NO_AUTO_CREATE_USER SQL mode immaterial for GRANT 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 with CREATE USER or modify them afterward with ALTER USER.

    • IDENTIFIED BY PASSWORD 'hash_string' syntax for CREATE USER and GRANT. Instead, use IDENTIFIED WITH auth_plugin AS 'hash_string' for CREATE USER and ALTER USER, where the 'hash_string' value is in a format compatible with the named plugin.

      Additionally, because IDENTIFIED BY PASSWORD syntax was removed, the log_builtin_as_identified_by_password system variable is superfluous and was removed.

    • The PASSWORD() function. Additionally, PASSWORD() removal means that SET PASSWORD ... = PASSWORD('auth_string') syntax is no longer available.

    • The old_passwords system variable.

  • The query cache was removed. Removal includes these items:

    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 of NO, 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 and ignore_db_dirs system variables are extraneous and are removed.

  • The tx_isolation and tx_read_only system variables have been removed. Use transaction_isolation and transaction_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. The MYSQL_SECURE_AUTH option for the mysql_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 the log_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 and metadata_locks_hash_instances system variables are removed.

  • The unused date_format, datetime_format, time_format, and max_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 the sql_mode system variable or used as permitted values for the mysqldump --compatible option.

    Removal of MAXDB means that the TIMESTAMP data type for CREATE TABLE or ALTER TABLE is treated as TIMESTAMP, and is no longer treated as DATETIME.

  • The deprecated ASC or DESC qualifiers for GROUP BY clauses are removed. Queries that previously relied on GROUP BY sorting may produce results that differ from previous MySQL versions. To produce a given sort order, provide an ORDER BY clause.

  • The EXTENDED and PARTITIONS keywords for the EXPLAIN statement have been removed. These keywords are unnecessary because their effect is always enabled.

  • These encryption-related items are removed:

    In place of the removed encryption functions: For ENCRYPT(), consider using SHA2() instead for one-way hashing. For the others, consider using AES_ENCRYPT() and AES_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 with MBR if it performs an operation based on minimum bounding rectangles. In MySQL 8.0, the deprecated functions are removed to leave only the corresponding ST_ and MBR 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 of ST_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 for NULL in SQL statements. Use NULL instead.

    This change does not affect text file import or export operations performed with LOAD DATA INFILE or SELECT ... INTO OUTFILE, for which NULL continues to be represented by \N. See Section 13.2.7, “LOAD DATA INFILE 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 and MYSQL_OPT_SSL_VERIFY_SERVER_CERT options for mysql_options() correspond to the client-side --ssl and --ssl-verify-server-cert options and are removed. Use MYSQL_OPT_SSL_MODE with an option value of SSL_MODE_REQUIRED or SSL_MODE_VERIFY_IDENTITY instead.

  • The --temp-pool server option was removed.

  • The --ignore-builtin-innodb server option and ignore_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, the UPGRADE DATA DIRECTORY NAME clause for the ALTER DATABASE statement, and the Com_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 the INSTALL_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 of SHOW PLUGINS or in the INFORMATION_SCHEMA.PLUGINS table.

    Two MySQL storage engines currently provide native partitioning support—InnoDB and NDB; of these, only InnoDB 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 as MyISAM) from MySQL 5.7 (or earlier) to MySQL 8.0 is not supported. There are two options for handling such a table:

    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 the STORAGE ENGINE option other than InnoDB.

    • Specifying the storage engine as InnoDB, or allow InnoDB 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, the show_compatibility_56 system variable was removed. It was used in the transition period during which system and status variable information in INFORMATION_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 the TICK row in the performance_timers table.

  • The libmysqld embedded server library is removed, along with:


    • The mysql_config --libmysqld-libs, --embedded-libs, and --embedded options


    • The (undocumented) mysql --server-arg option

    • The mysqltest --embedded-server, --server-arg, and --server-file options

    • The 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 the INSTALL 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.

  • The deprecated INFORMATION_SCHEMA INNODB_LOCKS and INNODB_LOCK_WAITS tables are removed. Use the Performance Schema data_locks and data_lock_waits tables instead.


    In MySQL 5.7, the LOCK_TABLE column in the INNODB_LOCKS table and the locked_table column in the sys schema innodb_lock_waits and x$innodb_lock_waits views contain combined schema/table name values. In MySQL 8.0, the data_locks table and the sys schema views contain separate schema name and table name columns. See Section, “The innodb_lock_waits and x$innodb_lock_waits Views”.

  • InnoDB no longer supports compressed temporary tables. When innodb_strict_mode is enabled (the default), CREATE TEMPORARY TABLE returns an error if ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE is specified. If innodb_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. The innodb_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 the innodb_directories option. See Section, “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 the INNODB_TABLES and INNODB_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. Use JSON_ARRAY_APPEND() instead.

  • Support for placing table partitions in shared InnoDB tablespaces was removed in MySQL 8.0.13. Shared tablespaces include the InnoDB system tablespace and general tablespaces. For information about identifying partitions in shared tablespaces and moving them to file-per-table tablespaces, see Section, “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. The innodb_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 using SHOW 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, “Undo Tablespaces”.

Find a PHP function
Error Infobrol

Can not display this page of the Infobrol website

Type of error (18-01)

Unknown format specifier "&"

Please try again in a few minutes…

Return to the home page