MySQL 3.23, 4.0, 4.1 Reference Manual

Copyright 1997-2006 MySQL AB

This document is NOT distributed under a GPL style license. Its use is subject to the following terms:

  • Conversion to other formats is allowed, but the actual content may not be altered or edited in any way.

  • You may create a printed copy for your own personal use.

  • For all other uses, such as selling printed copies or using this document in whole or in part within another publication, prior written agreement from MySQL AB is required.

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

Abstract

This is the MySQL Reference Manual. It documents MySQL 3.23 through MySQL 4.1.19.

Document generated on: 2006-05-04


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. History of MySQL
1.4.2. The Main Features of MySQL
1.4.3. MySQL Stability
1.4.4. How Large MySQL Tables Can Be
1.4.5. Year 2000 Compliance
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. MySQL 4.0 in a Nutshell
1.6.2. MySQL 4.1 in a Nutshell
1.6.3. What's New in MySQL 5.0
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.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
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 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 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 4.0 to 4.1
2.11.2. Upgrading from MySQL 3.23 to 4.0
2.11.3. Copying MySQL Databases to Another Machine
2.12. Downgrading MySQL
2.12.1. Downgrading to MySQL 4.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. Perl Installation Notes
2.14.1. Installing Perl on Unix
2.14.2. Installing ActiveState Perl on Windows
2.14.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. 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 Environment Variables to Specify Options
4.3.4. Using Options to Set Program Variables
5. Database Administration
5.1. Overview of Server-Side Programs
5.2. mysqld — The MySQL Server
5.2.1. mysqld Command Options
5.2.2. Server System Variables
5.2.3. Using System Variables
5.2.4. Server Status Variables
5.2.5. The Server SQL Mode
5.2.6. The MySQL Server Shutdown Process
5.3. The mysqld-max Extended MySQL Server
5.4. MySQL Server Startup Programs
5.4.1. mysqld_safe — MySQL Server Startup Script
5.4.2. mysql.server — MySQL Server Startup Script
5.4.3. mysqld_multi — Manage Multiple MySQL Servers
5.5. Installation-Related Programs
5.5.1. mysql_fix_privilege_tables — Upgrade MySQL System Tables
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.11. MySQL Server Logs
5.11.1. The Error Log
5.11.2. The General Query Log
5.11.3. The Update 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
5.13. The MySQL Query Cache
5.13.1. How the Query Cache Operates
5.13.2. Query Cache SELECT Options
5.13.3. Query Cache Configuration
5.13.4. Query Cache Status and Maintenance
6. Replication
6.1. Introduction to Replication
6.2. Replication Implementation Overview
6.3. Replication Implementation Details
6.3.1. Replication Master Thread States
6.3.2. Replication Slave I/O Thread States
6.3.3. Replication Slave SQL Thread States
6.3.4. Replication Relay and Status Files
6.4. How to Set Up Replication
6.5. Replication Compatibility Between MySQL Versions
6.6. Upgrading a Replication Setup
6.6.1. Upgrading Replication to 4.0 or 4.1
6.7. Replication Features and Known Problems
6.8. Replication Startup Options
6.9. How Servers Evaluate Replication Rules
6.10. Replication FAQ
6.11. Troubleshooting Replication
6.12. How to Report Replication Bugs or Problems
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. IS NULL Optimization
7.2.7. DISTINCT Optimization
7.2.8. LEFT JOIN and RIGHT JOIN Optimization
7.2.9. ORDER BY Optimization
7.2.10. GROUP BY Optimization
7.2.11. LIMIT Optimization
7.2.12. How to Avoid Table Scans
7.2.13. Speed of INSERT Statements
7.2.14. Speed of UPDATE Statements
7.2.15. Speed of DELETE Statements
7.2.16. Other Optimization Tips
7.3. Locking Issues
7.3.1. Locking Methods
7.3.2. Table Locking Issues
7.3.3. Concurrent Inserts
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. How Compiling and Linking Affects the Speed of MySQL
7.5.4. How MySQL Uses Memory
7.5.5. How MySQL Uses DNS
7.6. Disk Issues
7.6.1. Using Symbolic Links
8. Client and Utility Programs
8.1. Overview of Client and Utility Programs
8.2. myisam_ftdump — Display Full-Text Index information
8.3. myisamchkMyISAM Table-Maintenance Utility
8.3.1. myisamchk General Options
8.3.2. myisamchk Check Options
8.3.3. myisamchk Repair Options
8.3.4. Other myisamchk Options
8.3.5. myisamchk Memory Usage
8.4. myisamlog — Display MyISAM Log File Contents
8.5. myisampack — Generate Compressed, Read-Only MyISAM Tables
8.6. mysql — The MySQL Command-Line Tool
8.6.1. mysql Options
8.6.2. mysql Commands
8.6.3. Executing SQL Statements from a Text File
8.6.4. mysql Tips
8.7. mysqlaccess — Client for Checking Access Privileges
8.8. mysqladmin — Client for Administering a MySQL Server
8.9. mysqlbinlog — Utility for Processing Binary Log Files
8.10. mysqlcheck — A Table Maintenance and Repair Program
8.11. mysqldump — A Database Backup Program
8.12. mysqlhotcopy — A Database Backup Program
8.13. mysqlimport — A Data Import Program
8.14. mysqlshow — Display Database, Table, and Column Information
8.15. mysql_zap — Kill Processes That Match a Pattern
8.16. perror — Explain Error Codes
8.17. replace — A String-Replacement Utility
9. Language Structure
9.1. Literal Values
9.1.1. Strings
9.1.2. Numbers
9.1.3. Hexadecimal Values
9.1.4. Boolean Values
9.1.5. NULL Values
9.2. Database, Table, Index, Column, and Alias Names
9.2.1. Identifier Qualifiers
9.2.2. Identifier Case Sensitivity
9.3. User-Defined Variables
9.4. Comment Syntax
9.5. Treatment of Reserved Words in MySQL
10. Character Set Support
10.1. Character Sets and Collations in General
10.2. Character Sets and Collations in MySQL
10.3. Specifying Character Sets and Collations
10.3.1. Server Character Set and Collation
10.3.2. Database Character Set and Collation
10.3.3. Table Character Set and Collation
10.3.4. Column Character Set and Collation
10.3.5. Character String Literal Character Set and Collation
10.3.6. National Character Set
10.3.7. Examples of Character Set and Collation Assignment
10.3.8. Compatibility with Other DBMSs
10.4. Connection Character Sets and Collations
10.5. Collation Issues
10.5.1. Using COLLATE in SQL Statements
10.5.2. COLLATE Clause Precedence
10.5.3. BINARY Operator
10.5.4. Some Special Cases Where the Collation Determination Is Tricky
10.5.5. Collations Must Be for the Right Character Set
10.5.6. An Example of the Effect of Collation
10.6. Operations Affected by Character Set Support
10.6.1. Result Strings
10.6.2. CONVERT() and CAST()
10.6.3. SHOW Statements and INFORMATION_SCHEMA
10.7. Unicode Support
10.8. UTF-8 for Metadata
10.9. Upgrading Character Sets from MySQL 4.0
10.9.1. 4.0 Character Sets and Corresponding 4.1 Character Set/Collation Pairs
10.9.2. Converting 4.0 Character Columns to 4.1 Format
10.10. Character Sets and Collations That MySQL Supports
10.10.1. Unicode Character Sets
10.10.2. West European Character Sets
10.10.3. Central European Character Sets
10.10.4. South European and Middle East Character Sets
10.10.5. Baltic Character Sets
10.10.6. Cyrillic Character Sets
10.10.7. Asian Character Sets
11. Data Types
11.1. Data Type Overview
11.1.1. Overview of Numeric Types
11.1.2. Overview of Date and Time Types
11.1.3. Overview of String Types
11.1.4. Data Type Default Values
11.2. Numeric Types
11.3. Date and Time Types
11.3.1. The DATETIME, DATE, and TIMESTAMP Types
11.3.2. The TIME Type
11.3.3. The YEAR Type
11.3.4. Y2K Issues and Date Types
11.4. String Types
11.4.1. The CHAR and VARCHAR Types
11.4.2. The BINARY and VARBINARY Types
11.4.3. The BLOB and TEXT Types
11.4.4. The ENUM Type
11.4.5. The SET Type
11.5. Data Type Storage Requirements
11.6. Choosing the Right Type for a Column
11.7. Using Data Types from Other Database Engines
12. Functions and Operators
12.1. Operators
12.1.1. Operator Precedence
12.1.2. Type Conversion in Expression Evaluation
12.1.3. Comparison Functions and Operators
12.1.4. Logical Operators
12.2. Control Flow Functions
12.3. String Functions
12.3.1. String Comparison Functions
12.4. Numeric Functions
12.4.1. Arithmetic Operators
12.4.2. Mathematical Functions
12.5. Date and Time Functions
12.6. What Calendar Is Used By MySQL?
12.7. Full-Text Search Functions
12.7.1. Boolean Full-Text Searches
12.7.2. Full-Text Searches with Query Expansion
12.7.3. Full-Text Stopwords
12.7.4. Full-Text Restrictions
12.7.5. Fine-Tuning MySQL Full-Text Search
12.8. Cast Functions and Operators
12.9. Other Functions
12.9.1. Bit Functions
12.9.2. Encryption and Compression Functions
12.9.3. Information Functions
12.9.4. Miscellaneous Functions
12.10. Functions and Modifiers for Use with GROUP BY Clauses
12.10.1. GROUP BY (Aggregate) Functions
12.10.2. GROUP BY Modifiers
12.10.3. GROUP BY with Hidden Fields
13. SQL Statement Syntax
13.1. Data Definition Statements
13.1.1. ALTER DATABASE Syntax
13.1.2. ALTER TABLE Syntax
13.1.3. CREATE DATABASE Syntax
13.1.4. CREATE INDEX Syntax
13.1.5. CREATE TABLE Syntax
13.1.6. DROP DATABASE Syntax
13.1.7. DROP INDEX Syntax
13.1.8. DROP TABLE Syntax
13.1.9. RENAME TABLE Syntax
13.2. Data Manipulation Statements
13.2.1. DELETE Syntax
13.2.2. DO Syntax
13.2.3. HANDLER Syntax
13.2.4. INSERT Syntax
13.2.5. LOAD DATA INFILE Syntax
13.2.6. REPLACE Syntax
13.2.7. SELECT Syntax
13.2.8. Subquery Syntax
13.2.9. TRUNCATE Syntax
13.2.10. UPDATE Syntax
13.3. MySQL Utility Statements
13.3.1. DESCRIBE Syntax
13.3.2. USE Syntax
13.4. MySQL Transactional and Locking Statements
13.4.1. START TRANSACTION, COMMIT, and ROLLBACK Syntax
13.4.2. Statements That Cannot Be Rolled Back
13.4.3. Statements That Cause an Implicit Commit
13.4.4. SAVEPOINT and ROLLBACK TO SAVEPOINT Syntax
13.4.5. LOCK TABLES and UNLOCK TABLES Syntax
13.4.6. SET TRANSACTION Syntax
13.5. Database Administration Statements
13.5.1. Account Management Statements
13.5.2. Table Maintenance Statements
13.5.3. SET Syntax
13.5.4. SHOW Syntax
13.5.5. Other Administrative Statements
13.6. Replication Statements
13.6.1. SQL Statements for Controlling Master Servers
13.6.2. SQL Statements for Controlling Slave Servers
13.7. SQL Syntax for Prepared Statements
14. Storage Engines and Table Types
14.1. The MyISAM Storage Engine
14.1.1. MyISAM Startup Options
14.1.2. Space Needed for Keys
14.1.3. MyISAM Table Storage Formats
14.1.4. MyISAM Table Problems
14.2. The InnoDB Storage Engine
14.2.1. InnoDB Overview
14.2.2. InnoDB Contact Information
14.2.3. InnoDB in MySQL 3.23
14.2.4. InnoDB Configuration
14.2.5. InnoDB Startup Options and System Variables
14.2.6. Creating the InnoDB Tablespace
14.2.7. Creating and Using InnoDB Tables
14.2.8. Adding and Removing InnoDB Data and Log Files
14.2.9. Backing Up and Recovering an InnoDB Database
14.2.10. Moving an InnoDB Database to Another Machine
14.2.11. InnoDB Transaction Model and Locking
14.2.12. InnoDB Performance Tuning Tips
14.2.13. Implementation of Multi-Versioning
14.2.14. InnoDB Table and Index Structures
14.2.15. InnoDB File Space Management and Disk I/O
14.2.16. InnoDB Error Handling
14.2.17. Restrictions on InnoDB Tables
14.2.18. InnoDB Troubleshooting
14.3. The MERGE Storage Engine
14.3.1. MERGE Table Problems
14.4. The MEMORY (HEAP) Storage Engine
14.5. The BDB (BerkeleyDB) Storage Engine
14.5.1. Operating Systems Supported by BDB
14.5.2. Installing BDB
14.5.3. BDB Startup Options
14.5.4. Characteristics of BDB Tables
14.5.5. Things We Need to Fix for BDB
14.5.6. Restrictions on BDB Tables
14.5.7. Errors That May Occur When Using BDB Tables
14.6. The EXAMPLE Storage Engine
14.7. The ARCHIVE Storage Engine
14.8. The CSV Storage Engine
14.9. The BLACKHOLE Storage Engine
14.10. The ISAM Storage Engine
15. MySQL Cluster
15.1. MySQL Cluster Overview
15.2. Basic MySQL Cluster Concepts
15.2.1. MySQL Cluster Nodes, Node Groups, Replicas, and Partitions
15.3. Simple Multi-Computer How-To
15.3.1. Hardware, Software, and Networking
15.3.2. Multi-Computer Installation
15.3.3. Multi-Computer Configuration
15.3.4. Initial Startup
15.3.5. Loading Sample Data and Performing Queries
15.3.6. Safe Shutdown and Restart
15.4. MySQL Cluster Configuration
15.4.1. Building MySQL Cluster from Source Code
15.4.2. Installing the Software
15.4.3. Quick Test Setup of MySQL Cluster
15.4.4. Configuration File
15.5. Process Management in MySQL Cluster
15.5.1. MySQL Server Process Usage for MySQL Cluster
15.5.2. ndbd, the Storage Engine Node Process
15.5.3. ndb_mgmd, the Management Server Process
15.5.4. ndb_mgm, the Management Client Process
15.5.5. Command Options for MySQL Cluster Processes
15.6. Management of MySQL Cluster
15.6.1. MySQL Cluster Startup Phases
15.6.2. Commands in the Management Client
15.6.3. Event Reports Generated in MySQL Cluster
15.6.4. Single-User Mode
15.6.5. On-line Backup of MySQL Cluster
15.7. Upgrading and Downgrading MySQL Cluster
15.7.1. Performing a Rolling Upgrade or Downgrade
15.7.2. Cluster Upgrade and Downgrade Compatibility
15.8. Using High-Speed Interconnects with MySQL Cluster
15.8.1. Configuring MySQL Cluster to use SCI Sockets
15.8.2. Understanding the Impact of Cluster Interconnects
15.9. Known Limitations of MySQL Cluster
15.10. MySQL Cluster FAQ
15.11. MySQL Cluster Glossary
16. Spatial Extensions
16.1. Introduction to MySQL Spatial Support
16.2. The OpenGIS Geometry Model
16.2.1. The Geometry Class Hierarchy
16.2.2. Class Geometry
16.2.3. Class Point
16.2.4. Class Curve
16.2.5. Class LineString
16.2.6. Class Surface
16.2.7. Class Polygon
16.2.8. Class GeometryCollection
16.2.9. Class MultiPoint
16.2.10. Class MultiCurve
16.2.11. Class MultiLineString
16.2.12. Class MultiSurface
16.2.13. Class MultiPolygon
16.3. Supported Spatial Data Formats
16.3.1. Well-Known Text (WKT) Format
16.3.2. Well-Known Binary (WKB) Format
16.4. Creating a Spatially Enabled MySQL Database
16.4.1. MySQL Spatial Data Types
16.4.2. Creating Spatial Values
16.4.3. Creating Spatial Columns
16.4.4. Populating Spatial Columns
16.4.5. Fetching Spatial Data
16.5. Analyzing Spatial Information
16.5.1. Geometry Format Conversion Functions
16.5.2. Geometry Functions
16.5.3. Functions That Create New Geometries from Existing Ones
16.5.4. Functions for Testing Spatial Relations Between Geometric Objects
16.5.5. Relations on Geometry Minimal Bounding Rectangles (MBRs)
16.5.6. Functions That Test Spatial Relationships Between Geometries
16.6. Optimizing Spatial Analysis
16.6.1. Creating Spatial Indexes
16.6.2. Using a Spatial Index
16.7. MySQL Conformance and Compatibility
17. APIs and Libraries
17.1. libmysqld, the Embedded MySQL Server Library
17.1.1. Overview of the Embedded MySQL Server Library
17.1.2. Compiling Programs with libmysqld
17.1.3. Restrictions when using the Embedded MySQL Server
17.1.4. Options with the Embedded Server
17.1.5. Embedded Server Examples
17.1.6. Licensing the Embedded Server
17.2. MySQL C API
17.2.1. C API Data types
17.2.2. C API Function Overview
17.2.3. C API Function Descriptions
17.2.4. C API Prepared Statements
17.2.5. C API Prepared Statement Data types
17.2.6. C API Prepared Statement Function Overview
17.2.7. C API Prepared Statement Function Descriptions
17.2.8. C API Prepared statement problems
17.2.9. C API Handling of Multiple Query Execution
17.2.10. C API Handling of Date and Time Values
17.2.11. C API Threaded Function Descriptions
17.2.12. C API Embedded Server Function Descriptions
17.2.13. Common questions and problems when using the C API
17.2.14. Building Client Programs
17.2.15. How to Make a Threaded Client
17.3. MySQL PHP API
17.3.1. Common Problems with MySQL and PHP
17.3.2. Enabling Both mysql and mysqli in PHP
17.4. MySQL Perl API
17.5. MySQL C++ API
17.5.1. Borland C++
17.6. MySQL Python API
17.7. MySQL Tcl API
17.8. MySQL Eiffel Wrapper
17.9. MySQL Program Development Utilities
17.9.1. msql2mysql — Convert mSQL Programs for Use with MySQL
17.9.2. mysql_config — Get Compile Options for Compiling Clients
18. Connectors
18.1. MySQL Connector/ODBC
18.1.1. Introduction to MyODBC
18.1.2. General Information About ODBC and MyODBC
18.1.3. How to Install MyODBC
18.1.4. Installing MyODBC from a Binary Distribution on Windows
18.1.5. Installing MyODBC from a Binary Distribution on Unix
18.1.6. Installing MyODBC from a Source Distribution on Windows
18.1.7. Installing MyODBC from a Source Distribution on Unix
18.1.8. Installing MyODBC from the Development Source Tree
18.1.9. MyODBC Configuration
18.1.10. MyODBC Connection-Related Issues
18.1.11. MyODBC and Microsoft Access
18.1.12. MyODBC and Microsoft VBA and ASP
18.1.13. MyODBC and Third-Party ODBC Tools
18.1.14. MyODBC General Functionality
18.1.15. Basic MyODBC Application Steps
18.1.16. MyODBC API Reference
18.1.17. MyODBC Data Types
18.1.18. MyODBC Error Codes
18.1.19. MyODBC With VB: ADO, DAO and RDO
18.1.20. MyODBC with Microsoft .NET
18.1.21. Credits
18.2. MySQL Connector/NET
18.2.1. Introduction
18.2.2. Downloading and Installing MySQL Connector/NET
18.2.3. Connector/NET Architecture
18.2.4. Using MySQL Connector/NET
18.2.5. MySQL Connector/NET Change History
18.3. MySQL Connector/J
18.3.1. Basic JDBC concepts
18.3.2. Installing Connector/J
18.3.3. JDBC Reference
18.3.4. Using Connector/J with J2EE and Other Java Frameworks
18.3.5. Diagnosing Connector/J Problems
18.3.6. MySQL Connector/J Change History
18.4. MySQL Connector/MXJ
18.4.1. Introduction
18.4.2. Supported Platforms
18.4.3. JUnit Test Requirements
18.4.4. Running the JUnit Tests
18.4.5. Running as part of the JDBC Driver
18.4.6. Running within a Java Object
18.4.7. The MysqldResource API
18.4.8. Running within a JMX Agent (custom)
18.4.9. Deployment in a standard JMX Agent environment (JBoss)
18.4.10. Installation
18.5. Connector/PHP
19. Extending MySQL
19.1. MySQL Internals
19.1.1. MySQL Threads
19.1.2. MySQL Test Suite
19.2. Adding New Functions to MySQL
19.2.1. Features of the User-Defined Function Interface
19.2.2. CREATE FUNCTION Syntax
19.2.3. DROP FUNCTION Syntax
19.2.4. Adding a New User-Defined Function
19.2.5. Adding a New Native Function
19.3. Adding New Procedures to MySQL
19.3.1. Procedure Analyse
19.3.2. Writing a Procedure
A. Problems and Common Errors
A.1. How to Determine What Is Causing a Problem
A.2. Common Errors When Using MySQL Programs
A.2.1. Access denied
A.2.2. Can't connect to [local] MySQL server
A.2.3. Client does not support authentication protocol
A.2.4. Password Fails When Entered Interactively
A.2.5. Host 'host_name' is blocked
A.2.6. Too many connections
A.2.7. Out of memory
A.2.8. MySQL server has gone away
A.2.9. Packet too large
A.2.10. Communication Errors and Aborted Connections
A.2.11. The table is full
A.2.12. Can't create/write to file
A.2.13. Commands out of sync
A.2.14. Ignoring user
A.2.15. Table 'tbl_name' doesn't exist
A.2.16. Can't initialize character set
A.2.17. File Not Found
A.3. Installation-Related Issues
A.3.1. Problems Linking to the MySQL Client Library
A.3.2. Problems with File Permissions
A.4. Administration-Related Issues
A.4.1. How to Reset the Root Password
A.4.2. What to Do If MySQL Keeps Crashing
A.4.3. How MySQL Handles a Full Disk
A.4.4. Where MySQL Stores Temporary Files
A.4.5. How to Protect or Change the MySQL Unix Socket File
A.4.6. Time Zone Problems
A.5. Query-Related Issues
A.5.1. Case Sensitivity in Searches
A.5.2. Problems Using DATE Columns
A.5.3. Problems with NULL Values
A.5.4. Problems with Column Aliases
A.5.5. Rollback Failure for Non-Transactional Tables
A.5.6. Deleting Rows from Related Tables
A.5.7. Solving Problems with No Matching Rows
A.5.8. Problems with Floating-Point Comparisons
A.6. Optimizer-Related Issues
A.7. Table Definition-Related Issues
A.7.1. Problems with ALTER TABLE
A.7.2. How to Change the Order of Columns in a Table
A.7.3. TEMPORARY TABLE Problems
A.8. Known Issues in MySQL
A.8.1. Issues in MySQL 3.23 Fixed in a Later MySQL Version
A.8.2. Issues in MySQL 4.0 Fixed in a Later Version
A.8.3. Issues in MySQL 4.1 Fixed in a Later Version
A.8.4. Open Issues in MySQL
B. Error Codes and Messages
B.1. Server Error Codes and Messages
B.2. Client Error Codes and Messages
C. Credits
C.1. Developers at MySQL AB
C.2. Contributors to MySQL
C.3. Documenters and translators
C.4. Libraries used by and included with MySQL
C.5. Packages that support MySQL
C.6. Tools that were used to create MySQL
C.7. Supporters of MySQL
D. MySQL Change History
D.1. Changes in release 4.1.x (Production)
D.1.1. Changes in release 4.1.20 (Not yet released)
D.1.2. Changes in release 4.1.19 (29 April 2006)
D.1.3. Changes in release 4.1.18 (27 January 2006)
D.1.4. Changes in release 4.1.17 (Not released)
D.1.5. Changes in release 4.1.16 (29 November 2005)
D.1.6. Changes in release 4.1.15 (13 October 2005)
D.1.7. Changes in release 4.1.14 (17 August 2005)
D.1.8. Changes in release 4.1.13 (15 July 2005)
D.1.9. Changes in release 4.1.12 (13 May 2005)
D.1.10. Changes in release 4.1.11 (01 April 2005)
D.1.11. Changes in release 4.1.10 (12 February 2005)
D.1.12. Changes in release 4.1.9 (11 January 2005)
D.1.13. Changes in release 4.1.8 (14 December 2004)
D.1.14. Changes in release 4.1.7 (23 October 2004: Production)
D.1.15. Changes in release 4.1.6 (10 October 2004)
D.1.16. Changes in release 4.1.5 (16 September 2004)
D.1.17. Changes in release 4.1.4 (26 August 2004: Gamma)
D.1.18. Changes in release 4.1.3 (28 June 2004: Beta)
D.1.19. Changes in release 4.1.2 (28 May 2004)
D.1.20. Changes in release 4.1.1 (01 December 2003)
D.1.21. Changes in release 4.1.0 (03 April 2003: Alpha)
D.2. Changes in release 4.0.x (Recent; still supported)
D.2.1. Changes in release 4.0.27 (Not yet released)
D.2.2. Changes in release 4.0.26 (08 September 2005)
D.2.3. Changes in release 4.0.25 (05 July 2005)
D.2.4. Changes in release 4.0.24 (04 March 2005)
D.2.5. Changes in release 4.0.23 (18 December 2004)
D.2.6. Changes in release 4.0.22 (27 October 2004)
D.2.7. Changes in release 4.0.21 (06 September 2004)
D.2.8. Changes in release 4.0.20 (17 May 2004)
D.2.9. Changes in release 4.0.19 (04 May 2004)
D.2.10. Changes in release 4.0.18 (12 February 2004)
D.2.11. Changes in release 4.0.17 (14 December 2003)
D.2.12. Changes in release 4.0.16 (17 October 2003)
D.2.13. Changes in release 4.0.15 (03 September 2003)
D.2.14. Changes in release 4.0.14 (18 July 2003)
D.2.15. Changes in release 4.0.13 (16 May 2003)
D.2.16. Changes in release 4.0.12 (15 March 2003: Production)
D.2.17. Changes in release 4.0.11 (20 February 2003)
D.2.18. Changes in release 4.0.10 (29 January 2003)
D.2.19. Changes in release 4.0.9 (09 January 2003)
D.2.20. Changes in release 4.0.8 (07 January 2003)
D.2.21. Changes in release 4.0.7 (20 December 2002)
D.2.22. Changes in release 4.0.6 (14 December 2002: Gamma)
D.2.23. Changes in release 4.0.5 (13 November 2002)
D.2.24. Changes in release 4.0.4 (29 September 2002)
D.2.25. Changes in release 4.0.3 (26 August 2002: Beta)
D.2.26. Changes in release 4.0.2 (01 July 2002)
D.2.27. Changes in release 4.0.1 (23 December 2001)
D.2.28. Changes in release 4.0.0 (October 2001: Alpha)
D.3. Changes in release 3.23.x (Recent; still supported)
D.3.1. Changes in release 3.23.59 (Not yet released)
D.3.2. Changes in release 3.23.58 (11 September 2003)
D.3.3. Changes in release 3.23.57 (06 June 2003)
D.3.4. Changes in release 3.23.56 (13 March 2003)
D.3.5. Changes in release 3.23.55 (23 January 2003)
D.3.6. Changes in release 3.23.54 (05 December 2002)
D.3.7. Changes in release 3.23.53 (09 October 2002)
D.3.8. Changes in release 3.23.52 (14 August 2002)
D.3.9. Changes in release 3.23.51 (31 May 2002)
D.3.10. Changes in release 3.23.50 (21 April 2002)
D.3.11. Changes in release 3.23.49 (14 February 2002)
D.3.12. Changes in release 3.23.48 (07 February 2002)
D.3.13. Changes in release 3.23.47 (27 December 2001)
D.3.14. Changes in release 3.23.46 (29 November 2001)
D.3.15. Changes in release 3.23.45 (22 November 2001)
D.3.16. Changes in release 3.23.44 (31 October 2001)
D.3.17. Changes in release 3.23.43 (04 October 2001)
D.3.18. Changes in release 3.23.42 (08 September 2001)
D.3.19. Changes in release 3.23.41 (11 August 2001)
D.3.20. Changes in release 3.23.40 (18 July 2001)
D.3.21. Changes in release 3.23.39 (12 June 2001)
D.3.22. Changes in release 3.23.38 (09 May 2001)
D.3.23. Changes in release 3.23.37 (17 April 2001)
D.3.24. Changes in release 3.23.36 (27 March 2001)
D.3.25. Changes in release 3.23.35 (15 March 2001)
D.3.26. Changes in release 3.23.34a (11 March 2001)
D.3.27. Changes in release 3.23.34 (10 March 2001)
D.3.28. Changes in release 3.23.33 (09 February 2001)
D.3.29. Changes in release 3.23.32 (22 January 2001)
D.3.30. Changes in release 3.23.31 (17 January 2001: Production)
D.3.31. Changes in release 3.23.30 (04 January 2001)
D.3.32. Changes in release 3.23.29 (16 December 2000)
D.3.33. Changes in release 3.23.28 (22 November 2000: Gamma)
D.3.34. Changes in release 3.23.27 (24 October 2000)
D.3.35. Changes in release 3.23.26 (18 October 2000)
D.3.36. Changes in release 3.23.25 (29 September 2000)
D.3.37. Changes in release 3.23.24 (08 September 2000)
D.3.38. Changes in release 3.23.23 (01 September 2000)
D.3.39. Changes in release 3.23.22 (31 July 2000)
D.3.40. Changes in release 3.23.21 (04 July 2000)
D.3.41. Changes in release 3.23.20 (28 June 2000: Beta)
D.3.42. Changes in release 3.23.19
D.3.43. Changes in release 3.23.18 (11 June 2000)
D.3.44. Changes in release 3.23.17 (07 June 2000)
D.3.45. Changes in release 3.23.16 (16 May 2000)
D.3.46. Changes in release 3.23.15 (08 May 2000)
D.3.47. Changes in release 3.23.14 (09 April 2000)
D.3.48. Changes in release 3.23.13 (14 March 2000)
D.3.49. Changes in release 3.23.12 (07 March 2000)
D.3.50. Changes in release 3.23.11 (16 February 2000)
D.3.51. Changes in release 3.23.10 (30 January 2000)
D.3.52. Changes in release 3.23.9 (29 January 2000)
D.3.53. Changes in release 3.23.8 (02 January 2000)
D.3.54. Changes in release 3.23.7 (10 December 1999)
D.3.55. Changes in release 3.23.6 (15 December 1999)
D.3.56. Changes in release 3.23.5 (20 October 1999)
D.3.57. Changes in release 3.23.4 (28 September 1999)
D.3.58. Changes in release 3.23.3 (13 September 1999)
D.3.59. Changes in release 3.23.2 (09 August 1999)
D.3.60. Changes in release 3.23.1 (08 July 1999)
D.3.61. Changes in release 3.23.0 (05 July 1999: Alpha)
D.4. Changes in InnoDB
D.4.1. Changes in MySQL/InnoDB-4.0.21, September 10, 2004
D.4.2. Changes in MySQL/InnoDB-4.1.4, August 31, 2004
D.4.3. Changes in MySQL/InnoDB-4.1.3, June 28, 2004
D.4.4. Changes in MySQL/InnoDB-4.1.2, May 30, 2004
D.4.5. Changes in MySQL/InnoDB-4.0.20, May 18, 2004
D.4.6. Changes in MySQL/InnoDB-4.0.19, May 4, 2004
D.4.7. Changes in MySQL/InnoDB-4.0.18, February 13, 2004
D.4.8. Changes in MySQL/InnoDB-5.0.0, December 24, 2003
D.4.9. Changes in MySQL/InnoDB-4.0.17, December 17, 2003
D.4.10. Changes in MySQL/InnoDB-4.1.1, December 4, 2003
D.4.11. Changes in MySQL/InnoDB-4.0.16, October 22, 2003
D.4.12. Changes in MySQL/InnoDB-3.23.58, September 15, 2003
D.4.13. Changes in MySQL/InnoDB-4.0.15, September 10, 2003
D.4.14. Changes in MySQL/InnoDB-4.0.14, July 22, 2003
D.4.15. Changes in MySQL/InnoDB-3.23.57, June 20, 2003
D.4.16. Changes in MySQL/InnoDB-4.0.13, May 20, 2003
D.4.17. Changes in MySQL/InnoDB-4.1.0, April 3, 2003
D.4.18. Changes in MySQL/InnoDB-3.23.56, March 17, 2003
D.4.19. Changes in MySQL/InnoDB-4.0.12, March 18, 2003
D.4.20. Changes in MySQL/InnoDB-4.0.11, February 25, 2003
D.4.21. Changes in MySQL/InnoDB-4.0.10, February 4, 2003
D.4.22. Changes in MySQL/InnoDB-3.23.55, January 24, 2003
D.4.23. Changes in MySQL/InnoDB-4.0.9, January 14, 2003
D.4.24. Changes in MySQL/InnoDB-4.0.8, January 7, 2003
D.4.25. Changes in MySQL/InnoDB-4.0.7, December 26, 2002
D.4.26. Changes in MySQL/InnoDB-4.0.6, December 19, 2002
D.4.27. Changes in MySQL/InnoDB-3.23.54, December 12, 2002
D.4.28. Changes in MySQL/InnoDB-4.0.5, November 18, 2002
D.4.29. Changes in MySQL/InnoDB-3.23.53, October 9, 2002
D.4.30. Changes in MySQL/InnoDB-4.0.4, October 2, 2002
D.4.31. Changes in MySQL/InnoDB-4.0.3, August 28, 2002
D.4.32. Changes in MySQL/InnoDB-3.23.52, August 16, 2002
D.4.33. Changes in MySQL/InnoDB-4.0.2, July 10, 2002
D.4.34. Changes in MySQL/InnoDB-3.23.51, June 12, 2002
D.4.35. Changes in MySQL/InnoDB-3.23.50, April 23, 2002
D.4.36. Changes in MySQL/InnoDB-3.23.49, February 17, 2002
D.4.37. Changes in MySQL/InnoDB-3.23.48, February 9, 2002
D.4.38. Changes in MySQL/InnoDB-3.23.47, December 28, 2001
D.4.39. Changes in MySQL/InnoDB-4.0.1, December 23, 2001
D.4.40. Changes in MySQL/InnoDB-3.23.46, November 30, 2001
D.4.41. Changes in MySQL/InnoDB-3.23.45, November 23, 2001
D.4.42. Changes in MySQL/InnoDB-3.23.44, November 2, 2001
D.4.43. Changes in MySQL/InnoDB-3.23.43, October 4, 2001
D.4.44. Changes in MySQL/InnoDB-3.23.42, September 9, 2001
D.4.45. Changes in MySQL/InnoDB-3.23.41, August 13, 2001
D.4.46. Changes in MySQL/InnoDB-3.23.40, July 16, 2001
D.4.47. Changes in MySQL/InnoDB-3.23.39, June 13, 2001
D.4.48. Changes in MySQL/InnoDB-3.23.38, May 12, 2001
D.5. Changes in MySQL Cluster
D.5.1. Changes in MySQL Cluster-5.0.7 (Not yet released)
D.5.2. Changes in MySQL Cluster-5.0.6 (26 May 2005)
D.5.3. Changes in MySQL Cluster-5.0.5 (Not released)
D.5.4. Changes in MySQL Cluster-5.0.4 (16 April 2005)
D.5.5. Changes in MySQL Cluster-5.0.3 (23 March 2005: Beta)
D.5.6. Changes in MySQL Cluster-5.0.1 (27 July 2004)
D.5.7. Changes in MySQL Cluster-4.1.13 (15 July 2005)
D.5.8. Changes in MySQL Cluster-4.1.12 (13 May 2005)
D.5.9. Changes in MySQL Cluster-4.1.11 (01 April 2005)
D.5.10. Changes in MySQL Cluster-4.1.10 (12 February 2005)
D.5.11. Changes in MySQL Cluster-4.1.9 (13 January 2005)
D.5.12. Changes in MySQL Cluster-4.1.8 (14 December 2004)
D.5.13. Changes in MySQL Cluster-4.1.7 (23 October 2004)
D.5.14. Changes in MySQL Cluster-4.1.6 (10 October 2004)
D.5.15. Changes in MySQL Cluster-4.1.5 (16 September 2004)
D.5.16. Changes in MySQL Cluster-4.1.4 (31 August 2004)
D.5.17. Changes in MySQL Cluster-4.1.3 (28 June 2004)
D.6. Changes in MyODBC
D.6.1. Changes in MyODBC 3.51.13
D.6.2. Changes in MyODBC 3.51.12
D.6.3. Changes in MyODBC 3.51.11
E. Porting to Other Systems
E.1. Debugging a MySQL Server
E.1.1. Compiling MySQL for Debugging
E.1.2. Creating Trace Files
E.1.3. Debugging mysqld under gdb
E.1.4. Using a Stack Trace
E.1.5. Using Server Logs to Find Causes of Errors in mysqld
E.1.6. Making a Test Case If You Experience Table Corruption
E.2. Debugging a MySQL Client
E.3. The DBUG Package
E.4. Comments about RTS Threads
E.5. Differences Between Thread Packages
F. Environment Variables
G. Regular Expressions
H. Limits in MySQL
H.1. Limits of Joins
I. Feature Restrictions
I.1. Restrictions on Subqueries
J. GNU General Public License
K. MySQL FLOSS License Exception