Indian matrimonial | india air tickets | Web Development India


MySQL 6.0 Reference Manual

Copyright 1997-2008 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.

For more information on the terms of this license, for details on how the MySQL documentation is built and produced, or if you are interested in doing a translation, please contact us at .

If you want help with using MySQL, please visit either the MySQL Forums or MySQL Mailing Lists where you can discuss your issues with other MySQL users.

For additional documentation on MySQL products, including translations of the documentation into other languages, and downloadable versions in variety of formats, including HTML, CHM and PDF formats, see MySQL Documentation Library.

Abstract

This is the MySQL Reference Manual. It documents MySQL 6.0 through 6.0.6.

MySQL Cluster is currently not supported in MySQL 6.0. For information about MySQL Cluster, please see MySQL Cluster.

Document generated on: 2008-07-16 (revision: 11270)


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. MySQL Development Roadmap
1.5.1. What's New in MySQL 6.0
1.6. MySQL Information Sources
1.6.1. MySQL Mailing Lists
1.6.2. MySQL Community Support at the MySQL Forums
1.6.3. MySQL Community Support on Internet Relay Chat (IRC)
1.6.4. MySQL Enterprise
1.7. How to Report Bugs or Problems
1.8. MySQL Standards Compliance
1.8.1. What Standards MySQL Follows
1.8.2. Selecting SQL Modes
1.8.3. Running MySQL in ANSI Mode
1.8.4. MySQL Extensions to Standard SQL
1.8.5. MySQL Differences from Standard SQL
1.8.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.1 to 6.0
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.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
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. MySQL Programs
4.1. Overview of MySQL Programs
4.2. Using MySQL Programs
4.2.1. Invoking MySQL Programs
4.2.2. Connecting to the MySQL Server
4.2.3. Specifying Program Options
4.2.4. Setting Environment Variables
4.3. MySQL Server and Server-Startup Programs
4.3.1. mysqld — The MySQL Server
4.3.2. mysqld_safe — MySQL Server Startup Script
4.3.3. mysql.server — MySQL Server Startup Script
4.3.4. mysqld_multi — Manage Multiple MySQL Servers
4.4. MySQL Installation-Related Programs
4.4.1. comp_err — Compile MySQL Error Message File
4.4.2. make_win_bin_dist — Package MySQL Distribution as ZIP Archive
4.4.3. mysqlbug — Generate Bug Report
4.4.4. mysql_fix_privilege_tables — Upgrade MySQL System Tables
4.4.5. mysql_install_db — Initialize MySQL Data Directory
4.4.6. mysql_secure_installation — Improve MySQL Installation Security
4.4.7. mysql_tzinfo_to_sql — Load the Time Zone Tables
4.4.8. mysql_upgrade — Check Tables for MySQL Upgrade
4.5. MySQL Client Programs
4.5.1. mysql — The MySQL Command-Line Tool
4.5.2. mysqladmin — Client for Administering a MySQL Server
4.5.3. mysqlcheck — A Table Maintenance and Repair Program
4.5.4. mysqldump — A Database Backup Program
4.5.5. mysqlimport — A Data Import Program
4.5.6. mysqlshow — Display Database, Table, and Column Information
4.5.7. mysqlslap — Load Emulation Client
4.6. MySQL Administrative and Utility Programs
4.6.1. innochecksum — Offline InnoDB File Checksum Utility
4.6.2. myisam_ftdump — Display Full-Text Index information
4.6.3. myisamchk — MyISAM Table-Maintenance Utility
4.6.4. myisamlog — Display MyISAM Log File Contents
4.6.5. myisampack — Generate Compressed, Read-Only MyISAM Tables
4.6.6. mysqlaccess — Client for Checking Access Privileges
4.6.7. mysqlbinlog — Utility for Processing Binary Log Files
4.6.8. mysqlhotcopy — A Database Backup Program
4.6.9. mysql_convert_table_format — Convert Tables to Use a Given Storage Engine
4.6.10. mysql_find_rows — Extract SQL Statements from Files
4.6.11. mysql_fix_extensions — Normalize Table Filename Extensions
4.6.12. mysql_setpermission — Interactively Set Permissions in Grant Tables
4.6.13. mysql_waitpid — Kill Process and Wait for Its Termination
4.6.14. mysql_zap — Kill Processes That Match a Pattern
4.7. MySQL Program Development Utilities
4.7.1. msql2mysql — Convert mSQL Programs for Use with MySQL
4.7.2. mysql_config — Get Compile Options for Compiling Clients
4.7.3. my_print_defaults — Display Options from Option Files
4.7.4. resolve_stack_dump — Resolve Numeric Stack Trace Dump to Symbols
4.8. Miscellaneous Programs
4.8.1. perror — Explain Error Codes
4.8.2. replace — A String-Replacement Utility
4.8.3. resolveip — Resolve Hostname to IP Address or Vice Versa
5. MySQL Server Administration
5.1. The MySQL Server
5.1.1. Option and Variable Reference
5.1.2. Command Options
5.1.3. System Variables
5.1.4. Session System Variables
5.1.5. Using System Variables
5.1.6. Status Variables
5.1.7. SQL Modes
5.1.8. Server-Side Help
5.1.9. Server Response to Signals
5.1.10. The Shutdown Process
5.2. MySQL Server Logs
5.2.1. Selecting General Query and Slow Query Log Output Destinations
5.2.2. The Error Log
5.2.3. The General Query Log
5.2.4. The Binary Log
5.2.5. The Slow Query Log
5.2.6. Server Log Maintenance
5.3. General Security Issues
5.3.1. General Security Guidelines
5.3.2. Making MySQL Secure Against Attackers
5.3.3. Security-Related mysqld Options
5.3.4. Security Issues with LOAD DATA LOCAL
5.3.5. How to Run MySQL as a Normal User
5.4. The MySQL Access Privilege System
5.4.1. What the Privilege System Does
5.4.2. How the Privilege System Works
5.4.3. Privileges Provided by MySQL
5.4.4. Access Control, Stage 1: Connection Verification
5.4.5. Access Control, Stage 2: Request Verification
5.4.6. When Privilege Changes Take Effect
5.4.7. Causes of Access denied Errors
5.4.8. Password Hashing as of MySQL 4.1
5.5. MySQL User Account Management
5.5.1. MySQL Usernames and Passwords
5.5.2. Adding New User Accounts to MySQL
5.5.3. Removing User Accounts from MySQL
5.5.4. Limiting Account Resources
5.5.5. Assigning Account Passwords
5.5.6. Keeping Your Password Secure
5.5.7. Using SSL for Secure Connections
5.6. Running Multiple MySQL Servers on the Same Machine
5.6.1. Running Multiple Servers on Windows
5.6.2. Running Multiple Servers on Unix
5.6.3. Using Client Programs in a Multiple-Server Environment
6. Backup and Recovery
6.1. Database Backups
6.2. Example Backup and Recovery Strategy
6.2.1. Backup Policy
6.2.2. Using Backups for Recovery
6.2.3. Backup Strategy Summary
6.3. Using BACKUP DATABASE and RESTORE
6.3.1. Quick Guide to BACKUP DATABASE and RESTORE
6.3.2. How BACKUP DATABASE and RESTORE Work
6.3.3. BACKUP DATABASE and RESTORE Status Reporting and Monitoring
6.4. Point-in-Time Recovery
6.4.1. Specifying Times for Recovery
6.4.2. Specifying Positions for Recovery
6.5. Table Maintenance and Crash Recovery
6.5.1. Using myisamchk for Crash Recovery
6.5.2. How to Check MyISAM Tables for Errors
6.5.3. How to Repair Tables
6.5.4. Table Optimization
6.5.5. Getting Information About a Table
6.5.6. Setting Up a Table Maintenance Schedule
7. Optimization
7.1. Optimization Overview
7.1.1. MySQL Design Limitations and Tradeoffs
7.1.2. Designing Applications for Portability
7.1.3. What We Have Used MySQL For
7.1.4. The MySQL Benchmark Suite
7.1.5. Using Your Own Benchmarks
7.2. Optimizing SELECT and Other Statements
7.2.1. Optimizing Queries with EXPLAIN
7.2.2. Estimating Query Performance
7.2.3. Speed of SELECT Queries
7.2.4. WHERE Clause Optimization
7.2.5. Range Optimization
7.2.6. Index Merge Optimization
7.2.7. Condition Pushdown Optimization
7.2.8. Index Condition Pushdown Optimization
7.2.9. Multi Read Range Optimization
7.2.10. IS NULL Optimization
7.2.11. LEFT JOIN and RIGHT JOIN Optimization
7.2.12. Nested Join Optimization
7.2.13. Outer Join Simplification
7.2.14. ORDER BY Optimization
7.2.15. GROUP BY Optimization
7.2.16. DISTINCT Optimization
7.2.17. Optimizing IN/=ANY Subqueries
7.2.18. LIMIT Optimization
7.2.19. How to Avoid Table Scans
7.2.20. INFORMATION_SCHEMA Optimization
7.2.21. Speed of INSERT Statements
7.2.22. Speed of UPDATE Statements
7.2.23. Speed of DELETE Statements
7.2.24. Other Optimization Tips
7.3. Locking Issues
7.3.1. Internal Locking Methods
7.3.2. Table Locking Issues
7.3.3. Concurrent Inserts
7.3.4. External Locking
7.4. Optimizing Database Structure
7.4.1. Design Choices
7.4.2. Make Your Data as Small as Possible
7.4.3. Column Indexes
7.4.4. Multiple-Column Indexes
7.4.5. How MySQL Uses Indexes
7.4.6. The MyISAM Key Cache
7.4.7. MyISAM Index Statistics Collection
7.4.8. How MySQL Opens and Closes Tables
7.4.9. Drawbacks to Creating Many Tables in the Same Database
7.5. Optimizing the MySQL Server
7.5.1. System Factors and Startup Parameter Tuning
7.5.2. Tuning Server Parameters
7.5.3. Controlling Query Optimizer Performance
7.5.4. The MySQL Query Cache
7.5.5. Examining Thread Information
7.5.6. How Compiling and Linking Affects the Speed of MySQL
7.5.7. How MySQL Uses Threads for Client Connections
7.5.8. How MySQL Uses Memory
7.5.9. How MySQL Uses Internal Temporary Tables
7.5.10. How MySQL Uses DNS
7.6. Disk Issues
7.6.1. Using Symbolic Links
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. Schema Object Names
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. Internationalization and Localization
9.1. Character Set Support
9.1.1. Character Sets and Collations in General
9.1.2. Character Sets and Collations in MySQL
9.1.3. Specifying Character Sets and Collations
9.1.4. Connection Character Sets and Collations
9.1.5. Collation Issues
9.1.6. String Repertoire
9.1.7. Operations Affected by Character Set Support
9.1.8. Unicode Support
9.1.9. Upgrading from Previous to Current Unicode Support
9.1.10. UTF-8 for Metadata
9.1.11. Column Character Set Conversion
9.1.12. Character Sets and Collations That MySQL Supports
9.2. The Character Set Used for Data and Sorting
9.2.1. Using the German Character Set
9.3. Setting the Error Message Language
9.4. Adding a New Character Set
9.4.1. The Character Definition Arrays
9.4.2. String Collating Support
9.4.3. Multi-Byte Character Support
9.5. How to Add a New Collation to a Character Set
9.5.1. Collation Implementation Types
9.5.2. Choosing a Collation ID
9.5.3. Adding a Simple Collation to an 8-Bit Character Set
9.5.4. Adding a UCA Collation to a Unicode Character Set
9.6. Problems With Character Sets
9.7. MySQL Server Time Zone Support
9.8. MySQL Server Locale Support
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. Natural Language Full-Text Searches
11.8.2. Boolean Full-Text Searches
11.8.3. Full-Text Searches with Query Expansion
11.8.4. Full-Text Stopwords
11.8.5. Full-Text Restrictions
11.8.6. 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 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. LOAD XML Syntax
12.2.7. REPLACE Syntax
12.2.8. SELECT Syntax
12.2.9. Subquery Syntax
12.2.10. TRUNCATE Syntax
12.2.11. UPDATE Syntax
12.3. MySQL Utility Statements
12.3.1. DESCRIBE Syntax
12.3.2. EXPLAIN Syntax
12.3.3. HELP Syntax
12.3.4. 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. Backup and Restore Statements
12.5.4. Plugin Statements
12.5.5. SET Syntax
12.5.6. SHOW Syntax
12.5.7. 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
12.7.1. Automatic Prepared Statement Repreparation
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 Falcon Storage Engine
13.6.1. Falcon Features
13.6.2. Configuration Parameters
13.6.3. Creating the Falcon Tablespace
13.6.4. Creating Tables and Indexes within Falcon
13.6.5. Obtaining Performance Diagnostics
13.6.6. Principles and Terminology
13.6.7. Limits
13.6.8. Falcon Roadmap
13.7. The MERGE Storage Engine
13.7.1. MERGE Table Problems
13.8. The MEMORY (HEAP) Storage Engine
13.9. The EXAMPLE Storage Engine
13.10. The FEDERATED Storage Engine
13.10.1. FEDERATED Storage Engine Overview
13.10.2. How to Create FEDERATED Tables
13.10.3. FEDERATED Storage Engine Notes and Tips
13.10.4. FEDERATED Storage Engine Resources
13.11. The ARCHIVE Storage Engine
13.12. The CSV Storage Engine
13.12.1. Repairing and Checking CSV Tables
13.12.2. CSV Limitations
13.13. The BLACKHOLE Storage Engine
14. High Availability and Scalability
14.1. Using MySQL with DRBD for High Availability
14.1.1. Configuring the DRBD Environment
14.1.2. Configuring MySQL for DRBD
14.1.3. Optimizing Performance and Reliability
14.2. Using Linux HA Heartbeat
14.2.1. Heartbeat Configuration
14.2.2. Using Heartbeat with MySQL and DRBD
14.2.3. Using Heartbeat with DRBD and dopd
14.2.4. Dealing with System Level Errors
15. MySQL and Virtualization
15.1. Common Issues with Virtualization
15.1.1. Virtualization Performance Issues
15.1.2. Virtualization Storage Issues
15.1.3. Virtualization Networking Issues
15.2. Using MySQL within an Amazon EC2 Instance
15.2.1. Setting Up MySQL on an EC2 AMI
15.2.2. EC2 Instance Limitations
15.2.3. Deploying a MySQL Database Using EC2
15.3. Virtualization Resources
16. Using MySQL with memcached
16.1. Installing memcached
16.2. Using memcached
16.2.1. memcached Deployment
16.2.2. Memory allocation within memcached
16.2.3. Using namespaces
16.2.4. Data Expiry
16.2.5. memcached Hash Types
16.3. memcached Interfaces
16.3.1. Using libmemcached
16.3.2. Using MySQL and memcached with Perl
16.3.3. Using MySQL and memcached with Python
16.3.4. Using MySQL and memcached with PHP
16.3.5. Using MySQL and memcached with Ruby
16.3.6. Using MySQL and memcached with Java
16.3.7. Using the MySQL memcached UDFs
16.4. Getting memcached Statistics
16.4.1. memcached General Statistics
16.4.2. memcached Slabs Statistics
16.4.3. memcached Item Statistics
16.4.4. memcached Size Statistics
17. MySQL Proxy
17.1. MySQL Proxy Supported Platforms
17.2. Installing MySQL Proxy
17.2.1. Installing MySQL Proxy from a binary distribution
17.2.2. Installing MySQL Proxy from a source distribution
17.2.3. Installing MySQL Proxy from the Subversion repository
17.3. MySQL Proxy Command-Line Options
17.4. MySQL Proxy Scripting
17.4.1. Proxy Scripting Sequence During Query Injection
17.4.2. Internal Structures
17.4.3. Capturing a connection with connect_server()
17.4.4. Examining the handshake with read_handshake()
17.4.5. Examining the authentication credentials with read_auth()
17.4.6. Accessing authentication information with read_auth_result()
17.4.7. Manipulating Queries with read_query()
17.4.8. Manipulating Results with read_query_result()
17.5. Using MySQL Proxy
17.5.1. Using the Administration Interface
18. MySQL Load Balancer
18.1. Installing MySQL Load Balancer
18.2. Getting Started
18.3. Using MySQL Load Balancer
18.4. Known Issues
18.5. MySQL Load Balancer FAQ
19. Replication
19.1. Replication Configuration
19.1.1. How to Set Up Replication
19.1.2. Replication Formats
19.1.3. Replication Options and Variables
19.1.4. Common Replication Administration Tasks
19.2. Replication Solutions
19.2.1. Using Replication for Backups
19.2.2. Using Replication with Different Master and Slave Storage Engines
19.2.3. Using Replication for Scale-Out
19.2.4. Replicating Different Databases to Different Slaves
19.2.5. Improving Replication Performance
19.2.6. Switching Masters During Failover
19.2.7. Setting Up Replication Using SSL
19.3. Replication Notes and Tips
19.3.1. Replication Features and Issues
19.3.2. Replication Compatibility Between MySQL Versions
19.3.3. Upgrading a Replication Setup
19.3.4. Replication FAQ
19.3.5. Troubleshooting Replication
19.3.6. How to Report Replication Bugs or Problems
19.4. Replication Implementation
19.4.1. Replication Implementation Details
19.4.2. Replication Relay and Status Files
19.4.3. How Servers Evaluate Replication Rules
20. Partitioning
20.1. Overview of Partitioning in MySQL
20.2. Partition Types
20.2.1. RANGE Partitioning
20.2.2. LIST Partitioning
20.2.3. HASH Partitioning
20.2.4. KEY Partitioning
20.2.5. Subpartitioning
20.2.6. How MySQL Partitioning Handles NULL Values
20.3. Partition Management
20.3.1. Management of RANGE and LIST Partitions
20.3.2. Management of HASH and KEY Partitions
20.3.3. Maintenance of Partitions
20.3.4. Obtaining Information About Partitions
20.4. Partition Pruning
20.5. Restrictions and Limitations on Partitioning
20.5.1. Partitioning Keys, Primary Keys, and Unique Keys
20.5.2. Partitioning Limitations Relating to Storage Engines
20.5.3. Partitioning Limitations Relating to Functions
21. Spatial Extensions
21.1. Introduction to MySQL Spatial Support
21.2. The OpenGIS Geometry Model
21.2.1. The Geometry Class Hierarchy
21.2.2. Class Geometry
21.2.3. Class Point
21.2.4. Class Curve
21.2.5. Class LineString
21.2.6. Class Surface
21.2.7. Class Polygon
21.2.8. Class GeometryCollection
21.2.9. Class MultiPoint
21.2.10. Class MultiCurve
21.2.11. Class MultiLineString
21.2.12. Class MultiSurface
21.2.13. Class MultiPolygon
21.3. Supported Spatial Data Formats
21.3.1. Well-Known Text (WKT) Format
21.3.2. Well-Known Binary (WKB) Format
21.4. Creating a Spatially Enabled MySQL Database
21.4.1. MySQL Spatial Data Types
21.4.2. Creating Spatial Values
21.4.3. Creating Spatial Columns
21.4.4. Populating Spatial Columns
21.4.5. Fetching Spatial Data
21.5. Analyzing Spatial Information
21.5.1. Geometry Format Conversion Functions
21.5.2. Geometry Functions
21.5.3. Functions That Create New Geometries from Existing Ones
21.5.4. Functions for Testing Spatial Relations Between Geometric Objects
21.5.5. Relations on Geometry Minimal Bounding Rectangles (MBRs)
21.5.6. Functions That Test Spatial Relationships Between Geometries
21.6. Optimizing Spatial Analysis
21.6.1. Creating Spatial Indexes
21.6.2. Using a Spatial Index
21.7. MySQL Conformance and Compatibility
22. Stored Procedures and Functions
22.1. Stored Routines and the Grant Tables
22.2. Stored Routine Syntax
22.2.1. CREATE PROCEDURE and CREATE FUNCTION Syntax
22.2.2. ALTER PROCEDURE and ALTER FUNCTION Syntax
22.2.3. DROP PROCEDURE and DROP FUNCTION Syntax
22.2.4. CALL Statement Syntax
22.2.5. BEGIN ... END Compound Statement Syntax
22.2.6. DECLARE Statement Syntax
22.2.7. Variables in Stored Routines
22.2.8. Conditions and Handlers
22.2.9. Cursors
22.2.10. Flow Control Constructs
22.2.11. RETURN Statement Syntax
22.3. Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
22.4. Binary Logging of Stored Routines and Triggers
23. Triggers
23.1. CREATE TRIGGER Syntax
23.2. DROP TRIGGER Syntax
23.3. Using Triggers
24. Event Scheduler
24.1. Event Scheduler Overview
24.2. Event Scheduler Syntax
24.2.1. ALTER EVENT Syntax
24.2.2. CREATE EVENT Syntax
24.2.3. DROP EVENT Syntax
24.3. Event Metadata
24.4. Event Scheduler Status
24.5. The Event Scheduler and MySQL Privileges
24.6. Event Scheduler Limitations and Restrictions
25. Views
25.1. ALTER VIEW Syntax
25.2. CREATE VIEW Syntax
25.3. DROP VIEW Syntax
26. INFORMATION_SCHEMA Tables
26.1. The INFORMATION_SCHEMA SCHEMATA Table
26.2. The INFORMATION_SCHEMA TABLES Table
26.3. The INFORMATION_SCHEMA COLUMNS Table
26.4. The INFORMATION_SCHEMA STATISTICS Table
26.5. The INFORMATION_SCHEMA USER_PRIVILEGES Table
26.6. The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table
26.7. The INFORMATION_SCHEMA TABLE_PRIVILEGES Table
26.8. The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table
26.9. The INFORMATION_SCHEMA CHARACTER_SETS Table
26.10. The INFORMATION_SCHEMA COLLATIONS Table
26.11. The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY Table
26.12. The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table
26.13. The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table
26.14. The INFORMATION_SCHEMA ROUTINES Table
26.15. The INFORMATION_SCHEMA VIEWS Table
26.16. The INFORMATION_SCHEMA TRIGGERS Table
26.17. The INFORMATION_SCHEMA PLUGINS Table
26.18. The INFORMATION_SCHEMA ENGINES Table
26.19. The INFORMATION_SCHEMA PARTITIONS Table
26.20. The INFORMATION_SCHEMA EVENTS Table
26.21. The INFORMATION_SCHEMA FILES Table
26.22. The INFORMATION_SCHEMA PROCESSLIST Table
26.23. The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table
26.24. The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables
26.25. The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables
26.26. The INFORMATION_SCHEMA PARAMETERS Table
26.27. The INFORMATION_SCHEMA PROFILING Table
26.28. Other INFORMATION_SCHEMA Tables
26.29. Extensions to SHOW Statements
27. Precision Math
27.1. Types of Numeric Values
27.2. DECIMAL Data Type Changes
27.3. Expression Handling
27.4. Rounding Behavior
27.5. Precision Math Examples
28. APIs and Libraries
28.1. libmysqld, the Embedded MySQL Server Library
28.1.1. Compiling Programs with libmysqld
28.1.2. Restrictions When Using the Embedded MySQL Server
28.1.3. Options with the Embedded Server
28.1.4. Embedded Server Examples
28.1.5. Licensing the Embedded Server
28.2. MySQL C API
28.2.1. C API Data Types
28.2.2. C API Function Overview
28.2.3. C API Function Descriptions
28.2.4. C API Prepared Statements
28.2.5. C API Prepared Statement Data types
28.2.6. C API Prepared Statement Function Overview
28.2.7. C API Prepared Statement Function Descriptions
28.2.8. C API Prepared Statement Problems
28.2.9. C API Handling of Multiple Statement Execution
28.2.10. C API Handling of Date and Time Values
28.2.11. C API Threaded Function Descriptions
28.2.12. C API Embedded Server Function Descriptions
28.2.13. Controlling Automatic Reconnect Behavior
28.2.14. Common Questions and Problems When Using the C API
28.2.15. Building Client Programs
28.2.16. How to Make a Threaded Client
28.3. MySQL PHP API
28.3.1. Common Problems with MySQL and PHP
28.3.2. Enabling Both mysql and mysqli in PHP
28.4. MySQL Perl API
28.5. MySQL C++ API
28.6. MySQL Python API
28.7. MySQL Tcl API
28.8. MySQL Eiffel Wrapper
29. Connectors
29.1. MySQL Connector/ODBC
29.1.1. Connector/ODBC Versions
29.1.2. Connector/ODBC Introduction
29.1.3. Connector/ODBC Installation
29.1.4. Connector/ODBC Configuration
29.1.5. Connector/ODBC Examples
29.1.6. Connector/ODBC Reference
29.1.7. Connector/ODBC Notes and Tips
29.1.8. Connector/ODBC Support
29.2. MySQL Connector/NET
29.2.1. Connector/NET Versions
29.2.2. Connector/NET Installation
29.2.3. Connector/NET Examples and Usage Guide
29.2.4. Connector/NET Reference
29.2.5. Connector/NET Notes and Tips
29.2.6. Connector/NET Support
29.3. MySQL Visual Studio Plugin
29.3.1. Installing the MySQL Visual Studio Plugin
29.3.2. Creating a connection to the MySQL server
29.3.3. Using the MySQL Visual Studio Plugin
29.3.4. Visual Studio Plugin Support
29.4. MySQL Connector/J
29.4.1. Connector/J Versions
29.4.2. Connector/J Installation
29.4.3. Connector/J Examples
29.4.4. Connector/J (JDBC) Reference
29.4.5. Connector/J Notes and Tips
29.4.6. Connector/J Support
29.5. MySQL Connector/MXJ
29.5.1. Connector/MXJ Overview
29.5.2. Connector/MXJ Versions
29.5.3. Connector/MXJ Installation
29.5.4. Connector/MXJ Configuration
29.5.5. Connector/MXJ Reference
29.5.6. Connector/MXJ Notes and Tips
29.5.7. Connector/MXJ Support
29.6. Connector/PHP
30. Extending MySQL
30.1. MySQL Internals
30.1.1. MySQL Threads
30.1.2. MySQL Test Suite
30.2. The MySQL Plugin Interface
30.2.1. Characteristics of the Plugin Interface
30.2.2. Full-Text Parser Plugins
30.2.3. Writing Plugins
30.3. Adding New Functions to MySQL
30.3.1. Features of the User-Defined Function Interface
30.3.2. CREATE FUNCTION Syntax
30.3.3. DROP FUNCTION Syntax
30.3.4. Adding a New User-Defined Function
30.3.5. Adding a New Native Function
30.4. Adding New Procedures to MySQL
30.4.1. PROCEDURE ANALYSE
30.4.2. Writing a Procedure
30.5. Debugging and Porting MySQL
30.5.1. Debugging a MySQL Server
30.5.2. Debugging a MySQL Client
30.5.3. The DBUG Package
30.5.4. Comments about RTS Threads
30.5.5. Differences Between Thread Packages
A. MySQL 6.0 Frequently Asked Questions
A.1. MySQL 6.0 FAQ — General
A.2. MySQL 6.0 FAQ — Storage Engines
A.3. MySQL 6.0 FAQ — Server SQL Mode
A.4. MySQL 6.0 FAQ — Stored Procedures
A.5. MySQL 6.0 FAQ — Triggers
A.6. MySQL 6.0 FAQ — Views
A.7. MySQL 5.0 FAQ — INFORMATION_SCHEMA
A.8. MySQL 6.0 FAQ — Migration
A.9. MySQL 6.0 FAQ — Security
A.10. MySQL 6.0 FAQ — MySQL Cluster
A.11. MySQL 6.0 FAQ — MySQL Chinese, Japanese, and Korean Character Sets
A.12. MySQL 6.0 FAQ — Connectors & APIs
A.13. MySQL 6.0 FAQ — Replication
A.14. MySQL 6.0 FAQ — MySQL, DRBD, and Heartbeat
A.14.1. Distributed Replicated Block Device (DRBD) Basics
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 6.0.x (Development)
C.1.1. Changes in MySQL 6.0.6 (Not yet released)
C.1.2. Changes in MySQL 6.0.5 (12 June 2008)
C.1.3. Changes in MySQL 6.0.4 (12 February 2008)
C.1.4. Changes in MySQL 6.0.3 (16 November 2007)
C.1.5. Changes in MySQL 6.0.2 (04 September 2007)
C.1.6. Changes in MySQL 6.0.1 (Not released)
C.1.7. Changes in MySQL 6.0.0 (30 April 2007)
C.2. Changes in release 5.2.x (Development)
C.2.1. Changes in MySQL 5.2.5 (08 August 2007: Alpha)
C.2.2. Changes in MySQL 5.2.4 (Not released)
C.2.3. Changes in MySQL 5.2.3 (15 February 2007)
C.2.4. Changes in MySQL 5.2.2 (Not released)
C.2.5. Changes in MySQL 5.2.1 (Not released)
C.3. MySQL Connector/ODBC (MyODBC) Change History
C.3.1. Changes in MySQL Connector/ODBC 5.1.5 (Not yet released)
C.3.2. Changes in MySQL Connector/ODBC 5.1.4 (Not yet released)
C.3.3. Changes in MySQL Connector/ODBC 5.1.3 (Not yet released)
C.3.4. Changes in MySQL Connector/ODBC 5.1.2 (13 February 2008)
C.3.5. Changes in MySQL Connector/ODBC 5.1.1 (13 December 2007)
C.3.6. Changes in MySQL Connector/ODBC 5.1.0 (10 September 2007)
C.3.7. Changes in MySQL Connector/ODBC 5.0.12 (Never released)
C.3.8. Changes in MySQL Connector/ODBC 5.0.11 (31 January 2007)
C.3.9. Changes in MySQL Connector/ODBC 5.0.10 (14 December 2006)
C.3.10. Changes in MySQL Connector/ODBC 5.0.9 (22 November 2006)
C.3.11. Changes in MySQL Connector/ODBC 5.0.8 (17 November 2006)
C.3.12. Changes in MySQL Connector/ODBC 5.0.7 (08 November 2006)
C.3.13. Changes in MySQL Connector/ODBC 5.0.6 (03 November 2006)
C.3.14. Changes in MySQL Connector/ODBC 5.0.5 (17 October 2006)
C.3.15. Changes in Connector/ODBC 5.0.3 (Connector/ODBC 5.0 Alpha 3) (20 June 2006)
C.3.16. Changes in Connector/ODBC 5.0.2 (Never released)
C.3.17. Changes in Connector/ODBC 5.0.1 (Connector/ODBC 5.0 Alpha 2) (05 June 2006)
C.3.18. Changes in MySQL Connector/ODBC 3.51.26 (07 July 2008)
C.3.19. Changes in MySQL Connector/ODBC 3.51.25 (11 April 2008)
C.3.20. Changes in MySQL Connector/ODBC 3.51.24 (14 March 2008)
C.3.21. Changes in MySQL Connector/ODBC 3.51.23 (09 January 2008)
C.3.22. Changes in MySQL Connector/ODBC 3.51.22 (13 November 2007)
C.3.23. Changes in MySQL Connector/ODBC 3.51.21 (08 October 2007)
C.3.24. Changes in MySQL Connector/ODBC 3.51.20 (10 September 2007)
C.3.25. Changes in MySQL Connector/ODBC 3.51.19 (10 August 2007)
C.3.26. Changes in MySQL Connector/ODBC 3.51.18 (08 August 2007)
C.3.27. Changes in MySQL Connector/ODBC 3.51.17 (14 July 2007)
C.3.28. Changes in MySQL Connector/ODBC 3.51.16 (14 June 2007)
C.3.29. Changes in MySQL Connector/ODBC 3.51.15 (07 May 2007)
C.3.30. Changes in MySQL Connector/ODBC 3.51.14 (08 March 2007)
C.3.31. Changes in MySQL Connector/ODBC 3.51.13 (Never released)
C.3.32. Changes in MySQL Connector/ODBC 3.51.12 (11 Febrauary 2005)
C.3.33. Changes in MySQL Connector/ODBC 3.51.11 (28 January 2005)
C.4. MySQL Connector/NET Change History
C.4.1. Changes in MySQL Connector/NET 5.3.0 (Not yet released)
C.4.2. Changes in MySQL Connector/NET 5.2.3 (Not yet released)
C.4.3. Changes in MySQL Connector/NET 5.2.2 (12 May 2008)
C.4.4. Changes in MySQL Connector/NET 5.2.1 (27 February 2008)
C.4.5. Changes in MySQL Connector/NET 5.2.0 (11 February 2008)
C.4.6. Changes in MySQL Connector/NET 5.1.7 (Not yet released)
C.4.7. Changes in MySQL Connector/NET 5.1.6 (12 May 2008)
C.4.8. Changes in MySQL Connector/NET 5.1.5 (Not yet released)
C.4.9. Changes in MySQL Connector/NET 5.1.4 (20 November 2007)
C.4.10. Changes in MySQL Connector/NET 5.1.3 (21 September 2007)
C.4.11. Changes in MySQL Connector/NET 5.1.2 (18 June 2007)
C.4.12. Changes in MySQL Connector/NET 5.1.1 (23 May 2007)
C.4.13. Changes in MySQL Connector/NET 5.1.0 (01 May 2007)
C.4.14. Changes in MySQL Connector/NET 5.0.10 (Not yet released)
C.4.15. Changes in MySQL Connector/NET 5.0.9 (Not yet released)
C.4.16. Changes in MySQL Connector/NET 5.0.8 (21 August 2007)
C.4.17. Changes in MySQL Connector/NET 5.0.7 (18 May 2007)
C.4.18. Changes in MySQL Connector/NET 5.0.6 (22 March 2007)
C.4.19. Changes in MySQL Connector/NET 5.0.5 (07 March 2007)
C.4.20. Changes in MySQL Connector/NET 5.0.4 (Not released)
C.4.21. Changes in MySQL Connector/NET 5.0.3 (05 January 2007)
C.4.22. Changes in MySQL Connector/NET 5.0.2 (06 November 2006)
C.4.23. Changes in MySQL Connector/NET 5.0.1 (01 October 2006)
C.4.24. Changes in MySQL Connector/NET 5.0.0 (08 August 2006)
C.4.25. Changes in MySQL Connector/NET 1.0.11 (Not yet released)
C.4.26. Changes in MySQL Connector/NET 1.0.10 (24 August 2007)
C.4.27. Changes in MySQL Connector/NET 1.0.9 (02 February 2007)
C.4.28. Changes in MySQL Connector/NET 1.0.8 (20 October 2006)
C.4.29. Changes in MySQL Connector/NET 1.0.7 (21 November 2005)
C.4.30. Changes in MySQL Connector/NET 1.0.6 (03 October 2005)
C.4.31. Changes in MySQL Connector/NET 1.0.5 (29 August 2005)
C.4.32. Changes in MySQL Connector/NET 1.0.4 (20 January 2005)
C.4.33. Changes in MySQL Connector/NET 1.0.3 (12 October 2004)
C.4.34. Changes in MySQL Connector/NET 1.0.2 (15 November 2004)
C.4.35. Changes in MySQL Connector/NET 1.0.1 (27 October 2004)
C.4.36. Changes in MySQL Connector/NET 1.0.0 (01 September 2004)
C.4.37. Changes in MySQL Connector/NET Version 0.9.0 (30 August 2004)
C.4.38. Changes in MySQL Connector/NET Version 0.76
C.4.39. Changes in MySQL Connector/NET Version 0.75
C.4.40. Changes in MySQL Connector/NET Version 0.74
C.4.41. Changes in MySQL Connector/NET Version 0.71
C.4.42. Changes in MySQL Connector/NET Version 0.70
C.4.43. Changes in MySQL Connector/NET Version 0.68
C.4.44. Changes in MySQL Connector/NET Version 0.65
C.4.45. Changes in MySQL Connector/NET Version 0.60
C.4.46. Changes in MySQL Connector/NET Version 0.50
C.5. MySQL Visual Studio Plugin Change History
C.5.1. Changes in MySQL Visual Studio Plugin 1.0.3 (Not yet released)
C.5.2. Changes in MySQL Visual Studio Plugin 1.0.2 (Not yet released)
C.5.3. Changes in MySQL Visual Studio Plugin 1.0.1 (4 October 2006)
C.5.4. Changes in MySQL Visual Studio Plugin 1.0.0 (4 October 2006)
C.6. MySQL Connector/J Change History
C.6.1. Changes in MySQL Connector/J 5.1.x
C.6.2. Changes in MySQL Connector/J 5.0.x
C.6.3. Changes in MySQL Connector/J 3.1.x
C.6.4. Changes in MySQL Connector/J 3.0.x