MySQL Reference Manual for version 5.0.0-alpha.

Abstract


Table of Contents

I. MySQL Administrator
1. Introduction to MySQL Administrator
2. Installing MySQL Administrator
Introduction
Installing under Windows
Installing under Linux
3. Starting MySQL Administrator
Introduction
Connection Dialog
Options Dialog
Administrator
General Options
Connections
Troubleshooting Connection Errors
4. Main Window
Introduction
Sidebar
Working Area
Menus
File
Edit
View
Tools
Help
5. Server Information
6. Service Control
Introduction
Start/Stop Service
Configure Service
7. Startup Variables
Introduction
8. Server Connections
Introduction
Threads
User Connections
9. User Administration
Introduction
User Accounts
User Information
Global Privileges
Schema Privileges
Table Column Privileges
10. Health
Introduction
Connection Health
Memory Health
Status Variables
System Variables
11. Server Logs
Introduction
Error Log
Slow Log
General Log
12. Backup
Introduction
13. Restore
Introduction
General
Restore Content
14. Replication Status
Server Information
15. Catalogs
Introduction
Schema Tables
Columns
Indexes
Table Status
Row Status
Indexes
A. How MySQL Administrator Stores Connections
B. XML Files Used by MySQL Administrator
C. Notes for Translators
II. General Information
16. About This Manual
Conventions Used in This Manual
17. Overview of the MySQL Database Management System
History of MySQL
The Main Features of MySQL
MySQL Stability
How Big MySQL Tables Can Be
Year 2000 Compliance
18. Overview of MySQL AB
The Business Model and Services of MySQL AB
Support
Training and Certification
Consulting
Commercial Licenses
Partnering
Contact Information
19. MySQL Support and Licensing
Support Offered by MySQL AB
Copyrights and Licenses Used by MySQL
MySQL Licenses
Using the MySQL Software Under a Commercial License
Using the MySQL Software for Free Under GPL
MySQL AB Logos and Trademarks
The Original MySQL Logo
MySQL Logos that may be Used Without Written Permission
When You Need Written Permission to Use MySQL Logos
MySQL AB Partnership Logos
Using the Word MySQL in Printed Text or Presentations
Using the Word MySQL in Company and Product Names
20. MySQL Development Roadmap
MySQL 4.0 in a Nutshell
Features Available in MySQL 4.0
The Embedded MySQL Server
MySQL 4.1 in a Nutshell
Features Available in MySQL 4.1
Stepwise Rollout
Ready for Immediate Development Use
MySQL 5.0, The Next Development Release
21. MySQL and the Future (The TODO)
New Features Planned for 4.1
New Features Planned for 5.0
New Features Planned for 5.1
New Features Planned for the Near Future
New Features Planned for the Mid-Term Future
New Features We Don't Plan to Implement
22. MySQL Information Sources
MySQL Mailing Lists
The MySQL Mailing Lists
Asking Questions or Reporting Bugs
How to Report Bugs or Problems
Guidelines for Answering Questions on the Mailing List
MySQL Community Support on IRC (Internet Relay Chat)
23. MySQL Standards Compliance
What Standards MySQL Follows
Selecting SQL Modes
Running MySQL in ANSI Mode
MySQL Extensions to the SQL-92 Standard
MySQL Differences Compared to SQL-92
Subqueries
SELECT INTO TABLE
Transactions and Atomic Operations
Stored Procedures and Triggers
Foreign Keys
Views
-- as the Start of a Comment
How MySQL Deals with Constraints
Constraint PRIMARY KEY / UNIQUE
Constraint NOT NULL and DEFAULT values
Constraint ENUM and SET
Known Errors and Design Deficiencies in MySQL
Errors in 3.23 Fixed in a Later MySQL Version
Errors in 4.0 Fixed in a Later MySQL Version
Open Bugs / Design Deficiencies in MySQL
III. Installing MySQL
24. General Installation Issues
Verifying the MD5 Checksum
Signature Checking Using GnuPG
Signature Checking Using RPM
Operating Systems Supported by MySQL
Choosing Which MySQL Distribution to Install
Choosing Which Version of MySQL to Install
Choosing a Distribution Format
How and When Updates Are Released
Release Philosophy---No Known Bugs in Releases
MySQL Binaries Compiled by MySQL AB
How to Get MySQL
Verifying Package Integrity Using MD5 Checksums or GnuPG
Installation Layouts
25. Standard MySQL Installation Using a Binary Distribution
Installing MySQL on Windows
Windows System Requirements
Installing a Windows Binary Distribution
Preparing the Windows MySQL Environment
Selecting a Windows Server
Starting the Server for the First Time
Starting MySQL from the Windows Command Line
Starting MySQL as a Windows Service
Running MySQL Client Programs on Windows
MySQL on Windows Compared to MySQL on Unix
Installing MySQL on Linux
Installing MySQL on Mac OS X
Installing MySQL on NetWare
Installing MySQL on HP-UX
Installing MySQL on Other Unix-like Systems
26. MySQL Installation Using a Source Distribution
Quick Source Installation Overview
Typical configure Options
Installing from the Development Source Tree
Dealing With Problems Compiling MySQL
MIT-pthreads Notes
Installing MySQL from Source on Windows
Building MySQL Using VC++
Creating a Windows Source Package from the Latest Development Source
Compiling MySQL Clients on Windows
27. Post-installation Setup and Testing
Windows Post-installation Procedures
Unix Post-installation Procedures
Problems Running mysql_install_db
Starting and Stopping MySQL Automatically
Starting and Troubleshooting the MySQL Server
28. Upgrading/Downgrading MySQL
Upgrading from Version 4.1 to 5.0
Upgrading from Version 4.0 to 4.1
Upgrading from Version 3.23 to 4.0
Upgrading from Version 3.22 to 3.23
Upgrading from Version 3.21 to 3.22
Upgrading from Version 3.20 to 3.21
Upgrading MySQL under Windows
Upgrading the Grant Tables
Copying MySQL Databases to Another Machine
29. Operating System Specific Notes
Linux Notes
Linux Operating System Notes
Linux Binary Distribution Notes
Linux Source Distribution Notes
Linux Post-installation Notes
Linux x86 Notes
Linux SPARC Notes
Linux Alpha Notes
Linux PowerPC Notes
Linux MIPS Notes
Linux IA-64 Notes
Mac OS X Notes
Mac OS X 10.x (Darwin)
Mac OS X Server 1.2 (Rhapsody)
Solaris Notes
Solaris 2.7/2.8 Notes
Solaris x86 Notes
BSD Notes
FreeBSD Notes
NetBSD Notes
OpenBSD 2.5 Notes
OpenBSD 2.8 Notes
BSD/OS Version 2.x Notes
BSD/OS Version 3.x Notes
BSD/OS Version 4.x Notes
Other Unix Notes
HP-UX Version 10.20 Notes
HP-UX Version 11.x Notes
IBM-AIX notes
SunOS 4 Notes
Alpha-DEC-UNIX Notes (Tru64)
Alpha-DEC-OSF/1 Notes
SGI Irix Notes
SCO Notes
SCO UnixWare Version 7.1.x Notes
OS/2 Notes
BeOS Notes
30. Perl Installation Notes
Installing Perl on Unix
Installing ActiveState Perl on Windows
Problems Using the Perl DBI/DBD Interface
IV. MySQL Tutorial
31. Connecting to and Disconnecting from the Server
32. Entering Queries
33. Creating and Using a Database
Creating and Selecting a Database
Creating a Table
Loading Data into a Table
Retrieving Information from a Table
Selecting All Data
Selecting Particular Rows
Selecting Particular Columns
Sorting Rows
Date Calculations
Working with NULL Values
Pattern Matching
Counting Rows
Using More Than one Table
34. Getting Information About Databases and Tables
35. Using mysql in Batch Mode
36. Examples of Common Queries
The Maximum Value for a Column
The Row Holding the Maximum of a Certain Column
Maximum of Column per Group
The Rows Holding the Group-wise Maximum of a Certain Field
Using User Variables
Using Foreign Keys
Searching on Two Keys
Calculating Visits Per Day
Using AUTO_INCREMENT
37. Queries from the Twin Project
Find All Non-distributed Twins
Show a Table of Twin Pair Status
38. Using MySQL with Apache
V. Using MySQL Programs
39. Overview of MySQL Programs
40. Invoking MySQL Programs
41. Specifying Program Options
Using Options on the Command Line
Using Option Files
Using Environment Variables to Specify Options
Using Options to Set Program Variables
VI. Database Administration
42. The MySQL Server and Server Startup Scripts
Overview of the Server-Side Scripts and Utilities
mysqld-max, An Extended mysqld Server
mysqld_safe, The Wrapper Around mysqld
mysql.server, A Server Startup Script for Run Directories
mysqld_multi, A Program for Managing Multiple MySQL Servers
43. Configuring MySQL
mysqld Command-line Options
The Server SQL Mode
44. General Security Issues and the MySQL Access Privilege System
Implications of Password Hashing Changes for Application Programs
General Security Guidelines
How to Make MySQL Secure Against Crackers
Startup Options for mysqld Concerning Security
Security issues with LOAD DATA LOCAL
What the Privilege System Does
How the Privilege System Works
Privileges Provided by MySQL
Connecting to the MySQL Server
Access Control, Stage 1: Connection Verification
Access Control, Stage 2: Request Verification
Password Hashing in MySQL 4.1
Causes of Access denied Errors
45. MySQL User Account Management
MySQL Usernames and Passwords
When Privilege Changes Take Effect
Setting Up the Initial MySQL Privileges
Adding New Users to MySQL
Deleting Users from MySQL
Limiting user resources
Setting Up Passwords
Keeping Your Password Secure
Using Secure Connections
Basics
Requirements
Setting Up SSL Certificates for MySQL
SSL GRANT Options
SSL Command-line Options
Connecting to MySQL Remotely from Windows with SSH
46. Disaster Prevention and Recovery
Database Backups
Using myisamchk for Table Maintenance and Crash Recovery
myisamchk Invocation Syntax
General Options for myisamchk
Check Options for myisamchk
Repair Options for myisamchk
Other Options for myisamchk
myisamchk Memory Usage
Using myisamchk for Crash Recovery
How to Repair Tables
Table Optimization
Setting Up a Table Maintenance Regimen
Getting Information About a Table
47. MySQL Localization and International Usage
The Character Set Used for Data and Sorting
German character set
Non-English Error Messages
Adding a New Character Set
The Character Definition Arrays
String Collating Support
Multi-byte Character Support
Problems With Character Sets
48. The MySQL Log Files
The Error Log
The General Query Log
The Update Log
The Binary Log
The Slow Query Log
Log File Maintenance
49. Running Multiple MySQL Servers on the Same Machine
Running Multiple Servers on Windows
Starting Multiple Windows Servers at the Command Line
Starting Multiple Windows Servers as Services
Running Multiple Servers on Unix
Using Client Programs in a Multiple-Server Environment
VII. Replication in MySQL
50. Introduction to Replication
51. Replication Implementation Overview
52. Replication Implementation Details
53. How to Set Up Replication
54. Upgrading a Replication Setup - Mixing Different MySQL Versions
55. Replication Features and Known Problems
56. Replication Startup Options
57. Replication FAQ
58. Troubleshooting Replication
59. Reporting Replication Bugs
VIII. MySQL Optimization
60. Optimization Overview
MySQL Design Limitations/Tradeoffs
Portability
What We Have Used MySQL For
The MySQL Benchmark Suite
Using Your Own Benchmarks
61. Optimizing SELECT Statements and Other Queries
EXPLAIN Syntax (Get Information About a SELECT)
Estimating Query Performance
Speed of SELECT Queries
How MySQL Optimizes WHERE Clauses
How MySQL Optimizes OR Clauses
How MySQL Optimizes IS NULL
How MySQL Optimizes DISTINCT
How MySQL Optimizes LEFT JOIN and RIGHT JOIN
How MySQL Optimizes ORDER BY
How MySQL Optimizes LIMIT
Speed of INSERT Queries
Speed of UPDATE Queries
Speed of DELETE Queries
Other Optimization Tips
62. Locking Issues
How MySQL Locks Tables
Table Locking Issues
63. Optimizing Database Structure
Design Choices
Get Your Data as Small as Possible
How MySQL Uses Indexes
Column Indexes
Multiple-Column Indexes
How MySQL Counts Open Tables
How MySQL Opens and Closes Tables
Drawbacks to Creating Large Numbers of Tables in the Same Database
64. Optimizing the MySQL Server
System/Compile Time and Startup Parameter Tuning
Tuning Server Parameters
How Compiling and Linking Affects the Speed of MySQL
How MySQL Uses Memory
How MySQL uses DNS
SET Syntax
65. Disk Issues
Using Symbolic Links
Using Symbolic Links for Databases on Unix
Using Symbolic Links for Tables on Unix
Using Symbolic Links for Databases on Windows
IX. MySQL Client and Utility Programs
66. Overview of the Client-Side Scripts and Utilities
67. mysql, The Command-line Tool
How to Run SQL Commands from a Text File
68. mysqlcc, The MySQL Control Center
69. mysqladmin, Administering a MySQL Server
70. mysqlbinlog, Executing the queries from a binary log
71. Using mysqlcheck for Table Maintenance and Crash Recovery
72. mysqldump, Dumping Table Structure and Data
73. mysqlhotcopy, Copying MySQL Databases and Tables
74. mysqlimport, Importing Data from Text Files
75. mysqlshow, Showing Databases, Tables, and Columns
76. myisampack, The MySQL Compressed Read-only Table Generator
77. mysql_config, Get compile options for compiling clients
78. perror, Explaining Error Codes
X. MySQL Language Reference
XI. Language Structure
79. Literal Values
Strings
Numbers
Hexadecimal Values
Boolean Values
NULL Values
80. Database, Table, Index, Column, and Alias Names
Identifier Qualifiers
Identifier Case Sensitivity
81. User Variables
82. System Variables
83. Comment Syntax
84. Treatment of Reserved Words in MySQL
XII. Column Types
85. Numeric Types
86. Date and Time Types
Y2K Issues and Date Types
The DATETIME, DATE, and TIMESTAMP Types
TIMESTAMP behavior when running in MAXDB mode
TIMESTAMP behavior when not running in MAXDB mode
TIMESTAMP properties when running in MAXDB mode
TIMESTAMP properties as of MySQL 4.1 when not running in MAXDB mode
TIMESTAMP properties prior to MySQL 4.1
The TIME Type
The YEAR Type
87. String Types
The CHAR and VARCHAR Types
The BLOB and TEXT Types
The ENUM Type
The SET Type
88. Choosing the Right Type for a Column
89. Using Column Types from Other Database Engines
90. Column Type Storage Requirements
XIII. Functions and Operators
91. Non-Type-Specific Operators and Functions
Parentheses
Comparison Operators
Logical Operators
Control Flow Functions
92. String Functions
String Comparison Functions
Case-Sensitivity
93. Numeric Functions
Arithmetic Operations
Mathematical Functions
94. Date and Time Functions
95. Cast Functions
96. Other Functions
Bit Functions
Encryption Functions
Information Functions
Miscellaneous Functions
97. Functions and Modifiers for Use with GROUP BY Clauses
GROUP BY Functions
GROUP BY Modifiers
GROUP BY with Hidden Fields
XIV. SQL Statement Syntax
98. Data Manipulation Statements
DELETE Syntax
DO Syntax
HANDLER Syntax
INSERT Syntax
INSERT ... SELECT Syntax
INSERT DELAYED Syntax
LOAD DATA INFILE Syntax
REPLACE Syntax
SELECT Syntax
JOIN Syntax
UNION Syntax
Subquery Syntax
The Subquery as Scalar Operand
Comparisons Using Subqueries
Subqueries with ANY, IN, and SOME
Subqueries with ALL
Correlated Subqueries
EXISTS and NOT EXISTS
Row Subqueries
Subqueries in the FROM clause
Subquery Errors
Optimizing Subqueries
Rewriting Subqueries for Earlier MySQL Versions
TRUNCATE Syntax
UPDATE Syntax
99. Data Definition Statements
ALTER DATABASE Syntax
ALTER TABLE Syntax
CREATE DATABASE Syntax
CREATE INDEX Syntax
CREATE TABLE Syntax
Silent Column Specification Changes
DROP DATABASE Syntax
DROP INDEX Syntax
DROP TABLE Syntax
RENAME TABLE Syntax
100. Basic MySQL User Utility Statements
DESCRIBE Syntax (Get Information About Columns)
USE Syntax
101. MySQL Transactional and Locking Statements
START TRANSACTION, COMMIT, and ROLLBACK Syntax
Statements That Cannot Be Rolled Back
Statements That Cause an Implicit Commit
SAVEPOINT and ROLLBACK TO SAVEPOINT Syntax
LOCK TABLES and UNLOCK TABLES Syntax
SET TRANSACTION Syntax
102. Database Administration Statements
Account Management Statements
GRANT and REVOKE Syntax
Table Maintenance Statements
ANALYZE TABLE Syntax
BACKUP TABLE Syntax
CHECK TABLE Syntax
CHECKSUM TABLE Syntax
OPTIMIZE TABLE Syntax
REPAIR TABLE Syntax
RESTORE TABLE Syntax
SHOW Syntax
Retrieving Information about Database, Tables, Columns, and Indexes
SHOW TABLE STATUS
SHOW STATUS
SHOW VARIABLES
SHOW [BDB] LOGS
SHOW PROCESSLIST
SHOW GRANTS
SHOW CREATE TABLE
SHOW WARNINGS | ERRORS
SHOW TABLE TYPES
SHOW PRIVILEGES
Other Adminstrative Statements
FLUSH Syntax
KILL Syntax
PURGE MASTER LOGS Syntax
RESET Syntax
103. Replication Statements
SQL Statements for Controlling Master Servers
PURGE MASTER LOGS
RESET MASTER
SET SQL_LOG_BIN
SHOW BINLOG EVENTS
SHOW MASTER STATUS
SHOW MASTER LOGS
SHOW SLAVE HOSTS
SQL Statements for Controlling Slave Servers
CHANGE MASTER TO
LOAD DATA FROM MASTER
LOAD TABLE tbl_name FROM MASTER
MASTER_POS_WAIT()
RESET SLAVE
SET GLOBAL SQL_SLAVE_SKIP_COUNTER
SHOW SLAVE STATUS
START SLAVE
STOP SLAVE
104. MySQL Full-text Search
Full-text Restrictions
Fine-tuning MySQL Full-text Search
Full-text Search TODO
105. MySQL Query Cache
How the Query Cache Operates
Query Cache Configuration
Query Cache Options in SELECT
Query Cache Status and Maintenance
XV. MySQL Table Types
106. MyISAM Tables
Space Needed for Keys
MyISAM Table Formats
Static (Fixed-length) Table Characteristics
Dynamic Table Characteristics
Compressed Table Characteristics
MyISAM Table Problems
Corrupted MyISAM Tables
Clients is using or hasn't closed the table properly
107. MERGE Tables
MERGE Table Problems
108. HEAP Tables
109. InnoDB Tables
InnoDB Tables Overview
InnoDB in MySQL Version 3.23
InnoDB Startup Options
Creating InnoDB Tablespace
If Something Goes Wrong in Database Creation
Creating InnoDB Tables
Converting MyISAM Tables to InnoDB
FOREIGN KEY Constraints
Multiple tablespaces - putting each table into its own .ibd file
Adding and Removing InnoDB Data and Log Files
Backing up and Recovering an InnoDB Database
Forcing recovery
Checkpoints
Moving an InnoDB Database to Another Machine
InnoDB Transaction Model and Locking
InnoDB and SET ... TRANSACTION ISOLATION LEVEL ...
Consistent Non-Locking Read
Locking Reads SELECT ... FOR UPDATE and SELECT ... LOCK IN SHARE MODE
Next-key Locking: Avoiding the Phantom Problem
Locks Set by Different SQL Statements in InnoDB
Deadlock Detection and Rollback
An Example of How the Consistent Read Works in InnoDB
How to Cope With Deadlocks
Performance Tuning Tips
SHOW INNODB STATUS and the InnoDB Monitors
Implementation of Multi-versioning
Table and Index Structures
Physical Structure of an Index
Insert Buffering
Adaptive Hash Indexes
Physical Record Structure
How an AUTO_INCREMENT Column Works in InnoDB
File Space Management and Disk I/O
Disk I/O
File Space Management
Defragmenting a Table
Error Handling in MySQL
Restrictions on InnoDB Tables
InnoDB Change History
MySQL/InnoDB-5.0.0, December 24, 2003
MySQL/InnoDB-4.0.17, December 17, 2003
MySQL/InnoDB-4.1.1, December 4, 2003
MySQL/InnoDB-4.0.16, October 22, 2003
MySQL/InnoDB-3.23.58, September 15, 2003
MySQL/InnoDB-4.0.15, September 10, 2003
MySQL/InnoDB-4.0.14, July 22, 2003
MySQL/InnoDB-3.23.57, June 20, 2003
MySQL/InnoDB-4.0.13, May 20, 2003
MySQL/InnoDB-4.1.0, April 3, 2003
MySQL/InnoDB-3.23.56, March 17, 2003
MySQL/InnoDB-4.0.12, March 18, 2003
MySQL/InnoDB-4.0.11, February 25, 2003
MySQL/InnoDB-4.0.10, February 4, 2003
MySQL/InnoDB-3.23.55, January 24, 2003
MySQL/InnoDB-4.0.9, January 14, 2003
MySQL/InnoDB-4.0.8, January 7, 2003
MySQL/InnoDB-4.0.7, December 26, 2002
MySQL/InnoDB-4.0.6, December 19, 2002
MySQL/InnoDB-3.23.54, December 12, 2002
MySQL/InnoDB-4.0.5, November 18, 2002
MySQL/InnoDB-3.23.53, October 9, 2002
MySQL/InnoDB-4.0.4, October 2, 2002
MySQL/InnoDB-4.0.3, August 28, 2002
MySQL/InnoDB-3.23.52, August 16, 2002
MySQL/InnoDB-4.0.2, July 10, 2002
MySQL/InnoDB-3.23.51, June 12, 2002
MySQL/InnoDB-3.23.50, April 23, 2002
MySQL/InnoDB-3.23.49, February 17, 2002
MySQL/InnoDB-3.23.48, February 9, 2002
MySQL/InnoDB-3.23.47, December 28, 2001
MySQL/InnoDB-4.0.1, December 23, 2001
MySQL/InnoDB-3.23.46, November 30, 2001
MySQL/InnoDB-3.23.45, November 23, 2001
MySQL/InnoDB-3.23.44, November 2, 2001
MySQL/InnoDB-3.23.43, October 4, 2001
MySQL/InnoDB-3.23.42, September 9, 2001
MySQL/InnoDB-3.23.41, August 13, 2001
MySQL/InnoDB-3.23.40, July 16, 2001
MySQL/InnoDB-3.23.39, June 13, 2001
MySQL/InnoDB-3.23.38, May 12, 2001
InnoDB Contact Information
111. BDB or BerkeleyDB Tables
Overview of BDB Tables
Installing BDB
BDB Startup Options
Characteristics of BDB Tables
Things We Need to Fix for BDB in the Near Future
Operating Systems Supported by BDB
Restrictions on BDB Tables
Errors That May Occur When Using BDB Tables
112. ISAM Tables
XVI. Introduction to MaxDB
113. History of MaxDB
114. Licensing and Support
115. Basic Concepts of MaxDB
116. Feature Differences between MaxDB and MySQL
117. Interoperability Features between MaxDB and MySQL
118. MaxDB-related Links
119. Reserved Words in MaxDB
120. Functions
121. Column Types
XVII. National Character Sets and Unicode
122. Character Sets and Collations in General
123. Character Sets and Collations in MySQL
124. Determining the Default Character Set and Collation
Server Character Set and Collation
Database Character Set and Collation
Table Character Set and Collation
Column Character Set and Collation
Examples of Character Set and Collation Assignment
Example 1: Table + Column Definition
Example 2: Table + Column Definition
Example 3: Table + Column Definition
Example 4: Database + Table + Column Definition
Connection Character Sets and Collations
Character String Literal Character Set and Collation
COLLATE Clause in Various Parts of an SQL Query
COLLATE Clause Precedence
BINARY Operator
Some Special Cases Where the Collation Determination is Tricky
Collations Must Be for the Right Character Set
An example of the Effect of Collation
125. Operations Affected by Character Set Support
Result Strings
CONVERT()
CAST()
SHOW CHARACTER SET
SHOW COLLATION
SHOW CREATE DATABASE
SHOW FULL COLUMNS
126. Unicode Support
127. UTF8 for Metadata
128. Compatibility with Other DBMSs
129. New Character Set Configuration File format
130. National Character Set
131. Upgrading from MySQL 4.0
4.0 Character Sets and Corresponding 4.1 Character Set/Collation Pairs
132. The Character Sets and Collations that MySQL Supports
The Unicode Character Sets
Platform Specific Character Sets
Character Sets for South Europe and Middle East
The Asian Character Sets
The Baltic Character Sets
The Cyrillic Character Sets
The Central European Character Sets
The West European Character Sets
XVIII. Spatial Extensions in MySQL
133. Introduction
134. The OpenGIS Geometry Model
Geometry properties
Point Examples
Point Properties
Curve Properties
LineString Examples
LineString Properties
Surface Properties
Polygon Examples
Polygon Assertions
MultiPoint Examples
MultiPoint Properties
MultiCurve Properties
MultiLineString Examples
MultiSurface Assertions
MultiPolygon Examples
MultiPolygon Assertions
MultiPolygon Properties
The Geometry Class Hierarchy
Class Geometry
Class Point
Class Curve
Class LineString
Class Surface
Class Polygon
Class GeometryCollection
Class MultiPoint
Class MultiCurve
Class MultiLineString
Class MultiSurface
Class MultiPolygon
135. Supported Spatial Data Formats
Well-Known Text (WKT) Format
Well-Known Binary (WKB) Format
136. Creating a Spatially Enabled MySQL Database
MySQL Spatial Datatypes
Creating Spatial Values
Creating Geometry Values Using WKT Functions
Creating Geometry Values Using WKB Functions
Creating Geometry Values Using MySQL-Specific Functions
Creating Spatial Columns
Populating Spatial Columns
Fetching Spatial Data
Fetching Spatial Data in Internal Format
Fetching Spatial Data in WKT Format
Fetching Spatial Data in WKB Format
137. Analyzing Spatial Information
Geometry Format Conversion Functions
Geometry Functions
General Geometry Functions
Point Functions
LineString Functions
MultiLineString Functions
Polygon Functions
MultiPolygon Functions
GeometryCollection Functions
Functions That Create New Geometries from Existing Ones
Geometry Functions That Produce New Geometries
Spatial Operators
Functions for Testing Spatial Relations Between Geometric Objects
Relations on Geometry Minimal Bounding Rectangles (MBRs)
Functions That Test Spatial Relationships Between Geometries
138. Optimizing Spatial Analysis
Creating Spatial Indexes
Using a Spatial Index
139. MySQL Conformance and Compatibility
GIS Features That Are Not Yet Implemented
XIX. Stored Procedures and Functions
140. Stored Procedure Syntax
Maintaining Stored Procedures
CREATE PROCEDURE and CREATE FUNCTION
ALTER PROCEDURE and ALTER FUNCTION
DROP PROCEDURE and DROP FUNCTION
SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION
SHOW PROCEDURE STATUS and SHOW FUNCTION STATUS
CALL
BEGIN ... END Compound Statement
DECLARE Statement
Variables in Stored Procedures
DECLARE Local Variables
Variable SET Statement
SELECT ... INTO Statement
Conditions and Handlers
DECLARE Conditions
DECLARE Handlers
Cursors
Declaring Cursors
Cursor OPEN Statement
Cursor FETCH Statement
Cursor CLOSE Statement
Flow Control Constructs
IF Statement
CASE Statement
LOOP Statement
LEAVE Statement
ITERATE Statement
REPEAT Statement
WHILE Statement
XX. MySQL APIs
141. MySQL C API
C API Datatypes
C API Function Overview
C API Function Descriptions
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Example
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Example
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
See Also
Description
Return Values
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
mysql_affected_rows()
mysql_change_user()
mysql_character_set_name()
mysql_close()
mysql_connect()
mysql_create_db()
mysql_data_seek()
mysql_debug()
mysql_drop_db()
mysql_dump_debug_info()
mysql_eof()
mysql_errno()
mysql_error()
mysql_escape_string()
mysql_fetch_field()
mysql_fetch_fields()
mysql_fetch_field_direct()
mysql_fetch_lengths()
mysql_fetch_row()
mysql_field_count()
mysql_field_seek()
mysql_field_tell()
mysql_free_result()
mysql_get_client_info()
mysql_get_client_version()
mysql_get_host_info()
mysql_get_proto_info()
mysql_get_server_info()
mysql_get_server_version()
mysql_info()
mysql_init()
mysql_insert_id()
mysql_kill()
mysql_list_dbs()
mysql_list_fields()
mysql_list_processes()
mysql_list_tables()
mysql_num_fields()
mysql_num_rows()
mysql_options()
mysql_ping()
mysql_query()
mysql_real_connect()
mysql_real_escape_string()
mysql_real_query()
mysql_reload()
mysql_row_seek()
mysql_row_tell()
mysql_select_db()
mysql_set_server_option()
mysql_shutdown()
mysql_sqlstate()
mysql_ssl_set()
mysql_stat()
mysql_store_result()
mysql_thread_id()
mysql_use_result()
mysql_warning_count()
mysql_commit()
mysql_rollback()
mysql_autocommit()
mysql_more_results()
mysql_next_result()
C API Prepared Statements
C API Prepared Statement Datatypes
C API Prepared Statement Function Overview
Execution Steps
C API Prepared Statement Function Descriptions
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Example
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Errors
Description
Return Values
Description
Return Values
Errors
mysql_bind_param()
mysql_bind_result()
mysql_execute()
mysql_fetch()
mysql_fetch_column()
mysql_get_metadata()
mysql_param_count()
mysql_param_result()
mysql_prepare()
mysql_send_long_data()
mysql_stmt_affected_rows()
mysql_stmt_close()
mysql_stmt_data_seek()
mysql_stmt_errno()
mysql_stmt_error()
mysql_stmt_free_result()
mysql_stmt_num_rows()
mysql_stmt_reset()
mysql_stmt_row_seek()
mysql_stmt_row_tell()
mysql_stmt_sqlstate()
mysql_stmt_store_result()
C API Handling of Multiple Query Execution
C API Handling of Date and Time Values
C API Threaded Function Descriptions
Description
Return Values
Description
Return Values
Description
Return Values
Description
Return Values
my_init()
mysql_thread_init()
mysql_thread_end()
mysql_thread_safe()
C API Embedded Server Function Descriptions
Description
Example
Return Values
Description
Return Values
mysql_server_init()
mysql_server_end()
Common questions and problems when using the C API
Why mysql_store_result() Sometimes Returns NULL After mysql_query() Returns Success
What Results You Can Get from a Query
How to Get the Unique ID for the Last Inserted Row
Problems Linking with the C API
Building Client Programs
How to Make a Threaded Client
libmysqld, the Embedded MySQL Server Library
Overview of the Embedded MySQL Server Library
Compiling Programs with libmysqld
Restrictions when using the Embedded MySQL Server
Using Option Files with the Embedded Server
Things left to do in Embedded Server (TODO)
A Simple Embedded Server Example
Licensing the Embedded Server
142. MySQL ODBC Support
How to Install MyODBC
How to Fill in the Various Fields in the ODBC Administrator Program
Connect parameters for MyODBC
How to Report Problems with MyODBC
Programs Known to Work with MyODBC
How to Get the Value of an AUTO_INCREMENT Column in ODBC
Reporting Problems with MyODBC
143. MySQL Java Connectivity (JDBC)
144. MySQL PHP API
Common Problems with MySQL and PHP
145. MySQL Perl API
146. MySQL C API
Borland C++
147. MySQL Python API
148. MySQL Tcl API
149. MySQL Eiffel Wrapper
XXI.
XXII. Extending MySQL
150. MySQL Internals
MySQL Threads
MySQL Test Suite
Running the MySQL Test Suite
Extending the MySQL Test Suite
Reporting Bugs in the MySQL Test Suite
151. Adding New Functions to MySQL
CREATE FUNCTION/DROP FUNCTION Syntax
Adding a New User-defined Function
UDF Calling Sequences for simple functions
UDF Calling Sequences for aggregate functions
Argument Processing
Return Values and Error Handling
Compiling and Installing User-defined Functions
Adding a New Native Function
152. Adding New Procedures to MySQL
Procedure Analyse
Writing a Procedure
D. Problems and Common Errors
XXIII. How to Determine What Is Causing Problems
XXIV. Common Errors When Using MySQL
153. Access denied Error
154. MySQL server has gone away Error
155. Can't connect to [local] MySQL server Error
156. Client does not support authentication protocol error
157. Host '...' is blocked Error
158. Too many connections Error
159. Some non-transactional changed tables couldn't be rolled back Error
160. Out of memory Error
161. Packet too large Error
162. Communication Errors / Aborted Connection
163. The table is full Error
164. Can't create/write to file Error
165. Commands out of sync Error in Client
166. Ignoring user Error
167. Table 'xxx' doesn't exist Error
168. Can't initialize character set xxx error
169. File Not Found
XXV. Installation Related Issues
170. Problems When Linking with the MySQL Client Library
171. How to Run MySQL As a Normal User
172. Problems with File Permissions
XXVI. Administration Related Issues
173. What To Do If MySQL Keeps Crashing
174. How to Reset a Forgotten Root Password
175. How MySQL Handles a Full Disk
176. Where MySQL Stores Temporary Files
177. How to Protect or Change the MySQL Socket File /tmp/mysql.sock
178. Time Zone Problems
XXVII. Query Related Issues
179. Case-Sensitivity in Searches
180. Problems Using DATE Columns
181. Problems with NULL Values
182. Problems with alias
183. Deleting Rows from Related Tables
184. Solving Problems with No Matching Rows
185. Problems with Floating-Point Comparison
XXVIII. Optimizer Related Issues
186. How to avoid table scan,,,
XXIX. Table Definition Related Issues
187. Problems with ALTER TABLE.
188. How To Change the Order of Columns in a Table
189. TEMPORARY TABLE problems
E. Credits
XXX. Developers at MySQL AB
XXXI. Contributors to MySQL
XXXII. Documenters and translators
XXXIII. Libraries used by and included with MySQL
XXXIV. Packages that support MySQL
XXXV. Tools that were used to create MySQL
XXXVI. Supporters of MySQL
F. MySQL Change History
XXXVII. Changes in release 5.0.x (Development)
190. Changes in release 5.0.1 (not released yet)
191. Changes in release 5.0.0 (22 Dec 2003: Alpha)
XXXVIII. Changes in release 4.1.x (Alpha)
192. Changes in release 4.1.2 (not released yet)
193. Changes in release 4.1.1 (01 Dec 2003)
194. Changes in release 4.1.0 (03 Apr 2003: Alpha)
XXXIX. Changes in release 4.0.x (Production)
195. Changes in release 4.0.18 (not released yet)
196. Changes in release 4.0.17 (14 Dec 2003)
197. Changes in release 4.0.16 (17 Oct 2003)
198. Changes in release 4.0.15 (03 Sep 2003)
199. Changes in release 4.0.14 (18 Jul 2003)
200. Changes in release 4.0.13 (16 May 2003)
201. Changes in release 4.0.12 (15 Mar 2003: Production)
202. Changes in release 4.0.11 (20 Feb 2003)
203. Changes in release 4.0.10 (29 Jan 2003)
204. Changes in release 4.0.9 (09 Jan 2003)
205. Changes in release 4.0.8 (07 Jan 2003)
206. Changes in release 4.0.7 (20 Dec 2002)
207. Changes in release 4.0.6 (14 Dec 2002: Gamma)
208. Changes in release 4.0.5 (13 Nov 2002)
209. Changes in release 4.0.4 (29 Sep 2002)
210. Changes in release 4.0.3 (26 Aug 2002: Beta)
211. Changes in release 4.0.2 (01 Jul 2002)
212. Changes in release 4.0.1 (23 Dec 2001)
213. Changes in release 4.0.0 (Oct 2001: Alpha)
XL. Changes in release 3.23.x (Recent; still supported)
214. Changes in release 3.23.59 (not released yet)
215. Changes in release 3.23.58 (11 Sep 2003)
216. Changes in release 3.23.57 (06 Jun 2003)
217. Changes in release 3.23.56 (13 Mar 2003)
218. Changes in release 3.23.55 (23 Jan 2003)
219. Changes in release 3.23.54 (05 Dec 2002)
220. Changes in release 3.23.53 (09 Oct 2002)
221. Changes in release 3.23.52 (14 Aug 2002)
222. Changes in release 3.23.51 (31 May 2002)
223. Changes in release 3.23.50 (21 Apr 2002)
224. Changes in release 3.23.49
225. Changes in release 3.23.48 (07 Feb 2002)
226. Changes in release 3.23.47 (27 Dec 2001)
227. Changes in release 3.23.46 (29 Nov 2001)
228. Changes in release 3.23.45 (22 Nov 2001)
229. Changes in release 3.23.44 (31 Oct 2001)
230. Changes in release 3.23.43 (04 Oct 2001)
231. Changes in release 3.23.42 (08 Sep 2001)
232. Changes in release 3.23.41 (11 Aug 2001)
233. Changes in release 3.23.40
234. Changes in release 3.23.39 (12 Jun 2001)
235. Changes in release 3.23.38 (09 May 2001)
236. Changes in release 3.23.37 (17 Apr 2001)
237. Changes in release 3.23.36 (27 Mar 2001)
238. Changes in release 3.23.35 (15 Mar 2001)
239. Changes in release 3.23.34a
240. Changes in release 3.23.34 (10 Mar 2001)
241. Changes in release 3.23.33 (09 Feb 2001)
242. Changes in release 3.23.32 (22 Jan 2001: Production)
243. Changes in release 3.23.31 (17 Jan 2001)
244. Changes in release 3.23.30 (04 Jan 2001)
245. Changes in release 3.23.29 (16 Dec 2000)
246. Changes in release 3.23.28 (22 Nov 2000: Gamma)
247. Changes in release 3.23.27 (24 Oct 2000)
248. Changes in release 3.23.26 (18 Oct 2000)
249. Changes in release 3.23.25 (29 Sep 2000)
250. Changes in release 3.23.24 (08 Sep 2000)
251. Changes in release 3.23.23 (01 Sep 2000)
252. Changes in release 3.23.22 (31 Jul 2000)
253. Changes in release 3.23.21
254. Changes in release 3.23.20
255. Changes in release 3.23.19
256. Changes in release 3.23.18
257. Changes in release 3.23.17
258. Changes in release 3.23.16
259. Changes in release 3.23.15 (May 2000: Beta)
260. Changes in release 3.23.14
261. Changes in release 3.23.13
262. Changes in release 3.23.12 (07 Mar 2000)
263. Changes in release 3.23.11
264. Changes in release 3.23.10
265. Changes in release 3.23.9
266. Changes in release 3.23.8 (02 Jan 2000)
267. Changes in release 3.23.7 (10 Dec 1999)
268. Changes in release 3.23.6
269. Changes in release 3.23.5 (20 Oct 1999)
270. Changes in release 3.23.4 (28 Sep 1999)
271. Changes in release 3.23.3
272. Changes in release 3.23.2 (09 Aug 1999)
273. Changes in release 3.23.1
274. Changes in release 3.23.0 (05 Aug 1999: Alpha)
XLI. Changes in release 3.22.x (Old; discontinued)
275. Changes in release 3.22.35
276. Changes in release 3.22.34
277. Changes in release 3.22.33
278. Changes in release 3.22.32 (14 Feb 2000)
279. Changes in release 3.22.31
280. Changes in release 3.22.30
281. Changes in release 3.22.29 (02 Jan 2000)
282. Changes in release 3.22.28 (20 Oct 1999)
283. Changes in release 3.22.27
284. Changes in release 3.22.26 (16 Sep 1999)
285. Changes in release 3.22.25
286. Changes in release 3.22.24 (05 Jul 1999)
287. Changes in release 3.22.23 (08 Jun 1999)
288. Changes in release 3.22.22 (30 Apr 1999)
289. Changes in release 3.22.21
290. Changes in release 3.22.20 (18 Mar 1999)
291. Changes in release 3.22.19 (Mar 1999: Production)
292. Changes in release 3.22.18
293. Changes in release 3.22.17
294. Changes in release 3.22.16 (Feb 1999: Gamma)
295. Changes in release 3.22.15
296. Changes in release 3.22.14
297. Changes in release 3.22.13
298. Changes in release 3.22.12
299. Changes in release 3.22.11
300. Changes in release 3.22.10
301. Changes in release 3.22.9
302. Changes in release 3.22.8
303. Changes in release 3.22.7 (Sep 1998: Beta)
304. Changes in release 3.22.6
305. Changes in release 3.22.5
306. Changes in release 3.22.4
307. Changes in release 3.22.3
308. Changes in release 3.22.2
309. Changes in release 3.22.1 (Jun 1998: Alpha)
310. Changes in release 3.22.0
XLII. Changes in release 3.21.x
311. Changes in release 3.21.33
312. Changes in release 3.21.32
313. Changes in release 3.21.31
314. Changes in release 3.21.30
315. Changes in release 3.21.29
316. Changes in release 3.21.28
317. Changes in release 3.21.27
318. Changes in release 3.21.26
319. Changes in release 3.21.25
320. Changes in release 3.21.24
321. Changes in release 3.21.23
322. Changes in release 3.21.22
323. Changes in release 3.21.21a
324. Changes in release 3.21.21
325. Changes in release 3.21.20
326. Changes in release 3.21.19
327. Changes in release 3.21.18
328. Changes in release 3.21.17
329. Changes in release 3.21.16
330. Changes in release 3.21.15
331. Changes in release 3.21.14b
332. Changes in release 3.21.14a
333. Changes in release 3.21.13
334. Changes in release 3.21.12
335. Changes in release 3.21.11
336. Changes in release 3.21.10
337. Changes in release 3.21.9
338. Changes in release 3.21.8
339. Changes in release 3.21.7
340. Changes in release 3.21.6
341. Changes in release 3.21.5
342. Changes in release 3.21.4
343. Changes in release 3.21.3
344. Changes in release 3.21.2
345. Changes in release 3.21.0
XLIII. Changes in release 3.20.x
346. Changes in release 3.20.18
347. Changes in release 3.20.17
348. Changes in release 3.20.16
349. Changes in release 3.20.15
350. Changes in release 3.20.14
351. Changes in release 3.20.13
352. Changes in release 3.20.11
353. Changes in release 3.20.10
354. Changes in release 3.20.9
355. Changes in release 3.20.8
356. Changes in release 3.20.7
357. Changes in release 3.20.6
358. Changes in release 3.20.3
359. Changes in release 3.20.0
XLIV. Changes in release 3.19.x
360. Changes in release 3.19.5
361. Changes in release 3.19.4
362. Changes in release 3.19.3
G. Porting to Other Systems
XLV. Debugging a MySQL server
363. Compiling MYSQL for Debugging
364. Creating Trace Files
365. Debugging mysqld under gdb
366. Using a Stack Trace
367. Using Log Files to Find Cause of Errors in mysqld
368. Making a Test Case If You Experience Table Corruption
XLVI. Debugging a MySQL client
XLVII. The DBUG Package
XLVIII. Locking methods
XLIX. Comments about RTS threads
L. Differences between different thread packages
H. Environment Variables
I. MySQL Regular Expressions
J. GNU General Public License
Preamble
How to Apply These Terms to Your New Programs
LI. SQL command, type and function index
LII. Concept Index

List of Figures

3.1. Connection dialog
3.2. Options dialog
3.3. Options dialog: Connections
3.4. Error message dialog
4.1. MySQL Administrator main window
9.1. User accounts
9.2. User Information tab
11.1. Displaying entries from the middle of the General Log