0% found this document useful (0 votes)
17 views

Mysql 8.0 en 1 30

This document provides information about installing and setting up MySQL 8.0 database server on various platforms. It describes the installation layouts, packages, repositories and methods for installing MySQL from binaries, source or Docker. It also includes post-installation setup and testing instructions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Mysql 8.0 en 1 30

This document provides information about installing and setting up MySQL 8.0 database server on various platforms. It describes the installation layouts, packages, repositories and methods for installing MySQL from binaries, source or Docker. It also includes post-installation setup and testing instructions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

MySQL 8.

0 Reference Manual
Including MySQL NDB Cluster 8.0
Abstract

This is the MySQL Reference Manual. It documents MySQL 8.0 through 8.0.37, as well as NDB Cluster releases
based on version 8.0 of NDB through 8.0.35-ndb-8.0.35, respectively. It may include documentation of features of
MySQL versions that have not yet been released. For information about which versions have been released, see the
MySQL 8.0 Release Notes.

MySQL 8.0 features. This manual describes features that are not included in every edition of MySQL 8.0; such
features may not be included in the edition of MySQL 8.0 licensed to you. If you have any questions about the
features included in your edition of MySQL 8.0, refer to your MySQL 8.0 license agreement or contact your Oracle
sales representative.

For notes detailing the changes in each release, see the MySQL 8.0 Release Notes.

For legal information, including licensing information, see the Preface and Legal Notices.

For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQL
users.

Document generated on: 2024-03-14 (revision: 78085)


Table of Contents
Preface and Legal Notices .............................................................................................................. xxix
1 General Information ......................................................................................................................... 1
1.1 About This Manual ............................................................................................................... 2
1.2 Overview of the MySQL Database Management System ........................................................ 4
1.2.1 What is MySQL? ....................................................................................................... 4
1.2.2 The Main Features of MySQL .................................................................................... 6
1.2.3 History of MySQL ...................................................................................................... 9
1.3 What Is New in MySQL 8.0 .................................................................................................. 9
1.4 Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 8.0 ....... 65
1.5 How to Report Bugs or Problems ........................................................................................ 94
1.6 MySQL Standards Compliance ............................................................................................ 99
1.6.1 MySQL Extensions to Standard SQL ...................................................................... 100
1.6.2 MySQL Differences from Standard SQL .................................................................. 103
1.6.3 How MySQL Deals with Constraints ........................................................................ 106
2 Installing MySQL ......................................................................................................................... 109
2.1 General Installation Guidance ............................................................................................ 111
2.1.1 Supported Platforms ............................................................................................... 112
2.1.2 Which MySQL Version and Distribution to Install ..................................................... 112
2.1.3 How to Get MySQL ................................................................................................ 113
2.1.4 Verifying Package Integrity Using MD5 Checksums or GnuPG ................................. 113
2.1.5 Installation Layouts ................................................................................................ 130
2.1.6 Compiler-Specific Build Characteristics ................................................................... 130
2.2 Installing MySQL on Unix/Linux Using Generic Binaries ...................................................... 130
2.3 Installing MySQL on Microsoft Windows ............................................................................ 134
2.3.1 MySQL Installation Layout on Microsoft Windows .................................................... 136
2.3.2 Choosing an Installation Package ........................................................................... 137
2.3.3 MySQL Installer for Windows ................................................................................. 138
2.3.4 Installing MySQL on Microsoft Windows Using a noinstall ZIP Archive ................. 170
2.3.5 Troubleshooting a Microsoft Windows MySQL Server Installation .............................. 178
2.3.6 Windows Postinstallation Procedures ...................................................................... 179
2.3.7 Windows Platform Restrictions ................................................................................ 181
2.4 Installing MySQL on macOS ............................................................................................. 183
2.4.1 General Notes on Installing MySQL on macOS ....................................................... 183
2.4.2 Installing MySQL on macOS Using Native Packages ............................................... 184
2.4.3 Installing and Using the MySQL Launch Daemon .................................................... 191
2.4.4 Installing and Using the MySQL Preference Pane .................................................... 194
2.5 Installing MySQL on Linux ................................................................................................ 199
2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository .................................. 200
2.5.2 Installing MySQL on Linux Using the MySQL APT Repository ................................... 205
2.5.3 Installing MySQL on Linux Using the MySQL SLES Repository ................................. 205
2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle .................................. 205
2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle ............................... 210
2.5.6 Deploying MySQL on Linux with Docker Containers ................................................. 212
2.5.7 Installing MySQL on Linux from the Native Software Repositories ............................. 225
2.5.8 Installing MySQL on Linux with Juju ....................................................................... 227
2.5.9 Managing MySQL Server with systemd ................................................................... 227
2.6 Installing MySQL Using Unbreakable Linux Network (ULN) ................................................. 232
2.7 Installing MySQL on Solaris .............................................................................................. 233
2.7.1 Installing MySQL on Solaris Using a Solaris PKG .................................................... 234
2.8 Installing MySQL from Source ........................................................................................... 235
2.8.1 Source Installation Methods .................................................................................... 235

iii
MySQL 8.0 Reference Manual

2.8.2 Source Installation Prerequisites ............................................................................. 236


2.8.3 MySQL Layout for Source Installation ..................................................................... 238
2.8.4 Installing MySQL Using a Standard Source Distribution ............................................ 238
2.8.5 Installing MySQL Using a Development Source Tree ............................................... 242
2.8.6 Configuring SSL Library Support ............................................................................. 244
2.8.7 MySQL Source-Configuration Options ..................................................................... 245
2.8.8 Dealing with Problems Compiling MySQL ................................................................ 278
2.8.9 MySQL Configuration and Third-Party Tools ............................................................ 280
2.8.10 Generating MySQL Doxygen Documentation Content ............................................ 280
2.9 Postinstallation Setup and Testing ..................................................................................... 281
2.9.1 Initializing the Data Directory .................................................................................. 282
2.9.2 Starting the Server ................................................................................................. 287
2.9.3 Testing the Server ................................................................................................. 290
2.9.4 Securing the Initial MySQL Account ........................................................................ 292
2.9.5 Starting and Stopping MySQL Automatically ............................................................ 294
2.10 Perl Installation Notes ..................................................................................................... 295
2.10.1 Installing Perl on Unix .......................................................................................... 295
2.10.2 Installing ActiveState Perl on Windows .................................................................. 296
2.10.3 Problems Using the Perl DBI/DBD Interface .......................................................... 297
3 Upgrading MySQL ....................................................................................................................... 299
3.1 Before You Begin ............................................................................................................. 299
3.2 Upgrade Paths ................................................................................................................. 301
3.3 Upgrade Best Practices .................................................................................................... 301
3.4 What the MySQL Upgrade Process Upgrades .................................................................... 303
3.5 Changes in MySQL 8.0 ..................................................................................................... 307
3.6 Preparing Your Installation for Upgrade ............................................................................. 326
3.7 Upgrading MySQL Binary or Package-based Installations on Unix/Linux .............................. 329
3.8 Upgrading MySQL with the MySQL Yum Repository ........................................................... 334
3.9 Upgrading MySQL with the MySQL APT Repository ........................................................... 336
3.10 Upgrading MySQL with the MySQL SLES Repository ....................................................... 336
3.11 Upgrading MySQL on Windows ....................................................................................... 336
3.12 Upgrading a Docker Installation of MySQL ....................................................................... 338
3.13 Upgrade Troubleshooting ................................................................................................ 338
3.14 Rebuilding or Repairing Tables or Indexes ....................................................................... 339
3.15 Copying MySQL Databases to Another Machine .............................................................. 340
4 Downgrading MySQL ................................................................................................................... 343
5 Tutorial ........................................................................................................................................ 345
5.1 Connecting to and Disconnecting from the Server .............................................................. 345
5.2 Entering Queries ............................................................................................................... 346
5.3 Creating and Using a Database ........................................................................................ 349
5.3.1 Creating and Selecting a Database ......................................................................... 350
5.3.2 Creating a Table .................................................................................................... 351
5.3.3 Loading Data into a Table ...................................................................................... 353
5.3.4 Retrieving Information from a Table ........................................................................ 354
5.4 Getting Information About Databases and Tables ............................................................... 367
5.5 Using mysql in Batch Mode .............................................................................................. 368
5.6 Examples of Common Queries .......................................................................................... 370
5.6.1 The Maximum Value for a Column ......................................................................... 370
5.6.2 The Row Holding the Maximum of a Certain Column ............................................... 370
5.6.3 Maximum of Column per Group .............................................................................. 371
5.6.4 The Rows Holding the Group-wise Maximum of a Certain Column ............................ 371
5.6.5 Using User-Defined Variables ................................................................................. 372
5.6.6 Using Foreign Keys ................................................................................................ 373
5.6.7 Searching on Two Keys ......................................................................................... 375

iv
MySQL 8.0 Reference Manual

5.6.8 Calculating Visits Per Day ...................................................................................... 375


5.6.9 Using AUTO_INCREMENT ..................................................................................... 376
5.7 Using MySQL with Apache ............................................................................................... 378
6 MySQL Programs ........................................................................................................................ 381
6.1 Overview of MySQL Programs .......................................................................................... 382
6.2 Using MySQL Programs ................................................................................................... 386
6.2.1 Invoking MySQL Programs ..................................................................................... 386
6.2.2 Specifying Program Options ................................................................................... 387
6.2.3 Command Options for Connecting to the Server ...................................................... 401
6.2.4 Connecting to the MySQL Server Using Command Options ...................................... 416
6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value Pairs ......................... 419
6.2.6 Connecting to the Server Using DNS SRV Records ................................................. 426
6.2.7 Connection Transport Protocols .............................................................................. 427
6.2.8 Connection Compression Control ............................................................................ 429
6.2.9 Setting Environment Variables ................................................................................ 433
6.3 Server and Server-Startup Programs ................................................................................. 434
6.3.1 mysqld — The MySQL Server ................................................................................ 434
6.3.2 mysqld_safe — MySQL Server Startup Script .......................................................... 434
6.3.3 mysql.server — MySQL Server Startup Script ......................................................... 443
6.3.4 mysqld_multi — Manage Multiple MySQL Servers ................................................... 446
6.4 Installation-Related Programs ............................................................................................ 451
6.4.1 comp_err — Compile MySQL Error Message File .................................................... 451
6.4.2 mysql_secure_installation — Improve MySQL Installation Security ............................ 454
6.4.3 mysql_ssl_rsa_setup — Create SSL/RSA Files ....................................................... 460
6.4.4 mysql_tzinfo_to_sql — Load the Time Zone Tables ................................................. 464
6.4.5 mysql_upgrade — Check and Upgrade MySQL Tables ............................................ 464
6.5 Client Programs ................................................................................................................ 478
6.5.1 mysql — The MySQL Command-Line Client ............................................................ 478
6.5.2 mysqladmin — A MySQL Server Administration Program ......................................... 525
6.5.3 mysqlcheck — A Table Maintenance Program ......................................................... 542
6.5.4 mysqldump — A Database Backup Program ........................................................... 559
6.5.5 mysqlimport — A Data Import Program ................................................................... 602
6.5.6 mysqlpump — A Database Backup Program ........................................................... 618
6.5.7 mysqlshow — Display Database, Table, and Column Information ............................. 646
6.5.8 mysqlslap — A Load Emulation Client .................................................................... 659
6.6 Administrative and Utility Programs ................................................................................... 679
6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility ................................................ 679
6.6.2 innochecksum — Offline InnoDB File Checksum Utility ............................................ 684
6.6.3 myisam_ftdump — Display Full-Text Index information ............................................. 692
6.6.4 myisamchk — MyISAM Table-Maintenance Utility .................................................... 693
6.6.5 myisamlog — Display MyISAM Log File Contents .................................................... 713
6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables ......................... 715
6.6.7 mysql_config_editor — MySQL Configuration Utility ................................................. 722
6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility ............................................ 728
6.6.9 mysqlbinlog — Utility for Processing Binary Log Files .............................................. 737
6.6.10 mysqldumpslow — Summarize Slow Query Log Files ............................................ 772
6.7 Program Development Utilities .......................................................................................... 774
6.7.1 mysql_config — Display Options for Compiling Clients ............................................. 774
6.7.2 my_print_defaults — Display Options from Option Files ........................................... 776
6.8 Miscellaneous Programs ................................................................................................... 777
6.8.1 lz4_decompress — Decompress mysqlpump LZ4-Compressed Output ..................... 777
6.8.2 perror — Display MySQL Error Message Information ............................................... 777
6.8.3 zlib_decompress — Decompress mysqlpump ZLIB-Compressed Output ................... 778
6.9 Environment Variables ...................................................................................................... 779

v
MySQL 8.0 Reference Manual

6.10 Unix Signal Handling in MySQL ....................................................................................... 781


7 MySQL Server Administration ...................................................................................................... 785
7.1 The MySQL Server ........................................................................................................... 786
7.1.1 Configuring the Server ........................................................................................... 787
7.1.2 Server Configuration Defaults ................................................................................. 788
7.1.3 Server Configuration Validation ............................................................................... 788
7.1.4 Server Option, System Variable, and Status Variable Reference ............................... 789
7.1.5 Server System Variable Reference ......................................................................... 841
7.1.6 Server Status Variable Reference ........................................................................... 868
7.1.7 Server Command Options ...................................................................................... 886
7.1.8 Server System Variables ........................................................................................ 915
7.1.9 Using System Variables ....................................................................................... 1091
7.1.10 Server Status Variables ...................................................................................... 1124
7.1.11 Server SQL Modes ............................................................................................. 1153
7.1.12 Connection Management .................................................................................... 1166
7.1.13 IPv6 Support ...................................................................................................... 1174
7.1.14 Network Namespace Support .............................................................................. 1178
7.1.15 MySQL Server Time Zone Support ..................................................................... 1183
7.1.16 Resource Groups ............................................................................................... 1188
7.1.17 Server-Side Help Support ................................................................................... 1193
7.1.18 Server Tracking of Client Session State .............................................................. 1194
7.1.19 The Server Shutdown Process ............................................................................ 1198
7.2 The MySQL Data Directory ............................................................................................. 1199
7.3 The mysql System Schema ............................................................................................. 1200
7.4 MySQL Server Logs ....................................................................................................... 1205
7.4.1 Selecting General Query Log and Slow Query Log Output Destinations ................... 1206
7.4.2 The Error Log ...................................................................................................... 1209
7.4.3 The General Query Log ........................................................................................ 1231
7.4.4 The Binary Log .................................................................................................... 1233
7.4.5 The Slow Query Log ............................................................................................ 1250
7.4.6 Server Log Maintenance ....................................................................................... 1254
7.5 MySQL Components ....................................................................................................... 1256
7.5.1 Installing and Uninstalling Components ................................................................. 1257
7.5.2 Obtaining Component Information ......................................................................... 1257
7.5.3 Error Log Components ......................................................................................... 1258
7.5.4 Query Attribute Components ................................................................................. 1260
7.5.5 Scheduler Component .......................................................................................... 1260
7.6 MySQL Server Plugins .................................................................................................... 1261
7.6.1 Installing and Uninstalling Plugins ......................................................................... 1262
7.6.2 Obtaining Server Plugin Information ...................................................................... 1267
7.6.3 MySQL Enterprise Thread Pool ............................................................................ 1268
7.6.4 The Rewriter Query Rewrite Plugin ....................................................................... 1276
7.6.5 The ddl_rewriter Plugin ......................................................................................... 1286
7.6.6 Version Tokens .................................................................................................... 1288
7.6.7 The Clone Plugin ................................................................................................. 1300
7.6.8 The Keyring Proxy Bridge Plugin .......................................................................... 1328
7.6.9 MySQL Plugin Services ........................................................................................ 1328
7.7 MySQL Server Loadable Functions .................................................................................. 1336
7.7.1 Installing and Uninstalling Loadable Functions ....................................................... 1337
7.7.2 Obtaining Information About Loadable Functions ................................................... 1338
7.8 Running Multiple MySQL Instances on One Machine ........................................................ 1338
7.8.1 Setting Up Multiple Data Directories ...................................................................... 1340
7.8.2 Running Multiple MySQL Instances on Windows .................................................... 1341
7.8.3 Running Multiple MySQL Instances on Unix .......................................................... 1344

vi
MySQL 8.0 Reference Manual

7.8.4 Using Client Programs in a Multiple-Server Environment ........................................ 1345


7.9 Debugging MySQL .......................................................................................................... 1346
7.9.1 Debugging a MySQL Server ................................................................................. 1346
7.9.2 Debugging a MySQL Client .................................................................................. 1352
7.9.3 The LOCK_ORDER Tool ...................................................................................... 1352
7.9.4 The DBUG Package ............................................................................................. 1358
8 Security ..................................................................................................................................... 1363
8.1 General Security Issues .................................................................................................. 1364
8.1.1 Security Guidelines .............................................................................................. 1365
8.1.2 Keeping Passwords Secure .................................................................................. 1366
8.1.3 Making MySQL Secure Against Attackers .............................................................. 1369
8.1.4 Security-Related mysqld Options and Variables ..................................................... 1371
8.1.5 How to Run MySQL as a Normal User .................................................................. 1371
8.1.6 Security Considerations for LOAD DATA LOCAL ................................................... 1372
8.1.7 Client Programming Security Guidelines ................................................................ 1376
8.2 Access Control and Account Management ....................................................................... 1378
8.2.1 Account User Names and Passwords ................................................................... 1379
8.2.2 Privileges Provided by MySQL .............................................................................. 1381
8.2.3 Grant Tables ........................................................................................................ 1401
8.2.4 Specifying Account Names ................................................................................... 1411
8.2.5 Specifying Role Names ........................................................................................ 1413
8.2.6 Access Control, Stage 1: Connection Verification ................................................... 1414
8.2.7 Access Control, Stage 2: Request Verification ....................................................... 1418
8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts .............................. 1419
8.2.9 Reserved Accounts .............................................................................................. 1423
8.2.10 Using Roles ....................................................................................................... 1423
8.2.11 Account Categories ............................................................................................ 1430
8.2.12 Privilege Restriction Using Partial Revokes .......................................................... 1434
8.2.13 When Privilege Changes Take Effect .................................................................. 1441
8.2.14 Assigning Account Passwords ............................................................................ 1442
8.2.15 Password Management ...................................................................................... 1443
8.2.16 Server Handling of Expired Passwords ................................................................ 1454
8.2.17 Pluggable Authentication .................................................................................... 1456
8.2.18 Multifactor Authentication .................................................................................... 1462
8.2.19 Proxy Users ....................................................................................................... 1466
8.2.20 Account Locking ................................................................................................. 1474
8.2.21 Setting Account Resource Limits ......................................................................... 1475
8.2.22 Troubleshooting Problems Connecting to MySQL ................................................. 1477
8.2.23 SQL-Based Account Activity Auditing .................................................................. 1482
8.3 Using Encrypted Connections .......................................................................................... 1483
8.3.1 Configuring MySQL to Use Encrypted Connections ................................................ 1484
8.3.2 Encrypted Connection TLS Protocols and Ciphers ................................................. 1492
8.3.3 Creating SSL and RSA Certificates and Keys ........................................................ 1501
8.3.4 Connecting to MySQL Remotely from Windows with SSH ...................................... 1511
8.3.5 Reusing SSL Sessions ......................................................................................... 1511
8.4 Security Components and Plugins ................................................................................... 1514
8.4.1 Authentication Plugins .......................................................................................... 1515
8.4.2 The Connection-Control Plugins ............................................................................ 1608
8.4.3 The Password Validation Component .................................................................... 1615
8.4.4 The MySQL Keyring ............................................................................................. 1628
8.4.5 MySQL Enterprise Audit ....................................................................................... 1704
8.4.6 The Audit Message Component ............................................................................ 1796
8.4.7 MySQL Enterprise Firewall ................................................................................... 1799
8.5 MySQL Enterprise Data Masking and De-Identification ..................................................... 1828

vii
MySQL 8.0 Reference Manual

8.5.1 Data-Masking Components Versus the Data-Masking Plugin .................................. 1830


8.5.2 MySQL Enterprise Data Masking and De-Identification Components ....................... 1831
8.5.3 MySQL Enterprise Data Masking and De-Identification Plugin ................................. 1857
8.6 MySQL Enterprise Encryption .......................................................................................... 1875
8.6.1 MySQL Enterprise Encryption Installation and Upgrading ....................................... 1876
8.6.2 Configuring MySQL Enterprise Encryption ............................................................. 1879
8.6.3 MySQL Enterprise Encryption Usage and Examples .............................................. 1880
8.6.4 MySQL Enterprise Encryption Function Reference ................................................. 1882
8.6.5 MySQL Enterprise Encryption Component Function Descriptions ............................ 1882
8.6.6 MySQL Enterprise Encryption Legacy Function Descriptions .................................. 1886
8.7 SELinux .......................................................................................................................... 1891
8.7.1 Check if SELinux is Enabled ................................................................................ 1892
8.7.2 Changing the SELinux Mode ................................................................................ 1892
8.7.3 MySQL Server SELinux Policies ........................................................................... 1893
8.7.4 SELinux File Context ............................................................................................ 1893
8.7.5 SELinux TCP Port Context ................................................................................... 1894
8.7.6 Troubleshooting SELinux ...................................................................................... 1896
8.8 FIPS Support .................................................................................................................. 1897
9 Backup and Recovery ................................................................................................................ 1901
9.1 Backup and Recovery Types ........................................................................................... 1902
9.2 Database Backup Methods .............................................................................................. 1905
9.3 Example Backup and Recovery Strategy ......................................................................... 1907
9.3.1 Establishing a Backup Policy ................................................................................ 1908
9.3.2 Using Backups for Recovery ................................................................................. 1910
9.3.3 Backup Strategy Summary ................................................................................... 1910
9.4 Using mysqldump for Backups ........................................................................................ 1910
9.4.1 Dumping Data in SQL Format with mysqldump ...................................................... 1911
9.4.2 Reloading SQL-Format Backups ........................................................................... 1912
9.4.3 Dumping Data in Delimited-Text Format with mysqldump ....................................... 1913
9.4.4 Reloading Delimited-Text Format Backups ............................................................ 1914
9.4.5 mysqldump Tips ................................................................................................... 1915
9.5 Point-in-Time (Incremental) Recovery .............................................................................. 1917
9.5.1 Point-in-Time Recovery Using Binary Log .............................................................. 1917
9.5.2 Point-in-Time Recovery Using Event Positions ....................................................... 1918
9.6 MyISAM Table Maintenance and Crash Recovery ............................................................ 1920
9.6.1 Using myisamchk for Crash Recovery ................................................................... 1921
9.6.2 How to Check MyISAM Tables for Errors .............................................................. 1921
9.6.3 How to Repair MyISAM Tables ............................................................................. 1922
9.6.4 MyISAM Table Optimization .................................................................................. 1924
9.6.5 Setting Up a MyISAM Table Maintenance Schedule ............................................... 1925
10 Optimization ............................................................................................................................. 1927
10.1 Optimization Overview ................................................................................................... 1929
10.2 Optimizing SQL Statements ........................................................................................... 1930
10.2.1 Optimizing SELECT Statements .......................................................................... 1930
10.2.2 Optimizing Subqueries, Derived Tables, View References, and Common Table
Expressions .................................................................................................................. 1985
10.2.3 Optimizing INFORMATION_SCHEMA Queries ..................................................... 2000
10.2.4 Optimizing Performance Schema Queries ............................................................ 2002
10.2.5 Optimizing Data Change Statements ................................................................... 2004
10.2.6 Optimizing Database Privileges ........................................................................... 2005
10.2.7 Other Optimization Tips ...................................................................................... 2006
10.3 Optimization and Indexes .............................................................................................. 2006
10.3.1 How MySQL Uses Indexes ................................................................................. 2007
10.3.2 Primary Key Optimization ................................................................................... 2008

viii
MySQL 8.0 Reference Manual

10.3.3 SPATIAL Index Optimization ............................................................................... 2008


10.3.4 Foreign Key Optimization .................................................................................... 2009
10.3.5 Column Indexes ................................................................................................. 2009
10.3.6 Multiple-Column Indexes ..................................................................................... 2010
10.3.7 Verifying Index Usage ........................................................................................ 2012
10.3.8 InnoDB and MyISAM Index Statistics Collection ................................................... 2012
10.3.9 Comparison of B-Tree and Hash Indexes ............................................................ 2014
10.3.10 Use of Index Extensions ................................................................................... 2015
10.3.11 Optimizer Use of Generated Column Indexes .................................................... 2017
10.3.12 Invisible Indexes ............................................................................................... 2019
10.3.13 Descending Indexes ......................................................................................... 2021
10.3.14 Indexed Lookups from TIMESTAMP Columns .................................................... 2022
10.4 Optimizing Database Structure ...................................................................................... 2024
10.4.1 Optimizing Data Size .......................................................................................... 2024
10.4.2 Optimizing MySQL Data Types ........................................................................... 2026
10.4.3 Optimizing for Many Tables ................................................................................ 2028
10.4.4 Internal Temporary Table Use in MySQL ............................................................. 2029
10.4.5 Limits on Number of Databases and Tables ........................................................ 2033
10.4.6 Limits on Table Size ........................................................................................... 2033
10.4.7 Limits on Table Column Count and Row Size ...................................................... 2035
10.5 Optimizing for InnoDB Tables ........................................................................................ 2037
10.5.1 Optimizing Storage Layout for InnoDB Tables ...................................................... 2037
10.5.2 Optimizing InnoDB Transaction Management ....................................................... 2038
10.5.3 Optimizing InnoDB Read-Only Transactions ........................................................ 2039
10.5.4 Optimizing InnoDB Redo Logging ....................................................................... 2040
10.5.5 Bulk Data Loading for InnoDB Tables ................................................................. 2041
10.5.6 Optimizing InnoDB Queries ................................................................................. 2043
10.5.7 Optimizing InnoDB DDL Operations .................................................................... 2043
10.5.8 Optimizing InnoDB Disk I/O ................................................................................ 2044
10.5.9 Optimizing InnoDB Configuration Variables .......................................................... 2047
10.5.10 Optimizing InnoDB for Systems with Many Tables .............................................. 2049
10.6 Optimizing for MyISAM Tables ....................................................................................... 2049
10.6.1 Optimizing MyISAM Queries ............................................................................... 2049
10.6.2 Bulk Data Loading for MyISAM Tables ................................................................ 2050
10.6.3 Optimizing REPAIR TABLE Statements ............................................................... 2051
10.7 Optimizing for MEMORY Tables .................................................................................... 2053
10.8 Understanding the Query Execution Plan ....................................................................... 2053
10.8.1 Optimizing Queries with EXPLAIN ....................................................................... 2053
10.8.2 EXPLAIN Output Format ..................................................................................... 2054
10.8.3 Extended EXPLAIN Output Format ..................................................................... 2068
10.8.4 Obtaining Execution Plan Information for a Named Connection ............................. 2071
10.8.5 Estimating Query Performance ............................................................................ 2071
10.9 Controlling the Query Optimizer ..................................................................................... 2072
10.9.1 Controlling Query Plan Evaluation ....................................................................... 2072
10.9.2 Switchable Optimizations .................................................................................... 2073
10.9.3 Optimizer Hints .................................................................................................. 2083
10.9.4 Index Hints ........................................................................................................ 2098
10.9.5 The Optimizer Cost Model .................................................................................. 2101
10.9.6 Optimizer Statistics ............................................................................................. 2105
10.10 Buffering and Caching ................................................................................................. 2108
10.10.1 InnoDB Buffer Pool Optimization ....................................................................... 2108
10.10.2 The MyISAM Key Cache .................................................................................. 2108
10.10.3 Caching of Prepared Statements and Stored Programs ...................................... 2113
10.11 Optimizing Locking Operations ..................................................................................... 2114

ix
MySQL 8.0 Reference Manual

10.11.1 Internal Locking Methods .................................................................................. 2114


10.11.2 Table Locking Issues ........................................................................................ 2117
10.11.3 Concurrent Inserts ............................................................................................ 2118
10.11.4 Metadata Locking ............................................................................................. 2119
10.11.5 External Locking ............................................................................................... 2123
10.12 Optimizing the MySQL Server ...................................................................................... 2124
10.12.1 Optimizing Disk I/O ........................................................................................... 2124
10.12.2 Using Symbolic Links ....................................................................................... 2125
10.12.3 Optimizing Memory Use .................................................................................... 2128
10.13 Measuring Performance (Benchmarking) ...................................................................... 2135
10.13.1 Measuring the Speed of Expressions and Functions ........................................... 2136
10.13.2 Using Your Own Benchmarks ........................................................................... 2136
10.13.3 Measuring Performance with performance_schema ............................................ 2137
10.14 Examining Server Thread (Process) Information ........................................................... 2137
10.14.1 Accessing the Process List ............................................................................... 2137
10.14.2 Thread Command Values ................................................................................. 2139
10.14.3 General Thread States ..................................................................................... 2141
10.14.4 Replication Source Thread States ..................................................................... 2148
10.14.5 Replication I/O (Receiver) Thread States ........................................................... 2148
10.14.6 Replication SQL Thread States ......................................................................... 2150
10.14.7 Replication Connection Thread States ............................................................... 2152
10.14.8 NDB Cluster Thread States ............................................................................... 2152
10.14.9 Event Scheduler Thread States ......................................................................... 2153
11 Language Structure ................................................................................................................. 2155
11.1 Literal Values ................................................................................................................ 2155
11.1.1 String Literals ..................................................................................................... 2155
11.1.2 Numeric Literals ................................................................................................. 2158
11.1.3 Date and Time Literals ....................................................................................... 2159
11.1.4 Hexadecimal Literals .......................................................................................... 2164
11.1.5 Bit-Value Literals ................................................................................................ 2166
11.1.6 Boolean Literals ................................................................................................. 2168
11.1.7 NULL Values ...................................................................................................... 2168
11.2 Schema Object Names ................................................................................................. 2168
11.2.1 Identifier Length Limits ....................................................................................... 2170
11.2.2 Identifier Qualifiers ............................................................................................. 2171
11.2.3 Identifier Case Sensitivity .................................................................................... 2173
11.2.4 Mapping of Identifiers to File Names ................................................................... 2174
11.2.5 Function Name Parsing and Resolution ............................................................... 2176
11.3 Keywords and Reserved Words ..................................................................................... 2180
11.4 User-Defined Variables .................................................................................................. 2213
11.5 Expressions .................................................................................................................. 2216
11.6 Query Attributes ............................................................................................................ 2220
11.7 Comments .................................................................................................................... 2223
12 Character Sets, Collations, Unicode .......................................................................................... 2227
12.1 Character Sets and Collations in General ....................................................................... 2228
12.2 Character Sets and Collations in MySQL ....................................................................... 2229
12.2.1 Character Set Repertoire .................................................................................... 2231
12.2.2 UTF-8 for Metadata ............................................................................................ 2233
12.3 Specifying Character Sets and Collations ....................................................................... 2234
12.3.1 Collation Naming Conventions ............................................................................ 2235
12.3.2 Server Character Set and Collation ..................................................................... 2236
12.3.3 Database Character Set and Collation ................................................................. 2236
12.3.4 Table Character Set and Collation ...................................................................... 2238
12.3.5 Column Character Set and Collation ................................................................... 2238

x
MySQL 8.0 Reference Manual

12.3.6 Character String Literal Character Set and Collation ............................................. 2240
12.3.7 The National Character Set ................................................................................ 2241
12.3.8 Character Set Introducers ................................................................................... 2242
12.3.9 Examples of Character Set and Collation Assignment .......................................... 2244
12.3.10 Compatibility with Other DBMSs ........................................................................ 2245
12.4 Connection Character Sets and Collations ..................................................................... 2245
12.5 Configuring Application Character Set and Collation ....................................................... 2251
12.6 Error Message Character Set ........................................................................................ 2253
12.7 Column Character Set Conversion ................................................................................. 2254
12.8 Collation Issues ............................................................................................................ 2255
12.8.1 Using COLLATE in SQL Statements ................................................................... 2255
12.8.2 COLLATE Clause Precedence ............................................................................ 2256
12.8.3 Character Set and Collation Compatibility ............................................................ 2256
12.8.4 Collation Coercibility in Expressions .................................................................... 2256
12.8.5 The binary Collation Compared to _bin Collations ................................................ 2258
12.8.6 Examples of the Effect of Collation ..................................................................... 2261
12.8.7 Using Collation in INFORMATION_SCHEMA Searches ........................................ 2262
12.9 Unicode Support ........................................................................................................... 2264
12.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding) .............................. 2266
12.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding) .............................. 2267
12.9.3 The utf8 Character Set (Deprecated alias for utf8mb3) ......................................... 2268
12.9.4 The ucs2 Character Set (UCS-2 Unicode Encoding) ............................................ 2268
12.9.5 The utf16 Character Set (UTF-16 Unicode Encoding) ........................................... 2268
12.9.6 The utf16le Character Set (UTF-16LE Unicode Encoding) .................................... 2269
12.9.7 The utf32 Character Set (UTF-32 Unicode Encoding) ........................................... 2269
12.9.8 Converting Between 3-Byte and 4-Byte Unicode Character Sets ........................... 2270
12.10 Supported Character Sets and Collations ..................................................................... 2272
12.10.1 Unicode Character Sets .................................................................................... 2273
12.10.2 West European Character Sets ......................................................................... 2281
12.10.3 Central European Character Sets ...................................................................... 2282
12.10.4 South European and Middle East Character Sets ............................................... 2283
12.10.5 Baltic Character Sets ........................................................................................ 2284
12.10.6 Cyrillic Character Sets ...................................................................................... 2284
12.10.7 Asian Character Sets ........................................................................................ 2285
12.10.8 The Binary Character Set ................................................................................. 2289
12.11 Restrictions on Character Sets ..................................................................................... 2291
12.12 Setting the Error Message Language ........................................................................... 2291
12.13 Adding a Character Set ............................................................................................... 2292
12.13.1 Character Definition Arrays ............................................................................... 2294
12.13.2 String Collating Support for Complex Character Sets .......................................... 2294
12.13.3 Multi-Byte Character Support for Complex Character Sets .................................. 2295
12.14 Adding a Collation to a Character Set .......................................................................... 2295
12.14.1 Collation Implementation Types ......................................................................... 2296
12.14.2 Choosing a Collation ID .................................................................................... 2299
12.14.3 Adding a Simple Collation to an 8-Bit Character Set ........................................... 2300
12.14.4 Adding a UCA Collation to a Unicode Character Set ........................................... 2301
12.15 Character Set Configuration ......................................................................................... 2308
12.16 MySQL Server Locale Support ..................................................................................... 2309
13 Data Types .............................................................................................................................. 2315
13.1 Numeric Data Types ..................................................................................................... 2316
13.1.1 Numeric Data Type Syntax ................................................................................. 2316
13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT,
BIGINT ......................................................................................................................... 2320
13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC ...................................... 2321

xi
MySQL 8.0 Reference Manual

13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE .............................. 2321


13.1.5 Bit-Value Type - BIT ........................................................................................... 2322
13.1.6 Numeric Type Attributes ..................................................................................... 2322
13.1.7 Out-of-Range and Overflow Handling .................................................................. 2323
13.2 Date and Time Data Types ........................................................................................... 2325
13.2.1 Date and Time Data Type Syntax ....................................................................... 2326
13.2.2 The DATE, DATETIME, and TIMESTAMP Types ................................................. 2328
13.2.3 The TIME Type .................................................................................................. 2330
13.2.4 The YEAR Type ................................................................................................. 2331
13.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME .................. 2331
13.2.6 Fractional Seconds in Time Values ..................................................................... 2335
13.2.7 What Calendar Is Used By MySQL? ................................................................... 2336
13.2.8 Conversion Between Date and Time Types ......................................................... 2336
13.2.9 2-Digit Years in Dates ........................................................................................ 2337
13.3 String Data Types ......................................................................................................... 2338
13.3.1 String Data Type Syntax ..................................................................................... 2338
13.3.2 The CHAR and VARCHAR Types ....................................................................... 2342
13.3.3 The BINARY and VARBINARY Types ................................................................. 2343
13.3.4 The BLOB and TEXT Types ............................................................................... 2345
13.3.5 The ENUM Type ................................................................................................ 2346
13.3.6 The SET Type ................................................................................................... 2349
13.4 Spatial Data Types ....................................................................................................... 2352
13.4.1 Spatial Data Types ............................................................................................. 2353
13.4.2 The OpenGIS Geometry Model ........................................................................... 2354
13.4.3 Supported Spatial Data Formats ......................................................................... 2360
13.4.4 Geometry Well-Formedness and Validity ............................................................. 2363
13.4.5 Spatial Reference System Support ...................................................................... 2364
13.4.6 Creating Spatial Columns ................................................................................... 2365
13.4.7 Populating Spatial Columns ................................................................................ 2365
13.4.8 Fetching Spatial Data ......................................................................................... 2367
13.4.9 Optimizing Spatial Analysis ................................................................................. 2367
13.4.10 Creating Spatial Indexes ................................................................................... 2367
13.4.11 Using Spatial Indexes ....................................................................................... 2368
13.5 The JSON Data Type ................................................................................................... 2370
13.6 Data Type Default Values ............................................................................................. 2387
13.7 Data Type Storage Requirements .................................................................................. 2390
13.8 Choosing the Right Type for a Column .......................................................................... 2395
13.9 Using Data Types from Other Database Engines ............................................................ 2395
14 Functions and Operators .......................................................................................................... 2397
14.1 Built-In Function and Operator Reference ....................................................................... 2399
14.2 Loadable Function Reference ........................................................................................ 2421
14.3 Type Conversion in Expression Evaluation ..................................................................... 2426
14.4 Operators ..................................................................................................................... 2429
14.4.1 Operator Precedence ......................................................................................... 2431
14.4.2 Comparison Functions and Operators ................................................................. 2432
14.4.3 Logical Operators ............................................................................................... 2438
14.4.4 Assignment Operators ........................................................................................ 2440
14.5 Flow Control Functions .................................................................................................. 2441
14.6 Numeric Functions and Operators .................................................................................. 2444
14.6.1 Arithmetic Operators ........................................................................................... 2446
14.6.2 Mathematical Functions ...................................................................................... 2448
14.7 Date and Time Functions .............................................................................................. 2457
14.8 String Functions and Operators ..................................................................................... 2481
14.8.1 String Comparison Functions and Operators ........................................................ 2498

xii
MySQL 8.0 Reference Manual

14.8.2 Regular Expressions ........................................................................................... 2502


14.8.3 Character Set and Collation of Function Results .................................................. 2512
14.9 Full-Text Search Functions ............................................................................................ 2513
14.9.1 Natural Language Full-Text Searches .................................................................. 2514
14.9.2 Boolean Full-Text Searches ................................................................................ 2518
14.9.3 Full-Text Searches with Query Expansion ............................................................ 2523
14.9.4 Full-Text Stopwords ............................................................................................ 2524
14.9.5 Full-Text Restrictions .......................................................................................... 2529
14.9.6 Fine-Tuning MySQL Full-Text Search .................................................................. 2530
14.9.7 Adding a User-Defined Collation for Full-Text Indexing ......................................... 2533
14.9.8 ngram Full-Text Parser ....................................................................................... 2534
14.9.9 MeCab Full-Text Parser Plugin ........................................................................... 2537
14.10 Cast Functions and Operators ..................................................................................... 2541
14.11 XML Functions ............................................................................................................ 2556
14.12 Bit Functions and Operators ........................................................................................ 2567
14.13 Encryption and Compression Functions ........................................................................ 2579
14.14 Locking Functions ....................................................................................................... 2588
14.15 Information Functions .................................................................................................. 2591
14.16 Spatial Analysis Functions ........................................................................................... 2603
14.16.1 Spatial Function Reference ............................................................................... 2603
14.16.2 Argument Handling by Spatial Functions ............................................................ 2607
14.16.3 Functions That Create Geometry Values from WKT Values ................................ 2608
14.16.4 Functions That Create Geometry Values from WKB Values ................................ 2610
14.16.5 MySQL-Specific Functions That Create Geometry Values ................................... 2612
14.16.6 Geometry Format Conversion Functions ............................................................ 2613
14.16.7 Geometry Property Functions ............................................................................ 2615
14.16.8 Spatial Operator Functions ................................................................................ 2629
14.16.9 Functions That Test Spatial Relations Between Geometry Objects ...................... 2637
14.16.10 Spatial Geohash Functions ............................................................................. 2645
14.16.11 Spatial GeoJSON Functions ............................................................................ 2647
14.16.12 Spatial Aggregate Functions ............................................................................ 2649
14.16.13 Spatial Convenience Functions ....................................................................... 2652
14.17 JSON Functions .......................................................................................................... 2657
14.17.1 JSON Function Reference ................................................................................ 2657
14.17.2 Functions That Create JSON Values ................................................................. 2659
14.17.3 Functions That Search JSON Values ................................................................ 2660
14.17.4 Functions That Modify JSON Values ................................................................. 2676
14.17.5 Functions That Return JSON Value Attributes .................................................... 2686
14.17.6 JSON Table Functions ...................................................................................... 2689
14.17.7 JSON Schema Validation Functions .................................................................. 2694
14.17.8 JSON Utility Functions ...................................................................................... 2700
14.18 Replication Functions .................................................................................................. 2705
14.18.1 Group Replication Functions ............................................................................. 2707
14.18.2 Functions Used with Global Transaction Identifiers (GTIDs) ................................ 2715
14.18.3 Asynchronous Replication Channel Failover Functions ....................................... 2717
14.18.4 Position-Based Synchronization Functions ......................................................... 2722
14.19 Aggregate Functions ................................................................................................... 2724
14.19.1 Aggregate Function Descriptions ....................................................................... 2724
14.19.2 GROUP BY Modifiers ....................................................................................... 2735
14.19.3 MySQL Handling of GROUP BY ....................................................................... 2741
14.19.4 Detection of Functional Dependence ................................................................. 2744
14.20 Window Functions ....................................................................................................... 2747
14.20.1 Window Function Descriptions .......................................................................... 2748
14.20.2 Window Function Concepts and Syntax ............................................................. 2754

xiii
MySQL 8.0 Reference Manual

14.20.3 Window Function Frame Specification ............................................................... 2758


14.20.4 Named Windows .............................................................................................. 2762
14.20.5 Window Function Restrictions ........................................................................... 2763
14.21 Performance Schema Functions .................................................................................. 2763
14.22 Internal Functions ........................................................................................................ 2766
14.23 Miscellaneous Functions .............................................................................................. 2768
14.24 Precision Math ............................................................................................................ 2783
14.24.1 Types of Numeric Values .................................................................................. 2783
14.24.2 DECIMAL Data Type Characteristics ................................................................. 2784
14.24.3 Expression Handling ......................................................................................... 2785
14.24.4 Rounding Behavior ........................................................................................... 2787
14.24.5 Precision Math Examples .................................................................................. 2788
15 SQL Statements ...................................................................................................................... 2793
15.1 Data Definition Statements ............................................................................................ 2795
15.1.1 Atomic Data Definition Statement Support ........................................................... 2795
15.1.2 ALTER DATABASE Statement ............................................................................ 2800
15.1.3 ALTER EVENT Statement .................................................................................. 2806
15.1.4 ALTER FUNCTION Statement ............................................................................ 2807
15.1.5 ALTER INSTANCE Statement ............................................................................ 2808
15.1.6 ALTER LOGFILE GROUP Statement .................................................................. 2810
15.1.7 ALTER PROCEDURE Statement ........................................................................ 2811
15.1.8 ALTER SERVER Statement ................................................................................ 2811
15.1.9 ALTER TABLE Statement ................................................................................... 2812
15.1.10 ALTER TABLESPACE Statement ...................................................................... 2836
15.1.11 ALTER VIEW Statement ................................................................................... 2838
15.1.12 CREATE DATABASE Statement ....................................................................... 2838
15.1.13 CREATE EVENT Statement .............................................................................. 2839
15.1.14 CREATE FUNCTION Statement ........................................................................ 2844
15.1.15 CREATE INDEX Statement .............................................................................. 2844
15.1.16 CREATE LOGFILE GROUP Statement ............................................................. 2859
15.1.17 CREATE PROCEDURE and CREATE FUNCTION Statements ........................... 2861
15.1.18 CREATE SERVER Statement ........................................................................... 2867
15.1.19 CREATE SPATIAL REFERENCE SYSTEM Statement ....................................... 2868
15.1.20 CREATE TABLE Statement .............................................................................. 2873
15.1.21 CREATE TABLESPACE Statement ................................................................... 2937
15.1.22 CREATE TRIGGER Statement .......................................................................... 2944
15.1.23 CREATE VIEW Statement ................................................................................ 2946
15.1.24 DROP DATABASE Statement ........................................................................... 2950
15.1.25 DROP EVENT Statement ................................................................................. 2951
15.1.26 DROP FUNCTION Statement ........................................................................... 2952
15.1.27 DROP INDEX Statement .................................................................................. 2952
15.1.28 DROP LOGFILE GROUP Statement ................................................................. 2952
15.1.29 DROP PROCEDURE and DROP FUNCTION Statements ................................... 2953
15.1.30 DROP SERVER Statement ............................................................................... 2953
15.1.31 DROP SPATIAL REFERENCE SYSTEM Statement ........................................... 2953
15.1.32 DROP TABLE Statement .................................................................................. 2954
15.1.33 DROP TABLESPACE Statement ....................................................................... 2955
15.1.34 DROP TRIGGER Statement ............................................................................. 2956
15.1.35 DROP VIEW Statement .................................................................................... 2956
15.1.36 RENAME TABLE Statement ............................................................................. 2957
15.1.37 TRUNCATE TABLE Statement .......................................................................... 2959
15.2 Data Manipulation Statements ....................................................................................... 2960
15.2.1 CALL Statement ................................................................................................. 2960
15.2.2 DELETE Statement ............................................................................................ 2962

xiv
MySQL 8.0 Reference Manual

15.2.3 DO Statement .................................................................................................... 2966


15.2.4 EXCEPT Clause ................................................................................................. 2966
15.2.5 HANDLER Statement ......................................................................................... 2968
15.2.6 IMPORT TABLE Statement ................................................................................ 2969
15.2.7 INSERT Statement ............................................................................................. 2972
15.2.8 INTERSECT Clause ........................................................................................... 2981
15.2.9 LOAD DATA Statement ...................................................................................... 2982
15.2.10 LOAD XML Statement ...................................................................................... 2994
15.2.11 Parenthesized Query Expressions ..................................................................... 3001
15.2.12 REPLACE Statement ........................................................................................ 3004
15.2.13 SELECT Statement .......................................................................................... 3007
15.2.14 Set Operations with UNION, INTERSECT, and EXCEPT .................................... 3023
15.2.15 Subqueries ....................................................................................................... 3028
15.2.16 TABLE Statement ............................................................................................. 3045
15.2.17 UPDATE Statement .......................................................................................... 3047
15.2.18 UNION Clause ................................................................................................. 3051
15.2.19 VALUES Statement .......................................................................................... 3052
15.2.20 WITH (Common Table Expressions) .................................................................. 3055
15.3 Transactional and Locking Statements ........................................................................... 3066
15.3.1 START TRANSACTION, COMMIT, and ROLLBACK Statements .......................... 3066
15.3.2 Statements That Cannot Be Rolled Back ............................................................. 3069
15.3.3 Statements That Cause an Implicit Commit ......................................................... 3070
15.3.4 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT
Statements ................................................................................................................... 3071
15.3.5 LOCK INSTANCE FOR BACKUP and UNLOCK INSTANCE Statements ............... 3071
15.3.6 LOCK TABLES and UNLOCK TABLES Statements ............................................. 3072
15.3.7 SET TRANSACTION Statement .......................................................................... 3078
15.3.8 XA Transactions ................................................................................................. 3081
15.4 Replication Statements .................................................................................................. 3086
15.4.1 SQL Statements for Controlling Source Servers ................................................... 3086
15.4.2 SQL Statements for Controlling Replica Servers .................................................. 3090
15.4.3 SQL Statements for Controlling Group Replication ............................................... 3132
15.5 Prepared Statements ..................................................................................................... 3134
15.5.1 PREPARE Statement ......................................................................................... 3138
15.5.2 EXECUTE Statement ......................................................................................... 3140
15.5.3 DEALLOCATE PREPARE Statement .................................................................. 3140
15.6 Compound Statement Syntax ........................................................................................ 3140
15.6.1 BEGIN ... END Compound Statement .................................................................. 3141
15.6.2 Statement Labels ............................................................................................... 3141
15.6.3 DECLARE Statement ......................................................................................... 3142
15.6.4 Variables in Stored Programs ............................................................................. 3142
15.6.5 Flow Control Statements ..................................................................................... 3144
15.6.6 Cursors .............................................................................................................. 3148
15.6.7 Condition Handling ............................................................................................. 3150
15.6.8 Restrictions on Condition Handling ...................................................................... 3178
15.7 Database Administration Statements .............................................................................. 3178
15.7.1 Account Management Statements ....................................................................... 3178
15.7.2 Resource Group Management Statements .......................................................... 3234
15.7.3 Table Maintenance Statements ........................................................................... 3237
15.7.4 Component, Plugin, and Loadable Function Statements ....................................... 3252
15.7.5 CLONE Statement .............................................................................................. 3257
15.7.6 SET Statements ................................................................................................. 3258
15.7.7 SHOW Statements ............................................................................................. 3264
15.7.8 Other Administrative Statements ......................................................................... 3323

xv
MySQL 8.0 Reference Manual

15.8 Utility Statements .......................................................................................................... 3337


15.8.1 DESCRIBE Statement ........................................................................................ 3337
15.8.2 EXPLAIN Statement ........................................................................................... 3337
15.8.3 HELP Statement ................................................................................................ 3343
15.8.4 USE Statement .................................................................................................. 3345
16 MySQL Data Dictionary ............................................................................................................ 3347
16.1 Data Dictionary Schema ................................................................................................ 3347
16.2 Removal of File-based Metadata Storage ....................................................................... 3349
16.3 Transactional Storage of Dictionary Data ....................................................................... 3349
16.4 Dictionary Object Cache ................................................................................................ 3349
16.5 INFORMATION_SCHEMA and Data Dictionary Integration .............................................. 3350
16.6 Serialized Dictionary Information (SDI) ........................................................................... 3352
16.7 Data Dictionary Usage Differences ................................................................................ 3353
16.8 Data Dictionary Limitations ............................................................................................ 3354
17 The InnoDB Storage Engine ..................................................................................................... 3355
17.1 Introduction to InnoDB ................................................................................................... 3356
17.1.1 Benefits of Using InnoDB Tables ........................................................................ 3358
17.1.2 Best Practices for InnoDB Tables ........................................................................ 3359
17.1.3 Verifying that InnoDB is the Default Storage Engine ............................................. 3360
17.1.4 Testing and Benchmarking with InnoDB .............................................................. 3360
17.2 InnoDB and the ACID Model ......................................................................................... 3360
17.3 InnoDB Multi-Versioning ................................................................................................ 3362
17.4 InnoDB Architecture ...................................................................................................... 3363
17.5 InnoDB In-Memory Structures ........................................................................................ 3364
17.5.1 Buffer Pool ......................................................................................................... 3364
17.5.2 Change Buffer .................................................................................................... 3369
17.5.3 Adaptive Hash Index .......................................................................................... 3373
17.5.4 Log Buffer .......................................................................................................... 3373
17.6 InnoDB On-Disk Structures ............................................................................................ 3374
17.6.1 Tables ............................................................................................................... 3374
17.6.2 Indexes .............................................................................................................. 3399
17.6.3 Tablespaces ....................................................................................................... 3407
17.6.4 Doublewrite Buffer .............................................................................................. 3430
17.6.5 Redo Log ........................................................................................................... 3432
17.6.6 Undo Logs ......................................................................................................... 3439
17.7 InnoDB Locking and Transaction Model ......................................................................... 3440
17.7.1 InnoDB Locking .................................................................................................. 3441
17.7.2 InnoDB Transaction Model .................................................................................. 3445
17.7.3 Locks Set by Different SQL Statements in InnoDB ............................................... 3454
17.7.4 Phantom Rows ................................................................................................... 3458
17.7.5 Deadlocks in InnoDB .......................................................................................... 3459
17.7.6 Transaction Scheduling ...................................................................................... 3465
17.8 InnoDB Configuration .................................................................................................... 3466
17.8.1 InnoDB Startup Configuration .............................................................................. 3466
17.8.2 Configuring InnoDB for Read-Only Operation ....................................................... 3472
17.8.3 InnoDB Buffer Pool Configuration ........................................................................ 3474
17.8.4 Configuring Thread Concurrency for InnoDB ........................................................ 3490
17.8.5 Configuring the Number of Background InnoDB I/O Threads ................................. 3491
17.8.6 Using Asynchronous I/O on Linux ....................................................................... 3491
17.8.7 Configuring InnoDB I/O Capacity ......................................................................... 3492
17.8.8 Configuring Spin Lock Polling ............................................................................. 3493
17.8.9 Purge Configuration ............................................................................................ 3494
17.8.10 Configuring Optimizer Statistics for InnoDB ........................................................ 3496
17.8.11 Configuring the Merge Threshold for Index Pages .............................................. 3507

xvi
MySQL 8.0 Reference Manual

17.8.12 Enabling Automatic Configuration for a Dedicated MySQL Server ........................ 3510
17.9 InnoDB Table and Page Compression ........................................................................... 3512
17.9.1 InnoDB Table Compression ................................................................................ 3513
17.9.2 InnoDB Page Compression ................................................................................. 3527
17.10 InnoDB Row Formats .................................................................................................. 3531
17.11 InnoDB Disk I/O and File Space Management .............................................................. 3537
17.11.1 InnoDB Disk I/O ............................................................................................... 3537
17.11.2 File Space Management ................................................................................... 3538
17.11.3 InnoDB Checkpoints ......................................................................................... 3540
17.11.4 Defragmenting a Table ..................................................................................... 3540
17.11.5 Reclaiming Disk Space with TRUNCATE TABLE ............................................... 3541
17.12 InnoDB and Online DDL .............................................................................................. 3541
17.12.1 Online DDL Operations ..................................................................................... 3542
17.12.2 Online DDL Performance and Concurrency ........................................................ 3558
17.12.3 Online DDL Space Requirements ...................................................................... 3562
17.12.4 Online DDL Memory Management ..................................................................... 3562
17.12.5 Configuring Parallel Threads for Online DDL Operations ..................................... 3563
17.12.6 Simplifying DDL Statements with Online DDL .................................................... 3563
17.12.7 Online DDL Failure Conditions .......................................................................... 3564
17.12.8 Online DDL Limitations ..................................................................................... 3564
17.13 InnoDB Data-at-Rest Encryption .................................................................................. 3565
17.14 InnoDB Startup Options and System Variables ............................................................. 3574
17.15 InnoDB INFORMATION_SCHEMA Tables .................................................................... 3670
17.15.1 InnoDB INFORMATION_SCHEMA Tables about Compression ........................... 3670
17.15.2 InnoDB INFORMATION_SCHEMA Transaction and Locking Information ............. 3672
17.15.3 InnoDB INFORMATION_SCHEMA Schema Object Tables ................................. 3679
17.15.4 InnoDB INFORMATION_SCHEMA FULLTEXT Index Tables .............................. 3685
17.15.5 InnoDB INFORMATION_SCHEMA Buffer Pool Tables ........................................ 3688
17.15.6 InnoDB INFORMATION_SCHEMA Metrics Table ............................................... 3693
17.15.7 InnoDB INFORMATION_SCHEMA Temporary Table Info Table .......................... 3702
17.15.8 Retrieving InnoDB Tablespace Metadata from INFORMATION_SCHEMA.FILES .. 3703
17.16 InnoDB Integration with MySQL Performance Schema .................................................. 3705
17.16.1 Monitoring ALTER TABLE Progress for InnoDB Tables Using Performance
Schema ........................................................................................................................ 3707
17.16.2 Monitoring InnoDB Mutex Waits Using Performance Schema .............................. 3708
17.17 InnoDB Monitors ......................................................................................................... 3712
17.17.1 InnoDB Monitor Types ...................................................................................... 3713
17.17.2 Enabling InnoDB Monitors ................................................................................ 3713
17.17.3 InnoDB Standard Monitor and Lock Monitor Output ............................................ 3715
17.18 InnoDB Backup and Recovery ..................................................................................... 3719
17.18.1 InnoDB Backup ................................................................................................ 3719
17.18.2 InnoDB Recovery ............................................................................................. 3720
17.19 InnoDB and MySQL Replication ................................................................................... 3723
17.20 InnoDB memcached Plugin .......................................................................................... 3725
17.20.1 Benefits of the InnoDB memcached Plugin ........................................................ 3725
17.20.2 InnoDB memcached Architecture ...................................................................... 3726
17.20.3 Setting Up the InnoDB memcached Plugin ........................................................ 3728
17.20.4 InnoDB memcached Multiple get and Range Query Support ............................... 3733
17.20.5 Security Considerations for the InnoDB memcached Plugin ................................ 3736
17.20.6 Writing Applications for the InnoDB memcached Plugin ...................................... 3738
17.20.7 The InnoDB memcached Plugin and Replication ................................................ 3750
17.20.8 InnoDB memcached Plugin Internals ................................................................. 3754
17.20.9 Troubleshooting the InnoDB memcached Plugin ................................................ 3759
17.21 InnoDB Troubleshooting .............................................................................................. 3761

xvii
MySQL 8.0 Reference Manual

17.21.1 Troubleshooting InnoDB I/O Problems ............................................................... 3761


17.21.2 Troubleshooting Recovery Failures .................................................................... 3762
17.21.3 Forcing InnoDB Recovery ................................................................................. 3762
17.21.4 Troubleshooting InnoDB Data Dictionary Operations .......................................... 3764
17.21.5 InnoDB Error Handling ...................................................................................... 3765
17.22 InnoDB Limits ............................................................................................................. 3766
17.23 InnoDB Restrictions and Limitations ............................................................................. 3767
18 Alternative Storage Engines ..................................................................................................... 3769
18.1 Setting the Storage Engine ............................................................................................ 3772
18.2 The MyISAM Storage Engine ........................................................................................ 3773
18.2.1 MyISAM Startup Options .................................................................................... 3776
18.2.2 Space Needed for Keys ..................................................................................... 3777
18.2.3 MyISAM Table Storage Formats ......................................................................... 3778
18.2.4 MyISAM Table Problems .................................................................................... 3780
18.3 The MEMORY Storage Engine ...................................................................................... 3782
18.4 The CSV Storage Engine .............................................................................................. 3787
18.4.1 Repairing and Checking CSV Tables .................................................................. 3787
18.4.2 CSV Limitations ................................................................................................. 3788
18.5 The ARCHIVE Storage Engine ...................................................................................... 3788
18.6 The BLACKHOLE Storage Engine ................................................................................. 3790
18.7 The MERGE Storage Engine ......................................................................................... 3792
18.7.1 MERGE Table Advantages and Disadvantages .................................................... 3795
18.7.2 MERGE Table Problems ..................................................................................... 3796
18.8 The FEDERATED Storage Engine ................................................................................. 3797
18.8.1 FEDERATED Storage Engine Overview .............................................................. 3798
18.8.2 How to Create FEDERATED Tables ................................................................... 3799
18.8.3 FEDERATED Storage Engine Notes and Tips ..................................................... 3801
18.8.4 FEDERATED Storage Engine Resources ............................................................ 3803
18.9 The EXAMPLE Storage Engine ..................................................................................... 3803
18.10 Other Storage Engines ................................................................................................ 3803
18.11 Overview of MySQL Storage Engine Architecture ......................................................... 3804
18.11.1 Pluggable Storage Engine Architecture .............................................................. 3805
18.11.2 The Common Database Server Layer ................................................................ 3805
19 Replication ............................................................................................................................... 3807
19.1 Configuring Replication .................................................................................................. 3809
19.1.1 Binary Log File Position Based Replication Configuration Overview ....................... 3809
19.1.2 Setting Up Binary Log File Position Based Replication ......................................... 3810
19.1.3 Replication with Global Transaction Identifiers ..................................................... 3822
19.1.4 Changing GTID Mode on Online Servers ............................................................. 3846
19.1.5 MySQL Multi-Source Replication ......................................................................... 3853
19.1.6 Replication and Binary Logging Options and Variables ......................................... 3859
19.1.7 Common Replication Administration Tasks .......................................................... 3982
19.2 Replication Implementation ............................................................................................ 3989
19.2.1 Replication Formats ............................................................................................ 3990
19.2.2 Replication Channels .......................................................................................... 3998
19.2.3 Replication Threads ............................................................................................ 4002
19.2.4 Relay Log and Replication Metadata Repositories ................................................ 4005
19.2.5 How Servers Evaluate Replication Filtering Rules ................................................ 4012
19.3 Replication Security ....................................................................................................... 4021
19.3.1 Setting Up Replication to Use Encrypted Connections .......................................... 4022
19.3.2 Encrypting Binary Log Files and Relay Log Files .................................................. 4024
19.3.3 Replication Privilege Checks ............................................................................... 4028
19.4 Replication Solutions ..................................................................................................... 4035
19.4.1 Using Replication for Backups ............................................................................ 4035

xviii
MySQL 8.0 Reference Manual

19.4.2 Handling an Unexpected Halt of a Replica ........................................................... 4039


19.4.3 Monitoring Row-based Replication ...................................................................... 4042
19.4.4 Using Replication with Different Source and Replica Storage Engines ................... 4042
19.4.5 Using Replication for Scale-Out .......................................................................... 4043
19.4.6 Replicating Different Databases to Different Replicas ........................................... 4045
19.4.7 Improving Replication Performance ..................................................................... 4046
19.4.8 Switching Sources During Failover ...................................................................... 4047
19.4.9 Switching Sources and Replicas with Asynchronous Connection Failover .............. 4049
19.4.10 Semisynchronous Replication ............................................................................ 4053
19.4.11 Delayed Replication .......................................................................................... 4060
19.5 Replication Notes and Tips ............................................................................................ 4063
19.5.1 Replication Features and Issues ......................................................................... 4063
19.5.2 Replication Compatibility Between MySQL Versions ............................................. 4091
19.5.3 Upgrading a Replication Topology ....................................................................... 4092
19.5.4 Troubleshooting Replication ................................................................................ 4094
19.5.5 How to Report Replication Bugs or Problems ...................................................... 4096
20 Group Replication .................................................................................................................... 4099
20.1 Group Replication Background ...................................................................................... 4101
20.1.1 Replication Technologies .................................................................................... 4101
20.1.2 Group Replication Use Cases ............................................................................. 4104
20.1.3 Multi-Primary and Single-Primary Modes ............................................................. 4105
20.1.4 Group Replication Services ................................................................................. 4110
20.1.5 Group Replication Plugin Architecture ................................................................. 4112
20.2 Getting Started .............................................................................................................. 4114
20.2.1 Deploying Group Replication in Single-Primary Mode ........................................... 4114
20.2.2 Deploying Group Replication Locally ................................................................... 4128
20.3 Requirements and Limitations ........................................................................................ 4129
20.3.1 Group Replication Requirements ......................................................................... 4129
20.3.2 Group Replication Limitations .............................................................................. 4132
20.4 Monitoring Group Replication ......................................................................................... 4135
20.4.1 GTIDs and Group Replication ............................................................................. 4136
20.4.2 Group Replication Server States ......................................................................... 4137
20.4.3 The replication_group_members Table ................................................................ 4138
20.4.4 The replication_group_member_stats Table ......................................................... 4139
20.5 Group Replication Operations ........................................................................................ 4139
20.5.1 Configuring an Online Group .............................................................................. 4139
20.5.2 Restarting a Group ............................................................................................. 4146
20.5.3 Transaction Consistency Guarantees .................................................................. 4147
20.5.4 Distributed Recovery .......................................................................................... 4154
20.5.5 Support For IPv6 And For Mixed IPv6 And IPv4 Groups ....................................... 4169
20.5.6 Using MySQL Enterprise Backup with Group Replication ...................................... 4171
20.6 Group Replication Security ............................................................................................ 4177
20.6.1 Communication Stack for Connection Security Management ................................. 4177
20.6.2 Securing Group Communication Connections with Secure Socket Layer (SSL) ....... 4180
20.6.3 Securing Distributed Recovery Connections ......................................................... 4183
20.6.4 Group Replication IP Address Permissions .......................................................... 4187
20.7 Group Replication Performance and Troubleshooting ...................................................... 4190
20.7.1 Fine Tuning the Group Communication Thread .................................................... 4190
20.7.2 Flow Control ...................................................................................................... 4191
20.7.3 Single Consensus Leader ................................................................................... 4192
20.7.4 Message Compression ....................................................................................... 4193
20.7.5 Message Fragmentation ..................................................................................... 4195
20.7.6 XCom Cache Management ................................................................................. 4196
20.7.7 Responses to Failure Detection and Network Partitioning ..................................... 4198

xix
MySQL 8.0 Reference Manual

20.7.8 Handling a Network Partition and Loss of Quorum ............................................... 4204


20.7.9 Monitoring Group Replication Memory Usage with Performance Schema Memory
Instrumentation ............................................................................................................. 4210
20.8 Upgrading Group Replication ......................................................................................... 4218
20.8.1 Combining Different Member Versions in a Group ................................................ 4219
20.8.2 Group Replication Offline Upgrade ...................................................................... 4221
20.8.3 Group Replication Online Upgrade ...................................................................... 4222
20.9 Group Replication Variables .......................................................................................... 4225
20.9.1 Group Replication System Variables ................................................................... 4227
20.9.2 Group Replication Status Variables ..................................................................... 4273
20.10 Frequently Asked Questions ........................................................................................ 4274
21 MySQL Shell ........................................................................................................................... 4279
22 Using MySQL as a Document Store ......................................................................................... 4281
22.1 Interfaces to a MySQL Document Store ......................................................................... 4282
22.2 Document Store Concepts ............................................................................................. 4282
22.3 JavaScript Quick-Start Guide: MySQL Shell for Document Store ...................................... 4283
22.3.1 MySQL Shell ...................................................................................................... 4284
22.3.2 Download and Import world_x Database .............................................................. 4285
22.3.3 Documents and Collections ................................................................................ 4286
22.3.4 Relational Tables ............................................................................................... 4298
22.3.5 Documents in Tables .......................................................................................... 4303
22.4 Python Quick-Start Guide: MySQL Shell for Document Store ........................................... 4304
22.4.1 MySQL Shell ...................................................................................................... 4305
22.4.2 Download and Import world_x Database .............................................................. 4306
22.4.3 Documents and Collections ................................................................................ 4307
22.4.4 Relational Tables ............................................................................................... 4319
22.4.5 Documents in Tables .......................................................................................... 4324
22.5 X Plugin ....................................................................................................................... 4325
22.5.1 Checking X Plugin Installation ............................................................................. 4325
22.5.2 Disabling X Plugin .............................................................................................. 4326
22.5.3 Using Encrypted Connections with X Plugin ......................................................... 4326
22.5.4 Using X Plugin with the Caching SHA-2 Authentication Plugin ............................... 4327
22.5.5 Connection Compression with X Plugin ............................................................... 4327
22.5.6 X Plugin Options and Variables .......................................................................... 4331
22.5.7 Monitoring X Plugin ............................................................................................ 4353
23 InnoDB Cluster ........................................................................................................................ 4355
24 InnoDB ReplicaSet ................................................................................................................... 4357
25 MySQL NDB Cluster 8.0 .......................................................................................................... 4359
25.1 General Information ....................................................................................................... 4361
25.2 NDB Cluster Overview .................................................................................................. 4363
25.2.1 NDB Cluster Core Concepts ............................................................................... 4365
25.2.2 NDB Cluster Nodes, Node Groups, Fragment Replicas, and Partitions ................... 4368
25.2.3 NDB Cluster Hardware, Software, and Networking Requirements .......................... 4371
25.2.4 What is New in MySQL NDB Cluster 8.0 ............................................................. 4372
25.2.5 Options, Variables, and Parameters Added, Deprecated or Removed in NDB 8.0 ... 4402
25.2.6 MySQL Server Using InnoDB Compared with NDB Cluster ................................... 4408
25.2.7 Known Limitations of NDB Cluster ...................................................................... 4411
25.3 NDB Cluster Installation ................................................................................................ 4423
25.3.1 Installation of NDB Cluster on Linux .................................................................... 4426
25.3.2 Installing NDB Cluster on Windows ..................................................................... 4436
25.3.3 Initial Configuration of NDB Cluster ..................................................................... 4445
25.3.4 Initial Startup of NDB Cluster .............................................................................. 4447
25.3.5 NDB Cluster Example with Tables and Data ........................................................ 4448
25.3.6 Safe Shutdown and Restart of NDB Cluster ......................................................... 4451

xx
MySQL 8.0 Reference Manual

25.3.7 Upgrading and Downgrading NDB Cluster ........................................................... 4452


25.3.8 The NDB Cluster Auto-Installer (NO LONGER SUPPORTED) ............................... 4458
25.4 Configuration of NDB Cluster ......................................................................................... 4458
25.4.1 Quick Test Setup of NDB Cluster ........................................................................ 4459
25.4.2 Overview of NDB Cluster Configuration Parameters, Options, and Variables .......... 4461
25.4.3 NDB Cluster Configuration Files .......................................................................... 4483
25.4.4 Using High-Speed Interconnects with NDB Cluster ............................................... 4697
25.5 NDB Cluster Programs .................................................................................................. 4697
25.5.1 ndbd — The NDB Cluster Data Node Daemon .................................................... 4698
25.5.2 ndbinfo_select_all — Select From ndbinfo Tables ................................................ 4709
25.5.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded) ........................ 4715
25.5.4 ndb_mgmd — The NDB Cluster Management Server Daemon ............................. 4716
25.5.5 ndb_mgm — The NDB Cluster Management Client .............................................. 4728
25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster
Tables .......................................................................................................................... 4735
25.5.7 ndb_config — Extract NDB Cluster Configuration Information ............................... 4741
25.5.8 ndb_delete_all — Delete All Rows from an NDB Table ......................................... 4754
25.5.9 ndb_desc — Describe NDB Tables ..................................................................... 4759
25.5.10 ndb_drop_index — Drop Index from an NDB Table ............................................ 4769
25.5.11 ndb_drop_table — Drop an NDB Table ............................................................. 4774
25.5.12 ndb_error_reporter — NDB Error-Reporting Utility .............................................. 4779
25.5.13 ndb_import — Import CSV Data Into NDB ......................................................... 4780
25.5.14 ndb_index_stat — NDB Index Statistics Utility .................................................... 4798
25.5.15 ndb_move_data — NDB Data Copy Utility ......................................................... 4806
25.5.16 ndb_perror — Obtain NDB Error Message Information ....................................... 4812
25.5.17 ndb_print_backup_file — Print NDB Backup File Contents .................................. 4815
25.5.18 ndb_print_file — Print NDB Disk Data File Contents ........................................... 4820
25.5.19 ndb_print_frag_file — Print NDB Fragment List File Contents .............................. 4822
25.5.20 ndb_print_schema_file — Print NDB Schema File Contents ................................ 4823
25.5.21 ndb_print_sys_file — Print NDB System File Contents ........................................ 4823
25.5.22 ndb_redo_log_reader — Check and Print Content of Cluster Redo Log ................ 4824
25.5.23 ndb_restore — Restore an NDB Cluster Backup ................................................ 4827
25.5.24 ndb_secretsfile_reader — Obtain Key Information from an Encrypted NDB Data
File ............................................................................................................................... 4862
25.5.25 ndb_select_all — Print Rows from an NDB Table ............................................... 4864
25.5.26 ndb_select_count — Print Row Counts for NDB Tables ...................................... 4871
25.5.27 ndb_show_tables — Display List of NDB Tables ................................................ 4876
25.5.28 ndb_size.pl — NDBCLUSTER Size Requirement Estimator ................................ 4881
25.5.29 ndb_top — View CPU usage information for NDB threads .................................. 4884
25.5.30 ndb_waiter — Wait for NDB Cluster to Reach a Given Status ............................. 4890
25.5.31 ndbxfrm — Compress, Decompress, Encrypt, and Decrypt Files Created by NDB
Cluster .......................................................................................................................... 4897
25.6 Management of NDB Cluster ......................................................................................... 4905
25.6.1 Commands in the NDB Cluster Management Client ............................................. 4906
25.6.2 NDB Cluster Log Messages ................................................................................ 4912
25.6.3 Event Reports Generated in NDB Cluster ............................................................ 4931
25.6.4 Summary of NDB Cluster Start Phases ............................................................... 4943
25.6.5 Performing a Rolling Restart of an NDB Cluster ................................................... 4945
25.6.6 NDB Cluster Single User Mode ........................................................................... 4947
25.6.7 Adding NDB Cluster Data Nodes Online .............................................................. 4948
25.6.8 Online Backup of NDB Cluster ............................................................................ 4959
25.6.9 Importing Data Into MySQL Cluster ..................................................................... 4966
25.6.10 MySQL Server Usage for NDB Cluster .............................................................. 4967
25.6.11 NDB Cluster Disk Data Tables .......................................................................... 4968

xxi
MySQL 8.0 Reference Manual

25.6.12 Online Operations with ALTER TABLE in NDB Cluster ....................................... 4975
25.6.13 Privilege Synchronization and NDB_STORED_USER ......................................... 4979
25.6.14 File System Encryption for NDB Cluster ............................................................ 4980
25.6.15 NDB API Statistics Counters and Variables ........................................................ 4983
25.6.16 ndbinfo: The NDB Cluster Information Database ................................................ 4995
25.6.17 INFORMATION_SCHEMA Tables for NDB Cluster ............................................. 5089
25.6.18 NDB Cluster and the Performance Schema ....................................................... 5090
25.6.19 Quick Reference: NDB Cluster SQL Statements ................................................ 5091
25.6.20 NDB Cluster Security Issues ............................................................................. 5098
25.7 NDB Cluster Replication ................................................................................................ 5105
25.7.1 NDB Cluster Replication: Abbreviations and Symbols ........................................... 5107
25.7.2 General Requirements for NDB Cluster Replication .............................................. 5108
25.7.3 Known Issues in NDB Cluster Replication ............................................................ 5109
25.7.4 NDB Cluster Replication Schema and Tables ...................................................... 5117
25.7.5 Preparing the NDB Cluster for Replication ........................................................... 5124
25.7.6 Starting NDB Cluster Replication (Single Replication Channel) .............................. 5127
25.7.7 Using Two Replication Channels for NDB Cluster Replication ............................... 5129
25.7.8 Implementing Failover with NDB Cluster Replication ............................................ 5130
25.7.9 NDB Cluster Backups With NDB Cluster Replication ............................................ 5131
25.7.10 NDB Cluster Replication: Bidirectional and Circular Replication ........................... 5138
25.7.11 NDB Cluster Replication Using the Multithreaded Applier .................................... 5143
25.7.12 NDB Cluster Replication Conflict Resolution ...................................................... 5146
25.8 NDB Cluster Release Notes .......................................................................................... 5164
26 Partitioning .............................................................................................................................. 5167
26.1 Overview of Partitioning in MySQL ................................................................................. 5168
26.2 Partitioning Types ......................................................................................................... 5171
26.2.1 RANGE Partitioning ............................................................................................ 5173
26.2.2 LIST Partitioning ................................................................................................. 5177
26.2.3 COLUMNS Partitioning ....................................................................................... 5179
26.2.4 HASH Partitioning .............................................................................................. 5187
26.2.5 KEY Partitioning ................................................................................................. 5190
26.2.6 Subpartitioning ................................................................................................... 5192
26.2.7 How MySQL Partitioning Handles NULL .............................................................. 5193
26.3 Partition Management ................................................................................................... 5198
26.3.1 Management of RANGE and LIST Partitions ........................................................ 5199
26.3.2 Management of HASH and KEY Partitions .......................................................... 5205
26.3.3 Exchanging Partitions and Subpartitions with Tables ............................................ 5206
26.3.4 Maintenance of Partitions ................................................................................... 5214
26.3.5 Obtaining Information About Partitions ................................................................. 5215
26.4 Partition Pruning ........................................................................................................... 5217
26.5 Partition Selection ......................................................................................................... 5220
26.6 Restrictions and Limitations on Partitioning ..................................................................... 5226
26.6.1 Partitioning Keys, Primary Keys, and Unique Keys ............................................... 5232
26.6.2 Partitioning Limitations Relating to Storage Engines ............................................. 5236
26.6.3 Partitioning Limitations Relating to Functions ....................................................... 5237
27 Stored Objects ......................................................................................................................... 5239
27.1 Defining Stored Programs ............................................................................................. 5240
27.2 Using Stored Routines .................................................................................................. 5241
27.2.1 Stored Routine Syntax ........................................................................................ 5242
27.2.2 Stored Routines and MySQL Privileges ............................................................... 5242
27.2.3 Stored Routine Metadata .................................................................................... 5243
27.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID() ......................... 5243
27.3 Using Triggers .............................................................................................................. 5244
27.3.1 Trigger Syntax and Examples ............................................................................. 5244

xxii
MySQL 8.0 Reference Manual

27.3.2 Trigger Metadata ................................................................................................ 5248


27.4 Using the Event Scheduler ............................................................................................ 5249
27.4.1 Event Scheduler Overview .................................................................................. 5249
27.4.2 Event Scheduler Configuration ............................................................................ 5250
27.4.3 Event Syntax ...................................................................................................... 5252
27.4.4 Event Metadata .................................................................................................. 5253
27.4.5 Event Scheduler Status ...................................................................................... 5253
27.4.6 The Event Scheduler and MySQL Privileges ........................................................ 5254
27.5 Using Views .................................................................................................................. 5257
27.5.1 View Syntax ....................................................................................................... 5257
27.5.2 View Processing Algorithms ................................................................................ 5257
27.5.3 Updatable and Insertable Views .......................................................................... 5259
27.5.4 The View WITH CHECK OPTION Clause ............................................................ 5261
27.5.5 View Metadata ................................................................................................... 5262
27.6 Stored Object Access Control ........................................................................................ 5262
27.7 Stored Program Binary Logging ..................................................................................... 5266
27.8 Restrictions on Stored Programs ................................................................................... 5273
27.9 Restrictions on Views .................................................................................................... 5276
28 INFORMATION_SCHEMA Tables ............................................................................................ 5279
28.1 Introduction ................................................................................................................... 5281
28.2 INFORMATION_SCHEMA Table Reference ................................................................... 5284
28.3 INFORMATION_SCHEMA General Tables ..................................................................... 5288
28.3.1 INFORMATION_SCHEMA General Table Reference ........................................... 5288
28.3.2 The INFORMATION_SCHEMA ADMINISTRABLE_ROLE_AUTHORIZATIONS
Table ............................................................................................................................ 5291
28.3.3 The INFORMATION_SCHEMA APPLICABLE_ROLES Table ................................ 5291
28.3.4 The INFORMATION_SCHEMA CHARACTER_SETS Table .................................. 5292
28.3.5 The INFORMATION_SCHEMA CHECK_CONSTRAINTS Table ............................ 5293
28.3.6 The INFORMATION_SCHEMA COLLATIONS Table ............................................ 5293
28.3.7 The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY
Table ............................................................................................................................ 5294
28.3.8 The INFORMATION_SCHEMA COLUMNS Table ................................................ 5294
28.3.9 The INFORMATION_SCHEMA COLUMNS_EXTENSIONS Table ......................... 5297
28.3.10 The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table ........................... 5298
28.3.11 The INFORMATION_SCHEMA COLUMN_STATISTICS Table ............................ 5298
28.3.12 The INFORMATION_SCHEMA ENABLED_ROLES Table ................................... 5299
28.3.13 The INFORMATION_SCHEMA ENGINES Table ................................................ 5299
28.3.14 The INFORMATION_SCHEMA EVENTS Table .................................................. 5300
28.3.15 The INFORMATION_SCHEMA FILES Table ...................................................... 5304
28.3.16 The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table ........................... 5312
28.3.17 The INFORMATION_SCHEMA KEYWORDS Table ............................................ 5313
28.3.18 The INFORMATION_SCHEMA ndb_transid_mysql_connection_map Table ......... 5314
28.3.19 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table ................................ 5315
28.3.20 The INFORMATION_SCHEMA PARAMETERS Table ........................................ 5316
28.3.21 The INFORMATION_SCHEMA PARTITIONS Table ........................................... 5317
28.3.22 The INFORMATION_SCHEMA PLUGINS Table ................................................ 5321
28.3.23 The INFORMATION_SCHEMA PROCESSLIST Table ........................................ 5322
28.3.24 The INFORMATION_SCHEMA PROFILING Table ............................................. 5323
28.3.25 The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table ............... 5325
28.3.26 The INFORMATION_SCHEMA RESOURCE_GROUPS Table ............................ 5326
28.3.27 The INFORMATION_SCHEMA ROLE_COLUMN_GRANTS Table ...................... 5326
28.3.28 The INFORMATION_SCHEMA ROLE_ROUTINE_GRANTS Table ...................... 5327
28.3.29 The INFORMATION_SCHEMA ROLE_TABLE_GRANTS Table .......................... 5328
28.3.30 The INFORMATION_SCHEMA ROUTINES Table .............................................. 5329

xxiii
MySQL 8.0 Reference Manual

28.3.31 The INFORMATION_SCHEMA SCHEMATA Table ............................................. 5331


28.3.32 The INFORMATION_SCHEMA SCHEMATA_EXTENSIONS Table ...................... 5332
28.3.33 The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table ........................... 5333
28.3.34 The INFORMATION_SCHEMA STATISTICS Table ............................................ 5334
28.3.35 The INFORMATION_SCHEMA ST_GEOMETRY_COLUMNS Table .................... 5336
28.3.36 The INFORMATION_SCHEMA ST_SPATIAL_REFERENCE_SYSTEMS Table .... 5337
28.3.37 The INFORMATION_SCHEMA ST_UNITS_OF_MEASURE Table ....................... 5338
28.3.38 The INFORMATION_SCHEMA TABLES Table .................................................. 5339
28.3.39 The INFORMATION_SCHEMA TABLES_EXTENSIONS Table ........................... 5343
28.3.40 The INFORMATION_SCHEMA TABLESPACES Table ....................................... 5343
28.3.41 The INFORMATION_SCHEMA TABLESPACES_EXTENSIONS Table ................ 5343
28.3.42 The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table ........................... 5344
28.3.43 The INFORMATION_SCHEMA TABLE_CONSTRAINTS_EXTENSIONS Table .... 5345
28.3.44 The INFORMATION_SCHEMA TABLE_PRIVILEGES Table ............................... 5345
28.3.45 The INFORMATION_SCHEMA TRIGGERS Table .............................................. 5346
28.3.46 The INFORMATION_SCHEMA USER_ATTRIBUTES Table ............................... 5348
28.3.47 The INFORMATION_SCHEMA USER_PRIVILEGES Table ................................ 5349
28.3.48 The INFORMATION_SCHEMA VIEWS Table .................................................... 5350
28.3.49 The INFORMATION_SCHEMA VIEW_ROUTINE_USAGE Table ......................... 5351
28.3.50 The INFORMATION_SCHEMA VIEW_TABLE_USAGE Table ............................. 5352
28.4 INFORMATION_SCHEMA InnoDB Tables ...................................................................... 5353
28.4.1 INFORMATION_SCHEMA InnoDB Table Reference ............................................ 5353
28.4.2 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE Table .......................... 5354
28.4.3 The INFORMATION_SCHEMA INNODB_BUFFER_PAGE_LRU Table .................. 5358
28.4.4 The INFORMATION_SCHEMA INNODB_BUFFER_POOL_STATS Table .............. 5361
28.4.5 The INFORMATION_SCHEMA INNODB_CACHED_INDEXES Table .................... 5365
28.4.6 The INFORMATION_SCHEMA INNODB_CMP and INNODB_CMP_RESET Tables 5366
28.4.7 The INFORMATION_SCHEMA INNODB_CMPMEM and
INNODB_CMPMEM_RESET Tables .............................................................................. 5367
28.4.8 The INFORMATION_SCHEMA INNODB_CMP_PER_INDEX and
INNODB_CMP_PER_INDEX_RESET Tables ................................................................. 5368
28.4.9 The INFORMATION_SCHEMA INNODB_COLUMNS Table .................................. 5370
28.4.10 The INFORMATION_SCHEMA INNODB_DATAFILES Table .............................. 5372
28.4.11 The INFORMATION_SCHEMA INNODB_FIELDS Table ..................................... 5372
28.4.12 The INFORMATION_SCHEMA INNODB_FOREIGN Table ................................. 5373
28.4.13 The INFORMATION_SCHEMA INNODB_FOREIGN_COLS Table ....................... 5374
28.4.14 The INFORMATION_SCHEMA INNODB_FT_BEING_DELETED Table ............... 5374
28.4.15 The INFORMATION_SCHEMA INNODB_FT_CONFIG Table .............................. 5375
28.4.16 The INFORMATION_SCHEMA INNODB_FT_DEFAULT_STOPWORD Table ...... 5376
28.4.17 The INFORMATION_SCHEMA INNODB_FT_DELETED Table ........................... 5377
28.4.18 The INFORMATION_SCHEMA INNODB_FT_INDEX_CACHE Table ................... 5378
28.4.19 The INFORMATION_SCHEMA INNODB_FT_INDEX_TABLE Table .................... 5380
28.4.20 The INFORMATION_SCHEMA INNODB_INDEXES Table .................................. 5381
28.4.21 The INFORMATION_SCHEMA INNODB_METRICS Table ................................. 5383
28.4.22 The INFORMATION_SCHEMA INNODB_SESSION_TEMP_TABLESPACES
Table ............................................................................................................................ 5385
28.4.23 The INFORMATION_SCHEMA INNODB_TABLES Table .................................... 5386
28.4.24 The INFORMATION_SCHEMA INNODB_TABLESPACES Table ......................... 5387
28.4.25 The INFORMATION_SCHEMA INNODB_TABLESPACES_BRIEF Table ............. 5390
28.4.26 The INFORMATION_SCHEMA INNODB_TABLESTATS View ............................ 5391
28.4.27 The INFORMATION_SCHEMA INNODB_TEMP_TABLE_INFO Table ................. 5392
28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table .......................................... 5393
28.4.29 The INFORMATION_SCHEMA INNODB_VIRTUAL Table .................................. 5396
28.5 INFORMATION_SCHEMA Thread Pool Tables .............................................................. 5397

xxiv
MySQL 8.0 Reference Manual

28.5.1 INFORMATION_SCHEMA Thread Pool Table Reference ..................................... 5398


28.5.2 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATE Table ................... 5398
28.5.3 The INFORMATION_SCHEMA TP_THREAD_GROUP_STATS Table ................... 5398
28.5.4 The INFORMATION_SCHEMA TP_THREAD_STATE Table ................................. 5399
28.6 INFORMATION_SCHEMA Connection-Control Tables .................................................... 5399
28.6.1 INFORMATION_SCHEMA Connection-Control Table Reference ........................... 5399
28.6.2 The INFORMATION_SCHEMA
CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS Table ..................................... 5400
28.7 INFORMATION_SCHEMA MySQL Enterprise Firewall Tables ......................................... 5400
28.7.1 INFORMATION_SCHEMA Firewall Table Reference ............................................ 5400
28.7.2 The INFORMATION_SCHEMA MYSQL_FIREWALL_USERS Table ...................... 5400
28.7.3 The INFORMATION_SCHEMA MYSQL_FIREWALL_WHITELIST Table ................ 5401
28.8 Extensions to SHOW Statements .................................................................................. 5401
29 MySQL Performance Schema .................................................................................................. 5405
29.1 Performance Schema Quick Start .................................................................................. 5407
29.2 Performance Schema Build Configuration ...................................................................... 5413
29.3 Performance Schema Startup Configuration ................................................................... 5414
29.4 Performance Schema Runtime Configuration ................................................................. 5416
29.4.1 Performance Schema Event Timing .................................................................... 5416
29.4.2 Performance Schema Event Filtering ................................................................... 5419
29.4.3 Event Pre-Filtering .............................................................................................. 5421
29.4.4 Pre-Filtering by Instrument .................................................................................. 5421
29.4.5 Pre-Filtering by Object ........................................................................................ 5423
29.4.6 Pre-Filtering by Thread ....................................................................................... 5425
29.4.7 Pre-Filtering by Consumer .................................................................................. 5427
29.4.8 Example Consumer Configurations ..................................................................... 5430
29.4.9 Naming Instruments or Consumers for Filtering Operations ................................... 5435
29.4.10 Determining What Is Instrumented ..................................................................... 5435
29.5 Performance Schema Queries ....................................................................................... 5436
29.6 Performance Schema Instrument Naming Conventions ................................................... 5436
29.7 Performance Schema Status Monitoring ......................................................................... 5440
29.8 Performance Schema Atom and Molecule Events ........................................................... 5443
29.9 Performance Schema Tables for Current and Historical Events ....................................... 5444
29.10 Performance Schema Statement Digests and Sampling ................................................ 5445
29.11 Performance Schema General Table Characteristics ..................................................... 5450
29.12 Performance Schema Table Descriptions ..................................................................... 5451
29.12.1 Performance Schema Table Reference ............................................................. 5451
29.12.2 Performance Schema Setup Tables .................................................................. 5456
29.12.3 Performance Schema Instance Tables .............................................................. 5466
29.12.4 Performance Schema Wait Event Tables ........................................................... 5471
29.12.5 Performance Schema Stage Event Tables ......................................................... 5477
29.12.6 Performance Schema Statement Event Tables .................................................. 5482
29.12.7 Performance Schema Transaction Tables .......................................................... 5494
29.12.8 Performance Schema Connection Tables .......................................................... 5502
29.12.9 Performance Schema Connection Attribute Tables ............................................. 5506
29.12.10 Performance Schema User-Defined Variable Tables ......................................... 5511
29.12.11 Performance Schema Replication Tables ......................................................... 5511
29.12.12 Performance Schema NDB Cluster Tables ....................................................... 5536
29.12.13 Performance Schema Lock Tables .................................................................. 5539
29.12.14 Performance Schema System Variable Tables ................................................. 5549
29.12.15 Performance Schema Status Variable Tables ................................................... 5554
29.12.16 Performance Schema Thread Pool Tables ....................................................... 5555
29.12.17 Performance Schema Firewall Tables .............................................................. 5561
29.12.18 Performance Schema Keyring Tables .............................................................. 5563

xxv
MySQL 8.0 Reference Manual

29.12.19 Performance Schema Clone Tables ................................................................ 5564


29.12.20 Performance Schema Summary Tables ........................................................... 5567
29.12.21 Performance Schema Miscellaneous Tables .................................................... 5596
29.13 Performance Schema Option and Variable Reference ................................................... 5617
29.14 Performance Schema Command Options ..................................................................... 5620
29.15 Performance Schema System Variables ....................................................................... 5622
29.16 Performance Schema Status Variables ........................................................................ 5642
29.17 The Performance Schema Memory-Allocation Model ..................................................... 5646
29.18 Performance Schema and Plugins ............................................................................... 5647
29.19 Using the Performance Schema to Diagnose Problems ................................................. 5647
29.19.1 Query Profiling Using Performance Schema ...................................................... 5648
29.19.2 Obtaining Parent Event Information ................................................................... 5650
29.20 Restrictions on Performance Schema ........................................................................... 5652
30 MySQL sys Schema ................................................................................................................ 5653
30.1 Prerequisites for Using the sys Schema ......................................................................... 5653
30.2 Using the sys Schema .................................................................................................. 5654
30.3 sys Schema Progress Reporting .................................................................................... 5655
30.4 sys Schema Object Reference ....................................................................................... 5656
30.4.1 sys Schema Object Index ................................................................................... 5656
30.4.2 sys Schema Tables and Triggers ........................................................................ 5661
30.4.3 sys Schema Views ............................................................................................. 5664
30.4.4 sys Schema Stored Procedures .......................................................................... 5706
30.4.5 sys Schema Stored Functions ............................................................................. 5726
31 Connectors and APIs ............................................................................................................... 5739
31.1 MySQL Connector/C++ ................................................................................................. 5741
31.2 MySQL Connector/J ...................................................................................................... 5742
31.3 MySQL Connector/NET ................................................................................................. 5742
31.4 MySQL Connector/ODBC .............................................................................................. 5742
31.5 MySQL Connector/Python ............................................................................................. 5742
31.6 MySQL Connector/Node.js ............................................................................................ 5742
31.7 MySQL C API ............................................................................................................... 5742
31.8 MySQL PHP API .......................................................................................................... 5743
31.9 MySQL Perl API ........................................................................................................... 5743
31.10 MySQL Python API ..................................................................................................... 5743
31.11 MySQL Ruby APIs ...................................................................................................... 5744
31.11.1 The MySQL/Ruby API ...................................................................................... 5744
31.11.2 The Ruby/MySQL API ...................................................................................... 5744
31.12 MySQL Tcl API ........................................................................................................... 5744
31.13 MySQL Eiffel Wrapper ................................................................................................. 5744
32 MySQL Enterprise Edition ........................................................................................................ 5745
32.1 MySQL Enterprise Backup Overview .............................................................................. 5745
32.2 MySQL Enterprise Security Overview ............................................................................. 5746
32.3 MySQL Enterprise Encryption Overview ......................................................................... 5746
32.4 MySQL Enterprise Audit Overview ................................................................................. 5747
32.5 MySQL Enterprise Firewall Overview ............................................................................. 5747
32.6 MySQL Enterprise Thread Pool Overview ...................................................................... 5747
32.7 MySQL Enterprise Data Masking and De-Identification Overview ..................................... 5747
32.8 MySQL Enterprise Monitor Overview .............................................................................. 5748
32.9 MySQL Telemetry ......................................................................................................... 5749
33 MySQL Workbench .................................................................................................................. 5751
34 MySQL on the OCI Marketplace ............................................................................................... 5753
34.1 Prerequisites to Deploying MySQL EE on Oracle Cloud Infrastructure .............................. 5753
34.2 Deploying MySQL EE on Oracle Cloud Infrastructure ...................................................... 5753
34.3 Configuring Network Access .......................................................................................... 5755

xxvi
MySQL 8.0 Reference Manual

34.4 Connecting ................................................................................................................... 5755


34.5 Maintenance ................................................................................................................. 5756
A MySQL 8.0 Frequently Asked Questions .................................................................................... 5757
A.1 MySQL 8.0 FAQ: General ............................................................................................... 5757
A.2 MySQL 8.0 FAQ: Storage Engines .................................................................................. 5759
A.3 MySQL 8.0 FAQ: Server SQL Mode ................................................................................ 5760
A.4 MySQL 8.0 FAQ: Stored Procedures and Functions ......................................................... 5761
A.5 MySQL 8.0 FAQ: Triggers .............................................................................................. 5765
A.6 MySQL 8.0 FAQ: Views .................................................................................................. 5767
A.7 MySQL 8.0 FAQ: INFORMATION_SCHEMA .................................................................... 5768
A.8 MySQL 8.0 FAQ: Migration ............................................................................................. 5768
A.9 MySQL 8.0 FAQ: Security ............................................................................................... 5769
A.10 MySQL 8.0 FAQ: NDB Cluster ...................................................................................... 5772
A.11 MySQL 8.0 FAQ: MySQL Chinese, Japanese, and Korean Character Sets ...................... 5785
A.12 MySQL 8.0 FAQ: Connectors & APIs ............................................................................ 5796
A.13 MySQL 8.0 FAQ: C API, libmysql .................................................................................. 5796
A.14 MySQL 8.0 FAQ: Replication ........................................................................................ 5797
A.15 MySQL 8.0 FAQ: MySQL Enterprise Thread Pool .......................................................... 5801
A.16 MySQL 8.0 FAQ: InnoDB Change Buffer ....................................................................... 5802
A.17 MySQL 8.0 FAQ: InnoDB Data-at-Rest Encryption ......................................................... 5804
A.18 MySQL 8.0 FAQ: Virtualization Support ......................................................................... 5806
B Error Messages and Common Problems .................................................................................... 5807
B.1 Error Message Sources and Elements ............................................................................. 5807
B.2 Error Information Interfaces ............................................................................................. 5810
B.3 Problems and Common Errors ........................................................................................ 5811
B.3.1 How to Determine What Is Causing a Problem ...................................................... 5811
B.3.2 Common Errors When Using MySQL Programs .................................................... 5813
B.3.3 Administration-Related Issues ............................................................................... 5824
B.3.4 Query-Related Issues ........................................................................................... 5832
B.3.5 Optimizer-Related Issues ..................................................................................... 5839
B.3.6 Table Definition-Related Issues ............................................................................ 5840
B.3.7 Known Issues in MySQL ...................................................................................... 5841
C Indexes ..................................................................................................................................... 5845
MySQL Glossary ........................................................................................................................... 6701

xxvii
xxviii
Preface and Legal Notices
This is the Reference Manual for the MySQL Database System, version 8.0, through release 8.0.36.
Differences between minor versions of MySQL 8.0 are noted in the present text with reference to release
numbers (8.0.x). For license information, see the Legal Notices.

This manual is not intended for use with older versions of the MySQL software due to the many functional
and other differences between MySQL 8.0 and previous versions. If you are using an earlier release of
the MySQL software, please refer to the appropriate manual. For example, MySQL 5.7 Reference Manual
covers the 5.7 series of MySQL software releases.

Licensing information—MySQL 8.0. This product may include third-party software, used under
license. If you are using a Commercial release of MySQL 8.0, see the MySQL 8.0 Commercial Release
License Information User Manual for licensing information, including licensing information relating to third-
party software that may be included in this Commercial release. If you are using a Community release
of MySQL 8.0, see the MySQL 8.0 Community Release License Information User Manual for licensing
information, including licensing information relating to third-party software that may be included in this
Community release.

Licensing information—MySQL NDB Cluster 8.0. If you are using a Commercial release of MySQL
NDB Cluster 8.0, see the MySQL NDB Cluster 8.0 Commercial Release License Information User Manual
for licensing information, including licensing information relating to third-party software that may be
included in this Commercial release. If you are using a Community release of MySQL NDB Cluster 8.0,
see the MySQL NDB Cluster 8.0 Community Release License Information User Manual for licensing
information, including licensing information relating to third-party software that may be included in this
Community release.

Legal Notices
Copyright © 1997, 2024, Oracle and/or its affiliates.

License Restrictions

This software and related documentation are provided under a license agreement containing restrictions
on use and disclosure and are protected by intellectual property laws. Except as expressly permitted
in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast,
modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any
means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for
interoperability, is prohibited.

Warranty Disclaimer

The information contained herein is subject to change without notice and is not warranted to be error-free.
If you find any errors, please report them to us in writing.

Restricted Rights Notice

If this is software, software documentation, data (as defined in the Federal Acquisition Regulation), or
related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S.
Government, then the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated
software, any programs embedded, installed, or activated on delivered hardware, and modifications
of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed
by U.S. Government end users are "commercial computer software," "commercial computer software
documentation," or "limited rights data" pursuant to the applicable Federal Acquisition Regulation and

xxix
Documentation Accessibility

agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display,
disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including
any operating system, integrated software, any programs embedded, installed, or activated on delivered
hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle
data, is subject to the rights and limitations specified in the license contained in the applicable contract.
The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable
contract for such services. No other rights are granted to the U.S. Government.

Hazardous Applications Notice

This software or hardware is developed for general use in a variety of information management
applications. It is not developed or intended for use in any inherently dangerous applications, including
applications that may create a risk of personal injury. If you use this software or hardware in dangerous
applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other
measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages
caused by use of this software or hardware in dangerous applications.

Trademark Notice

Oracle, Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates. Other names
may be trademarks of their respective owners.

Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks
are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,
Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a
registered trademark of The Open Group.

Third-Party Content, Products, and Services Disclaimer

This software or hardware and documentation may provide access to or information about content,
products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and
expressly disclaim all warranties of any kind with respect to third-party content, products, and services
unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its
affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of
third-party content, products, or services, except as set forth in an applicable agreement between you and
Oracle.

Use of This Documentation

This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the
following terms:

You may create a printed copy of this documentation solely for your own personal use. Conversion to other
formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish
or distribute this documentation in any form or on any media, except if you distribute the documentation in
a manner similar to how Oracle disseminates it (that is, electronically for download on a Web site with the
software) or on a CD-ROM or similar medium, provided however that the documentation is disseminated
together with the software on the same medium. Any other use, such as any dissemination of printed
copies or use of this documentation, in whole or in part, in another publication, requires the prior written
consent from an authorized representative of Oracle. Oracle and/or its affiliates reserve any and all rights
to this documentation not expressly granted above.

Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website
at

xxx

You might also like