manual_toc.html
MySQL Reference Manual for version 5.0.3-alpha
- 1 General Information
- 1.1 About This Manual
- 1.2 Overview of the MySQL Database Management System
- 1.3 MySQL Development Roadmap
- 1.4 MySQL Information Sources
- 1.5 MySQL Standards Compliance
- 2 Installing MySQL
- 2.1 General Installation Issues
- 2.2 Standard MySQL Installation Using a Binary Distribution
- 2.3 Installing MySQL on Windows
- 2.3.1 Windows System Requirements
- 2.3.2 Choosing An Installation Package
- 2.3.3 Installing MySQL with the Automated Installer
- 2.3.4 Using the MySQL Installation Wizard
- 2.3.5 Using the Configuration Wizard
- 2.3.5.1 Introduction
- 2.3.5.2 Starting the MySQL Configuration Wizard
- 2.3.5.3 Choosing a Maintenance Option
- 2.3.5.4 Choosing a Configuration Type
- 2.3.5.5 The Server Type Dialog
- 2.3.5.6 The Database Usage Dialog
- 2.3.5.7 The InnoDB Tablespace Dialog
- 2.3.5.8 The Concurrent Connections Dialog
- 2.3.5.9 The Networking Options Dialog
- 2.3.5.10 The Character Set Dialog
- 2.3.5.11 The Service Options Dialog
- 2.3.5.12 The Security Options Dialog
- 2.3.5.13 The Confirmation Dialog
- 2.3.5.14 The Location of the my.ini File
- 2.3.5.15 Editing The my.ini File
- 2.3.6 Installing MySQL from a noinstall Zip Archive
- 2.3.7 Extracting the Install Archive
- 2.3.8 Creating an Option File
- 2.3.9 Selecting a MySQL Server type
- 2.3.10 Starting the Server for the First Time
- 2.3.11 Starting MySQL from the Windows Command Line
- 2.3.12 Starting MySQL as a Windows Service
- 2.3.13 Testing The MySQL Installation
- 2.3.14 Troubleshooting a MySQL Installation Under Windows
- 2.3.15 Upgrading MySQL on Windows
- 2.3.16 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 NetWare
- 2.7 Installing MySQL on Other Unix-Like Systems
- 2.8 MySQL Installation Using a Source Distribution
- 2.9 Post-Installation Setup and Testing
- 2.10 Upgrading MySQL
- 2.10.1 Upgrading from Version 4.1 to 5.0
- 2.10.2 Upgrading from Version 4.0 to 4.1
- 2.10.3 Upgrading from Version 3.23 to 4.0
- 2.10.4 Upgrading from Version 3.22 to 3.23
- 2.10.5 Upgrading from Version 3.21 to 3.22
- 2.10.6 Upgrading from Version 3.20 to 3.21
- 2.10.7 Upgrading the Grant Tables
- 2.10.8 Copying MySQL Databases to Another Machine
- 2.11 Downgrading MySQL
- 2.12 Operating System-Specific Notes
- 2.12.1 Linux Notes
- 2.12.1.1 Linux Operating System Notes
- 2.12.1.2 Linux Binary Distribution Notes
- 2.12.1.3 Linux Source Distribution Notes
- 2.12.1.4 Linux Post-Installation Notes
- 2.12.1.5 Linux x86 Notes
- 2.12.1.6 Linux SPARC Notes
- 2.12.1.7 Linux Alpha Notes
- 2.12.1.8 Linux PowerPC Notes
- 2.12.1.9 Linux MIPS Notes
- 2.12.1.10 Linux IA-64 Notes
- 2.12.2 Mac OS X Notes
- 2.12.3 Solaris Notes
- 2.12.4 BSD Notes
- 2.12.5 Other Unix Notes
- 2.12.6 OS/2 Notes
- 2.12.7 BeOS Notes
- 2.12.1 Linux Notes
- 2.13 Perl Installation Notes
- 3 MySQL Tutorial
- 3.1 Connecting to and Disconnecting from the Server
- 3.2 Entering Queries
- 3.3 Creating and Using a Database
- 3.4 Getting Information About Databases and Tables
- 3.5 Using
mysqlin 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 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.8 Using MySQL with Apache
- 4 Using MySQL Programs
- 5 Database Administration
- 5.1 The MySQL Server and Server Startup Scripts
- 5.2 Configuring the MySQL Server
- 5.3 The MySQL Server Shutdown Process
- 5.4 General Security Issues
- 5.5 The MySQL Access Privilege System
- 5.5.1 What the Privilege System Does
- 5.5.2 How the Privilege System Works
- 5.5.3 Privileges Provided by MySQL
- 5.5.4 Connecting to the MySQL Server
- 5.5.5 Access Control, Stage 1: Connection Verification
- 5.5.6 Access Control, Stage 2: Request Verification
- 5.5.7 When Privilege Changes Take Effect
- 5.5.8 Causes of
Access deniedErrors - 5.5.9 Password Hashing in MySQL 4.1
- 5.6 MySQL User Account Management
- 5.7 Disaster Prevention and Recovery
- 5.7.1 Database Backups
- 5.7.2 Table Maintenance and Crash Recovery
- 5.7.2.1
myisamchkInvocation Syntax - 5.7.2.2 General Options for
myisamchk - 5.7.2.3 Check Options for
myisamchk - 5.7.2.4 Repair Options for
myisamchk - 5.7.2.5 Other Options for
myisamchk - 5.7.2.6
myisamchkMemory Usage - 5.7.2.7 Using
myisamchkfor Crash Recovery - 5.7.2.8 How to Check
MyISAMTables for Errors - 5.7.2.9 How to Repair Tables
- 5.7.2.10 Table Optimization
- 5.7.2.1
- 5.7.3 Setting Up a Table Maintenance Schedule
- 5.7.4 Getting Information About a Table
- 5.8 MySQL Localization and International Usage
- 5.9 The MySQL Log Files
- 5.10 Running Multiple MySQL Servers on the Same Machine
- 5.11 The MySQL Query Cache
- 6 Replication in MySQL
- 6.1 Introduction to Replication
- 6.2 Replication Implementation Overview
- 6.3 Replication Implementation Details
- 6.4 How to Set Up Replication
- 6.5 Replication Compatibility Between MySQL Versions
- 6.6 Upgrading a Replication Setup
- 6.7 Replication Features and Known Problems
- 6.8 Replication Startup Options
- 6.9 Replication FAQ
- 6.10 Troubleshooting Replication
- 6.11 Reporting Replication Bugs
- 7 MySQL Optimization
- 7.1 Optimization Overview
- 7.2 Optimizing
SELECTStatements and Other Queries- 7.2.1
EXPLAINSyntax (Get Information About aSELECT) - 7.2.2 Estimating Query Performance
- 7.2.3 Speed of
SELECTQueries - 7.2.4 How MySQL Optimizes
WHEREClauses - 7.2.5 Range Optimization
- 7.2.6 Index Merge Optimization
- 7.2.7 How MySQL Optimizes
IS NULL - 7.2.8 How MySQL Optimizes
DISTINCT - 7.2.9 How MySQL Optimizes
LEFT JOINandRIGHT JOIN - 7.2.10 How MySQL Optimizes
ORDER BY - 7.2.11 How MySQL Optimizes
GROUP BY - 7.2.12 How MySQL Optimizes
LIMIT - 7.2.13 How to Avoid Table Scans
- 7.2.14 Speed of
INSERTStatements - 7.2.15 Speed of
UPDATEStatements - 7.2.16 Speed of
DELETEStatements - 7.2.17 Other Optimization Tips
- 7.2.1
- 7.3 Locking Issues
- 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
MyISAMKey Cache - 7.4.7 How MySQL Counts Open Tables
- 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.6 Disk Issues
- 8 MySQL Client and Utility Programs
- 8.1 Overview of the Client-Side Scripts and Utilities
- 8.2
myisampack, the MySQL Compressed Read-only Table Generator - 8.3
mysql, the Command-Line Tool - 8.4
mysqladmin, Administering a MySQL Server - 8.5 The
mysqlbinlogBinary Log Utility - 8.6
mysqlcc, the MySQL Control Center - 8.7 The
mysqlcheckTable Maintenance and Repair Program - 8.8 The
mysqldumpDatabase Backup Program - 8.9 The
mysqlhotcopyDatabase Backup Program - 8.10 The
mysqlimportData Import Program - 8.11
mysqlshow, Showing Databases, Tables, and Columns - 8.12
perror, Explaining Error Codes - 8.13 The
replaceString-Replacement Utility
- 9 Language Structure
- 10 Character Set Support
- 10.1 Character Sets and Collations in General
- 10.2 Character Sets and Collations in MySQL
- 10.3 Determining the Default Character Set and Collation
- 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 Examples of Character Set and Collation Assignment
- 10.3.6 Connection Character Sets and Collations
- 10.3.7 Character String Literal Character Set and Collation
- 10.3.8 Using
COLLATEin SQL Statements - 10.3.9
COLLATEClause Precedence - 10.3.10
BINARYOperator - 10.3.11 Some Special Cases Where the Collation Determination Is Tricky
- 10.3.12 Collations Must Be for the Right Character Set
- 10.3.13 An Example of the Effect of Collation
- 10.4 Operations Affected by Character Set Support
- 10.5 Unicode Support
- 10.6 UTF8 for Metadata
- 10.7 Compatibility with Other DBMSs
- 10.8 New Character Set Configuration File Format
- 10.9 National Character Set
- 10.10 Upgrading Character Sets from MySQL 4.0
- 10.11 Character Sets and Collations That MySQL Supports
- 11 Column Types
- 12 Functions and Operators
- 13 SQL Statement Syntax
- 13.1 Data Manipulation Statements
- 13.1.1
DELETESyntax - 13.1.2
DOSyntax - 13.1.3
HANDLERSyntax - 13.1.4
INSERTSyntax - 13.1.5
LOAD DATA INFILESyntax - 13.1.6
REPLACESyntax - 13.1.7
SELECTSyntax - 13.1.8 Subquery Syntax
- 13.1.8.1 The Subquery as Scalar Operand
- 13.1.8.2 Comparisons Using Subqueries
- 13.1.8.3 Subqueries with
ANY,IN, andSOME - 13.1.8.4 Subqueries with
ALL - 13.1.8.5 Row Subqueries
- 13.1.8.6
EXISTSandNOT EXISTS - 13.1.8.7 Correlated Subqueries
- 13.1.8.8 Subqueries in the
FROMclause - 13.1.8.9 Subquery Errors
- 13.1.8.10 Optimizing Subqueries
- 13.1.8.11 Rewriting Subqueries as Joins for Earlier MySQL Versions
- 13.1.9
TRUNCATESyntax - 13.1.10
UPDATESyntax
- 13.1.1
- 13.2 Data Definition Statements
- 13.2.1
ALTER DATABASESyntax - 13.2.2
ALTER TABLESyntax - 13.2.3
ALTER VIEWSyntax - 13.2.4
CREATE DATABASESyntax - 13.2.5
CREATE INDEXSyntax - 13.2.6
CREATE TABLESyntax - 13.2.7
CREATE VIEWSyntax - 13.2.8
DROP DATABASESyntax - 13.2.9
DROP INDEXSyntax - 13.2.10
DROP TABLESyntax - 13.2.11
DROP VIEWSyntax - 13.2.12
RENAME TABLESyntax
- 13.2.1
- 13.3 MySQL Utility Statements
- 13.4 MySQL Transactional and Locking Statements
- 13.5 Database Administration Statements
- 13.5.1 Account Management Statements
- 13.5.2 Table Maintenance Statements
- 13.5.3
SETSyntax - 13.5.4
SHOWSyntax- 13.5.4.1
SHOW CHARACTER SETSyntax - 13.5.4.2
SHOW COLLATIONSyntax - 13.5.4.3
SHOW COLUMNSSyntax - 13.5.4.4
SHOW CREATE DATABASESyntax - 13.5.4.5
SHOW CREATE TABLESyntax - 13.5.4.6
SHOW CREATE VIEWSyntax - 13.5.4.7
SHOW DATABASESSyntax - 13.5.4.8
SHOW ENGINESSyntax - 13.5.4.9
SHOW ERRORSSyntax - 13.5.4.10
SHOW GRANTSSyntax - 13.5.4.11
SHOW INDEXSyntax - 13.5.4.12
SHOW INNODB STATUSSyntax - 13.5.4.13
SHOW LOGSSyntax - 13.5.4.14
SHOW PRIVILEGESSyntax - 13.5.4.15
SHOW PROCESSLISTSyntax - 13.5.4.16
SHOW STATUSSyntax - 13.5.4.17
SHOW TABLE STATUSSyntax - 13.5.4.18
SHOW TABLESSyntax - 13.5.4.19
SHOW VARIABLESSyntax - 13.5.4.20
SHOW WARNINGSSyntax
- 13.5.4.1
- 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.6.2.1
CHANGE MASTER TOSyntax - 13.6.2.2
LOAD DATA FROM MASTERSyntax - 13.6.2.3
LOAD TABLE tbl_name FROM MASTERSyntax - 13.6.2.4
MASTER_POS_WAIT()Syntax - 13.6.2.5
RESET SLAVESyntax - 13.6.2.6
SET GLOBAL SQL_SLAVE_SKIP_COUNTERSyntax - 13.6.2.7
SHOW SLAVE STATUSSyntax - 13.6.2.8
START SLAVESyntax - 13.6.2.9
STOP SLAVESyntax
- 13.6.2.1
- 13.7 SQL Syntax for Prepared Statements
- 13.1 Data Manipulation Statements
- 14 MySQL Storage Engines and Table Types
- 14.1 The
MyISAMStorage Engine - 14.2 The
MERGEStorage Engine - 14.3 The
MEMORY(HEAP) Storage Engine - 14.4 The
BDB(BerkeleyDB) Storage Engine - 14.5 The
EXAMPLEStorage Engine - 14.6 The
FEDERATEDStorage Engine - 14.7 The
ARCHIVEStorage Engine - 14.8 The
CSVStorage Engine - 14.9 The
ISAMStorage Engine
- 14.1 The
- 15 The
InnoDBStorage Engine- 15.1
InnoDBOverview - 15.2
InnoDBContact Information - 15.3
InnoDBin MySQL 3.23 - 15.4
InnoDBConfiguration - 15.5
InnoDBStartup Options - 15.6 Creating the
InnoDBTablespace - 15.7 Creating
InnoDBTables - 15.8 Adding and Removing
InnoDBData and Log Files - 15.9 Backing Up and Recovering an
InnoDBDatabase - 15.10 Moving an
InnoDBDatabase to Another Machine - 15.11
InnoDBTransaction Model and Locking- 15.11.1
InnoDBandAUTOCOMMIT - 15.11.2
InnoDBandTRANSACTION ISOLATION LEVEL - 15.11.3 Consistent Non-Locking Read
- 15.11.4 Locking Reads
SELECT ... FOR UPDATEandSELECT ... LOCK IN SHARE MODE - 15.11.5 Next-Key Locking: Avoiding the Phantom Problem
- 15.11.6 An Example of How the Consistent Read Works in
InnoDB - 15.11.7 Locks Set by Different SQL Statements in
InnoDB - 15.11.8 When Does MySQL Implicitly Commit or Roll Back a Transaction?
- 15.11.9 Deadlock Detection and Rollback
- 15.11.10 How to Cope with Deadlocks
- 15.11.1
- 15.12
InnoDBPerformance Tuning Tips - 15.13 Implementation of Multi-Versioning
- 15.14 Table and Index Structures
- 15.15 File Space Management and Disk I/O
- 15.16 Error Handling
- 15.17 Restrictions on
InnoDBTables - 15.18
InnoDBTroubleshooting
- 15.1
- 16 MySQL Cluster
- 16.1 MySQL Cluster Overview
- 16.2 Basic MySQL Cluster Concepts
- 16.3 MySQL Cluster Configuration
- 16.3.1 Building from Source Code
- 16.3.2 Installing the Software
- 16.3.3 Quick Test Setup of MySQL Cluster
- 16.3.4 Configuration File
- 16.3.4.1 Example Configuration for a MySQL Cluster
- 16.3.4.2 The MySQL Cluster
connectstring - 16.3.4.3 Defining the Computers Making up a MySQL Cluster
- 16.3.4.4 Defining the MySQL Cluster Management Server
- 16.3.4.5 Defining MySQL Cluster Storage Nodes
- 16.3.4.6 Defining the MySQL Servers for a MySQL Cluster
- 16.3.4.7 MySQL Cluster TCP/IP Connections
- 16.3.4.8 MySQL Cluster Shared-Memory Connections
- 16.3.4.9 MySQL Cluster SCI Transport Connections
- 16.4 Process Management in MySQL Cluster
- 16.5 Management of MySQL Cluster
- 16.6 Using High-Speed Interconnects with MySQL Cluster
- 16.7 MySQL Cluster Limitations in 4.1
- 17 Introduction to MaxDB
- 18 Spatial Extensions in MySQL
- 18.1 Introduction
- 18.2 The OpenGIS Geometry Model
- 18.2.1 The Geometry Class Hierarchy
- 18.2.2 Class
Geometry - 18.2.3 Class
Point - 18.2.4 Class
Curve - 18.2.5 Class
LineString - 18.2.6 Class
Surface - 18.2.7 Class
Polygon - 18.2.8 Class
GeometryCollection - 18.2.9 Class
MultiPoint - 18.2.10 Class
MultiCurve - 18.2.11 Class
MultiLineString - 18.2.12 Class
MultiSurface - 18.2.13 Class
MultiPolygon
- 18.3 Supported Spatial Data Formats
- 18.4 Creating a Spatially Enabled MySQL Database
- 18.5 Analyzing Spatial Information
- 18.5.1 Geometry Format Conversion Functions
- 18.5.2
GeometryFunctions - 18.5.3 Functions That Create New Geometries from Existing Ones
- 18.5.4 Functions for Testing Spatial Relations Between Geometric Objects
- 18.5.5 Relations on Geometry Minimal Bounding Rectangles (MBRs)
- 18.5.6 Functions That Test Spatial Relationships Between Geometries
- 18.6 Optimizing Spatial Analysis
- 18.7 MySQL Conformance and Compatibility
- 19 Stored Procedures and Functions