MySQL 5.1 Reference Manual

Copyright 1997-2007 MySQL AB

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 MySQL 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 MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly granted above.

Please email for more information or if you are interested in doing a translation.

Abstract

This is the MySQL Reference Manual. It documents MySQL 5.1 through 5.1.21-beta.

Document generated on: 2007-09-19 (revision: 7883)


Table of Contents

Preface
1. General Information
1.1. About This Manual
1.2. Conventions Used in This Manual
1.3. Overview of MySQL AB
1.4. Overview of the MySQL Database Management System
1.4.1. What is MySQL?
1.4.2. History of MySQL
1.4.3. The Main Features of MySQL
1.5. Overview of the MaxDB Database Management System
1.5.1. What is MaxDB?
1.5.2. History of MaxDB
1.5.3. Features of MaxDB
1.5.4. Licensing and Support
1.5.5. Feature Differences Between MaxDB and MySQL
1.5.6. Interoperability Features Between MaxDB and MySQL
1.5.7. MaxDB-Related Links
1.6. MySQL Development Roadmap
1.6.1. What's New in MySQL 5.1
1.6.2. What's Planned for MySQL 5.2
1.7. MySQL Information Sources
1.7.1. MySQL Mailing Lists
1.7.2. MySQL Community Support at the MySQL Forums
1.7.3. MySQL Community Support on Internet Relay Chat (IRC)
1.7.4. MySQL Enterprise
1.8. How to Report Bugs or Problems
1.9. MySQL Standards Compliance
1.9.1. What Standards MySQL Follows
1.9.2. Selecting SQL Modes
1.9.3. Running MySQL in ANSI Mode
1.9.4. MySQL Extensions to Standard SQL
1.9.5. MySQL Differences from Standard SQL
1.9.6. How MySQL Deals with Constraints
2. Installing and Upgrading MySQL
2.1. General Installation Issues
2.1.1. Operating Systems Supported by MySQL Community Server
2.1.2. Choosing Which MySQL 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.2. Standard MySQL Installation Using a Binary Distribution
2.3. Installing MySQL on Windows
2.3.1. Choosing An Installation Package
2.3.2. Installing MySQL with the Automated Installer
2.3.3. Using the MySQL Installation Wizard
2.3.4. Using the Configuration Wizard
2.3.5. Installing MySQL from a Noinstall Zip Archive
2.3.6. Extracting the Install Archive
2.3.7. Creating an Option File
2.3.8. Selecting a MySQL Server Type
2.3.9. Starting the Server for the First Time
2.3.10. Starting MySQL from the Windows Command Line
2.3.11. Starting MySQL as a Windows Service
2.3.12. Testing The MySQL Installation
2.3.13. Troubleshooting a MySQL Installation Under Windows
2.3.14. Upgrading MySQL on Windows
2.3.15. MySQL on Windows Compared to MySQL on Unix
2.4. Installing MySQL from RPM Packages on Linux
2.5. Installing MySQL on Mac OS X
2.6. Installing MySQL on Solaris
2.7. Installing MySQL on NetWare
2.8. Installing MySQL from tar.gz Packages on Other Unix-Like Systems
2.9. MySQL Installation Using a Source Distribution
2.9.1. Source Installation Overview
2.9.2. Typical configure Options
2.9.3. Installing from the Development Source Tree
2.9.4. Dealing with Problems Compiling MySQL
2.9.5. MIT-pthreads Notes
2.9.6. Installing MySQL from Source on Windows
2.9.7. Compiling MySQL Clients on Windows
2.10. Post-Installation Setup and Testing
2.10.1. Windows Post-Installation Procedures
2.10.2. Unix Post-Installation Procedures
2.10.3. Securing the Initial MySQL Accounts
2.11. Upgrading MySQL
2.11.1. Upgrading from MySQL 5.0 to 5.1
2.11.2. Copying MySQL Databases to Another Machine
2.12. Downgrading MySQL
2.12.1. Downgrading to MySQL 5.0
2.13. Operating System-Specific Notes
2.13.1. Linux Notes
2.13.2. Mac OS X Notes
2.13.3. Solaris Notes
2.13.4. BSD Notes
2.13.5. Other Unix Notes
2.13.6. OS/2 Notes
2.14. Environment Variables
2.15. Perl Installation Notes
2.15.1. Installing Perl on Unix
2.15.2. Installing ActiveState Perl on Windows
2.15.3. Problems Using the Perl DBI/DBD Interface
2.16. Porting to Other Systems
2.16.1. Debugging a MySQL Server
2.16.2. Debugging a MySQL Client
2.16.3. The DBUG Package
2.16.4. Comments about RTS Threads
2.16.5. Differences Between Thread Packages
3. Tutorial
3.1. Connecting to and Disconnecting from the Server
3.2. Entering Queries
3.3. Creating and Using a Database
3.3.1. Creating and Selecting a Database
3.3.2. Creating a Table
3.3.3. Loading Data into a Table
3.3.4. Retrieving Information from a Table
3.4. Getting Information About Databases and Tables
3.5. Using mysql in Batch Mode
3.6. Examples of Common Queries
3.6.1. The Maximum Value for a Column
3.6.2. The Row Holding the Maximum of a Certain Column
3.6.3. Maximum of Column per Group
3.6.4. The Rows Holding the Group-wise Maximum of a Certain Field
3.6.5. Using User-Defined Variables
3.6.6. Using Foreign Keys
3.6.7. Searching on Two Keys
3.6.8. Calculating Visits Per Day
3.6.9. Using AUTO_INCREMENT
3.7. Queries from the Twin Project
3.7.1. Find All Non-distributed Twins
3.7.2. Show a Table of Twin Pair Status
3.8. Using MySQL with Apache
4. Using MySQL Programs
4.1. Overview of MySQL Programs
4.2. Invoking MySQL Programs
4.3. Specifying Program Options
4.3.1. Using Options on the Command Line
4.3.2. Using Option Files
4.3.3. Using Options to Set Program Variables
4.4. Setting Environment Variables
5. Database Administration
5.1. Overview of Server-Side Programs
5.2. mysqld — The MySQL Server
5.2.1. Option and Variable Reference
5.2.2. Command Options
5.2.3. System Variables
5.2.4. Using System Variables
5.2.5. Status Variables
5.2.6. SQL Modes
5.2.7. The Shutdown Process
5.2.8. Server-Side Help
5.3. MySQL Server Startup Programs
5.3.1. mysqld_safe — MySQL Server Startup Script
5.3.2. mysql.server — MySQL Server Startup Script
5.3.3. mysqld_multi — Manage Multiple MySQL Servers
5.4. mysqlmanager — The MySQL Instance Manager
5.4.1. MySQL Instance Manager Command Options
5.4.2. MySQL Instance Manager Configuration Files
5.4.3. Starting the MySQL Server with MySQL Instance Manager
5.4.4. Instance Manager User and Password Management
5.4.5. MySQL Server Instance Status Monitoring
5.4.6. Connecting to MySQL Instance Manager
5.4.7. MySQL Instance Manager Commands
5.5. Installation-Related Programs
5.5.1. comp_err — Compile MySQL Error Message File
5.5.2. make_win_bin_dist — Package MySQL Distribution as ZIP Archive
5.5.3. mysql_fix_privilege_tables — Upgrade MySQL System Tables
5.5.4. mysql_install_db — Initialize MySQL Data Directory
5.5.5. mysql_secure_installation — Improve MySQL Installation Security
5.5.6. mysql_tzinfo_to_sql — Load the Time Zone Tables
5.5.7. mysql_upgrade — Check Tables for MySQL Upgrade
5.6. General Security Issues
5.6.1. General Security Guidelines
5.6.2. Making MySQL Secure Against Attackers
5.6.3. Security-Related mysqld Options
5.6.4. Security Issues with LOAD DATA LOCAL
5.6.5. How to Run MySQL as a Normal User
5.7. The MySQL Access Privilege System
5.7.1. What the Privilege System Does
5.7.2. How the Privilege System Works
5.7.3. Privileges Provided by MySQL
5.7.4. Connecting to the MySQL Server
5.7.5. Access Control, Stage 1: Connection Verification
5.7.6. Access Control, Stage 2: Request Verification
5.7.7. When Privilege Changes Take Effect
5.7.8. Causes of Access denied Errors
5.7.9. Password Hashing as of MySQL 4.1
5.8. MySQL User Account Management
5.8.1. MySQL Usernames and Passwords
5.8.2. Adding New User Accounts to MySQL
5.8.3. Removing User Accounts from MySQL
5.8.4. Limiting Account Resources
5.8.5. Assigning Account Passwords
5.8.6. Keeping Your Password Secure
5.8.7. Using Secure Connections
5.9. Backup and Recovery
5.9.1. Database Backups
5.9.2. Example Backup and Recovery Strategy
5.9.3. Point-in-Time Recovery
5.9.4. Table Maintenance and Crash Recovery
5.10. MySQL Localization and International Usage
5.10.1. The Character Set Used for Data and Sorting
5.10.2. Setting the Error Message Language
5.10.3. Adding a New Character Set
5.10.4. The Character Definition Arrays
5.10.5. String Collating Support
5.10.6. Multi-Byte Character Support
5.10.7. Problems With Character Sets
5.10.8. MySQL Server Time Zone Support
5.10.9. MySQL Server Locale Support
5.11. MySQL Server Logs
5.11.1. Selecting General Query and Slow Query Log Output Destinations
5.11.2. The Error Log
5.11.3. The General Query Log
5.11.4. The Binary Log
5.11.5. The Slow Query Log
5.11.6. Server Log Maintenance
5.12. Running Multiple MySQL Servers on the Same Machine
5.12.1. Running Multiple Servers on Windows
5.12.2. Running Multiple Servers on Unix
5.12.3. Using Client Programs in a Multiple-Server Environment
6. Optimization
6.1. Optimization Overview
6.1.1. MySQL Design Limitations and Tradeoffs
6.1.2. Designing Applications for Portability
6.1.3. What We Have Used MySQL For
6.1.4. The MySQL Benchmark Suite
6.1.5. Using Your Own Benchmarks
6.2. Optimizing SELECT and Other Statements
6.2.1. Optimizing Queries with EXPLAIN
6.2.2. Estimating Query Performance
6.2.3. Speed of SELECT Queries
6.2.4. WHERE Clause Optimization
6.2.5. Range Optimization
6.2.6. Index Merge Optimization
6.2.7. IS NULL Optimization
6.2.8. LEFT JOIN and RIGHT JOIN Optimization
6.2.9. Nested Join Optimization
6.2.10. Outer Join Simplification
6.2.11. ORDER BY Optimization
6.2.12. GROUP BY Optimization
6.2.13. DISTINCT Optimization
6.2.14. Optimizing IN/=ANY Subqueries
6.2.15. LIMIT Optimization
6.2.16. How to Avoid Table Scans
6.2.17. Speed of INSERT Statements
6.2.18. Speed of UPDATE Statements
6.2.19. Speed of DELETE Statements
6.2.20. Other Optimization Tips
6.3. Locking Issues
6.3.1. Internal Locking Methods
6.3.2. Table Locking Issues
6.3.3. Concurrent Inserts
6.3.4. External Locking
6.4. Optimizing Database Structure
6.4.1. Design Choices
6.4.2. Make Your Data as Small as Possible
6.4.3. Column Indexes
6.4.4. Multiple-Column Indexes
6.4.5. How MySQL Uses Indexes
6.4.6. The MyISAM Key Cache
6.4.7. MyISAM Index Statistics Collection
6.4.8. How MySQL Opens and Closes Tables
6.4.9. Drawbacks to Creating Many Tables in the Same Database
6.5. Optimizing the MySQL Server
6.5.1. System Factors and Startup Parameter Tuning
6.5.2. Tuning Server Parameters
6.5.3. Controlling Query Optimizer Performance
6.5.4. The MySQL Query Cache
6.5.5. Examining Thread Information
6.5.6. How Compiling and Linking Affects the Speed of MySQL
6.5.7. How MySQL Uses Memory
6.5.8. How MySQL Uses Internal Temporary Tables
6.5.9. How MySQL Uses DNS
6.6. Disk Issues
6.6.1. Using Symbolic Links
7. Client and Utility Programs
7.1. Overview of Client and Utility Programs
7.2. innochecksum — Offline InnoDB File Checksum Utility
7.3. my_print_defaults — Display Options from Option Files
7.4. myisam_ftdump — Display Full-Text Index information
7.5. myisamchk — MyISAM Table-Maintenance Utility
7.5.1. myisamchk General Options
7.5.2. myisamchk Check Options
7.5.3. myisamchk Repair Options
7.5.4. Other myisamchk Options
7.5.5. myisamchk Memory Usage
7.6. myisamlog — Display MyISAM Log File Contents
7.7. myisampack — Generate Compressed, Read-Only MyISAM Tables
7.8. mysql — The MySQL Command-Line Tool
7.8.1. mysql Options
7.8.2. mysql Commands
7.8.3. mysql Server-Side Help
7.8.4. Executing SQL Statements from a Text File
7.8.5. mysql Tips
7.9. mysqlaccess — Client for Checking Access Privileges
7.10. mysqladmin — Client for Administering a MySQL Server
7.11. mysqlbinlog — Utility for Processing Binary Log Files
7.12. mysqlcheck — A Table Maintenance and Repair Program
7.13. mysqldump — A Database Backup Program
7.14. mysqlhotcopy — A Database Backup Program
7.15. mysqlimport — A Data Import Program
7.16. mysqlshow — Display Database, Table, and Column Information
7.17. mysqlslap — Load Emulation Client
7.18. mysql_convert_table_format — Convert Tables to Use a Given Storage Engine
7.19. mysql_find_rows — Extract SQL Statements from Files
7.20. mysql_fix_extensions — Make Table Filename Extensions Lowercase
7.21. mysql_setpermission — Interactively Set Permissions in Grant Tables
7.22. mysql_tableinfo — Generate Database Metadata
7.23. mysql_waitpid — Kill Process and Wait for Its Termination
7.24. mysql_zap — Kill Processes That Match a Pattern
7.25. perror — Explain Error Codes
7.26. replace — A String-Replacement Utility
7.27. resolveip — Resolve Hostname to IP Address or Vice Versa
7.28. resolve_stack_dump — Resolve Numeric Stack Trace Dump to Symbols
8. Language Structure
8.1. Literal Values
8.1.1. Strings
8.1.2. Numbers
8.1.3. Hexadecimal Values
8.1.4. Boolean Values
8.1.5. Bit-Field Values
8.1.6. NULL Values
8.2. Identifiers
8.2.1. Identifier Qualifiers
8.2.2. Identifier Case Sensitivity
8.2.3. Mapping of Identifiers to Filenames
8.2.4. Function Name Parsing and Resolution
8.3. Reserved Words
8.4. User-Defined Variables
8.5. Comment Syntax
9. Character Set Support
9.1. Character Sets and Collations in General
9.2. Character Sets and Collations in MySQL
9.3. Specifying Character Sets and Collations
9.3.1. Server Character Set and Collation
9.3.2. Database Character Set and Collation
9.3.3. Table Character Set and Collation
9.3.4. Column Character Set and Collation
9.3.5. Character String Literal Character Set and Collation
9.3.6. National Character Set
9.3.7. Examples of Character Set and Collation Assignment
9.3.8. Compatibility with Other DBMSs
9.4. Connection Character Sets and Collations
9.5. Collation Issues
9.5.1. Using COLLATE in SQL Statements
9.5.2. COLLATE Clause Precedence
9.5.3. BINARY Operator
9.5.4. Some Special Cases Where the Collation Determination Is Tricky
9.5.5. Collations Must Be for the Right Character Set
9.5.6. Examples of the Effect of Collation
9.6. String Repertoire
9.7. Operations Affected by Character Set Support
9.7.1. Result Strings
9.7.2. CONVERT() and CAST()
9.7.3. SHOW Statements and INFORMATION_SCHEMA
9.8. Unicode Support
9.9. UTF-8 for Metadata
9.10. Column Character Set Conversion
9.11. Character Sets and Collations That MySQL Supports
9.11.1. Unicode Character Sets
9.11.2. West European Character Sets
9.11.3. Central European Character Sets
9.11.4. South European and Middle East Character Sets
9.11.5. Baltic Character Sets
9.11.6. Cyrillic Character Sets
9.11.7. Asian Character Sets
10. Data Types
10.1. Data Type Overview
10.1.1. Overview of Numeric Types
10.1.2. Overview of Date and Time Types
10.1.3. Overview of String Types
10.1.4. Data Type Default Values
10.2. Numeric Types
10.3. Date and Time Types
10.3.1. The DATETIME, DATE, and TIMESTAMP Types
10.3.2. The TIME Type
10.3.3. The YEAR Type
10.3.4. Year 2000 Issues and Date Types
10.4. String Types
10.4.1. The CHAR and VARCHAR Types
10.4.2. The BINARY and VARBINARY Types
10.4.3. The BLOB and TEXT Types
10.4.4. The ENUM Type
10.4.5. The SET Type
10.5. Data Type Storage Requirements
10.6. Choosing the Right Type for a Column
10.7. Using Data Types from Other Database Engines
11. Functions and Operators
11.1. Operator and Function Reference
11.2. Operators
11.2.1. Operator Precedence
11.2.2. Type Conversion in Expression Evaluation
11.2.3. Comparison Functions and Operators
11.2.4. Logical Operators
11.3. Control Flow Functions
11.4. String Functions
11.4.1. String Comparison Functions
11.4.2. Regular Expressions
11.5. Numeric Functions
11.5.1. Arithmetic Operators
11.5.2. Mathematical Functions
11.6. Date and Time Functions
11.7. What Calendar Is Used By MySQL?
11.8. Full-Text Search Functions
11.8.1. Boolean Full-Text Searches
11.8.2. Full-Text Searches with Query Expansion
11.8.3. Full-Text Stopwords
11.8.4. Full-Text Restrictions
11.8.5. Fine-Tuning MySQL Full-Text Search
11.9. Cast Functions and Operators
11.10. XML Functions
11.11. Other Functions
11.11.1. Bit Functions
11.11.2. Encryption and Compression Functions
11.11.3. Information Functions
11.11.4. Miscellaneous Functions
11.12. Functions and Modifiers for Use with GROUP BY Clauses
11.12.1. GROUP BY (Aggregate) Functions
11.12.2. GROUP BY Modifiers
11.12.3. GROUP BY and HAVING with Hidden Fields
12. SQL Statement Syntax
12.1. Data Definition Statements
12.1.1. ALTER DATABASE Syntax
12.1.2. ALTER LOGFILE GROUP Syntax
12.1.3. ALTER SERVER Syntax
12.1.4. ALTER TABLE Syntax
12.1.5. ALTER TABLESPACE Syntax
12.1.6. CREATE DATABASE Syntax
12.1.7. CREATE INDEX Syntax
12.1.8. CREATE LOGFILE GROUP Syntax
12.1.9. CREATE SERVER Syntax
12.1.10. CREATE TABLE Syntax
12.1.11. CREATE TABLESPACE Syntax
12.1.12. DROP DATABASE Syntax
12.1.13. DROP INDEX Syntax
12.1.14. DROP LOGFILE GROUP Syntax
12.1.15. DROP SERVER Syntax
12.1.16. DROP TABLE Syntax
12.1.17. DROP TABLESPACE Syntax
12.1.18. RENAME DATABASE Syntax
12.1.19. RENAME TABLE Syntax
12.2. Data Manipulation Statements
12.2.1. DELETE Syntax
12.2.2. DO Syntax
12.2.3. HANDLER Syntax
12.2.4. INSERT Syntax
12.2.5. LOAD DATA INFILE Syntax
12.2.6. REPLACE Syntax
12.2.7. SELECT Syntax
12.2.8. Subquery Syntax
12.2.9. TRUNCATE Syntax
12.2.10. UPDATE Syntax
12.3. MySQL Utility Statements
12.3.1. DESCRIBE Syntax
12.3.2. HELP Syntax
12.3.3. USE Syntax
12.4. MySQL Transactional and Locking Statements
12.4.1. START TRANSACTION, COMMIT, and ROLLBACK Syntax
12.4.2. Statements That Cannot Be Rolled Back
12.4.3. Statements That Cause an Implicit Commit
12.4.4. SAVEPOINT and ROLLBACK TO SAVEPOINT Syntax
12.4.5. LOCK TABLES and UNLOCK TABLES Syntax
12.4.6. SET TRANSACTION Syntax
12.4.7. XA Transactions
12.5. Database Administration Statements
12.5.1. Account Management Statements
12.5.2. Table Maintenance Statements
12.5.3. SET Syntax
12.5.4. SHOW Syntax
12.5.5. Other Administrative Statements
12.6. Replication Statements
12.6.1. SQL Statements for Controlling Master Servers
12.6.2. SQL Statements for Controlling Slave Servers
12.7. SQL Syntax for Prepared Statements
13. Storage Engines
13.1. Overview of MySQL Storage Engine Architecture
13.1.1. The Common Database Server Layer
13.1.2. Pluggable Storage Engine Architecture
13.2. Supported Storage Engines
13.2.1. Choosing a Storage Engine
13.2.2. Comparing Transaction and Non-Transaction Engines
13.2.3. Other Storage Engines
13.3. Setting the Storage Engine
13.4. The MyISAM Storage Engine
13.4.1. MyISAM Startup Options
13.4.2. Space Needed for Keys
13.4.3. MyISAM Table Storage Formats
13.4.4. MyISAM Table Problems
13.5. The InnoDB Storage Engine
13.5.1. InnoDB Overview
13.5.2. InnoDB Contact Information
13.5.3. InnoDB Configuration
13.5.4. InnoDB Startup Options and System Variables
13.5.5. Creating the InnoDB Tablespace
13.5.6. Creating and Using InnoDB Tables
13.5.7. Adding and Removing InnoDB Data and Log Files
13.5.8. Backing Up and Recovering an InnoDB Database
13.5.9. Moving an InnoDB Database to Another Machine
13.5.10. InnoDB Transaction Model and Locking
13.5.11. InnoDB Performance Tuning Tips
13.5.12. Implementation of Multi-Versioning
13.5.13. InnoDB Table and Index Structures
13.5.14. InnoDB File Space Management and Disk I/O
13.5.15. InnoDB Error Handling
13.5.16. Restrictions on InnoDB Tables
13.5.17. InnoDB Troubleshooting
13.6. The MERGE Storage Engine
13.6.1. MERGE Table Problems
13.7. The MEMORY (HEAP) Storage Engine
13.8. The EXAMPLE Storage Engine
13.9. The FEDERATED Storage Engine
13.9.1. FEDERATED Storage Engine Overview
13.9.2. How to create FEDERATED Tables
13.9.3. FEDERATED Storage Engine Notes and Tips
13.9.4. FEDERATED Storage Engine Resources
13.10. The ARCHIVE Storage Engine
13.11. The CSV Storage Engine
13.11.1. Repairing and Checking CSV Tables
13.11.2. CSV Limitations
13.12. The BLACKHOLE Storage Engine
14. High Availability, Scalability, and DRBD
14.1. Using MySQL with DRBD for High Availability
14.1.1. Configuring a MySQL and DRBD Environment
15. Replication
15.1. Replication Configuration
15.1.1. How to Set Up Replication
15.1.2. Replication Formats
15.1.3. Replication Options and Variables
15.1.4. Common Replication Administration Tasks
15.2. Replication Solutions
15.2.1. Using Replication for Backups
15.2.2. Using Replication with different Master and Slave Storage Engines
15.2.3. Using Replication for Scale-out
15.2.4. Replicating Different Databases to Different Slaves
15.2.5. Improving Replication Performance
15.2.6. Switching Masters During Failover
15.2.7. Setting up Replication using SSL
15.3. Replication Notes and Tips
15.3.1. Replication Features and Issues
15.3.2. Replication Compatibility Between MySQL Versions
15.3.3. Upgrading a Replication Setup
15.3.4. Replication FAQ
15.3.5. Troubleshooting Replication
15.3.6. How to Report Replication Bugs or Problems
15.4. Replication Implementation
15.4.1. Replication Implementation Details
15.4.2. Replication Relay and Status Files
15.4.3. How Servers Evaluate Replication Rules
16. MySQL Cluster
16.1. MySQL Cluster Overview
16.1.1. MySQL Cluster Core Concepts
16.1.2. MySQL Cluster Nodes, Node Groups, Replicas, and Partitions
16.2. MySQL Cluster 5.1 Carrier Grade Edition
16.2.1. Major Differences Between MySQL 5.1 and MySQL Cluster 5.1 Carrier Grade Edition
16.2.2. MySQL Cluster 5.1 Carrier Grade Edition Releases
16.3. Simple Multi-Computer How-To
16.3.1. Hardware, Software, and Networking
16.3.2. Multi-Computer Installation
16.3.3. Multi-Computer Configuration
16.3.4. Initial Startup
16.3.5. Loading Sample Data and Performing Queries
16.3.6. Safe Shutdown and Restart
16.4. MySQL Cluster Configuration
16.4.1. Building MySQL Cluster from Source Code
16.4.2. Installing the Cluster Software
16.4.3. Quick Test Setup of MySQL Cluster
16.4.4. Configuration File
16.4.5. Overview of Cluster Configuration Parameters
16.4.6. Configuring Parameters for Local Checkpoints
16.5. Upgrading and Downgrading MySQL Cluster
16.5.1. Performing a Rolling Restart of the Cluster
16.5.2. Cluster Upgrade and Downgrade Compatibility
16.6. Process Management in MySQL Cluster
16.6.1. MySQL Server Process Usage for MySQL Cluster
16.6.2. ndbd — The Storage Engine Node Process
16.6.3. ndb_mgmd — The Management Server Process
16.6.4. ndb_mgm — The Management Client Process
16.6.5. Command Options for MySQL Cluster Processes
16.7. Management of MySQL Cluster
16.7.1. Summary of MySQL Cluster Start Phases
16.7.2. Commands in the MySQL Cluster Management Client
16.7.3. Event Reports Generated in MySQL Cluster
16.7.4. Single User Mode
16.7.5. Quick Reference: MySQL Cluster SQL Statements
16.8. On-line Backup of MySQL Cluster
16.8.1. Cluster Backup Concepts
16.8.2. Using The Management Client to Create a Backup
16.8.3. ndb_restore — Restore a Cluster Backup
16.8.4. Configuration for Cluster Backup
16.8.5. Backup Troubleshooting
16.9. Cluster Utility Programs
16.9.1. ndb_config — Extract NDB Configuration Information
16.9.2. ndb_cpcd — Automate Testing for NDB Development
16.9.3. ndb_delete_all — Delete All Rows from NDB Table
16.9.4. ndb_desc — Describe NDB Tables
16.9.5. ndb_drop_index — Drop Index from NDB Table
16.9.6. ndb_drop_table — Drop NDB Table
16.9.7. ndb_error_reporter — NDB Error-Reporting Utility
16.9.8. ndb_print_backup_file — Print NDB Backup File Contents
16.9.9. ndb_print_schema_file — Print NDB Schema File Contents
16.9.10. ndb_print_sys_file — Print NDB System File Contents
16.9.11. ndbd_redo_log_reader — Check and Print Content of Cluster Redo Log
16.9.12. ndb_select_all — Print Rows from NDB Table
16.9.13. ndb_select_count — Print Row Counts for NDB Tables
16.9.14. ndb_show_tables — Display List of NDB Tables
16.9.15. ndb_size.pl — NDBCluster Size Requirement Estimator
16.9.16. ndb_waiter — Wait for Cluster to Reach a Given Status
16.10. MySQL Cluster Replication
16.10.1. Abbreviations and Symbols
16.10.2. Assumptions and General Requirements
16.10.3. Known Issues in MySQL Cluster Replication
16.10.4. Cluster Replication Schema and Tables
16.10.5. Preparing the Cluster for Replication
16.10.6. Starting Replication (Single Replication Channel)
16.10.7. Using Two Replication Channels
16.10.8. Implementing Failover with MySQL Cluster
16.10.9. MySQL Cluster Backups With Replication
16.10.10. MySQL Cluster Replication Conflict Resolution
16.11. MySQL Cluster Disk Data Tables
16.11.1. Disk Data Objects
16.11.2. Disk Data Storage Requirements
16.11.3. Disk Data Configuration Parameters
16.12. Using High-Speed Interconnects with MySQL Cluster
16.12.1. Configuring MySQL Cluster to use SCI Sockets
16.12.2. Understanding the Impact of Cluster Interconnects
16.13. Known Limitations of MySQL Cluster
16.13.1. Non-Compliance In SQL Syntax
16.13.2. Limits and Differences from Standard MySQL Limits
16.13.3. Limits Relating to Transaction Handling
16.13.4. Error Handling
16.13.5. Limits Associated with Database Objects
16.13.6. Unsupported Or Missing Features
16.13.7. Limitations Relating to Performance
16.13.8. Issues Exclusive to MySQL Cluster
16.13.9. Limitations Relating to Disk Data Storage
16.13.10. Limitations Relating to Multiple Cluster Nodes
16.13.11. Previous MySQL Cluster Issues Resolved in MySQL 5.1
16.14. MySQL Cluster Development Roadmap
16.14.1. MySQL Cluster Changes in MySQL 5.1
16.15. MySQL Cluster Glossary
17. Partitioning
17.1. Overview of Partitioning in MySQL
17.2. Partition Types
17.2.1. RANGE Partitioning
17.2.2. LIST Partitioning
17.2.3. HASH Partitioning
17.2.4. KEY Partitioning
17.2.5. Subpartitioning
17.2.6. How MySQL Partitioning Handles NULL Values
17.3. Partition Management
17.3.1. Management of RANGE and LIST Partitions
17.3.2. Management of HASH and KEY Partitions
17.3.3. Maintenance of Partitions
17.3.4. Obtaining Information About Partitions
17.4. Partition Pruning
17.5. Restrictions and Limitations on Partitioning
17.5.1. Partitioning Keys, Primary Keys, and Unique Keys
17.5.2. Partitioning Limitations Relating to Storage Engines
17.5.3. Partitioning Limitations Relating to Functions
18. Spatial Extensions
18.1. Introduction to MySQL Spatial Support
18.2. The OpenGIS Geometry Model
18.2.1. The Geometry Class Hierarchy
18.2.2. Class Geometry
18.2.3. Class Point
18.2.4. Class Curve
18.2.5. Class LineString
18.2.6. Class Surface
18.2.7. Class Polygon
18.2.8. Class GeometryCollection
18.2.9. Class MultiPoint
18.2.10. Class MultiCurve
18.2.11. Class MultiLineString
18.2.12. Class MultiSurface
18.2.13. Class MultiPolygon
18.3. Supported Spatial Data Formats
18.3.1. Well-Known Text (WKT) Format
18.3.2. Well-Known Binary (WKB) Format
18.4. Creating a Spatially Enabled MySQL Database
18.4.1. MySQL Spatial Data Types
18.4.2. Creating Spatial Values
18.4.3. Creating Spatial Columns
18.4.4. Populating Spatial Columns
18.4.5. Fetching Spatial Data
18.5. Analyzing Spatial Information
18.5.1. Geometry Format Conversion Functions
18.5.2. Geometry Functions
18.5.3. Functions That Create New Geometries from Existing Ones
18.5.4. Functions for Testing Spatial Relations Between Geometric Objects
18.5.5. Relations on Geometry Minimal Bounding Rectangles (MBRs)
18.5.6. Functions That Test Spatial Relationships Between Geometries
18.6. Optimizing Spatial Analysis
18.6.1. Creating Spatial Indexes
18.6.2. Using a Spatial Index
18.7. MySQL Conformance and Compatibility
19. Stored Procedures and Functions
19.1. Stored Routines and the Grant Tables
19.2. Stored Routine Syntax
19.2.1. CREATE PROCEDURE and CREATE FUNCTION Syntax
19.2.2. ALTER PROCEDURE and ALTER FUNCTION Syntax
19.2.3. DROP PROCEDURE and DROP FUNCTION Syntax
19.2.4. CALL Statement Syntax
19.2.5. BEGIN ... END Compound Statement Syntax
19.2.6. DECLARE Statement Syntax
19.2.7. Variables in Stored Routines
19.2.8. Conditions and Handlers
19.2.9. Cursors
19.2.10. Flow Control Constructs
19.3. Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
19.4. Binary Logging of Stored Routines and Triggers
20. Triggers
20.1. CREATE TRIGGER Syntax
20.2. DROP TRIGGER Syntax
20.3. Using Triggers
21. Event Scheduler
21.1. Event Scheduler Overview
21.2. Event Scheduler Syntax
21.2.1. ALTER EVENT Syntax
21.2.2. CREATE EVENT Syntax
21.2.3. DROP EVENT Syntax
21.3. Event Metadata
21.4. Event Scheduler Status
21.5. The Event Scheduler and MySQL Privileges
21.6. Event Scheduler Limitations and Restrictions
22. Views
22.1. ALTER VIEW Syntax
22.2. CREATE VIEW Syntax
22.3. DROP VIEW Syntax
23. The INFORMATION_SCHEMA Database
23.1. The INFORMATION_SCHEMA SCHEMATA Table
23.2. The INFORMATION_SCHEMA TABLES Table
23.3. The INFORMATION_SCHEMA COLUMNS Table
23.4. The INFORMATION_SCHEMA STATISTICS Table
23.5. The INFORMATION_SCHEMA USER_PRIVILEGES Table
23.6. The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table
23.7. The INFORMATION_SCHEMA TABLE_PRIVILEGES Table
23.8. The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table
23.9. The INFORMATION_SCHEMA CHARACTER_SETS Table
23.10. The INFORMATION_SCHEMA COLLATIONS Table
23.11. The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY Table
23.12. The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table
23.13. The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table
23.14. The INFORMATION_SCHEMA ROUTINES Table
23.15. The INFORMATION_SCHEMA VIEWS Table
23.16. The INFORMATION_SCHEMA TRIGGERS Table
23.17. The INFORMATION_SCHEMA PLUGINS Table
23.18. The INFORMATION_SCHEMA ENGINES Table
23.19. The INFORMATION_SCHEMA PARTITIONS Table
23.20. The INFORMATION_SCHEMA EVENTS Table
23.21. The INFORMATION_SCHEMA FILES Table
23.22. The INFORMATION_SCHEMA PROCESSLIST Table
23.23. The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table
23.24. The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables
23.25. The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables
23.26. Other INFORMATION_SCHEMA Tables
23.27. Extensions to SHOW Statements
24. Precision Math
24.1. Types of Numeric Values
24.2. DECIMAL Data Type Changes
24.3. Expression Handling
24.4. Rounding Behavior
24.5. Precision Math Examples
25. APIs and Libraries
25.1. libmysqld, the Embedded MySQL Server Library
25.1.1. Overview of the Embedded MySQL Server Library
25.1.2. Compiling Programs with libmysqld
25.1.3. Restrictions When Using the Embedded MySQL Server
25.1.4. Options with the Embedded Server
25.1.5. Embedded Server Examples
25.1.6. Licensing the Embedded Server
25.2. MySQL C API
25.2.1. C API Data types
25.2.2. C API Function Overview
25.2.3. C API Function Descriptions
25.2.4. C API Prepared Statements
25.2.5. C API Prepared Statement Data types
25.2.6. C API Prepared Statement Function Overview
25.2.7. C API Prepared Statement Function Descriptions
25.2.8. C API Prepared statement problems
25.2.9. C API Handling of Multiple Statement Execution
25.2.10. C API Handling of Date and Time Values
25.2.11. C API Threaded Function Descriptions
25.2.12. C API Embedded Server Function Descriptions
25.2.13. Controlling Automatic Reconnect Behavior
25.2.14. Common Questions and Problems When Using the C API
25.2.15. Building Client Programs
25.2.16. How to Make a Threaded Client
25.3. MySQL PHP API
25.3.1. Common Problems with MySQL and PHP
25.3.2. Enabling Both mysql and mysqli in PHP
25.4. MySQL Perl API
25.5. MySQL C++ API
25.6. MySQL Python API
25.7. MySQL Tcl API
25.8. MySQL Eiffel Wrapper
25.9. MySQL Program Development Utilities
25.9.1. msql2mysql — Convert mSQL Programs for Use with MySQL
25.9.2. mysql_config — Get Compile Options for Compiling Clients
26. Connectors
26.1. MySQL Connector/ODBC
26.1.1. Introduction to Connector/ODBC
26.1.2. Connector/ODBC Installation
26.1.3. Connector/ODBC Configuration
26.1.4. Connector/ODBC Examples
26.1.5. Connector/ODBC Reference
26.1.6. Connector/ODBC Notes and Tips
26.1.7. Connector/ODBC Support
26.2. MySQL Connector/NET
26.2.1. Connector/NET Versions
26.2.2. Connector/NET Installation
26.2.3. Connector/NET Examples and Usage Guide
26.2.4. Connector/NET Reference
26.2.5. Connector/NET Notes and Tips
26.2.6. Connector/NET Support
26.3. MySQL Visual Studio Plugin
26.3.1. Installing the MySQL Visual Studio Plugin
26.3.2. Creating a connection to the MySQL server
26.3.3. Using the MySQL Visual Studio Plugin
26.3.4. Visual Studio Plugin Support
26.4. MySQL Connector/J
26.4.1. Connector/J Versions
26.4.2. Connector/J Installation
26.4.3. Connector/J Examples
26.4.4. Connector/J (JDBC) Reference
26.4.5. Connector/J Notes and Tips
26.4.6. Connector/J Support
26.5. MySQL Connector/MXJ
26.5.1. Introduction to Connector/MXJ
26.5.2. Connector/MXJ Installation
26.5.3. Connector/MXJ Configuration
26.5.4. Connector/MXJ Reference
26.5.5. Connector/MXJ Notes and Tips
26.5.6. Connector/MXJ Support
26.6. Connector/PHP
27. MySQL Proxy
27.1. MySQL Proxy Supported Platforms
27.2. Installing MySQL Proxy
27.2.1. Installing MySQL Proxy from a binary distribution
27.2.2. Installing MySQL Proxy from a source distribution
27.2.3. Installing MySQL Proxy from the Subversion repository
27.3. MySQL Proxy Command Line Options
27.4. MySQL Proxy Scripting
27.4.1. Proxy Scripting Sequence During Query Injection
27.4.2. Internal Structures
27.4.3. Capturing a connection with connect_server()
27.4.4. Examining the handshake with read_handshake()
27.4.5. Examining the authentication credentials with read_auth()
27.4.6. Accessing authentication information with read_auth_result()
27.4.7. Manipulating Queries with read_query()
27.4.8. Manipulating Results with read_query_result()
27.5. Using MySQL Proxy
27.5.1. Using the Administration Interface
28. Extending MySQL
28.1. MySQL Internals
28.1.1. MySQL Threads
28.1.2. MySQL Test Suite
28.2. The MySQL Plugin Interface
28.2.1. Characteristics of the Plugin Interface
28.2.2. Full-Text Parser Plugins
28.2.3. INSTALL PLUGIN Syntax
28.2.4. UNINSTALL PLUGIN Syntax
28.2.5. Writing Plugins
28.3. Adding New Functions to MySQL
28.3.1. Features of the User-Defined Function Interface
28.3.2. CREATE FUNCTION Syntax
28.3.3. DROP FUNCTION Syntax
28.3.4. Adding a New User-Defined Function
28.3.5. Adding a New Native Function
28.4. Adding New Procedures to MySQL
28.4.1. Procedure Analyse
28.4.2. Writing a Procedure
A. MySQL 5.1 Frequently Asked Questions
A.1. MySQL 5.1 FAQ — General
A.2. MySQL 5.1 FAQ — Storage Engines
A.3. MySQL 5.1 FAQ — Server SQL Mode
A.4. MySQL 5.1 FAQ — Stored Procedures
A.5. MySQL 5.1 FAQ — Triggers
A.6. MySQL 5.1 FAQ — Views
A.7. MySQL 5.0 FAQ — INFORMATION_SCHEMA
A.8. MySQL 5.1 FAQ — Migration
A.9. MySQL 5.1 FAQ — Security
A.10. MySQL 5.1 FAQ — MySQL Cluster
A.11. MySQL 5.1 FAQ — MySQL Chinese, Japanese, and Korean Character Sets
A.12. MySQL 5.1 FAQ — Connectors & APIs
A.13. MySQL 5.1 FAQ — Replication
A.14. MySQL 5.1 FAQ — MySQL, DRBD, and Heartbeat
A.14.1. Distributed Replicated Block Device
A.14.2. Linux Heartbeat
A.14.3. DRBD Architecture
A.14.4. DRBD and MySQL Replication
A.14.5. DRBD and File Systems
A.14.6. DRBD and LVM
A.14.7. DRBD and Virtualization
A.14.8. DRBD and Security
A.14.9. DRBD and System Requirements
A.14.10. DBRD and Support and Consulting
B. Errors, Error Codes, and Common Problems
B.1. Problems and Common Errors
B.1.1. How to Determine What Is Causing a Problem
B.1.2. Common Errors When Using MySQL Programs
B.1.3. Installation-Related Issues
B.1.4. Administration-Related Issues
B.1.5. Query-Related Issues
B.1.6. Optimizer-Related Issues
B.1.7. Table Definition-Related Issues
B.1.8. Known Issues in MySQL
B.2. Server Error Codes and Messages
B.3. Client Error Codes and Messages
C. MySQL Change History
C.1. Changes in release 5.1.x (Development)
C.1.1. Changes in release 5.1.23 (Not yet released)
C.1.2. Changes in release 5.1.22 (14 September 2007: Release Ca