MySQL 9.1 Reference Manual

Including MySQL NDB Cluster 9.1

Abstract

This is the MySQL Reference Manual. It documents MySQL 9.1 (9.1.0), as well as NDB Cluster 9.1 (9.1.0), 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 9.1 Release Notes.

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

For notes detailing the changes in each release, see the MySQL 9.1 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: 2025-04-15 (revision: 81637)


Table of Contents

Preface and Legal Notices
1 General Information
1.1 About This Manual
1.2 Overview of the MySQL Database Management System
1.2.1 What is MySQL?
1.2.2 The Main Features of MySQL
1.2.3 History of MySQL
1.3 MySQL Releases: Innovation and LTS
1.4 What Is New in MySQL 9.1
1.5 Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 9.1
1.6 How to Report Bugs or Problems
1.7 MySQL Standards Compliance
1.7.1 MySQL Extensions to Standard SQL
1.7.2 MySQL Differences from Standard SQL
1.7.3 How MySQL Deals with Constraints
2 Installing MySQL
2.1 General Installation Guidance
2.1.1 Supported Platforms
2.1.2 Which MySQL Version and Distribution to Install
2.1.3 How to Get MySQL
2.1.4 Verifying Package Integrity Using MD5 Checksums or GnuPG
2.1.5 Installation Layouts
2.1.6 Compiler-Specific Build Characteristics
2.2 Installing MySQL on Unix/Linux Using Generic Binaries
2.3 Installing MySQL on Microsoft Windows
2.3.1 Choosing an Installation Package
2.3.2 Configuration: Using MySQL Configurator
2.3.3 Configuration: Manually
2.3.4 Troubleshooting a Microsoft Windows MySQL Server Installation
2.3.5 Windows Postinstallation Procedures
2.3.6 Windows Platform Restrictions
2.4 Installing MySQL on macOS
2.4.1 General Notes on Installing MySQL on macOS
2.4.2 Installing MySQL on macOS Using Native Packages
2.4.3 Installing and Using the MySQL Launch Daemon
2.4.4 Installing and Using the MySQL Preference Pane
2.5 Installing MySQL on Linux
2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository
2.5.2 Installing MySQL on Linux Using the MySQL APT Repository
2.5.3 Using the MySQL SLES Repository
2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle
2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle
2.5.6 Deploying MySQL on Linux with Docker Containers
2.5.7 Installing MySQL on Linux from the Native Software Repositories
2.5.8 Installing MySQL on Linux with Juju
2.5.9 Managing MySQL Server with systemd
2.6 Installing MySQL Using Unbreakable Linux Network (ULN)
2.7 Installing MySQL on Solaris
2.7.1 Installing MySQL on Solaris Using a Solaris PKG
2.8 Installing MySQL from Source
2.8.1 Source Installation Methods
2.8.2 Source Installation Prerequisites
2.8.3 MySQL Layout for Source Installation
2.8.4 Installing MySQL Using a Standard Source Distribution
2.8.5 Installing MySQL Using a Development Source Tree
2.8.6 Configuring SSL Library Support
2.8.7 MySQL Source-Configuration Options
2.8.8 Dealing with Problems Compiling MySQL
2.8.9 MySQL Configuration and Third-Party Tools
2.8.10 Generating MySQL Doxygen Documentation Content
2.9 Postinstallation Setup and Testing
2.9.1 Initializing the Data Directory
2.9.2 Starting the Server
2.9.3 Testing the Server
2.9.4 Securing the Initial MySQL Account
2.9.5 Starting and Stopping MySQL Automatically
2.10 Perl Installation Notes
2.10.1 Installing Perl on Unix
2.10.2 Installing ActiveState Perl on Windows
2.10.3 Problems Using the Perl DBI/DBD Interface
3 Upgrading MySQL
3.1 Before You Begin
3.2 Upgrade Paths
3.3 Upgrade Best Practices
3.4 What the MySQL Upgrade Process Upgrades
3.5 Changes in MySQL 9.1
3.6 Preparing Your Installation for Upgrade
3.7 Upgrading MySQL Binary or Package-based Installations on Unix/Linux
3.8 Upgrading MySQL with the MySQL Yum Repository
3.9 Upgrading MySQL with the MySQL APT Repository
3.10 Upgrading MySQL with the MySQL SLES Repository
3.11 Upgrading MySQL on Windows
3.12 Upgrading a Docker Installation of MySQL
3.13 Upgrade Troubleshooting
3.14 Rebuilding or Repairing Tables or Indexes
3.15 Copying MySQL Databases to Another Machine
4 Downgrading MySQL
5 Tutorial
5.1 Connecting to and Disconnecting from the Server
5.2 Entering Queries
5.3 Creating and Using a Database
5.3.1 Creating and Selecting a Database
5.3.2 Creating a Table
5.3.3 Loading Data into a Table
5.3.4 Retrieving Information from a Table
5.4 Getting Information About Databases and Tables
5.5 Using mysql in Batch Mode
5.6 Examples of Common Queries
5.6.1 The Maximum Value for a Column
5.6.2 The Row Holding the Maximum of a Certain Column
5.6.3 Maximum of Column per Group
5.6.4 The Rows Holding the Group-wise Maximum of a Certain Column
5.6.5 Using User-Defined Variables
5.6.6 Using Foreign Keys
5.6.7 Searching on Two Keys
5.6.8 Calculating Visits Per Day
5.6.9 Using AUTO_INCREMENT
5.7 Using MySQL with Apache
6 MySQL Programs
6.1 Overview of MySQL Programs
6.2 Using MySQL Programs
6.2.1 Invoking MySQL Programs
6.2.2 Specifying Program Options
6.2.3 Command Options for Connecting to the Server
6.2.4 Connecting to the MySQL Server Using Command Options
6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value Pairs
6.2.6 Connecting to the Server Using DNS SRV Records
6.2.7 Connection Transport Protocols
6.2.8 Connection Compression Control
6.2.9 Setting Environment Variables
6.3 Server and Server-Startup Programs
6.3.1 mysqld — The MySQL Server
6.3.2 mysqld_safe — MySQL Server Startup Script
6.3.3 mysql.server — MySQL Server Startup Script
6.3.4 mysqld_multi — Manage Multiple MySQL Servers
6.4 Installation-Related Programs
6.4.1 comp_err — Compile MySQL Error Message File
6.4.2 mysql_secure_installation — Improve MySQL Installation Security
6.4.3 mysql_tzinfo_to_sql — Load the Time Zone Tables
6.5 Client Programs
6.5.1 mysql — The MySQL Command-Line Client
6.5.2 mysqladmin — A MySQL Server Administration Program
6.5.3 mysqlcheck — A Table Maintenance Program
6.5.4 mysqldump — A Database Backup Program
6.5.5 mysqlimport — A Data Import Program
6.5.6 mysqlshow — Display Database, Table, and Column Information
6.5.7 mysqlslap — A Load Emulation Client
6.6 Administrative and Utility Programs
6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility
6.6.2 innochecksum — Offline InnoDB File Checksum Utility
6.6.3 myisam_ftdump — Display Full-Text Index information
6.6.4 myisamchk — MyISAM Table-Maintenance Utility
6.6.5 myisamlog — Display MyISAM Log File Contents
6.6.6 myisampack — Generate Compressed, Read-Only MyISAM Tables
6.6.7 mysql_config_editor — MySQL Configuration Utility
6.6.8 mysql_migrate_keyring — Keyring Key Migration Utility
6.6.9 mysqlbinlog — Utility for Processing Binary Log Files
6.6.10 mysqldumpslow — Summarize Slow Query Log Files
6.7 Program Development Utilities
6.7.1 mysql_config — Display Options for Compiling Clients
6.7.2 my_print_defaults — Display Options from Option Files
6.8 Miscellaneous Programs
6.8.1 perror — Display MySQL Error Message Information
6.9 Environment Variables
6.10 Unix Signal Handling in MySQL
7 MySQL Server Administration
7.1 The MySQL Server
7.1.1 Configuring the Server
7.1.2 Server Configuration Defaults
7.1.3 Server Configuration Validation
7.1.4 Server Option, System Variable, and Status Variable Reference
7.1.5 Server System Variable Reference
7.1.6 Server Status Variable Reference
7.1.7 Server Command Options
7.1.8 Server System Variables
7.1.9 Using System Variables
7.1.10 Server Status Variables
7.1.11 Server SQL Modes
7.1.12 Connection Management
7.1.13 IPv6 Support
7.1.14 Network Namespace Support
7.1.15 MySQL Server Time Zone Support
7.1.16 Resource Groups
7.1.17 Server-Side Help Support
7.1.18 Server Tracking of Client Session State
7.1.19 The Server Shutdown Process
7.2 The MySQL Data Directory
7.3 The mysql System Schema
7.4 MySQL Server Logs
7.4.1 Selecting General Query Log and Slow Query Log Output Destinations
7.4.2 The Error Log
7.4.3 The General Query Log
7.4.4 The Binary Log
7.4.5 The Slow Query Log
7.4.6 Server Log Maintenance
7.5 MySQL Components
7.5.1 Installing and Uninstalling Components
7.5.2 Obtaining Component Information
7.5.3 Error Log Components
7.5.4 Query Attribute Components
7.5.5 Scheduler Component
7.5.6 Replication Components
7.5.7 Multilingual Engine Component (MLE)
7.5.8 Option Tracker Component
7.6 MySQL Server Plugins
7.6.1 Installing and Uninstalling Plugins
7.6.2 Obtaining Server Plugin Information
7.6.3 MySQL Enterprise Thread Pool
7.6.4 The Rewriter Query Rewrite Plugin
7.6.5 The ddl_rewriter Plugin
7.6.6 Version Tokens
7.6.7 The Clone Plugin
7.6.8 The Keyring Proxy Bridge Plugin
7.6.9 MySQL Plugin Services
7.7 MySQL Server Loadable Functions
7.7.1 Installing and Uninstalling Loadable Functions
7.7.2 Obtaining Information About Loadable Functions
7.8 Running Multiple MySQL Instances on One Machine
7.8.1 Setting Up Multiple Data Directories
7.8.2 Running Multiple MySQL Instances on Windows
7.8.3 Running Multiple MySQL Instances on Unix
7.8.4 Using Client Programs in a Multiple-Server Environment
7.9 Debugging MySQL
7.9.1 Debugging a MySQL Server
7.9.2 Debugging a MySQL Client
7.9.3 The LOCK_ORDER Tool
7.9.4 The DBUG Package
8 Security
8.1 General Security Issues
8.1.1 Security Guidelines
8.1.2 Keeping Passwords Secure
8.1.3 Making MySQL Secure Against Attackers
8.1.4 Security-Related mysqld Options and Variables
8.1.5 How to Run MySQL as a Normal User
8.1.6 Security Considerations for LOAD DATA LOCAL
8.1.7 Client Programming Security Guidelines
8.2 Access Control and Account Management
8.2.1 Account User Names and Passwords
8.2.2 Privileges Provided by MySQL
8.2.3 Grant Tables
8.2.4 Specifying Account Names
8.2.5 Specifying Role Names
8.2.6 Access Control, Stage 1: Connection Verification
8.2.7 Access Control, Stage 2: Request Verification
8.2.8 Adding Accounts, Assigning Privileges, and Dropping Accounts