Copyright © 1997-2008 MySQL AB, 2009 Sun Microsystems, Inc. All rights reserved. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java, Solaris, StarOffice, MySQL Enterprise Monitor 2.0, MySQL logo™ and MySQL™ are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.
Copyright © 1997-2008 MySQL AB, 2009 Sun Microsystems, Inc. Tous droits réservés. L'utilisation est soumise aux termes du contrat de licence.Sun, Sun Microsystems, le logo Sun, Java, Solaris, StarOffice, MySQL Enterprise Monitor 2.0, MySQL logo™ et MySQL™ sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays. UNIX est une marque déposée aux Etats-Unis et dans d'autres pays et licenciée exlusivement par X/Open Company, Ltd.
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 Sun 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 Sun Microsystems, Inc. Sun Microsystems, Inc. and MySQL AB reserve 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 the Documentation Team.
For additional licensing information, including licenses for libraries used by MySQL, see Preface, Notes, Licenses.
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 5.0 through 5.0.84.
This manual is for MySQL Enterprise Server, our commercial offering, and for MySQL Community Server. Sections that do not apply for MySQL Enterprise Server users are marked:
This section does not apply to MySQL Enterprise Server users.
Sections that do not apply to MySQL Community Server users are marked:
This section does not apply to MySQL Community Server users.
MySQL 5.0 Features — This manual describes features that are not included in every edition of MySQL 5.0 and such features may not be included in the edition of MySQL 5.0 licensed to you. If you have any questions about the features included in your edition of MySQL 5.0, refer to your MySQL 5.0 license agreement or contact your Sun Microsystems sales representative."
Document generated on: 2009-07-02 (revision: 15556)
The following table provides direct links into areas of the manual according to different topics. Links marked with » link to online guides and other manuals for more information.
Table 1. Topic Quick Reference
Table of Contents
GnuPG
tar.gz
Packages on Other
Unix-Like SystemsAUTO_INCREMENT
SELECT
and Other StatementsEXPLAIN
SELECT
QueriesWHERE
Clause OptimizationIS NULL
OptimizationLEFT JOIN
and RIGHT JOIN
OptimizationORDER BY
OptimizationGROUP BY
OptimizationDISTINCT
OptimizationIN
/=ANY
SubqueriesLIMIT
OptimizationINSERT
StatementsUPDATE
StatementsDELETE
StatementsGROUP BY
ClausesALTER DATABASE
SyntaxALTER FUNCTION
SyntaxALTER PROCEDURE
SyntaxALTER TABLE
SyntaxALTER VIEW
SyntaxCREATE DATABASE
SyntaxCREATE FUNCTION
SyntaxCREATE INDEX
SyntaxCREATE PROCEDURE
and
CREATE FUNCTION
SyntaxCREATE TABLE
SyntaxCREATE TRIGGER
SyntaxCREATE VIEW
SyntaxDROP DATABASE
SyntaxDROP FUNCTION
SyntaxDROP INDEX
SyntaxDROP PROCEDURE
and
DROP FUNCTION
SyntaxDROP TABLE
SyntaxDROP TRIGGER
SyntaxDROP VIEW
SyntaxRENAME TABLE
SyntaxMyISAM
Storage EngineInnoDB
Storage EngineInnoDB
Contact InformationInnoDB
ConfigurationInnoDB
Startup Options and System VariablesInnoDB
TablesInnoDB
Data and Log
FilesInnoDB
DatabaseInnoDB
Database to Another MachineInnoDB
Transaction Model and LockingInnoDB
Multi-VersioningInnoDB
Table and Index StructuresInnoDB
Disk I/O and File Space ManagementInnoDB
Error HandlingInnoDB
Performance Tuning and TroubleshootingInnoDB
TablesMERGE
Storage EngineMEMORY
(HEAP
) Storage EngineBDB
(BerkeleyDB
) Storage
EngineEXAMPLE
Storage EngineFEDERATED
Storage EngineARCHIVE
Storage EngineCSV
Storage EngineBLACKHOLE
Storage EngineINFORMATION_SCHEMA
TablesINFORMATION_SCHEMA SCHEMATA
TableINFORMATION_SCHEMA TABLES
TableINFORMATION_SCHEMA COLUMNS
TableINFORMATION_SCHEMA STATISTICS
TableINFORMATION_SCHEMA USER_PRIVILEGES
TableINFORMATION_SCHEMA SCHEMA_PRIVILEGES
TableINFORMATION_SCHEMA TABLE_PRIVILEGES
TableINFORMATION_SCHEMA COLUMN_PRIVILEGES
TableINFORMATION_SCHEMA CHARACTER_SETS
TableINFORMATION_SCHEMA COLLATIONS
TableINFORMATION_SCHEMA
COLLATION_CHARACTER_SET_APPLICABILITY
TableINFORMATION_SCHEMA TABLE_CONSTRAINTS
TableINFORMATION_SCHEMA KEY_COLUMN_USAGE
TableINFORMATION_SCHEMA ROUTINES
TableINFORMATION_SCHEMA VIEWS
TableINFORMATION_SCHEMA TRIGGERS
TableINFORMATION_SCHEMA PROFILING
TableINFORMATION_SCHEMA
TablesSHOW
StatementsCALL
StatementsINFORMATION_SCHEMA
INFORMATION_SCHEMA
IndexJOIN
Types IndexList of Figures
List of Tables
configure
) ReferenceList of Examples
DriverManager
SELECT
queryConnection.prepareCall()
CallableStatement
input
parametersAUTO_INCREMENT
column values
using Statement.getGeneratedKeys()
AUTO_INCREMENT
column values
using SELECT LAST_INSERT_ID()
AUTO_INCREMENT
column values
in Updatable ResultSets
mysql_affected_rows
examplemysql_affected_rows
example using transactionsmysql_client_encoding
examplemysql_close
examplemysql_connect
examplemysql_connect
example using hostname:port
syntaxmysql_connect
example using ":/path/to/socket" syntaxmysql_create_db
alternative examplemysql_data_seek
examplemysql_db_name
examplemysql_db_query
alternative examplemysql_drop_db
alternative examplemysql_errno
examplemysql_error
examplemysql_escape_string
examplemysql_fetch_array
with
MYSQL_NUM
mysql_fetch_array
with
MYSQL_ASSOC
mysql_fetch_array
with
MYSQL_BOTH
mysql_fetch_assoc
examplemysql_fetch_field
examplemysql_fetch_lengths
examplemysql_fetch_object
examplemysql_fetch_object
examplemysql_fetch_row
mysql_field_flags
examplemysql_field_len
examplemysql_field_name
examplemysql_field_table
examplemysql_field_type
examplemysql_free_result
examplemysql_get_client_info
examplemysql_get_host_info
examplemysql_get_proto_info
examplemysql_get_server_info
examplemysql_insert_id
examplemysql_list_dbs
examplemysql_list_fields
mysql_list_processes
examplemysql_list_tables
alternative examplemysql_num_fields
examplemysql_num_rows
examplemysql_ping
examplemysql_real_escape_string
examplemysql_result
examplemysql_select_db
examplemysql_stat
examplemysql_stat
examplemysql_tablename
examplemysql_thread_id
examplemysqli_get_cache_stats
examplemysqli_get_client_stats
examplemysqli_get_connection_stats
examplemysqli_poll
example