MySQL 5.5 Reference Manual
MySQL 5.5 Reference Manual
Abstract
This is the MySQL™ Reference Manual. It documents MySQL 5.5 through 5.5.16.
MySQL Cluster is currently not supported in MySQL 5.5. For information about MySQL Cluster, please see MySQL
Cluster NDB 6.X/7.X.
MySQL 5.5 features. This manual describes features that are not included in every edition of MySQL 5.5; such fea-
tures may not be included in the edition of MySQL 5.5 licensed to you. If you have any questions about the features
included in your edition of MySQL 5.5, refer to your MySQL 5.5 license agreement or contact your Oracle sales rep-
resentative.
Document generated on: 2011-07-20 (revision: 26887)
Getting Star-
ted
Platforms Administrat-
ors
Developers Functionality Connectors HA/Scalability
Tutorial » Linux/Unix Server Option/
Variable Refer-
ence
Server Option/
Variable Refer-
ence
SQL Syntax Connector/J » HA/
Scalability
Guide
Installation » Mac OS X MySQL
Change History
» MySQL Ver-
sion Reference
Views Connector/
ODBC
MySQL and
DRBD
Upgrading » Windows » MySQL Ver-
sion Reference
SQL Syntax Stored
Routines
Connector/
NET
MySQL and
Virtualization
Server Admin-
istration
» Solaris » Security Optimization Replication Connector/C++ Memcached
FAQs » Building
from Source
» Startup/
Shutdown
Connectors &
APIs
Semisynchron-
ous Replication
Connector/
OOo
MySQL Proxy
» Backup and
Recovery
Functions and
Operators
Spatial Exten-
sions
PHP Replication
Partitioning Stored Pro-
grams and
View
Precision Math C API Semisynchron-
ous Replication
Information
Schema
SIGNAL/
RESIGNAL
Globalization
Partitioning
Copyright © 1997, 2011, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by
intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate,
broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering,
disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them
to us in writing.
If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the follow-
ing notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government cus-
tomers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-
specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and li-
cense terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional
rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood
City, CA 94065.
This software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inher-
ently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications,
then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle
Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. MySQL is a trademark of Oracle Corporation and/or its affiliates, and
shall not be used without Oracle's express written authorization. Other names may be trademarks of their respective owners.
This software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation
and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services.
Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party con-
tent, products, or services.
This document in any form, software or printed matter, contains proprietary information that is the exclusive property of Oracle. Your access to and
use of this material is subject to the terms and conditions of your Oracle Software License and Service Agreement, which has been executed and
with which you agree to comply. This document and information contained herein may not be disclosed, copied, reproduced, or distributed to any-
one outside Oracle without prior written consent of Oracle or as specifically provided below. This document is not part of your license agreement
nor can it be incorporated into any contractual agreement with Oracle or its subsidiaries or affiliates.
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 distrib-
ute the documentation in a manner similar to how Oracle 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 oth-
er use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior writ-
ten consent from an authorized representative of Oracle. Oracle and/or its affiliates 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 visit MySQL Contact & Questions.
For additional licensing information, including licenses for third-party libraries used by MySQL products, see Preface and Notes.
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 and PDF formats, see the MySQL Documentation Library.
Table of Contents
Preface and Notes ....................................................................................................................... xxviii
1. General Information .......................................................................................................................1
1.1. About This Manual ..............................................................................................................1
1.2. Typographical and Syntax Conventions ......................................................................................2
1.3. Overview of the MySQL Database Management System ..................................................................3
1.3.1. What is MySQL? ......................................................................................................3
1.3.2. History of MySQL ....................................................................................................4
1.3.3. The Main Features of MySQL .......................................................................................4
1.4. MySQL Development History .................................................................................................7
1.5. What Is New in MySQL 5.5 ....................................................................................................7
1.5.1. Scalability Improvements .......................................................................................... 10
1.5.2. InnoDB I/O Subsystem Changes ................................................................................. 10
1.5.3. Diagnostic and Monitoring Capabilities .......................................................................... 11
1.5.4. Enhanced Solaris Support .......................................................................................... 11
1.6. MySQL Information Sources ................................................................................................ 11
1.6.1. MySQL Mailing Lists ............................................................................................... 12
1.6.2. MySQL Community Support at the MySQL Forums .......................................................... 13
1.6.3. MySQL Community Support on Internet Relay Chat (IRC) .................................................. 14
1.6.4. MySQL Enterprise .................................................................................................. 14
1.7. How to Report Bugs or Problems ........................................................................................... 14
1.8. MySQL Standards Compliance .............................................................................................. 17
1.8.1. What Standards MySQL Follows ................................................................................. 18
1.8.2. Selecting SQL Modes ............................................................................................... 18
1.8.3. Running MySQL in ANSI Mode .................................................................................. 18
1.8.4. MySQL Extensions to Standard SQL ............................................................................. 18
1.8.5. MySQL Differences from Standard SQL ........................................................................ 21
1.8.6. How MySQL Deals with Constraints ............................................................................. 25
1.9. Credits ........................................................................................................................... 27
1.9.1. Contributors to MySQL ............................................................................................ 27
1.9.2. Documenters and translators ....................................................................................... 30
1.9.3. Packages that support MySQL ..................................................................................... 32
1.9.4. Tools that were used to create MySQL ........................................................................... 32
1.9.5. Supporters of MySQL .............................................................................................. 33
2. Installing and Upgrading MySQL ..................................................................................................... 34
2.1. General Installation Guidance ................................................................................................ 35
2.1.1. Operating Systems Supported by MySQL Community Server ............................................... 35
2.1.2. Choosing Which MySQL Distribution to Install ................................................................ 36
2.1.3. How to Get MySQL ................................................................................................. 38
2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG ............................................. 39
2.1.5. Installation Layouts ................................................................................................. 41
2.1.6. Compiler-Specific Build Characteristics ......................................................................... 41
2.2. Installing MySQL from Generic Binaries on Unix/Linux ................................................................ 42
2.3. Installing MySQL on Microsoft Windows ................................................................................. 44
2.3.1. MySQL Installation Layout on Microsoft Windows ........................................................... 45
2.3.2. Choosing An Installation Package ................................................................................ 45
2.3.3. Installing MySQL on Microsoft Windows Using an MSI Package .......................................... 45
2.3.4. MySQL Server Instance Configuration Wizard ................................................................. 50
2.3.5. Installing MySQL on Microsoft Windows Using a noinstall Zip Archive ............................ 63
2.3.6. Troubleshooting a MySQL Installation Under Windows ...................................................... 69
2.3.7. Upgrading MySQL on Windows .................................................................................. 70
2.3.8. Windows Postinstallation Procedures ............................................................................ 71
2.4. Installing MySQL on Mac OS X ............................................................................................ 72
2.4.1. General Notes on Installing MySQL on Mac OS X ............................................................ 73
2.4.2. Installing MySQL on Mac OS X Using Native Packages ..................................................... 74
2.4.3. Installing the MySQL Startup Item ............................................................................... 76
2.4.4. Installing and Using the MySQL Preference Pane .............................................................. 79
2.4.5. Using the Bundled MySQL on Mac OS X Server .............................................................. 80
2.5. Installing MySQL on Linux .................................................................................................. 81
2.5.1. Installing MySQL from RPM Packages on Linux .............................................................. 82
2.5.2. Installing MySQL on Linux using Native Package Manager .................................................. 85
2.6. Installing MySQL on Solaris and OpenSolaris ............................................................................ 87
2.6.1. Installing MySQL on Solaris using a Solaris PKG .............................................................. 88
2.6.2. Installing MySQL on OpenSolaris using IPS .................................................................... 89
2.7. Installing MySQL on HP-UX ................................................................................................ 90
v