0% found this document useful (0 votes)
43 views

Mysql 5.1 Reference Manual: Including Mysql Cluster NDB 6.X/7.X Reference Guide

OPTIMIZE TABLE support for dynamic columns of in-memory NDBCLUSTER tables. The number of unnecessary reads when performing a primary key or unique key update has been greatly reduced. Support for batched DELETE and UPDATE operations has been significantly improved.

Uploaded by

gdvqzar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Mysql 5.1 Reference Manual: Including Mysql Cluster NDB 6.X/7.X Reference Guide

OPTIMIZE TABLE support for dynamic columns of in-memory NDBCLUSTER tables. The number of unnecessary reads when performing a primary key or unique key update has been greatly reduced. Support for batched DELETE and UPDATE operations has been significantly improved.

Uploaded by

gdvqzar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 0

MySQL 5.

1 Reference Manual
Including MySQL Cluster NDB 6.X/7.X Reference
Guide
system threads) to specific CPUs on multiprocessor data node hosts, and to leverage real-time scheduling.
Improved performance of updates using primary keys or unique keys. The number of unnecessary reads when performing a
primary key or unique key update has been greatly reduced. Since it is seldom necessary to read a record prior to an update, this can
yield a considerable improvement in performance. In addition, primary key columns are no longer written to when not needed dur-
ing update operations.
Batching improvements. Support of batched DELETE and UPDATE operations has been significantly improved. Batching of UP-
DATE WHERE... and multiple DELETE operations is also now implemented.
Improved SQL statement performance metrics. The Ndb_execute_count system status variable measures the number of
round trips made by SQL statements to the NDB kernel, providing an improved metric for determining efficiency with which state-
ments are excuted. For more information, see MySQL Cluster Status Variables: Ndb_execute_count.
Compressed LCPs and backups. Compressed local checkpoints and backups can save 50% or more of the disk space used by un-
compressed LCPs and backups. These can be enabled using the two new data node configuration parameters CompressedLCP
and CompressedBackup, respectively. See MySQL Cluster Status Variables: CompressedBackup, and MySQL Cluster
Status Variables: CompressedLCP, for more information about these parameters.
OPTIMIZE TABLE support with NDBCLUSTER tables. OPTIMIZE TABLE is supported for dynamic columns of in-memory
NDB tables. In such cases, it is no longer necessary to drop (and possibly to re-create) a table, or to perform a rolling restart, in order
to recover memory from deleted rows for general re-use by Cluster. The performance of OPTIMIZE on Cluster tables can be tuned
by adjusting the value of the ndb_optimization_delay system variable, which controls the number of milliseconds to wait
between processing batches of rows by OPTIMIZE TABLE. In addition, OPTIMIZE TABLE on an NDBCLUSTER table can be in-
terrupted by, for example, killing the SQL thread performing the OPTIMIZE operation.
Batching of transactions. It is possible to cause statements occurring within the same transaction to be run as a batch by setting the
session variable transaction_allow_batching to 1 or ON. To use this feature, autocommit must be set to 0 or OFF.
Batch sizes can be controlled using the --ndb-batch-size option for mysqld. For more information, see Section 17.4.2,
mysqld Command Options for MySQL Cluster, and Section 17.4.3, MySQL Cluster System Variables.
Attribute promotion with ndb_restore. It is possible using ndb_restore to restore data reliably from a column of a given
type to a column that uses a larger type. This is sometimes referred to as attribute promotion. For example, MySQL Cluster
backup data that originated in a SMALLINT column can be restored to a MEDIUMINT, INT, or BIGINT column. See Sec-
tion 17.6.17, ndb_restore Restore a MySQL Cluster Backup, for more information.
Parallel data node recovery. Recovery of multiple data nodes can now be done in parallel, rather than sequentially. In other
words, several data nodes can be restored concurrently, which can often result in much faster recovery times than when they are re-
stored one at a time.
Increased local checkpoint efficiency. Only 2 local checkpoints are stored, rather than 3, lowering disk space requirements and the
size and number of redo log files.
NDBCLUSTER table persistence control. Persistence of NDB tables can be controlled using the session variables
ndb_table_temporary and ndb_table_no_logging. ndb_table_no_logging causes NDB tables not to be check-
pointed to disk; ndb_table_temporary does the same, and in addition, no schema files are created. See Section 17.4.1,
MySQL Cluster Server Option and Variable Reference.
Epoll support (Linux only). Epoll is an improved method for handling file descriptors, which is more efficient than scanning to de-
termine whether a file descriptor has data to be read. (The term epoll is specific to Linux and equivalent functionality is known by
other names on other platforms such as Solaris and FreeBSD.) Currently, MySQL Cluster supports this functionality on Linux only.
Distribution awareness (SQL nodes). In MySQL Cluster NDB 6.3, SQL nodes can take advantage of distribution awareness. Here
we provide a brief example showing how to design a table to make a given class of queries distrubtion-aware. Suppose an NDB-
CLUSTER table t1 has the following schema:
CREATE TABLE t1 (
userid INT NOT NULL,
serviceid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
data VARCHAR(255)
) ENGINE=NDBCLUSTER;
Suppose further that most of the queries to be used in our application test values of the userid column of this table. The form of
such a query looks something like this:
SELECT columns FROM t1
WHERE userid relation value;
MySQL Cluster NDB 6.X/7.X
1718
In this query, relation represents some relational operator, such as =, <, >, and so on. Queries using IN and a list of values can
also be used:
SELECT columns FROM t1
WHERE userid IN value_list;
In order to make use of distribution awareness, we need to make the userid column part of the table's primary key, then explicitly
partition the table with this column being used as the partitioning key. (Recall that for a partitioned table having one or more unique
keys, all columns of the table's partitioning key must also be part of all of the unique keys for more information and examples,
see Section 18.5.1, Partitioning Keys, Primary Keys, and Unique Keys.) In other words, the table schema should be equivalent to
the following CREATE TABLE statement:
CREATE TABLE t1 (
userid INT NOT NULL,
serviceid INT NOT NULL AUTO_INCREMENT,
data VARCHAR(255),
PRIMARY KEY p (userid,serviceid)
) ENGINE=NDBCLUSTER
PARTITION BY KEY(userid);
When the table is partitioned in this way, all rows having the same userid value are found on the same node group, and the
MySQL Server can immediately select the optimal node to use as the transaction coordinator.
Realtime extensions for multiple CPUs. When running MySQL Cluster data nodes on hosts with multiple processors, the realtime
extensions make it possible to give priority to the data node process and control on which CPU cores it should operate. This can be
done using the data node configuration parameters RealtimeScheduler, SchedulerExecutionTimer and Scheduler-
SpinTimer. Doing so properly can significantly lower response times and make them much more predictable response. For more
information about using these parameters, see Defining Data Nodes: Realtime Performance Parameters
Fully automatic database discovery. It is no longer a requirement for database autodiscovery that an SQL node already be con-
nected to the cluster at the time that a database is created on another SQL node, or for a CREATE DATABASE or CREATE
SCHEMA statement to be issued on the new SQL node after it joins the cluster.
Restoring specific tables and databases from a MySQL Cluster backup. It is now possible exercise more fine-grained control
when restoring a MySQL Cluster from backup using ndb_restore. You can restore only specified tables or databases, or exclude
specific tables or databases from being restored, using the new ndb_restore options --include-tables, -
-include-databases, --exclude-tables, and --exclude-databases. For more information about these options,
see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
Improved Disk Data filesystem configuration. As of MySQL Cluster NDB 6.3.22, you can specify default locations for MySQL
Cluster Disk Data data files and undo log files using the data node configuration parameters FileSystemPathDD, FileSys-
temPathDataFiles, and FileSystemPathUndoFiles. For more information, see Disk Data filesystem parameters.
Automatic creation of Disk Data log file groups and tablespaces. Beginning with MySQL Cluster NDB 6.3.22, using the data
node configuration parameters InitialLogFileGroup and InitialTablespace, you can cause the creation of a MySQL
Cluster Disk Data log file group, tablespace, or both, when the cluster is first started. When using these parameters, no SQL state-
ments are required to create these Disk Data objects. For more information, see Disk Data object creation parameters.
Configuration parameter data dumps. Starting with MySQL Cluster NDB 6.3.25, the ndb_config utility supports a -
-configinfo option that causes it to dump a list of all configuration parameters supported by the cluster, along with brief de-
scriptions, information about the parameters' default and allowed values, and the sections of the config.ini file in which the
parameters apply. An additional --xml switch causes ndb_config to use XML rather than plaintext output. Using
ndb_config --configinfo or ndb_config --configinfo --xml requires no access to a running MySQL Cluster,
any other programs, or any files. For more information and examples, see Section 17.6.6, ndb_config Extract MySQL
Cluster Configuration Information.
17.13.5. Features Added in MySQL Cluster NDB 7.0
The following list provides an overview of significant feature additions and changes made in or planned for MySQL Cluster NDB 7.0.
For more detailed information about all feature changes and bugfixes made in MySQL Cluster NDB 7.0, see Section 17.15.1, Changes
in MySQL Cluster NDB 7.0.
Important
Early development versions of MySQL Cluster NDB 7.0 were known as MySQL Cluster NDB 6.4, and the first four re-
leases in this series were identified as MySQL Cluster NDB 6.4.0 through 6.4.3. Any information relating to these MySQL
MySQL Cluster NDB 6.X/7.X
1719
Cluster NDB 6.4.x releases appearing in this documentation apply to MySQL Cluster NDB 7.0.
MySQL Cluster NDB 7.0.4 is the fifth MySQL Cluster NDB 7.0 release; it is the successor to MySQL Cluster NDB 6.4.3.
MySQL Cluster on Windows (alpha). MySQL Cluster is now available on an experimental basis for Windows operating systems.
Features and behavior comparable to those found on platforms that are already supported such as Linux and Solaris are
planned for MySQL Cluster on Windows. Currently, you must build from source, although we intend to start making Windows bin-
aries available in the near future. To enable MySQL Cluster support on Windows, you must configure the build using the
WITH_NDBCLUSTER_STORAGE_ENGINE option. For more information, see Section 2.10.6, Installing MySQL from Source on
Windows.
Ability to add nodes and node groups online. Beginning with MySQL Cluster NDB 6.4.0, it is possible to add new node groups
(and thus new data nodes) to a running MySQL Cluster without shutting down and reloading the cluster. As part of enabling this
feature, a new command CREATE NODEGROUP has been added to the cluster management client and the functionality of the AL-
TER ONLINE TABLE ... REORGANIZE PARTITION SQL statement has been extended. For more information, see Sec-
tion 17.7.8, Adding MySQL Cluster Data Nodes Online.
Data node multithreading support. Beginning with MySQL Cluster NDB 6.4.0, a multithreaded version of the data node daemon,
named ndbmtd, is available for use on data node hosts with multiple CPU cores. This binary is built automatically when compiling
with MySQL Cluster support; no additional options other than those needed to provide MySQL Cluster support are needed when
configuring the build. In most respects, ndbmtd functions in the same way as ndbd, and can use the same command-line options
and configuration parameters. In addition, the new MaxNoOfExecutionThreads configuration parameter can be used to de-
termine the number of data node process threads for ndbmtd. For more information, see Section 17.6.3, ndbmtd The MySQL
Cluster Data Node Daemon (Multi-Threaded).
Note
Disk Data tables are not yet supported for use with ndbmtd.
Configuration cache. Formerly, MySQL Cluster configuration was stateless that is, configuration information was reloaded
from the cluster's global configuration file (usually config.ini) each time ndb_mgmd was started. Beginning with MySQL
Cluster NDB 6.4.0, the cluster's configuration is cached internally, and the global configuration file is no longer automatically re-
read when the management server is restarted. This behavior can be controlled via the three new management server options -
-configdir, --initial, and --reload. For more information about this change, see Section 17.3.4, MySQL Cluster Con-
figuration Files. For more information about the new management server options, see Section 17.6.24.3, Program Options for
ndb_mgmd.
Snapshot options for backups. Beginning with MySQL Cluster NDB 6.4.0, you can determine when performing a cluster backup
whether the backup matches the state of the data when the backup was started or when it was completed, using the new options
SNAPSHOTSTART and SNAPSHOTEND for the management client's START BACKUP command. See Section 17.7.3.2, Using The
MySQL Cluster Management Client to Create a Backup, for more information.
Dynamic NDB transporter send buffer memory allocation. Previously, the NDB kernel used a fixed-size send buffer for every
data node in the cluster, which was allocated when the node started. Because the size of this buffer could not be changed after the
cluster was started, it was necessary to make it large enough in advance to accomodate the maximum possible load on any transport-
er socket. However, this was an inefficient use of memory, since much of it often went unused. Beginning with MySQL Cluster
NDB 6.4.0, send buffer memory is allocated dynamically from a memory pool shared between all transporters, which means that the
size of the send buffer can be adjusted as necessary. This change is reflected by the addition of the configuration parameters
TotalSendBufferMemory, ReservedSendBufferMemory, and OverLoadLimit, as well as a change in how the exist-
ing SendBufferMemory configuration parameter is used. For more information, see Section 17.3.7, Configuring MySQL
Cluster Send Buffer Parameters.
Robust DDL operations. Beginning with MySQL Cluster NDB 6.4.0, DDL operations (such as CREATE TABLE or ALTER TA-
BLE) are protected from data node failures; in the event of a data node failure, such operations are now rolled back gracefully. Pre-
viously, if a data node failed while trying to perform a DDL operation, the MySQL Cluster data dictionary became locked and no
further DDL statements could be executed without restarting the cluster.
IPv6 support in MySQL Cluster Replication. Beginning with MySQL Cluster NDB 6.4.1, IPv6 networking is supported between
MySQL Cluster SQL nodes, which makes it possible to replicate between instances of MySQL Cluster using IPv6 addresses.
However, IPv6 is supported only for direct connections between MySQL servers; all connections within an individual MySQL
Cluster must use IPv4. For more information, see Section 17.9.3, Known Issues in MySQL Cluster Replication.
Restoring specific tables and databases from a MySQL Cluster backup. It is now possible exercise more fine-grained control
when restoring a MySQL Cluster from backup using ndb_restore. You can restore only specified tables or databases, or exclude
MySQL Cluster NDB 6.X/7.X
1720
specific tables or databases from being restored, using the new ndb_restore options --include-tables, -
-include-databases, --exclude-tables, and --exclude-databases. For more information about these options,
see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
Improved Disk Data filesystem configuration. As of MySQL Cluster NDB 6.4.3, you can specify default locations for MySQL
Cluster Disk Data data files and undo log files using the data node configuration parameters FileSystemPathDD, FileSys-
temPathDataFiles, and FileSystemPathUndoFiles. For more information, see Disk Data filesystem parameters.
Automatic creation of Disk Data log file groups and tablespaces. Beginning with MySQL Cluster NDB 6.4.3, using the data
node configuration parameters InitialLogFileGroup and InitialTablespace, you can cause the creation of a MySQL
Cluster Disk Data log file group, tablespace, or both, when the cluster is first started. When using these parameters, no SQL state-
ments are required to create these Disk Data objects. For more information, see Disk Data object creation parameters.
Improved internal message passing and record handling. MySQL Cluster NDB 7.0 contains 2 changes that optimize the use of
network connections by addressing the size and number of messages passed between data nodes, and between data nodes and API
nodes, which can increase MySQL Cluster and application performance:
Packed reads. Formerly, each read request signal contained a list of columns to be retrieved, each of these column identifiers
using 4 bytes within the message. This meant that the message size increased as the number of columns being fetched increased.
In addition, in the response from the data node, each column result was packed to a 4-byte boundary, which resulted in wasted
space. In MySQL Cluster NDB 7.0, messaging for read operations is optimized in both directions, using a bitmap in the read re-
quest to specify the columns to be fetched. Where many fields are requested, this can result in a significant message size reduc-
tion as compared with the old method. In addition, the 4-byte packing in responses is no longer used, which means that smaller
fields consume less space.
Long signal transactions. This enhancement reduces the number of messages and signals that are sent to data nodes for com-
plex requests. Prior to MySQL Cluster NDB 7.0, there was a 100 byte limit on the size of the request signal, which meant that
complex requests had to be split up between multiple messages prior to transmission, then reassembled on the receiving end. In
addition to actual payload data, each message required its own operating system and protocol overhead such as header informa-
tion. This often wasted network bandwidth and data node CPU. The maximum size of the message is now 32 KB, which is suffi-
cient to accommodate most queries.
Both of these optimizations are internal to the NDB API, and so is transparent to applications; this is true whether an application
uses the NDB API directly or does so indirectly through an SQL node.
Configuration parameter data dumps. Starting with MySQL Cluster NDB 7.0.6, the ndb_config utility supports a -
-configinfo option that causes it to dump a list of all configuration parameters supported by the cluster, along with brief de-
scriptions, information about the parameters' default and allowed values, and the sections of the config.ini file in which the
parameters apply. An additional --xml switch causes ndb_config to use XML rather than plaintext output. Using
ndb_config --configinfo or ndb_config --configinfo --xml requires no access to a running MySQL Cluster,
any other programs, or any files. For more information and examples, see Section 17.6.6, ndb_config Extract MySQL
Cluster Configuration Information.
17.13.6. Features Planned for MySQL Cluster NDB 7.1 and Later
The following improvements to MySQL Cluster are planned for MySQL Cluster NDB 7.1 and later release series.
Important
These features are in planning or early development phase. Timing, availability, and implementation details are not guar-
anteed, and are subject to change at any time without notice.
Native support for default column values. Starting with MySQL Cluster NDB 7.1.0, default values for table columns are stored
in the NDB kernel rather than by the MySQL server as was done previously. This means that inserts on tables having column value
defaults can be smaller and faster than before, because less data must be sent from SQL nodes to NDBCLUSTER.
Tables created using previous MySQL Cluster releases can still be used in MySQL Cluster 7.1.0 and later; however, they do not
support native default values until they are upgraded. You can upgrade a table with non-native default values to support native de-
fault values using an offline ALTER TABLE statement.
Further enhancements based on this work that we hope to implement in future MySQL Cluster releases include the following:
Decrease NDB space requirements, since there is no longer any need to store the default value for every row
MySQL Cluster NDB 6.X/7.X
1721
Implement REPLACE more efficiently, because there is no need any longer to read the current row before replacing it
Provide idempotency in replication for tables having non-nullable columns
NDB$INFO meta-information database. This feature is intended to make it possible to obtain real-time characteristics of a
MySQL Cluster by issuing queries from the mysql client or other MySQL client applications. NDB$INFO is a database which is
planned for MySQL Cluster NDB 7.1 to provide metadata specific to MySQL Cluster similar to that provided by the INFORMA-
TION_SCHEMA database for the standard MySQL Server. This would eliminate much of the need to read log files, issue DUMP
commands, or parse the output of ndb_config in order to get configuration and status information from a running MySQL
Cluster.
17.14. MySQL Cluster Glossary
The following terms are useful to an understanding of MySQL Cluster or have specialized meanings when used in relation to it.
Cluster. In its generic sense, a cluster is a set of computers functioning as a unit and working together to accomplish a single task.
NDBCLUSTER. This is the storage engine used in MySQL to implement data storage, retrieval, and management distributed among
several computers.
MySQL Cluster. This refers to a group of computers working together using the NDB storage engine to support a distributed
MySQL database in a shared-nothing architecture using in-memory storage.
Configuration files. Text files containing directives and information regarding the cluster, its hosts, and its nodes. These are read
by the cluster's management nodes when the cluster is started. See Section 17.3.4, MySQL Cluster Configuration Files, for details.
Backup. A complete copy of all cluster data, transactions and logs, saved to disk or other long-term storage.
Restore. Returning the cluster to a previous state, as stored in a backup.
Checkpoint. Generally speaking, when data is saved to disk, it is said that a checkpoint has been reached. More specific to Cluster,
it is a point in time where all committed transactions are stored on disk. With regard to the NDB storage engine, there are two types
of checkpoints which work together to ensure that a consistent view of the cluster's data is maintained:
Local Checkpoint (LCP). This is a checkpoint that is specific to a single node; however, LCP's take place for all nodes in the
cluster more or less concurrently. An LCP involves saving all of a node's data to disk, and so usually occurs every few minutes.
The precise interval varies, and depends upon the amount of data stored by the node, the level of cluster activity, and other
factors.
Global Checkpoint (GCP). A GCP occurs every few seconds, when transactions for all nodes are synchronized and the redo-
log is flushed to disk.
Cluster host. A computer making up part of a MySQL Cluster. A cluster has both a physical structure and a logical structure. Phys-
ically, the cluster consists of a number of computers, known as cluster hosts (or more simply as hosts. See also Node and Node
group below.
Node. This refers to a logical or functional unit of MySQL Cluster, and is sometimes also referred to as a cluster node. In the con-
text of MySQL Cluster, we use the term node to indicate a process rather than a physical component of the cluster. There are three
node types required to implement a working MySQL Cluster:
Management nodes. Manages the other nodes within the MySQL Cluster. It provides configuration data to the other nodes;
starts and stops nodes; handles network partitioning; creates backups and restores from them, and so forth.
SQL nodes. Instances of MySQL Server which serve as front ends to data kept in the cluster's data nodes. Clients desiring to
store, retrieve, or update data can access an SQL node just as they would any other MySQL Server, employing the usual MySQL
authentication methods and APIs; the underlying distribution of data between node groups is transparent to users and applica-
tions. SQL nodes access the cluster's databases as a whole without regard to the data's distribution across different data nodes or
cluster hosts.
Data nodes. These nodes store the actual data. Table data fragments are stored in a set of node groups; each node group stores a
different subset of the table data. Each of the nodes making up a node group stores a replica of the fragment for which that node
group is responsible. Currently, a single cluster can support up to 48 data nodes total.
MySQL Cluster NDB 6.X/7.X
1722
It is possible for more than one node to co-exist on a single machine. (In fact, it is even possible to set up a complete cluster on one
machine, although one would almost certainly not want to do this in a production environment.) It may be helpful to remember that,
when working with MySQL Cluster, the term host refers to a physical component of the cluster whereas a node is a logical or func-
tional component (that is, a process).
Note Regarding Terms. In older versions of the MySQL Cluster documentation, data nodes were sometimes referred to as
database nodes. The term storage nodes has also been used. In addition, SQL nodes were sometimes known as client nodes.
This older terminology has been deprecated to minimize confusion, and for this reason should be avoided. They are also often re-
ferred to as API nodes an SQL node is actually an API node that provides an SQL interface to the cluster.
Node group. A set of data nodes. All data nodes in a node group contain the same data (fragments), and all nodes in a single group
should reside on different hosts. It is possible to control which nodes belong to which node groups.
For more information, see Section 17.1.2, MySQL Cluster Nodes, Node Groups, Replicas, and Partitions.
Node failure. MySQL Cluster is not solely dependent upon the functioning of any single node making up the cluster; the cluster
can continue to run if one or more nodes fail. The precise number of node failures that a given cluster can tolerate depends upon the
number of nodes and the cluster's configuration.
Node restart. The process of restarting a failed cluster node.
Initial node restart. The process of starting a cluster node with its file system removed. This is sometimes used in the course of
software upgrades and in other special circumstances.
System crash (or system failure). This can occur when so many cluster nodes have failed that the cluster's state can no longer be
guaranteed.
System restart. The process of restarting the cluster and reinitializing its state from disk logs and checkpoints. This is required
after either a planned or an unplanned shutdown of the cluster.
Fragment. A portion of a database table; in the NDB storage engine, a table is broken up into and stored as a number of fragments.
A fragment is sometimes also called a partition; however, fragment is the preferred term. Tables are fragmented in MySQL
Cluster in order to facilitate load balancing between machines and nodes.
Replica. Under the NDB storage engine, each table fragment has number of replicas stored on other data nodes in order to provide
redundancy. Currently, there may be up four replicas per fragment.
Transporter. A protocol providing data transfer between nodes. MySQL Cluster currently supports four different types of trans-
porter connections:
TCP/IP. This is, of course, the familiar network protocol that underlies HTTP, FTP (and so on) on the Internet. TCP/IP can be
used for both local and remote connections.
SCI. Scalable Coherent Interface is a high-speed protocol used in building multiprocessor systems and parallel-processing ap-
plications. Use of SCI with MySQL Cluster requires specialized hardware, as discussed in Section 17.11.1, Configuring
MySQL Cluster to use SCI Sockets. For a basic introduction to SCI, see this essay at dolphinics.com.
SHM. Unix-style shared memory segments. Where supported, SHM is used automatically to connect nodes running on the
same host. The Unix man page for shmop(2) is a good place to begin obtaining additional information about this topic.
Note
The cluster transporter is internal to the cluster. Applications using MySQL Cluster communicate with SQL nodes just as
they do with any other version of MySQL Server (via TCP/IP, or through the use of Unix socket files or Windows named
pipes). Queries can be sent and results retrieved using the standard MySQL client APIs.
NDB. This stands for Network Database, and refers to the storage engine used to enable MySQL Cluster. The NDB storage engine
supports all the usual MySQL data types and SQL statements, and is ACID-compliant. This engine also provides full support for
transactions (commits and rollbacks).
Shared-nothing architecture. The ideal architecture for a MySQL Cluster. In a true shared-nothing setup, each node runs on a
separate host. The advantage such an arrangement is that there no single host or node can act as single point of failure or as a per-
formance bottle neck for the system as a whole.
In-memory storage. All data stored in each data node is kept in memory on the node's host computer. For each data node in the
MySQL Cluster NDB 6.X/7.X
1723
cluster, you must have available an amount of RAM equal to the size of the database times the number of replicas, divided by the
number of data nodes. Thus, if the database takes up 1GB of memory, and you want to set up the cluster with four replicas and eight
data nodes, a minimum of 500MB memory will be required per node. Note that this is in addition to any requirements for the operat-
ing system and any other applications that might be running on the host.
In MySQL 5.1 and MySQL Cluster NDB 6.x, it is also possible to create Disk Data tables where nonindexed columns are stored on
disk, thus reducing the memory footprint required by the cluster. Note that indexes and indexed column data are still stored in RAM.
See Section 17.10, MySQL Cluster Disk Data Tables.
Table. As is usual in the context of a relational database, the term table denotes a set of identically structured records. In MySQL
Cluster, a database table is stored in a data node as a set of fragments, each of which is replicated on additional data nodes. The set
of data nodes replicating the same fragment or set of fragments is referred to as a node group.
Cluster programs. These are command-line programs used in running, configuring, and administering MySQL Cluster. They in-
clude both server daemons:
ndbd:
The data node daemon (runs a data node process)
ndb_mgmd:
The management server daemon (runs a management server process)
and client programs:
ndb_mgm:
The management client (provides an interface for executing management commands)
ndb_waiter:
Used to verify status of all nodes in a cluster
ndb_restore:
Restores cluster data from backup
For more about these programs and their uses, see Section 17.6, MySQL Cluster Programs.
Event log. MySQL Cluster logs events by category (startup, shutdown, errors, checkpoints, and so on), priority, and severity. A
complete listing of all reportable events may be found in Section 17.7.4, Event Reports Generated in MySQL Cluster. Event logs
are of two types:
Cluster log. Keeps a record of all desired reportable events for the cluster as a whole.
Node log. A separate log which is also kept for each individual node.
Under normal circumstances, it is necessary and sufficient to keep and examine only the cluster log. The node logs need be consul-
ted only for application development and debugging purposes.
Angel process. When a data node is started, ndbd actually starts two processes. One of these is known as the angel process; its
purpose is to check to make sure that the main ndbd process continues to run, and to restart the main process if it should stop for
any reason.
Watchdog thread. Each ndbd process has an internal watchdog thread which monitors the main worker thread, ensuring forward
progress and a timely response to cluster protocols such as the cluster heartbeat. If the ndbd process is not being woken up
promptly by the operating system when its sleep time expires, INFO and WARNING events, which are identifiable because they con-
tain Watchdog:..., are written to the cluster log. Such messages are usually a symptom of an overloaded system; you should see
what else is running on the system, and whether the ndbd process is being swapped out to disk. If ndbd cannot wake up regu-
larly then it cannot respond to heartbeat messages on time, and other nodes eventually consider it dead due to the missed heart-
beats, causing it to be excluded from the cluster.
17.15. Changes in MySQL Cluster NDB 6.X and 7.X
MySQL Cluster NDB 6.X/7.X
1724
This section contains changelog information for MySQL Cluster releases that use versions 6.1, 6.2, 6.3, and 7.0 of the NDBCLUSTER
storage engine.
Note
Version 7.0 of the NDBCLUSTER storage engine was previously known as NDB 6.4. For more information, see Sec-
tion 17.15.1, Changes in MySQL Cluster NDB 7.0.
Each MySQL Cluster release is based on a mainline MySQL 5.1 release and a particular version of the NDBCLUSTER storage engine,
as shown in the version string returned by executing SELECT VERSION() in the mysql client, or by executing the ndb_mgm client
SHOW or STATUS command; for more information, see Chapter 17, MySQL Cluster NDB 6.X/7.X.
For general information about features added in MySQL Cluster, see Section 17.13, MySQL Cluster Development Roadmap. For a
complete list of all bugfixes and feature changes in MySQL Cluster, please refer to the changelog section for each individual MySQL
Cluster release.
An overview of features added in MySQL 5.1 not specific to MySQL Cluster can be found here: Section 1.4.1, What Is New in
MySQL 5.1. For a complete list of all bugfixes and features changes made in MySQL 5.1 that are not specific to MySQL Cluster, see
Section C.1, Changes in Release 5.1.x (Production).
17.15.1. Changes in MySQL Cluster NDB 7.0
This section contains change history information for MySQL Cluster releases based on version 7.0 of the NDBCLUSTER storage engine.
Important
Previously, version 7.0 of NDBCLUSTER was known as version 6.4, and early development versions of MySQL Cluster
NDB 7.0 were known as MySQL Cluster 6.4. The first four releases in this series were identified using NDB 6.4.x ver-
sion numbers (NDB 6.4.0 through NDB 6.4.3).
MySQL Cluster NDB 7.0.4 is the fifth release in this series. All future MySQL Cluster NDB 7.0 releases will use NDB
7.0.x version numbers.
Users running MySQL Cluster NDB 6.4.3 should upgrade to MySQL Cluster NDB 7.0.4 (or a later MySQL Cluster NDB
7.0 release).
For an overview of new features added in MySQL Cluster NDB 7.0, see Section 17.13.5, Features Added in MySQL Cluster NDB
7.0.
When upgrading to a MySQL Cluster NDB 7.0 release from earlier MySQL Cluster releases, you should be aware of the following is-
sues:
It is not currently possible to perform an online upgrade to MySQL Cluster NDB 7.0 from an earlier MySQL Cluster release.
You cannot run a MySQL Cluster using a mix of MySQL Cluster NDB 7.0 and earlier binaries; all MySQL Cluster executables
must be replaced with the MySQL Cluster NDB 7.0 versions.
NDB API applications built against previous MySQL Cluster versions must be recompiled against against the MySQL Cluster NDB
7.0 sources.
17.15.1.1. Changes in MySQL Cluster NDB 7.0.7 (5.1.35-ndb-7.0.7) (Not yet released)
This release incorporates new features in the NDBCLUSTER storage engine and fixes recently discovered bugs in MySQL Cluster NDB
7.0.6.
Obtaining MySQL Cluster NDB 7.0.7. The latest MySQL Cluster NDB 7.0 binaries for supported platforms can be obtained from ht-
tp://dev.mysql.com/downloads/cluster/7.0.html. Source code for the latest MySQL Cluster NDB 7.0 release can be obtained from the
same location. You can also access the MySQL Cluster NDB 7.0 development source tree at ht-
tps://code.launchpad.net/~mysql/mysql-server/mysql-cluster-7.0.
This release also incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 7.0 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.35 (see Section C.1.2, Changes in
MySQL 5.1.35 (13 May 2009)).
MySQL Cluster NDB 6.X/7.X
1725
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Important Change: The default value of the DiskIOThreadPool data node configuration parameter has changed from 8 to 2.
Formerly, node IDs were represented in the cluster log using a complex hexadecimal/binary encoding scheme. Now, node IDs are
reported in the cluster log using numbers in standard decimal notation. (Bug#44248)
Bugs fixed:
The signals used by ndb_restore to send progress information about backups to the cluster log accessed the cluster transporter
without using any locks. Because of this, it was theoretically possible that these signals could be interefered with by heartbeat sig-
nals if both were sent at the same time, causing the ndb_restore messages to be corrupted. (Bug#45646)
Due to changes in the way that NDBCLUSTER handles schema changes (implementation of schema transactions) in MySQL Cluster
NDB 7.0, it was not possible to create MySQL Cluster tables having more than 16 indexes using a single CREATE TABLE state-
ment.
This issue occurs only in MySQL Cluster NDB 7.0 releases prior to 7.0.7 (including releases numbered NDB 6.4.x).
If you are not yet able to upgrade from an earlier MySQL Cluster NDB 7.0 release, you can work around this problem by creating
the table without any indexes, then adding the indexes using a separate CREATE INDEX statement for each index. (Bug#45525)
storage/ndb/src/common/util/CMakeLists.txt did not build the BaseString-t test program for Windows as the
equivalent storage/ndb/src/common/util/Makefile.am does when building MySQL Cluster on Unix platforms.
(Bug#45099)
Debugging code causing ndbd to use file compression on NTFS filesystems failed with an error. (The code was removed.) This is-
sue affected debug builds of MySQL Cluster on Windows platforms only. (Bug#44418)
Previously, a GCP STOP event was written to the cluster log as an INFO event. Now it is logged as a WARNING event instead.
(Bug#43853)
Disk Data: Partitioning: An NDBCLUSTER table created with a very large value for the MAX_ROWS option could if this table
was dropped and a new table with fewer partitions, but having the same table ID, was created cause ndbd to crash when per-
forming a system restart. This was because the server attempted to examine each partition whether or not it actually existed.
(Bug#45154)
17.15.1.2. Changes in MySQL Cluster NDB 7.0.6 (5.1.34-ndb-7.0.6) (26 May 2009)
This release incorporates new features in the NDBCLUSTER storage engine and fixes recently discovered bugs in MySQL Cluster NDB
7.0.5.
Obtaining MySQL Cluster NDB 7.0.5. The latest MySQL Cluster NDB 7.0 binaries for supported platforms can be obtained from ht-
tp://dev.mysql.com/downloads/cluster/7.0.html. Source code for the latest MySQL Cluster NDB 7.0 release can be obtained from the
same location. You can also access the MySQL Cluster NDB 7.0 development source tree at ht-
tps://code.launchpad.net/~mysql/mysql-server/mysql-cluster-7.0.
This release also incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 7.0 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.34 (see Section C.1.3, Changes in
MySQL 5.1.34 (02 April 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1726
The ndb_config utility program can now provide an offline dump of all MySQL Cluster configuration parameters including in-
formation such as default and permitted values, brief description, and applicable section of the config.ini file. A dump in text
format is produced when running ndb_config with the new --configinfo option, and in XML format when the options -
-configinfo --xml are used together. For more information and examples, see Section 17.6.6, ndb_config Extract
MySQL Cluster Configuration Information.
Bugs fixed:
Important Change: Partitioning: User-defined partitioning of an NDBCLUSTER table without any primary key sometimes failed,
and could cause mysqld to crash.
Now, if you wish to create an NDBCLUSTER table with user-defined partitioning, the table must have an explicit primary key, and
all columns listed in the partitioning expression must be part of the primary key. The hidden primary key used by the NDBCLUSTER
storage engine is not sufficient for this purpose. However, if the list of columns is empty (that is, the table is defined using PARTI-
TION BY [LINEAR] KEY()), then no explicit primary key is required.
This change does not effect the partitioning of tables using any storage engine other than NDBCLUSTER. (Bug#40709)
Important Note: It was not possible to perform an online upgrade from any MySQL Cluster NDB 6.x release to MySQL Cluster
NDB 7.0.5 or any to earlier MySQL Cluster NDB 7.0 release.
With this fix, it is possible in MySQL Cluster NDB 7.0.6 and later to perform online upgrades from MySQL Cluster NDB 6.3.8 and
later MySQL Cluster NDB 6.3 releases, or from MySQL Cluster NDB 7.0.5 or later MySQL Cluster NDB 7.0 releases. Online up-
grades to MySQL Cluster NDB 7.0 releases previous to MySQL Cluster NDB 7.0.6 from earlier MySQL Cluster releases remain
unsupported; online upgrades from MySQL Cluster NDB 7.0 releases previous to MySQL Cluster NDB 7.0.5 (including NDB 6.4.x
beta releases) to later MySQL Cluster NDB 7.0 releases also remain unsupported. (Bug#44294)
An internal NDB API buffer was not properly initialized. (Bug#44977)
When a data node had written its GCI marker to the first page of a megabyte, and that node was later killed during restart after hav-
ing processed that page (marker) but before completing a LCP, the data node could fail with filesystem errors. (Bug#44952)
See also Bug#42564.
When restarting a data nodes, management and API nodes reconnecting to it failed to re-use existing ports that had already been dy-
namically allocated for communications with that data node. (Bug#44866)
When ndb_config could not find the file referenced by the --config-file option, it tried to read my.cnf instead, then
failed with a misleading error message. (Bug#44846)
When a data node was down so long that its most recent local checkpoint depended on a global checkpoint that was no longer
restorable, it was possible for it to be unable to use optimized node recovery when being restarted later. (Bug#44844)
See also Bug#26913.
Online upgrades to MySQL Cluster NDB 7.0 from a MySQL Cluster NDB 6.3 release could fail due to changes in the handling of
key lengths and unique indexes during node recovery. (Bug#44827)
Use of __builtin_expect() had the side effect that compiler warnings about misuse of = (assignment) instead of == in com-
parisons were lost when building in debug mode. This is no longer employed when configuring the build with the --with-debug
option. (Bug#44570)
See also Bug#44567.
Inspection of the code revealed that several assignment operators (=) were used in place of comparison operators (==) in Dbdih-
Main.cpp. (Bug#44567)
See also Bug#44570.
When using large numbers of configuration parameters, the management server took an excessive amount of time (several minutes
or more) to load these from the configuration cache when starting. This problem occurred when there were more than 32 configura-
tion parameters specified, and became progressively worse with each additional multiple of 32 configuration parameters.
(Bug#44488)
MySQL Cluster NDB 6.X/7.X
1727
Building the MySQL Cluster NDB 7.0 tree failed when using the icc compiler. (Bug#44310)
SSL connections to SQL nodes failed on big-endian platforms. (Bug#44295)
Signals providing node state information (NODE_STATE_REP and CHANGE_NODE_STATE_REQ) were not propagated to all
blocks of ndbmtd. This could cause the following problems:
Inconsistent redo logs when performing a graceful shutdown;
Data nodes crashing when later restarting the cluster, data nodes needing to perform node recovery during the system restart, or
both.
(Bug#44291)
See also Bug#42564.
An NDB internal timing function did not work correctly on Windows and could cause mysqld to fail on some AMD processors, or
when running inside a virtual machine. (Bug#44276)
It was possible for NDB API applications to insert corrupt data into the database, which could subquently lead to data node crashes.
Now, stricter checking is enforced on input data for inserts and updates. (Bug#44132)
ndb_restore failed when trying to restore data on a big-endian machine from a backup file created on a little-endian machine.
(Bug#44069)
Repeated starting and stopping of data nodes could cause ndb_mgmd to fail. This issue was observed on Solaris/SPARC.
(Bug#43974)
A number of incorrectly formatted output strings in the source code caused compiler warnings. (Bug#43878)
When trying to use a data node with an older version of the management server, the data node crashed on startup. (Bug#43699)
In some cases, data node restarts during a system restart could fail due to insufficient redo log space. (Bug#43156)
NDBCLUSTER did not build correctly on Solaris 9 platforms. (Bug#39080)
See also Bug#39036, Bug#39038.
The output of ndbd --help did not provide clear information about the program's --initial and --initial-start op-
tions. (Bug#28905)
It was theoretically possible for the value of a nonexistent column to be read as NULL, rather than causing an error. (Bug#27843)
Disk Data: During a checkpoint, restore points are created for both the on-disk and in-memory parts of a Disk Data table. Under
certain rare conditions, the in-memory restore point could include or exclude a row that should have been in the snapshot. This
would later later lead to a crash during or following recovery.
This issue was somewhat more likely to be encountered when using ndbmtd. (Bug#41915)
Disk Data: This fix supercedes and improves on an earlier fix made for this bug in MySQL 5.1.18. (Bug#24521)
Cluster Replication: A failure when setting up replication events could lead to subsequent data node failures. (Bug#44915)
17.15.1.3. Changes in MySQL Cluster NDB 7.0.5 (5.1.32-ndb-7.0.5) (20 April 2009)
This General Availability (GA) release incorporates new features in the NDBCLUSTER storage engine and fixes recently discovered
bugs in MySQL Cluster NDB 7.0.4.
Obtaining MySQL Cluster NDB 7.0.5. The latest MySQL Cluster NDB 7.0 binaries for supported platforms can be obtained from ht-
tp://dev.mysql.com/downloads/cluster/7.0.html. Source code for the latest MySQL Cluster NDB 7.0 release can be obtained from the
same location. You can also access the MySQL Cluster NDB 7.0 development source tree at ht-
tps://code.launchpad.net/~mysql/mysql-server/mysql-cluster-7.0.
This release also incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 6.4 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in
MySQL Cluster NDB 6.X/7.X
1728
MySQL 5.1.32 (14 February 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Two new server status variables Ndb_scan_count and Ndb_pruned_scan_count have been introduced.
Ndb_scan_count gives the number of scans executed since the cluster was last started. Ndb_pruned_scan_count gives the
number of scans for which NDBCLUSTER was able to use partition pruning. Together, these variables can be used to help determine
in the MySQL server whether table scans are pruned by NDBCLUSTER. (Bug#44153)
Bugs fixed:
Important Note: Due to problem discovered after the code freeze for this release, it is not possible to perform an online upgrade
from any MySQL Cluster NDB 6.x release to MySQL Cluster NDB 7.0.5 or any earlier MySQL Cluster NDB 7.0 release.
This issue is fixed in MySQL Cluster NDB 7.0.6 and later for upgrades from MySQL Cluster NDB 6.3.8 and later MySQL Cluster
NDB 6.3 releases, or from MySQL Cluster NDB 7.0.5. (Bug#44294)
Cluster Replication: If data node failed during an event creation operation, there was a slight risk that a surviving data node could
send an invalid table reference back to NDB, causing the operation to fail with a false Error 723 (NO SUCH TABLE). This could take
place when a data node failed as a mysqld process was setting up MySQL Cluster Replication. (Bug#43754)
Cluster API: The following issues occurred when performing an online (rolling) upgrade of a cluster to a version of MySQL
Cluster that supports configuration caching from a version that does not:
1. When using multiple management servers, after upgrading and restarting one ndb_mgmd, any remaining management servers
using the previous version of ndb_mgmd could not synchronize their configuration data.
2. The MGM API ndb_mgm_get_configuration() function failed to obtain configuration data.
(Bug#43641)
If the number of fragments per table rises above a certain threshold, the DBDIH kernel block's on-disk table-definition grows large
enough to occupy 2 pages. However, in MySQL Cluster NDB 7.0 (including MySQL Cluster NDB 6.4 releases), only 1 page was
actually written, causing table definitions stored on disk to be incomplete.
This issue was not observed in MySQL Cluster release series prior to MySQL Cluster NDB 7.0. (Bug#44135)
TransactionDeadlockDetectionTimeout values less than 100 were treated as 100. This could cause scans to time out un-
expectedly. (Bug#44099)
The file ndberror.c contained a C++-style comment, which caused builds to fail with some C compilers. (Bug#44036)
A race condition could occur when a data node failed to restart just before being included in the next global checkpoint. This could
cause other data nodes to fail. (Bug#43888)
The setting for ndb_use_transactions was ignored. This issue was only known to occur in MySQL Cluster NDB 6.4.3 and
MySQL Cluster NDB 7.0.4. (Bug#43236)
When a data node process had been killed after allocating a node ID, but before making contact with any other data node processes,
it was not possible to restart it due to a node ID allocation failure.
This issue could effect either ndbd or ndbmtd processes. (Bug#43224)
This regression was introduced by Bug#42973.
ndb_restore crashed when trying to restore a backup made to a MySQL Cluster running on a platform having different endian-
ness from that on which the original backup was taken. (Bug#39540)
PID files for the data and management node daemons were not removed following a normal shutdown. (Bug#37225)
MySQL Cluster NDB 6.X/7.X
1729
ndb_restore --print_data did not handle DECIMAL columns correctly. (Bug#37171)
Invoking the management client START BACKUP command from the system shell (for example, as ndb_mgm -e "START
BACKUP") did not work correctly, unless the backup ID was included when the command was invoked.
Now, the backup ID is no longer required in such cases, and the backup ID that is automatically generated is printed to stdout, simil-
ar to how this is done when invoking START BACKUP within the management client. (Bug#31754)
When aborting an operation involving both an insert and a delete, the insert and delete were aborted separately. This was because
the transaction coordinator did not know that the operations affected on same row, and, in the case of a committed-read (tuple or in-
dex) scan, the abort of the insert was performed first, then the row was examined after the insert was aborted but before the delete
was aborted. In some cases, this would leave the row in a inconsistent state. This could occur when a local checkpoint was per-
formed during a backup. This issue did not affect primary ley operations or scans that used locks (these are serialized).
After this fix, for ordered indexes, all operations that follow the operation to be aborted are now also aborted.
Disk Data: When using multi-threaded data nodes, DROP TABLE statements on Disk Data tables could hang. (Bug#43825)
Disk Data: This fix completes one that was made for this issue in MySQL Cluster NDB-7.0.4, which did not rectify the problem in
all cases. (Bug#43632)
Cluster Replication: When creating or altering a table an NdbEventOperation is created by the mysqld process to monitor
the table for subsequent logging in the binlog. If this happened during a node restart there was a chance that the reference count on
this event operation object could be incorrect, which could lead to an assert in debug MySQL Cluster builds. (Bug#43752)
Cluster API: If the largest offset of a RecordSpecification used for an NdbRecord object was for the NULL bits (and thus
not a column), this offset was not taken into account when calculating the size used for the RecordSpecification. This meant
that the space for the NULL bits could be overwritten by key or other information. (Bug#43891)
Cluster API: BIT columns created using the native NDB API format that were not created as nullable could still sometimes be
overwritten, or cause other columns to be overwritten.
This issue did not effect tables having BIT columns created using the mysqld format (always used by MySQL Cluster SQL nodes).
(Bug#43802)
17.15.1.4. Changes in MySQL Cluster NDB 7.0.4 (5.1.32-ndb-7.0.4) (18 March 2008)
This is a new Beta development release, incorporating new features in the NDBCLUSTER storage engine and fixing recently discovered
bugs in MySQL Cluster NDB 6.4.3. All feature additions and bugfixes that were made in MySQL Cluster releases having NDB 6.4.x
release numbers are included in MySQL Cluster 7.0.4.
Important
MySQL Cluster NDB 7.0.4 is the successor to MySQL Cluster NDB 6.4.3. Users running MySQL Cluster NDB 6.4.3
should upgrade to MySQL Cluster NDB 7.0.4 or a later 7.0.x release.
Obtaining MySQL Cluster NDB 7.0.4. MySQL Cluster NDB 7.0.4 is a source-only release. You can obtain the source code from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.32-ndb-7.0.4/.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 6.4 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in
MySQL 5.1.32 (14 February 2009)).
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Functionality added or changed:
Important Change: The default values for a number of MySQL Cluster configuration parameters relating to memory usage and
buffering have changed. These parameters include RedoBuffer, LongMessageBuffer, BackupMemory, BackupDat-
MySQL Cluster NDB 6.X/7.X
1730
aBufferSize, BackupLogBufferSize, BackupWriteSize, BackupMaxWriteSize, SendBufferMemory (when
applied to TCP transporters), and ReceiveBufferMemory.
For more information, see Section 17.3, MySQL Cluster Configuration.
When restoring from backup, ndb_restore now reports the last global checkpoint reached when the backup was taken.
(Bug#37384)
Bugs fixed:
Cluster API: Partition pruning did not work correctly for queries involving multiple range scans.
As part of the fix for this issue, several improvements have been made in the NDB API, including the addition of a new NdbScan-
Operation::getPruned() method, a new variant of NdbIndexScanOperation::setBound(), and a new
Ndb::PartitionSpec data structure. For more information about these changes, see NdbScanOpera-
tion::getPruned(), NdbIndexScanOperation::setBound, and The PartitionSpec Structure. (Bug#37934)
TimeBetweenLocalCheckpoints was measured from the end of one local checkpoint to the beginning of the next, rather than
from the beginning of one LCP to the beginning of the next. This meant that the time spent performing the LCP was not taken into
account when determining the TimeBetweenLocalCheckpoints interval, so that LCPs were not started often enough, pos-
sibly causing data nodes to run out of redo log space prematurely. (Bug#43567)
The management server failed to start correctly in daemon mode. (Bug#43559)
Following a DROP NODEGROUP command, the output of SHOW in the ndb_mgm cliently was not updated to reflect the fact that the
data nodes affected by this command were no longer part of a node group. (Bug#43413)
Using indexes containing variable-sized columns could lead to internal errors when the indexes were being built. (Bug#43226)
When using ndbmtd, multiple data node failures caused the remaining data nodes to fail as well. (Bug#43109)
It was not possible to add new data nodes to the cluster online using multi-threaded data node processes (ndbmtd). (Bug#43108)
Some queries using combinations of logical and comparison operators on an indexed column in the WHERE clause could fail with
the error GOT ERROR 4541 'INDEXBOUND HAS NO BOUND INFORMATION' FROM NDBCLUSTER. (Bug#42857)
Disk Data: When using multi-threaded data nodes, dropping a Disk Data table followed by a data node restart led to a crash.
(Bug#43632)
Disk Data: When using ndbmtd, repeated high-volume inserts (on the order of 10000 rows inserted at a time) on a Disk Data table
would eventually lead to a data node crash. (Bug#41398)
Disk Data: When a log file group had an undo log file whose size was too small, restarting data nodes failed with READ UNDERFLOW
errors.
As a result of this fix, the minimum allowed INTIAL_SIZE for an undo log file is now 1M (1 megabyte). (Bug#29574)
Cluster API: The default NdbRecord structures created by NdbDictionary could have overlapping null bits and data fields.
(Bug#43590)
Cluster API: When performing insert or write operations, NdbRecord allows key columns to be specified in both the key record
and in the attribute record. Only one key column value for each key column should be sent to the NDB kernel, but this was not guar-
anteed. This is now ensured as follows: For insert and write operations, key column values are taken from the key record; for scan
takeover update operations, key column values are taken from the attribute record. (Bug#42238)
Cluster API: Ordered index scans using NdbRecord formerly expressed a BoundEQ range as separate lower and upper bounds,
resulting in 2 copies of the column values being sent to the NDB kernel.
Now, when a range is specified by NdbScanOperation::setBound(), the passed pointers, key lengths, and inclusive bits are
compared, and only one copy of the equal key columns is sent to the kernel. This makes such operations more efficient, as half the
amount of KeyInfo is now sent for a BoundEQ range as before. (Bug#38793)
17.15.1.5. Changes in MySQL Cluster NDB 6.4.3 (5.1.32-ndb-6.4.3) (23 February 2009)
MySQL Cluster NDB 6.X/7.X
1731
This is a new Beta development release, incorporating new features in the NDBCLUSTER storage engine and fixing recently discovered
bugs in MySQL Cluster NDB 6.4.2.
Important
The successor version to MySQL Cluster NDB 6.4.3 is MySQL Cluster NDB 7.0.4. See Section 17.15.1.4, Changes in
MySQL Cluster NDB 7.0.4 (5.1.32-ndb-7.0.4) (18 March 2008).
Obtaining MySQL Cluster NDB 6.4.3. MySQL Cluster NDB 6.4.3 is a source-only release. You can obtain the source code from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.32-ndb-6.4.3/.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 6.4 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in
MySQL 5.1.32 (14 February 2009)).
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Functionality added or changed:
Important Change: Replication: RESET MASTER and RESET SLAVE now reset the values shown for Last_IO_Error,
Last_IO_Errno, Last_SQL_Error, and Last_SQL_Errno in the output of SHOW SLAVE STATUS. (Bug#34654)
A new data node configuration parameter MaxLCPStartDelay has been introduced to facilitate parallel node recovery by caus-
ing a local checkpoint to be delayed while recovering nodes are synchronizing data dictionaries and other meta-information. For
more information about this parameter, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes. (Bug#43053)
New options are introduced for ndb_restore for determining which tables or databases should be restored:
--include-tables and --include-databases can be used to restore specific tables or databases.
--exclude-tables and --exclude-databases can be used to exclude the specified tables or databases from being re-
stored.
For more information about these options, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
(Bug#40429)
Disk Data: It is now possible to specify default locations for Disk Data data files and undo log files, either together or separately,
using the data node configuration parameters FileSystemPathDD, FileSystemPathDataFiles, and FileSystem-
PathUndoFiles. For information about these configuration parameters, see Disk Data filesystem parameters.
It is also now possible to specify a log file group, tablespace, or both, that is created when the cluster is started, using the Ini-
tialLogFileGroup and InitialTablespace data node configuration parameters. For information about these configura-
tion parameters, see Disk Data object creation parameters.
Bugs fixed:
Important Note: It is not possible in this release to install the InnoDB plugin if InnoDB support has been compiled into mysqld.
(Bug#42610)
This regression was introduced by Bug#29263.
Packaging: Packages for MySQL Cluster were missing the libndbclient.so and libndbclient.a files. (Bug#42278)
Partitioning: Executing ALTER TABLE ... REORGANIZE PARTITION on an NDBCLUSTER table having only one partition
caused mysqld to crash. (Bug#41945)
See also Bug#40389.
Backup IDs greater than 2
31
were not handled correctly, causing negative values to be used in backup directory names and printouts.
MySQL Cluster NDB 6.X/7.X
1732
(Bug#43042)
When using ndbmtd, NDB kernel threads could hang while trying to start the data nodes with LockPagesInMainMemory set
to 1. (Bug#43021)
When using multiple management servers and starting several API nodes (possibly including one or more SQL nodes) whose con-
nectstrings listed the management servers in different order, it was possible for 2 API nodes to be assigned the same node ID. When
this happened it was possible for an API node not to get fully connected, consequently producing a number of errors whose cause
was not easily recognizable. (Bug#42973)
When using multi-threaded data nodes, IndexMemory, MaxNoOfLocalOperations, and MaxNoOfLocalScans were ef-
fectively multiplied by the number of local query handlers in use by each ndbmtd instance. (Bug#42765)
See also Bug#42215.
ndb_error_reporter worked correctly only with GNU tar. (With other versions of tar, it produced empty archives.)
(Bug#42753)
Triggers on NDBCLUSTER tables caused such tables to become locked. (Bug#42751)
See also Bug#16229, Bug#18135.
When performing more than 32 index or tuple scans on a single fragment, the scans could be left hanging. This caused unnecessary
timeouts, and in addition could possibly lead to a hang of an LCP. (Bug#42559)
A data node failure that occurred between calls to NdbIndexScanOperation::readTuples(SF_OrderBy) and Ndb-
Transaction::Execute() was not correctly handled; a subsequent call to nextResult() caused a null pointer to be defer-
enced, leading to a segfault in mysqld. (Bug#42545)
If the cluster configuration cache file was larger than 32K, the management server would not start. (Bug#42543)
Issuing SHOW GLOBAL STATUS LIKE 'NDB%' before mysqld had connected to the cluster caused a segmentation fault.
(Bug#42458)
When using ndbmtd for all data nodes, repeated failures of one data node during DML operations caused other data nodes to fail.
(Bug#42450)
Data node failures that occurred before all data nodes had connected to the cluster were not handled correctly, leading to additional
data node failures. (Bug#42422)
When using multi-threaded data nodes, their DataMemory and IndexMemory usage as reported was multiplied by the number of
local query handlers (worker threads), making it appear that much more memory was being used than was actually the case.
(Bug#42215)
See also Bug#42765.
Given a MySQL Cluster containing no data (that is, whose data nodes had all been started using --initial, and into which no
data had yet been imported) and having an empty backup directory, executing START BACKUP with a user-specified backup ID
caused the data nodes to crash. (Bug#41031)
In some cases, NDB did not check correctly whether tables had changed before trying to use the query cache. This could result in a
crash of the debug MySQL server. (Bug#40464)
Disk Data: It was not possible to add an in-memory column online to a table that used a table-level or column-level STORAGE
DISK option. The same issue prevented ALTER ONLINE TABLE ... REORGANIZE PARTITION from working on Disk
Data tables. (Bug#42549)
Disk Data: Repeated insert and delete operations on disk-based tables could lead to failures in the NDB Tablespace Manager (TS-
MAN kernel block). (Bug#40344)
Disk Data: Creating a Disk Data tablespace with a very large extent size caused the data nodes to fail. The issue was observed when
using extent sizes of 100 MB and larger. (Bug#39096)
Disk Data: Trying to execute a CREATE LOGFILE GROUP statement using a value greater than 150M for
UNDO_BUFFER_SIZE caused data nodes to crash.
MySQL Cluster NDB 6.X/7.X
1733
As a result of this fix, the upper limit for UNDO_BUFFER_SIZE is now 600M; attempting to set a higher value now fails gracefully
with an error. (Bug#34102)
Disk Data: When attempting to create a tablespace that already existed, the error message returned was TABLE OR INDEX WITH
GIVEN NAME ALREADY EXISTS. (Bug#32662)
Disk Data: Using a path or filename longer than 128 characters for Disk Data undo log files and tablespace data files caused a num-
ber of issues, including failures of CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, and AL-
TER TABLESPACE statements, as well as crashes of management nodes and data nodes.
With this fix, the maximum length for path and file names used for Disk Data undo log files and tablespace data files is now the
same as the maximum for the operating system. (Bug#31769, Bug#31770, Bug#31772)
Disk Data: Attempting to perform a system restart of the cluster where there existed a logfile group without and undo log files
caused the data nodes to crash.
Note
While issuing a CREATE LOGFILE GROUP statement without an ADD UNDOFILE option fails with an error in the
MySQL server, this situation could arise if an SQL node failed during the execution of a valid CREATE LOGFILE
GROUP statement; it is also possible to create a logfile group without any undo log files using the NDB API.
(Bug#17614)
Cluster Replication: Being disconnected from the cluster while setting up the binary log caused mysqld to hang or crash.
(Bug#43045)
Cluster Replication: Primary key updates on MyISAM and InnoDB tables failed to replicate to NDBCLUSTER tables.
(Bug#42921)
Cluster API: Some error messages from ndb_mgmd contained newline (\n) characters. This could break the MGM API protocol,
which uses the newline as a line separator. (Bug#43104)
Cluster API: When using an ordered index scan without putting all key columns in the read mask, this invalid use of the NDB API
went undetected, which resulted in the use of uninitialized memory. (Bug#42591)
17.15.1.6. Changes in MySQL Cluster NDB 6.4.2 (5.1.31-ndb-6.4.2) (28 January 2009)
This is a new Beta development release, incorporating new features in the NDBCLUSTER storage engine and fixing recently discovered
bugs in MySQL Cluster NDB 6.4.1.
Obtaining MySQL Cluster NDB 6.4.2. MySQL Cluster NDB 6.4.2 is a source-only release. You can obtain the source code from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.31-ndb-6.4.2/.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 6.4 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.31 (see Section C.1.7, Changes in
MySQL 5.1.31 (19 January 2009)).
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Bugs fixed:
Connections using IPv6 were not handled correctly by mysqld. (Bug#42413)
See also Bug#42412, Bug#38247.
When a cluster backup failed with Error 1304 (Node node_id1: Backup request from node_id2 failed to start), no clear reason
for the failure was provided.
MySQL Cluster NDB 6.X/7.X
1734
As part of this fix, MySQL Cluster now retries backups in the event of sequence errors. (Bug#42354)
See also Bug#22698.
Issuing SHOW ENGINE NDBCLUSTER STATUS on an SQL node before the management server had connected to the cluster
caused mysqld to crash. (Bug#42264)
When using ndbmtd, setting MaxNoOfThreads to a value higher than the actual number of cores available and with insufficient
SharedGlobalMemory caused the data nodes to crash.
The fix for this issue changes the behavior of ndbmtd such that its internal job buffers no longer rely on
SharedGlobalMemory. (Bug#42254)
17.15.1.7. Changes in MySQL Cluster NDB 6.4.1 (5.1.31-ndb-6.4.1) (21 January 2009)
This is a new Beta development release, incorporating new features in the NDBCLUSTER storage engine and fixing recently discovered
bugs in MySQL Cluster NDB 6.4.0.
Obtaining MySQL Cluster NDB 6.4.1. MySQL Cluster NDB 6.4.1 is a source-only release. You can obtain the source code from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.31-ndb-6.4.1/.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, 6.3, and 6.4 releases, as well as
all bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.31 (see Section C.1.7, Changes in
MySQL 5.1.31 (19 January 2009)).
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Functionality added or changed:
Important Change: Formerly, when the management server failed to create a transporter for a data node connection,
net_write_timeout seconds elapsed before the data node was actually allowed to disconnect. Now in such cases the discon-
nection occurs immediately. (Bug#41965)
See also Bug#41713.
Formerly, when using MySQL Cluster Replication, records for empty epochs that is, epochs in which no changes to NDB-
CLUSTER data or tables took place were inserted into the ndb_apply_status and ndb_binlog_index tables on the
slave even when --log-slave-updates was disabled. Beginning with MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB
6.3.13 this was changed so that these empty eopchs were no longer logged. However, it is now possible to re-enable the older be-
havior (and cause empty epochs to be logged) by using the --ndb-log-empty-epochs option. For more information, see
Section 16.1.3.3, Replication Slave Options and Variables.
See also Bug#37472.
Cluster Replication: IPv6 networking is now supported between MySQL Cluster SQL nodes. This means that it is now possible to
replicate between instances of MySQL Cluster using IPv6 addresses.
Important
Currently, other MySQL Cluster processes (ndbd, ndbmtd, ndb_mgmd, and ndb_mgm) do not support IPv6 connec-
tions. This means that all MySQL Cluster data nodes, management servers, and management clients must connect to and
be accessible from one another using IPv4. In addition, SQL nodes must use IPv4 to communicate with the cluster. There
is also not yet any support in the NDB and MGM APIs for IPv6, which means that applications written using the MySQL
Cluster APIs must make connections using IPv4. For more information, see Section 17.9.3, Known Issues in MySQL
Cluster Replication.
Bugs fixed:
MySQL Cluster NDB 6.X/7.X
1735
A maximum of 11 TUP scans were allowed in parallel. (Bug#42084)
The management server could hang after attempting to halt it with the STOP command in the management client. (Bug#42056)
See also Bug#40922.
When using ndbmtd, one thread could flood another thread, which would cause the system to stop with a JOB BUFFER FULL condi-
tion (currently implemented as an abort). This could be caused by committing or aborting a large transaction (50000 rows or more)
on a single data node running ndbmtd. To prevent this from happening, the number of signals that can be accepted by the system
threads is calculated before excuting them, and only executing them if sufficient space is found. (Bug#42052)
MySQL Cluster would not compile when using libwrap. This issue was known to occur only in MySQL Cluster NDB 6.4.0.
(Bug#41918)
Trying to execute an ALTER ONLINE TABLE ... ADD COLUMN statement while inserting rows into the table caused mysqld
to crash. (Bug#41905)
When a data node connects to the management server, the node sends its node ID and transporter type; the management server then
verifies that there is a transporter set up for that node and that it is in the correct state, and then sends back an acknowledgement to
the connecting node. If the transporter was not in the correct state, no reply was sent back to the connecting node, which would then
hang until a read timeout occurred (60 seconds). Now, if the transporter is not in the correct state, the management server acknow-
ledges this promptly, and the node immediately disconnects. (Bug#41713)
See also Bug#41965.
Issuing EXIT in the management client sometimes caused the client to hang. (Bug#40922)
In the event that a MySQL Cluster backup failed due to file permissions issues, conflicting reports were issued in the management
client. (Bug#34526)
If all data nodes were shut down, MySQL clients were unable to access NDBCLUSTER tables and data even after the data nodes
were restarted, unless the MySQL clients themselves were restarted. (Bug#33626)
17.15.1.8. Changes in MySQL Cluster NDB 6.4.0 (5.1.30-ndb-6.4.0) (22 December 2008)
This is a new Beta development release, incorporating new features in the NDBCLUSTER storage engine and fixing recently discovered
bugs in previous MySQL Cluster releases.
Obtaining MySQL Cluster NDB 6.4.0. MySQL Cluster NDB 6.4.0 is a source-only release. You can obtain the source code from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.30-ndb-6.4.0/.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1, 6.2, and 6.3 releases, as well as all
bugfixes and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.30 (see Section C.1.8, Changes in
MySQL 5.1.30 (14 November 2008 General Availability)).
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Functionality added or changed:
Important Change: MySQL Cluster now caches its configuration data. This means that, by default, the management server only
reads the global configuration file (usually named config.ini) the first time that it is started, and does not automatically re-read
the this file when restarted. This behavior can be controlled using new management server options (--config-dir,
--initial, and --reload) that have been added for this purpose. For more information, see Section 17.3.4, MySQL Cluster
Configuration Files, and Section 17.6.24.3, Program Options for ndb_mgmd.
It is now possible while in Single User Mode to restart all data nodes using ALL RESTART in the management client. Restarting of
individual nodes while in Single User Mode remains disallowed. (Bug#31056)
It is now possible to add data nodes to a MySQL Cluster online that is, to a running MySQL Cluster without shutting it down.
MySQL Cluster NDB 6.X/7.X
1736
For information about the procedure for adding data nodes online, see Section 17.7.8, Adding MySQL Cluster Data Nodes
Online.
A multi-threaded version of the MySQL Cluster data node daemon is now available. The multi-threaded ndbmtd binary is similar
to ndbd and functions in much the same way, but is intended for use on machines with multiple CPU cores.
For more information, see Section 17.6.3, ndbmtd The MySQL Cluster Data Node Daemon (Multi-Threaded).
It is now possible when performing a cluster backup to determine whether the backup matches the state of the data when the backup
began or when it ended, using the new START BACKUP options SNAPSHOTSTART and SNAPSHOTEND in the management cli-
ent. See Section 17.7.3.2, Using The MySQL Cluster Management Client to Create a Backup, for more information.
Bugs fixed:
API nodes disconnected too agressively from cluster when data nodes were being restarted. This could sometimes lead to the API
node being unable to access the cluster at all during a rolling restart. (Bug#41462)
When long signal buffer exhaustion in the ndbd process resulted in a signal being dropped, the usual handling mechanism did not
take fragmented signals into account. This could result in a crash of the data node because the fragmented signal handling mechan-
ism was not able to work with the missing fragments. (Bug#39235)
The failure of a master node during a DDL operation caused the cluster to be unavailable for further DDL operations until it was re-
started; failures of nonmaster nodes during DLL operations caused the cluster to become completely inaccessible. (Bug#36718)
Status messages shown in the management client when restarting a management node were inappropriate and misleading. Now,
when restarting a management node, the messages displayed are as follows, where node_id is the management node's node ID:
ndb_mgm> node_id RESTART
Shutting down MGM node node_id for restart
Node node_id is being restarted
ndb_mgm>
(Bug#29275)
A data node failure when NoOfReplicas was greater than 2 caused all cluster SQL nodes to crash. (Bug#18621)
Partitioning: A query on a user-partitioned table caused MySQL to crash, where the query had the following characteristics:
The query's WHERE clause referenced an indexed column that was also in the partitioning key.
The query's WHERE clause included a value found in the partition.
The query's WHERE clause used the < or <> operators to compare with the indexed column's value with a constant.
The query used an ORDER BY clause, and the same indexed column was used in the ORDER BY clause.
The ORDER BY clause used an explcit or implicit ASC sort priority.
Two examples of such a query are given here, where a represents an indexed column used in the table's partitioning key:
1.
SELECT * FROM table WHERE a < constant ORDER BY a;
2.
SELECT * FROM table WHERE a <> constant ORDER BY a;
(Bug#40954)
This regression was introduced by Bug#30573, Bug#33257, Bug#33555.
17.15.2. Changes in MySQL Cluster NDB 6.3
MySQL Cluster NDB 6.X/7.X
1737
This section contains change history information for MySQL Cluster releases based on version 6.3 of the NDBCLUSTER storage engine.
For an overview of new features added in MySQL Cluster NDB 6.3, see Section 17.13.4, Features Added in MySQL Cluster NDB
6.3.
17.15.2.1. Changes in MySQL Cluster NDB 6.3.26 (5.1.35-ndb-6.3.26) (Not yet released)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.35 (see Section C.1.2, Changes in MySQL 5.1.35 (13
May 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
An internal NDB API buffer was not properly initialized. (Bug#44977)
When a data node had written its GCI marker to the first page of a megabyte, and that node was later killed during restart after hav-
ing processed that page (marker) but before completing a LCP, the data node could fail with filesystem errors. (Bug#44952)
See also Bug#42564.
Disk Data: Partitioning: An NDBCLUSTER table created with a very large value for the MAX_ROWS option could if this table
was dropped and a new table with fewer partitions, but having the same table ID, was created cause ndbd to crash when per-
forming a system restart. This was because the server attempted to examine each partition whether or not it actually existed.
(Bug#45154)
Disk Data: During a checkpoint, restore points are created for both the on-disk and in-memory parts of a Disk Data table. Under
certain rare conditions, the in-memory restore point could include or exclude a row that should have been in the snapshot. This
would later later lead to a crash during or following recovery. (Bug#41915)
17.15.2.2. Changes in MySQL Cluster NDB 6.3.25 (5.1.34-ndb-6.3.25) (25 May 2009)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.34 (see Section C.1.3, Changes in MySQL 5.1.34 (02
April 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Two new server status variables Ndb_scan_count and Ndb_pruned_scan_count have been introduced.
Ndb_scan_count gives the number of scans executed since the cluster was last started. Ndb_pruned_scan_count gives the
number of scans for which NDBCLUSTER was able to use partition pruning. Together, these variables can be used to help determine
in the MySQL server whether table scans are pruned by NDBCLUSTER. (Bug#44153)
The ndb_config utility program can now provide an offline dump of all MySQL Cluster configuration parameters including in-
formation such as default and permitted values, brief description, and applicable section of the config.ini file. A dump in text
format is produced when running ndb_config with the new --configinfo option, and in XML format when the options -
-configinfo --xml are used together. For more information and examples, see Section 17.6.6, ndb_config Extract
MySQL Cluster Configuration Information.
Bugs fixed:
MySQL Cluster NDB 6.X/7.X
1738
Important Change: Partitioning: User-defined partitioning of an NDBCLUSTER table without any primary key sometimes failed,
and could cause mysqld to crash.
Now, if you wish to create an NDBCLUSTER table with user-defined partitioning, the table must have an explicit primary key, and
all columns listed in the partitioning expression must be part of the primary key. The hidden primary key used by the NDBCLUSTER
storage engine is not sufficient for this purpose. However, if the list of columns is empty (that is, the table is defined using PARTI-
TION BY [LINEAR] KEY()), then no explicit primary key is required.
This change does not effect the partitioning of tables using any storage engine other than NDBCLUSTER. (Bug#40709)
When ndb_config could not find the file referenced by the --config-file option, it tried to read my.cnf instead, then
failed with a misleading error message. (Bug#44846)
When a data node was down so long that its most recent local checkpoint depended on a global checkpoint that was no longer
restorable, it was possible for it to be unable to use optimized node recovery when being restarted later. (Bug#44844)
See also Bug#26913.
Inspection of the code revealed that several assignment operators (=) were used in place of comparison operators (==) in Dbdih-
Main.cpp. (Bug#44567)
See also Bug#44570.
It was possible for NDB API applications to insert corrupt data into the database, which could subquently lead to data node crashes.
Now, stricter checking is enforced on input data for inserts and updates. (Bug#44132)
ndb_restore failed when trying to restore data on a big-endian machine from a backup file created on a little-endian machine.
(Bug#44069)
The file ndberror.c contained a C++-style comment, which caused builds to fail with some C compilers. (Bug#44036)
When trying to use a data node with an older version of the management server, the data node crashed on startup. (Bug#43699)
In some cases, data node restarts during a system restart could fail due to insufficient redo log space. (Bug#43156)
NDBCLUSTER did not build correctly on Solaris 9 platforms. (Bug#39080)
See also Bug#39036, Bug#39038.
ndb_restore --print_data did not handle DECIMAL columns correctly. (Bug#37171)
The output of ndbd --help did not provide clear information about the program's --initial and --initial-start op-
tions. (Bug#28905)
It was theoretically possible for the value of a nonexistent column to be read as NULL, rather than causing an error. (Bug#27843)
Disk Data: This fix supercedes and improves on an earlier fix made for this bug in MySQL 5.1.18. (Bug#24521)
Cluster Replication: A failure when setting up replication events could lead to subsequent data node failures. (Bug#44915)
17.15.2.3. Changes in MySQL Cluster NDB 6.3.24 (5.1.32-ndb-6.3.24) (09 April 2009)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
This is a source-only release. You can obtain the GPL source code for MySQL Cluster NDB 6.3.24 from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.32-ndb-6.3.24/.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in MySQL 5.1.32 (14
February 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
MySQL Cluster NDB 6.X/7.X
1739
Bugs fixed:
Cluster Replication: If data node failed during an event creation operation, there was a slight risk that a surviving data node could
send an invalid table reference back to NDB, causing the operation to fail with a false Error 723 (NO SUCH TABLE). This could take
place when a data node failed as a mysqld process was setting up MySQL Cluster Replication. (Bug#43754)
Cluster API: Partition pruning did not work correctly for queries involving multiple range scans.
As part of the fix for this issue, several improvements have been made in the NDB API, including the addition of a new NdbScan-
Operation::getPruned() method, a new variant of NdbIndexScanOperation::setBound(), and a new
Ndb::PartitionSpec data structure. For more information about these changes, see NdbScanOpera-
tion::getPruned(), NdbIndexScanOperation::setBound, and The PartitionSpec Structure. (Bug#37934)
TransactionDeadlockDetectionTimeout values less than 100 were treated as 100. This could cause scans to time out un-
expectedly. (Bug#44099)
A race condition could occur when a data node failed to restart just before being included in the next global checkpoint. This could
cause other data nodes to fail. (Bug#43888)
TimeBetweenLocalCheckpoints was measured from the end of one local checkpoint to the beginning of the next, rather than
from the beginning of one LCP to the beginning of the next. This meant that the time spent performing the LCP was not taken into
account when determining the TimeBetweenLocalCheckpoints interval, so that LCPs were not started often enough, pos-
sibly causing data nodes to run out of redo log space prematurely. (Bug#43567)
Using indexes containing variable-sized columns could lead to internal errors when the indexes were being built. (Bug#43226)
When a data node process had been killed after allocating a node ID, but before making contact with any other data node processes,
it was not possible to restart it due to a node ID allocation failure.
This issue could effect either ndbd or ndbmtd processes. (Bug#43224)
This regression was introduced by Bug#42973.
Some queries using combinations of logical and comparison operators on an indexed column in the WHERE clause could fail with
the error GOT ERROR 4541 'INDEXBOUND HAS NO BOUND INFORMATION' FROM NDBCLUSTER. (Bug#42857)
ndb_restore crashed when trying to restore a backup made to a MySQL Cluster running on a platform having different endian-
ness from that on which the original backup was taken. (Bug#39540)
When aborting an operation involving both an insert and a delete, the insert and delete were aborted separately. This was because
the transaction coordinator did not know that the operations affected on same row, and, in the case of a committed-read (tuple or in-
dex) scan, the abort of the insert was performed first, then the row was examined after the insert was aborted but before the delete
was aborted. In some cases, this would leave the row in a inconsistent state. This could occur when a local checkpoint was per-
formed during a backup. This issue did not affect primary ley operations or scans that used locks (these are serialized).
After this fix, for ordered indexes, all operations that follow the operation to be aborted are now also aborted.
Disk Data: When a log file group had an undo log file whose size was too small, restarting data nodes failed with READ UNDERFLOW
errors.
As a result of this fix, the minimum allowed INTIAL_SIZE for an undo log file is now 1M (1 megabyte). (Bug#29574)
Cluster Replication: When creating or altering a table an NdbEventOperation is created by the mysqld process to monitor
the table for subsequent logging in the binlog. If this happened during a node restart there was a chance that the reference count on
this event operation object could be incorrect, which could lead to an assert in debug MySQL Cluster builds. (Bug#43752)
Cluster API: If the largest offset of a RecordSpecification used for an NdbRecord object was for the NULL bits (and thus
not a column), this offset was not taken into account when calculating the size used for the RecordSpecification. This meant
that the space for the NULL bits could be overwritten by key or other information. (Bug#43891)
Cluster API: BIT columns created using the native NDB API format that were not created as nullable could still sometimes be
overwritten, or cause other columns to be overwritten.
This issue did not effect tables having BIT columns created using the mysqld format (always used by MySQL Cluster SQL nodes).
(Bug#43802)
MySQL Cluster NDB 6.X/7.X
1740
Cluster API: The default NdbRecord structures created by NdbDictionary could have overlapping null bits and data fields.
(Bug#43590)
Cluster API: When performing insert or write operations, NdbRecord allows key columns to be specified in both the key record
and in the attribute record. Only one key column value for each key column should be sent to the NDB kernel, but this was not guar-
anteed. This is now ensured as follows: For insert and write operations, key column values are taken from the key record; for scan
takeover update operations, key column values are taken from the attribute record. (Bug#42238)
Cluster API: Ordered index scans using NdbRecord formerly expressed a BoundEQ range as separate lower and upper bounds,
resulting in 2 copies of the column values being sent to the NDB kernel.
Now, when a range is specified by NdbScanOperation::setBound(), the passed pointers, key lengths, and inclusive bits are
compared, and only one copy of the equal key columns is sent to the kernel. This makes such operations more efficient, as half the
amount of KeyInfo is now sent for a BoundEQ range as before. (Bug#38793)
17.15.2.4. Changes in MySQL Cluster NDB 6.3.23 (5.1.32-ndb-6.3.23) (24 February 2009)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
This is a source-only release. You can obtain the GPL source code for MySQL Cluster NDB 6.3.23 from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.32-ndb-6.3.23/.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in MySQL 5.1.32 (14
February 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Important Change: Replication: RESET MASTER and RESET SLAVE now reset the values shown for Last_IO_Error,
Last_IO_Errno, Last_SQL_Error, and Last_SQL_Errno in the output of SHOW SLAVE STATUS. (Bug#34654)
A new data node configuration parameter MaxLCPStartDelay has been introduced to facilitate parallel node recovery by caus-
ing a local checkpoint to be delayed while recovering nodes are synchronizing data dictionaries and other meta-information. For
more information about this parameter, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes. (Bug#43053)
Bugs fixed:
Packaging: Packages for MySQL Cluster were missing the libndbclient.so and libndbclient.a files. (Bug#42278)
Partitioning: Executing ALTER TABLE ... REORGANIZE PARTITION on an NDBCLUSTER table having only one partition
caused mysqld to crash. (Bug#41945)
See also Bug#40389.
Backup IDs greater than 2
31
were not handled correctly, causing negative values to be used in backup directory names and printouts.
(Bug#43042)
When using ndbmtd, NDB kernel threads could hang while trying to start the data nodes with LockPagesInMainMemory set
to 1. (Bug#43021)
When using multiple management servers and starting several API nodes (possibly including one or more SQL nodes) whose con-
nectstrings listed the management servers in different order, it was possible for 2 API nodes to be assigned the same node ID. When
this happened it was possible for an API node not to get fully connected, consequently producing a number of errors whose cause
was not easily recognizable. (Bug#42973)
ndb_error_reporter worked correctly only with GNU tar. (With other versions of tar, it produced empty archives.)
(Bug#42753)
MySQL Cluster NDB 6.X/7.X
1741
Triggers on NDBCLUSTER tables caused such tables to become locked. (Bug#42751)
See also Bug#16229, Bug#18135.
Given a MySQL Cluster containing no data (that is, whose data nodes had all been started using --initial, and into which no
data had yet been imported) and having an empty backup directory, executing START BACKUP with a user-specified backup ID
caused the data nodes to crash. (Bug#41031)
In some cases, NDB did not check correctly whether tables had changed before trying to use the query cache. This could result in a
crash of the debug MySQL server. (Bug#40464)
Disk Data: It was not possible to add an in-memory column online to a table that used a table-level or column-level STORAGE
DISK option. The same issue prevented ALTER ONLINE TABLE ... REORGANIZE PARTITION from working on Disk
Data tables. (Bug#42549)
Disk Data: Creating a Disk Data tablespace with a very large extent size caused the data nodes to fail. The issue was observed when
using extent sizes of 100 MB and larger. (Bug#39096)
Disk Data: Trying to execute a CREATE LOGFILE GROUP statement using a value greater than 150M for
UNDO_BUFFER_SIZE caused data nodes to crash.
As a result of this fix, the upper limit for UNDO_BUFFER_SIZE is now 600M; attempting to set a higher value now fails gracefully
with an error. (Bug#34102)
Disk Data: When attempting to create a tablespace that already existed, the error message returned was TABLE OR INDEX WITH
GIVEN NAME ALREADY EXISTS. (Bug#32662)
Disk Data: Using a path or filename longer than 128 characters for Disk Data undo log files and tablespace data files caused a num-
ber of issues, including failures of CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, and AL-
TER TABLESPACE statements, as well as crashes of management nodes and data nodes.
With this fix, the maximum length for path and file names used for Disk Data undo log files and tablespace data files is now the
same as the maximum for the operating system. (Bug#31769, Bug#31770, Bug#31772)
Disk Data: Attempting to perform a system restart of the cluster where there existed a logfile group without and undo log files
caused the data nodes to crash.
Note
While issuing a CREATE LOGFILE GROUP statement without an ADD UNDOFILE option fails with an error in the
MySQL server, this situation could arise if an SQL node failed during the execution of a valid CREATE LOGFILE
GROUP statement; it is also possible to create a logfile group without any undo log files using the NDB API.
(Bug#17614)
Cluster Replication: Being disconnected from the cluster while setting up the binary log caused mysqld to hang or crash.
(Bug#43045)
Cluster Replication: Primary key updates on MyISAM and InnoDB tables failed to replicate to NDBCLUSTER tables.
(Bug#42921)
Cluster API: Some error messages from ndb_mgmd contained newline (\n) characters. This could break the MGM API protocol,
which uses the newline as a line separator. (Bug#43104)
Cluster API: When using an ordered index scan without putting all key columns in the read mask, this invalid use of the NDB API
went undetected, which resulted in the use of uninitialized memory. (Bug#42591)
17.15.2.5. Changes in MySQL Cluster NDB 6.3.22 (5.1.31-ndb-6.3.22) (09 February 2009)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
This is a source-only release. You can obtain the GPL source code for MySQL Cluster NDB 6.3.22 from
ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.31-ndb-6.3.22/.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
MySQL Cluster NDB 6.X/7.X
1742
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.31 (see Section C.1.7, Changes in MySQL 5.1.31 (19
January 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
New options are introduced for ndb_restore for determining which tables or databases should be restored:
--include-tables and --include-databases can be used to restore specific tables or databases.
--exclude-tables and --exclude-databases can be used to exclude the specified tables or databases from being re-
stored.
For more information about these options, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
(Bug#40429)
Bugs fixed:
When performing more than 32 index or tuple scans on a single fragment, the scans could be left hanging. This caused unnecessary
timeouts, and in addition could possibly lead to a hang of an LCP. (Bug#42559)
A data node failure that occurred between calls to NdbIndexScanOperation::readTuples(SF_OrderBy) and Ndb-
Transaction::Execute() was not correctly handled; a subsequent call to nextResult() caused a null pointer to be defer-
enced, leading to a segfault in mysqld. (Bug#42545)
Issuing SHOW GLOBAL STATUS LIKE 'NDB%' before mysqld had connected to the cluster caused a segmentation fault.
(Bug#42458)
Data node failures that occurred before all data nodes had connected to the cluster were not handled correctly, leading to additional
data node failures. (Bug#42422)
When a cluster backup failed with Error 1304 (Node node_id1: Backup request from node_id2 failed to start), no clear reason
for the failure was provided.
As part of this fix, MySQL Cluster now retries backups in the event of sequence errors. (Bug#42354)
See also Bug#22698.
Issuing SHOW ENGINE NDBCLUSTER STATUS on an SQL node before the management server had connected to the cluster
caused mysqld to crash. (Bug#42264)
17.15.2.6. Changes in MySQL Cluster NDB 6.3.21 (5.1.31-ndb-6.3.21) (19 January 2009)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
Note
MySQL Cluster NDB 6.3.21 was withdrawn due to issues discovered after its release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.31 (see Section C.1.7, Changes in MySQL 5.1.31 (19
January 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1743
Important Change: Formerly, when the management server failed to create a transporter for a data node connection,
net_write_timeout seconds elapsed before the data node was actually allowed to disconnect. Now in such cases the discon-
nection occurs immediately. (Bug#41965)
See also Bug#41713.
It is now possible while in Single User Mode to restart all data nodes using ALL RESTART in the management client. Restarting of
individual nodes while in Single User Mode remains disallowed. (Bug#31056)
Formerly, when using MySQL Cluster Replication, records for empty epochs that is, epochs in which no changes to NDB-
CLUSTER data or tables took place were inserted into the ndb_apply_status and ndb_binlog_index tables on the
slave even when --log-slave-updates was disabled. Beginning with MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB
6.3.13 this was changed so that these empty eopchs were no longer logged. However, it is now possible to re-enable the older be-
havior (and cause empty epochs to be logged) by using the --ndb-log-empty-epochs option. For more information, see
Section 16.1.3.3, Replication Slave Options and Variables.
See also Bug#37472.
Bugs fixed:
A maximum of 11 TUP scans were allowed in parallel. (Bug#42084)
Trying to execute an ALTER ONLINE TABLE ... ADD COLUMN statement while inserting rows into the table caused mysqld
to crash. (Bug#41905)
If the master node failed during a global checkpoint, it was possible in some circumstances for the new master to use an incorrect
value for the global checkpoint index. This could occur only when the cluster used more than one node group. (Bug#41469)
API nodes disconnected too agressively from cluster when data nodes were being restarted. This could sometimes lead to the API
node being unable to access the cluster at all during a rolling restart. (Bug#41462)
It was not possible to perform online upgrades from a MySQL Cluster NDB 6.2 release to MySQL Cluster NDB 6.3.8 or a later
MySQL Cluster NDB 6.3 release. (Bug#41435)
Cluster log files were opened twice by internal log-handling code, resulting in a resource leak. (Bug#41362)
An abort path in the DBLQH kernel block failed to release a commit acknowledgement marker. This meant that, during node failure
handling, the local query handler could be added multiple times to the marker record which could lead to additional node failures
due an array overflow. (Bug#41296)
During node failure handling (of a data node other than the master), there was a chance that the master was waiting for a
GCP_NODEFINISHED signal from the failed node after having received it from all other data nodes. If this occurred while the
failed node had a transaction that was still being committed in the current epoch, the master node could crash in the DBTC kernel
block when discovering that a transaction actually belonged to an epoch which was already completed. (Bug#41295)
Issuing EXIT in the management client sometimes caused the client to hang. (Bug#40922)
In the event that a MySQL Cluster backup failed due to file permissions issues, conflicting reports were issued in the management
client. (Bug#34526)
If all data nodes were shut down, MySQL clients were unable to access NDBCLUSTER tables and data even after the data nodes
were restarted, unless the MySQL clients themselves were restarted. (Bug#33626)
Disk Data: Starting a cluster under load such that Disk Data tables used most of the undo buffer could cause data node failures.
The fix for this bug also corrected an issue in the LGMAN kernel block where the amount of free space left in the undo buffer was
miscalculated, causing buffer overruns. This could cause records in the buffer to be overwritten, leading to problems when restarting
data nodes. (Bug#28077)
Cluster Replication: Sometimes, when using the --ndb_log_orig option, the orig_epoch and orig_server_id
columns of the ndb_binlog_index table on the slave contained the ID and epoch of the local server instead. (Bug#41601)
Cluster API: mgmapi.h contained constructs which only worked in C++, but not in C. (Bug#27004)
MySQL Cluster NDB 6.X/7.X
1744
17.15.2.7. Changes in MySQL Cluster NDB 6.3.20 (5.1.30-ndb-6.3.20) (17 December 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
Obtaining MySQL Cluster NDB 6.3.20. You can download MySQL Cluster NDB 6.3.20 source code and binaries for supported plat-
forms from http://dev.mysql.com/downloads/cluster.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.30 (see Section C.1.8, Changes in MySQL 5.1.30 (14
November 2008 General Availability)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
If a transaction was aborted during the handling of a data node failure, this could lead to the later handling of an API node failure
not being completed. (Bug#41214)
Issuing SHOW TABLES repeatedly could cause NDBCLUSTER tables to be dropped. (Bug#40854)
Statements of the form UPDATE ... ORDER BY ... LIMIT run against NDBCLUSTER tables failed to update all matching
rows, or failed with the error CAN'T FIND RECORD IN 'TABLE_NAME'. (Bug#40081)
Start phase reporting was inconsistent between the management client and the cluster log. (Bug#39667)
Status messages shown in the management client when restarting a management node were inappropriate and misleading. Now,
when restarting a management node, the messages displayed are as follows, where node_id is the management node's node ID:
ndb_mgm> node_id RESTART
Shutting down MGM node node_id for restart
Node node_id is being restarted
ndb_mgm>
(Bug#29275)
Partitioning: This bug was introduced in MySQL Cluster NDB 6.3.19. (Bug#40954)
This regression was introduced by Bug#30573, Bug#33257, Bug#33555.
Replication: Issuing the statement CHANGE MASTER TO ... MASTER_HEARTBEAT_PERIOD = period using a value for
period outside the permitted range caused the slave to crash. (Bug#39077)
Disk Data: This improves on a previous fix for this issue that was made in MySQL Cluster 6.3.8. (Bug#37116)
See also Bug#29186.
Cluster API: When creating a scan using an NdbScanFilter object, it was possible to specify conditions against a BIT column,
but the correct rows were not returned when the scan was executed.
As part of this fix, 4 new comparison operators have been implemented for use with scans on BIT columns:
COL_AND_MASK_EQ_MASK
COL_AND_MASK_NE_MASK
COL_AND_MASK_EQ_ZERO
COL_AND_MASK_NE_ZERO
For more information about these operators, see The NdbScanFilter::BinaryCondition Type.
Equivalent methods are now also defined for NdbInterpretedCode; for more information, see NdbInterpretedCode Bit-
wise Comparison Operations. (Bug#40535)
MySQL Cluster NDB 6.X/7.X
1745
17.15.2.8. Changes in MySQL Cluster NDB 6.3.19 (5.1.29-ndb-6.3.19) (21 November 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.29 (see Section C.1.9, Changes in MySQL 5.1.29 (11 Oc-
tober 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster API: Important Change: MGM API applications exited without raising any errors if the connection to the management
server was lost. The fix for this issue includes two changes:
1. The MGM API now provides its own SIGPIPE handler to catch the broken pipe error that occurs when writing to a closed
or reset socket. This means that MGM API now behaves the same as NDB API in this regard.
2. A new function ndb_mgm_set_ignore_sigpipe() has been added to the MGM API. This function makes it possible to
bypass the SIGPIPE handler provded by the MGM API.
(Bug#40498)
Cluster Replication: Important Note: This release of MySQL Cluster derives in part from MySQL 5.1.29, where the default value
for the --binlog-format option changed to STATEMENT. That change does not affect this or future MySQL Cluster NDB 6.x
releases, where the default value for this option remains MIXED, since MySQL Cluster Replication does not work with the state-
ment-based format. (Bug#40586)
When performing an initial start of a data node, fragment log files were always created sparsely that is, not all bytes were written.
Now it is possible to override this behavior using the new InitFragmentLogFiles configuration parameter. (Bug#40847)
Bugs fixed:
Cluster API: Failed operations on BLOB and TEXT columns were not always reported correctly to the originating SQL node. Such
errors were sometimes reported as being due to timeouts, when the actual problem was a transporter overload due to insufficient
buffer space. (Bug#39867, Bug#39879)
Undo logs and data files were created in 32K increments. Now these files are created in 512K increments, resulting in shorter cre-
ation times. (Bug#40815)
Redo log creation was very slow on some platforms, causing MySQL Cluster to start more slowly than necessary with some com-
binations of hardware and operating system. This was due to all write operations being synchronized to disk while creating a redo
log file. Now this synchronization occurs only after the redo log has been created. (Bug#40734)
Transaction failures took longer to handle than was necessary.
When a data node acting as transaction coordinator (TC) failed, the surviving data nodes did not inform the API node initiating the
transaction of this until the failure had been processed by all protocols. However, the API node needed only to know about failure
handling by the transaction protocol that is, it needed to be informed only about the TC takeover process. Now, API nodes
(including MySQL servers acting as cluster SQL nodes) are informed as soon as the TC takeover is complete, so that it can carry on
operating more quickly. (Bug#40697)
It was theoretically possible for stale data to be read from NDBCLUSTER tables when the transaction isolation level was set to
ReadCommitted. (Bug#40543)
The LockExecuteThreadToCPU and LockMaintThreadsToCPU parameters did not work on Solaris. (Bug#40521)
SET SESSION ndb_optimized_node_selection = 1 failed with an invalid warning message. (Bug#40457)
A restarting data node could fail with an error in the DBDIH kernel block when a local or global checkpoint was started or triggered
just as the node made a request for data from another data node. (Bug#40370)
MySQL Cluster NDB 6.X/7.X
1746
Restoring a MySQL Cluster from a dump made using mysqldump failed due to a spurious error: CAN'T EXECUTE THE GIVEN
COMMAND BECAUSE YOU HAVE ACTIVE LOCKED TABLES OR AN ACTIVE TRANSACTION. (Bug#40346)
O_DIRECT was incorrectly disabled when making MySQL Cluster backups. (Bug#40205)
Heavy DDL usage caused the mysqld processes to hang due to a timeout error (NDB error code 266). (Bug#39885)
Executing EXPLAIN SELECT on an NDBCLUSTER table could cause mysqld to crash. (Bug#39872)
Events logged after setting ALL CLUSTERLOG STATISTICS=15 in the management client did not always include the node ID
of the reporting node. (Bug#39839)
The MySQL Query Cache did not function correctly with NDBCLUSTER tables containing TEXT columns. (Bug#39295)
A segfault in Logger::Log caused ndbd to hang indefinitely. This fix improves on an earlier one for this issue, first made in
MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB 6.3.17. (Bug#39180)
See also Bug#38609.
Memory leaks could occur in handling of strings used for storing cluster metadata and providing output to users. (Bug#38662)
A duplicate key error raised when inserting into an NDBCLUSTER table caused the current transaction to abort, after which any SQL
statement other than a ROLLBACK failed. With this fix, the NDBCLUSTER storage engine now supports rollback of individual state-
ments in such cases, and it is no longer necessary to issue an explicit ROLLBACK and then retry the entire transaction. (Bug#32656)
Error messages for NDBCLUSTER error codes 1224 and 1227 were missing. (Bug#28496)
Partitioning: Dropping or creating an index on a partitioned table managed by the InnoDB Plugin locked the table. (Bug#37453)
Disk Data: Issuing concurrent CREATE TABLESPACE, ALTER TABLESPACE, CREATE LOGFILE GROUP, or ALTER LOG-
FILE GROUP statements on separate SQL nodes caused a resource leak that led to data node crashes when these statements were
used again later. (Bug#40921)
Disk Data: Disk-based variable-length columns were not always handled like their memory-based equivalents, which could poten-
tially lead to a crash of cluster data nodes. (Bug#39645)
Disk Data: O_SYNC was incorrectly disabled on platforms that do not support O_DIRECT. This issue was noted on Solaris but
could have affected other platforms not having O_DIRECT capability. (Bug#34638)
Cluster API: The MGM API reset error codes on management server handles before checking them. This meant that calling an
MGM API function with a null handle caused applications to crash. (Bug#40455)
Cluster API: It was not always possible to access parent objects directly from NdbBlob, NdbOperation, and NdbScanOper-
ation objects. To alleviate this problem, a new getNdbOperation() method has been added to NdbBlob and new getNdb-
Transaction() methods have been added to NdbOperation and NdbScanOperation. In addition, a const variant of NdbOp-
eration::getErrorLine() is now also available. (Bug#40242)
Cluster API: NdbScanOperation::getBlobHandle() failed when used with incorrect column names or numbers.
(Bug#40241)
Cluster API: The MGM API function ndb_mgm_listen_event() ignored bind addresses.
As part of this fix, it is now possible to specify bind addresses in connectstrings. See Section 17.3.4.3, The MySQL Cluster Con-
nectstring, for more information. (Bug#38473)
Cluster API: The NDB API example programs included in MySQL Cluster source distributions failed to compile. (Bug#37491)
See also Bug#40238.
17.15.2.9. Changes in MySQL Cluster NDB 6.3.18 (5.1.28-ndb-6.3.18) (03 October 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
Obtaining MySQL Cluster NDB 6.3. You can download the latest MySQL Cluster NDB 6.3 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
MySQL Cluster NDB 6.X/7.X
1747
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.28 (see Section C.1.10, Changes in MySQL 5.1.28 (28
August 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
It is no longer a requirement for database autodiscovery that an SQL node already be connected to the cluster at the time that a data-
base is created on another SQL node. It is no longer necessary to issue CREATE DATABASE (or CREATE SCHEMA) statements on
an SQL node joining the cluster after a database is created in order for the new SQL node to see the database and any NDCLUSTER
tables that it contains. (Bug#39612)
Bugs fixed:
When a transaction included a multi-row insert to an NDBCLUSTER table that caused a constraint violation, the transaction failed to
roll back. (Bug#395638)
Starting the MySQL Server with the --ndbcluster option plus an invalid command-line option (for example, using mysqld -
-ndbcluster --foobar) caused it to hang while shutting down the binlog thread. (Bug#39635)
Dropping and then re-creating a database on one SQL node caused other SQL nodes to hang. (Bug#39613)
Setting a low value of MaxNoOfLocalScans (< 100) and performing a large number of (certain) scans could cause the Transac-
tion Coordinator to run out of scan fragment records, and then crash. Now when this resource is exhausted, the cluster returns Error
291 (OUT OF SCANFRAG RECORDS IN TC (INCREASE MAXNOOFLOCALSCANS)) instead. (Bug#39549)
Creating a unique index on an NDBCLUSTER table caused a memory leak in the NDB subscription manager (SUMA) which could
lead to mysqld hanging, due to the fact that the resource shortage was not reported back to the NDB kernel correctly. (Bug#39518)
See also Bug#39450.
Embedded libmysqld with NDB did not drop table events. (Bug#39450)
Unique identifiers in tables having no primary key were not cached. This fix has been observed to increase the efficiency of IN-
SERT operations on such tables by as much as 50%. (Bug#39267)
When restarting a data node, an excessively long shutodwn message could cause the node process to crash. (Bug#38580)
After a forced shutdown and initial restart of the cluster, it was possible for SQL nodes to retain .FRM files corresponding to NDB-
CLUSTER tables that had been dropped, and thus to be unaware that these tables no longer existed. In such cases, attempting to re-
create the tables using CREATE TABLE IF NOT EXISTS could fail with a spurious TABLE ... DOESN'T EXIST error.
(Bug#37921)
A statement of the form DELETE FROM table WHERE primary_key=value or UPDATE table WHERE
primary_key=value where there was no row whose primary key column had the stated value appeared to succeed, with the
server reporting that 1 row had been changed.
This issue was only known to affect MySQL Cluster NDB 6.3.11 and later NDB 6.3 versions. (Bug#37153)
Cluster Replication: In some cases, dropping a database on the master could cause table logging to fail on the slave, or, when using
a debug build, could cause the slave mysqld to fail completely. (Bug#39404)
Cluster API: Passing a value greater than 65535 to NdbInterpretedCode::add_val() and NdbInterpreted-
Code::sub_val() caused these methods to have no effect. (Bug#39536)
17.15.2.10. Changes in MySQL Cluster NDB 6.3.17 (5.1.27-ndb-6.3.17) (28 August 2008)
This is a new release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
MySQL Cluster NDB 6.X/7.X
1748
Obtaining MySQL Cluster NDB 6.3. Previously, MySQL Cluster NDB 6.3 releases were source-only releases which required com-
piling and installing using the instructions found in Section 2.10, MySQL Installation Using a Source Distribution, and in Sec-
tion 17.3.1, Building MySQL Cluster from Source Code. Beginning with MySQL Cluster NDB 6.3.17, binaries built from NDB 6.3
sources are also available. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported platforms from
http://dev.mysql.com/downloads/cluster.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.3 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.27 (see Section C.1.11, Changes in MySQL 5.1.27 (Not
released)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Packaging: Support for the InnoDB storage engine was missing from the GPL source releases. An updated GPL source tarball
mysql-5.1.27-ndb-6.3.17-innodb.tar.gz which includes code for building InnoDB can be found on the MySQL FTP
site.
MgmtSrvr::allocNodeId() left a mutex locked following an AMBIGUITY FOR NODE IF %D error. (Bug#39158)
An invalid path specification caused mysql-test-run.pl to fail. (Bug#39026)
During transactional coordinator takeover (directly after node failure), the LQH finding an operation in the LOG_COMMIT state sent
an LQH_TRANS_CONF signal twice, causing the TC to fail. (Bug#38930)
An invalid memory access caused the management server to crash on Solaris Sparc platforms. (Bug#38628)
A segfault in Logger::Log caused ndbd to hang indefinitely. (Bug#38609)
ndb_mgmd failed to start on older Linux distributions (2.4 kernels) that did not support e-polling. (Bug#38592)
ndb_mgmd sometimes performed unnecessary network I/O with the client. This in combination with other factors led to long-
running threads that were attempting to write to clients that no longer existed. (Bug#38563)
ndb_restore failed with a floating point exception due to a division by zero error when trying to restore certain data files.
(Bug#38520)
A failed connection to the management server could cause a resource leak in ndb_mgmd. (Bug#38424)
Failure to parse configuration parameters could cause a memory leak in the NDB log parser. (Bug#38380)
Renaming an NDBCLUSTER table on one SQL node, caused a trigger on this table to be deleted on another SQL node. (Bug#36658)
Attempting to add a UNIQUE INDEX twice to an NDBCLUSTER table, then deleting rows from the table could cause the MySQL
Server to crash. (Bug#35599)
ndb_restore failed when a single table was specified. (Bug#33801)
GCP_COMMIT did not wait for transaction takeover during node failure. This could cause GCP_SAVE_REQ to be executed too
early. This could also cause (very rarely) replication to skip rows. (Bug#30780)
Cluster Replication: During a parallel node restart, the starting nodes could (sometimes) incorrectly synchronize subscriptions
among themselves. Instead, this synchronization now takes place only among nodes that have actually (completely) started.
(Bug#38767)
Cluster API: Support for Multi-Range Read index scans using the old API (using, for example, NdbIndexScanOpera-
tion::setBound() or NdbIndexScanOperation::end_of_bound()) were dropped in MySQL Cluster NDB 6.2. This
functionality is restored in MySQL Cluster NDB 6.3 beginning with 6.3.17, but remains unavailable in MySQL Cluster NDB 6.2.
Both MySQL Cluster NDB 6.2 and 6.3 support Multi-Range Read scans via the NdbRecord API. (Bug#38791)
Cluster API: The NdbScanOperation::readTuples() method could be called multiple times without error. (Bug#38717)
Cluster API: Certain Multi-Range Read scans involving IS NULL and IS NOT NULL comparisons failed with an error in the
MySQL Cluster NDB 6.X/7.X
1749
NDB local query handler. (Bug#38204)
Cluster API: Problems with the public headers prevented NDB applications from being built with warnings turned on. (Bug#38177)
Cluster API: Creating an NdbScanFilter object using an NdbScanOperation object that had not yet had its
readTuples() method called resulted in a crash when later attempting to use the NdbScanFilter. (Bug#37986)
Cluster API: Executing an NdbRecord interpreted delete created with an ANYVALUE option caused the transaction to abort.
(Bug#37672)
17.15.2.11. Changes in MySQL Cluster NDB 6.3.16 (5.1.24-ndb-6.3.16) (27 June 2008)
This is a new source release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.24 (see Section C.1.14, Changes in MySQL 5.1.24 (08
April 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Event buffer lag reports are now written to the cluster log. (Bug#37427)
Added the --no-binlog option for ndb_restore. When used, this option prevents information being written to SQL node
binary logs from the restoration of a cluster backup. (Bug#30452)
Bugs fixed:
Cluster API: Changing the system time on data nodes could cause MGM API applications to hang and the data nodes to crash.
(Bug#35607)
Failure of a data node could sometimes cause mysqld to crash. (Bug#37628)
DELETE ... WHERE unique_index_column=value deleted the wrong row from the table. (Bug#37516)
If subscription was terminated while a node was down, the epoch was not properly acknowledged by that node. (Bug#37442)
libmysqld failed to wait for the cluster binlog thread to terminate before exiting. (Bug#37429)
In rare circumstances, a connection followed by a disconnection could give rise to a stale connection where the connection still
existed but was not seen by the transporter. (Bug#37338)
Queries against NDBCLUSTER tables were cached only if autocommit was in use. (Bug#36692)
Cluster Replication: Data was written to the binlog with --log-slave-updates disabled. (Bug#37472)
Cluster API: When some operations succeeded and some failed following a call to NdbTransaction::execute(Commit,
AO_IgnoreOnError), a race condition could cause spurious occurrences of NDB API Error 4011 (INTERNAL ERROR).
(Bug#37158)
Cluster API: Creating a table on an SQL node, then starting an NDB API application that listened for events from this table, then
dropping the table from an SQL node, prevented data node restarts. (Bug#32949, Bug#37279)
Cluster API: A buffer overrun in NdbBlob::setValue() caused erroneous results on Mac OS X. (Bug#31284)
MySQL Cluster NDB 6.X/7.X
1750
17.15.2.12. Changes in MySQL Cluster NDB 6.3.15 (5.1.24-ndb-6.3.15) (30 May 2008)
This is a new source release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.24 (see Section C.1.14, Changes in MySQL 5.1.24 (08
April 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
In certain rare situations, ndb_size.pl could fail with the error CAN'T USE STRING ("VALUE") AS A HASH REF WHILE
"STRICT REFS" IN USE. (Bug#43022)
Under some circumstances, a failed CREATE TABLE could mean that subsequent CREATE TABLE statements caused node fail-
ures. (Bug#37092)
A fail attempt to create an NDB table could in some cases lead to resource leaks or cluster failures. (Bug#37072)
Attempting to create a native backup of NDB tables having a large number of NULL columns and data could lead to node failures.
(Bug#37039)
Checking of API node connections was not efficiently handled. (Bug#36843)
Attempting to delete a nonexistent row from a table containing a TEXT or BLOB column within a transaction caused the transaction
to fail. (Bug#36756)
See also Bug#36851.
If the combined total of tables and indexes in the cluster was greater than 4096, issuing START BACKUP caused data nodes to fail.
(Bug#36044)
Where column values to be compared in a query were of the VARCHAR or VARBINARY types, NDBCLUSTER passed a value pad-
ded to the full size of the column, which caused unnecessary data to be sent to the data nodes. This also had the effect of wasting
CPU and network bandwidth, and causing condition pushdown to be disabled where it could (and should) otherwise have been ap-
plied. (Bug#35393)
When dropping a table failed for any reason (such as when in single user mode) then the corresponding .ndb file was still removed.
Replication: When flushing tables, there was a slight chance that the flush occurred between the processing of one table map event
and the next. Since the tables were opened one by one, subsequent locking of tables would cause the slave to crash. This problem
was observed when replicating NDBCLUSTER or InnoDB tables, when executing multi-table updates, and when a trigger or a
stored routine performed an (additional) insert on a table so that two tables were effectively being inserted into in the same state-
ment. (Bug#36197)
Cluster API: Ordered index scans were not pruned correctly where a partitioning key was specified with an EQ-bound.
(Bug#36950)
Cluster API: When an insert operation involving BLOB data was attempted on a row which already existed, no duplicate key error
was correctly reported and the transaction is incorrectly aborted. In some cases, the existing row could also become corrupted.
(Bug#36851)
See also Bug#26756.
Cluster API: NdbApi.hpp depended on ndb_global.h, which was not actually installed, causing the compilation of programs
that used NdbApi.hpp to fail. (Bug#35853)
MySQL Cluster NDB 6.X/7.X
1751
17.15.2.13. Changes in MySQL Cluster NDB 6.3.14 (5.1.24-ndb-6.3.14) (11 May 2008)
This is a new source release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.24 (see Section C.1.14, Changes in MySQL 5.1.24 (08
April 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
SET GLOBAL ndb_extra_logging caused mysqld to crash. (Bug#36547)
A race condition caused by a failure in epoll handling could cause data nodes to fail. (Bug#36537)
Under certain rare circumstances, the failure of the new master node while attempting a node takeover would cause takeover errors
to repeat without being resolved. (Bug#36199, Bug#36246, Bug#36247, Bug#36276)
When more than one SQL node connected to the cluster at the same time, creation of the mysql.ndb_schema table failed on one
of them with an explicit TABLE EXISTS error, which was not necessary. (Bug#35943)
mysqld failed to start after running mysql_upgrade. (Bug#35708)
Notification of a cascading master node failures could sometimes not be transmitted correctly (that is, transmission of the
NF_COMPLETEREP signal could fail), leading to transactions hanging and timing out (NDB error 4012), scans hanging, and failure
of the management server process. (Bug#32645)
If an API node disconnected and then reconnected during Start Phase 8, then the connection could be blocked that is, the QMGR
kernel block failed to detect that the API node was in fact connected to the cluster, causing issues with the NDB Subscription Man-
ager (SUMA).
NDB error 1427 (API NODE DIED, WHEN SUB_START_REQ REACHED NODE) was incorrectly classified as a schema error rather
than a temporary error.
Cluster Replication: Performing SELECT ... FROM mysql.ndb_apply_status before the mysqld process had connec-
ted to the cluster failed, and caused this table never to be created. (Bug#36123)
Cluster API: Accesing the debug version of libndbclient via dlopen() resulted in a segmentation fault. (Bug#35927)
Cluster API: Attempting to pass a nonexistent column name to the equal() and setValue() methods of NdbOperation
caused NDB API applications to crash. Now the column name is checked, and an error is returned in the event that the column is not
found. (Bug#33747)
Cluster API: Relocation errors were encountered when trying to compile NDB API applications on a number of platforms, includ-
ing 64-bit Linux. As a result, libmysys, libmystrings, and libdbug have been changed from normal libraries to noinst
libtool helper libraries. They are no longer installed as separate libraries; instead, all necessary symbols from these are added
directly to libndbclient. This means that NDB API programs now need to be linked only using -lndbclient. (Bug#29791)
17.15.2.14. Changes in MySQL Cluster NDB 6.3.13 (5.1.24-ndb-6.3.13) (10 April 2008)
This is a new source release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
MySQL Cluster NDB 6.X/7.X
1752
This release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.24 (see Section C.1.14, Changes in MySQL 5.1.24 (08
April 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
The ndbd and ndb_mgmd man pages have been reclassified from volume 1 to volume 8. (Bug#34642)
Bugs fixed:
Important Change: mysqld_safe now traps Signal 13 (SIGPIPE) so that this signal no longer kills the MySQL server process.
(Bug#33984)
Node or system restarts could fail due an unitialized variable in the DTUP kernel block. This issue was found in MySQL Cluster
NDB 6.3.11. (Bug#35797)
If an error occured while executing a statement involving a BLOB or TEXT column of an NDB table, a memory leak could result.
(Bug#35593)
It was not possible to determine the value used for the --ndb-cluster-connection-pool option in the mysql client. Now
this value is reported as a system status variable. (Bug#35573)
The ndb_waiter utility wrongly calculated timeouts. (Bug#35435)
A SELECT on a table with a nonindexed, large VARCHAR column which resulted in condition pushdown on this column could
cause mysqld to crash. (Bug#35413)
ndb_restore incorrectly handled some datatypes when applying log files from backups. (Bug#35343)
In some circumstances, a stopped data node was handled incorrectly, leading to redo log space being exhausted following an initial
restart of the node, or an initial or partial restart of the cluster (the wrong CGI might be used in such cases). This could happen, for
example, when a node was stopped following the creation of a new table, but before a new LCP could be executed. (Bug#35241)
SELECT ... LIKE ... queries yielded incorrect results when used on NDB tables. As part of this fix, condition pushdown of
such queries has been disabled; re-enabling it is expected to be done as part of a later, permanent fix for this issue. (Bug#35185)
ndb_mgmd reported errors to STDOUT rather than to STDERR. (Bug#35169)
Nested Multi-Range Read scans failed when the second Multi-Range Read released the first read's unprocessed operations, some-
times leading to an SQL node crash. (Bug#35137)
In some situations, a problem with synchronizing checkpoints between nodes could cause a system restart or a node restart to fail
with ERROR 630 DURING RESTORE OF TX. (Bug#34756)
A node failure during an initial node restart followed by another node start could cause the master data node to fail, because it incor-
rectly gave the node permission to start even if the invalidated node's LCP was still running. (Bug#34702)
When a secondary index on a DECIMAL column was used to retrieve data from an NDB table, no results were returned even if the
target table had a matched value in the column that was defined with the secondary index. (Bug#34515)
An UPDATE on an NDB table that set a new value for a unique key column could cause subsequent queries to fail. (Bug#34208)
If a data node in one node group was placed in the not started state (using node_id RESTART -n), it was not possible to stop
a data node in a different node group. (Bug#34201)
Numerous NDBCLUSTER test failures occurred in builds compiled using icc on IA64 platforms. (Bug#31239)
If a START BACKUP command was issued while ndb_restore was running, the backup being restored could be overwritten.
(Bug#26498)
MySQL Cluster NDB 6.X/7.X
1753
REPLACE statements did not work correctly with NDBCLUSTER tables when all columns were not explicitly listed. (Bug#22045)
CREATE TABLE and ALTER TABLE statements using ENGINE=NDB or ENGINE=NDBCLUSTER caused mysqld to fail on Sol-
aris 10 for x86 platforms. (Bug#19911)
Replication: A CHANGE MASTER TO statement with no MASTER_HEARTBEAT_PERIOD option failed to reset the heartbeat
period to its default value. (Bug#34686)
Cluster Replication: In some cases, when updating only one or some columns in a table, the complete row was written to the binary
log instead of only the updated column or columns, even when ndb_log_updated_only was set to 1. (Bug#35208)
Cluster Replication: Enabling the ndb_wait_connected system variable caused the server to wait for a partial connection plus
an additional 3 seconds for a complete connection to the cluster. This could lead to issues with setting up the binary log.
(Bug#34757)
Cluster API: Closing a scan before it was executed caused the application to segfault. (Bug#36375)
Cluster API: Using NDB API applications from older MySQL Cluster versions with libndbclient from newer ones caused the
cluster to fail. (Bug#36124)
Cluster API: Some ordered index scans could return tuples out of order. (Bug#35908)
Cluster API: Scans having no bounds set were handled incorrectly. (Bug#35876)
Cluster API: NdbScanFilter::getNdbOperation(), which was inadvertently removed in MySQL Cluster NDB 6.3.11,
has been restored. (Bug#35854)
Enabling the read_only system variable while autocommit mode was enabled caused SELECT statements for transactional stor-
age engines to fail. (Bug#35732)
Executing a FLUSH PRIVILEGES statement after creating a temporary table in the mysql database with the same name as one of
the MySQL system tables caused the server to crash.
Note
While it is possible to shadow a system table in this way, the temporary table exists only for the current user and connec-
tion, and does not effect any user privileges.
(Bug#33275)
17.15.2.15. Changes in MySQL Cluster NDB 6.3.12 (5.1.23-ndb-6.3.12) (05 April 2008)
MySQL Cluster NDB 6.3.12 was pulled due to issues discovered shortly after its release, and is no longer available. Users of MySQL
Cluster NDB 6.3.10 and earlier MySQL Cluster NDB 6.3 releases should upgrade to MySQL Cluster NDB 6.3.13 or later.
For information about bugfixes and feature enhancements that were originally scheduled to appear for the first time in this release, see
Section 17.15.2.14, Changes in MySQL Cluster NDB 6.3.13 (5.1.24-ndb-6.3.13) (10 April 2008).
17.15.2.16. Changes in MySQL Cluster NDB 6.3.11 (5.1.23-ndb-6.3.11) (28 March 2008)
This release was pulled due to issues discovered shortly after its release, and is no longer available. Users of MySQL Cluster NDB
6.3.10 and earlier MySQL Cluster NDB 6.3 releases should upgrade to MySQL Cluster NDB 6.3.13 or later.
For information about bugfixes and feature enhancements that were originally scheduled to appear for the first time in this release, see
Section 17.15.2.14, Changes in MySQL Cluster NDB 6.3.13 (5.1.24-ndb-6.3.13) (10 April 2008).
17.15.2.17. Changes in MySQL Cluster NDB 6.3.10 (5.1.23-ndb-6.3.10) (17 February 2008)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
MySQL Cluster NDB 6.X/7.X
1754
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23
(29 January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Due to the reduction of the number of local checkpoints from 3 to 2 in MySQL Cluster NDB 6.3.8, a data node using ndbd from
MySQL Cluster NDB 6.3.8 or later started using a file system from an earlier version could incorrectly invalidate local checkpoints
too early during the startup process, causing the node to fail. (Bug#34596)
17.15.2.18. Changes in MySQL Cluster NDB 6.3.9 (5.1.23-ndb-6.3.9) (12 February 2008)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23
(29 January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Beginning with this version, MySQL Cluster NDB 6.3.x releases once again include the InnoDB storage engine. In order to enable
InnoDB, you must configure the build using --with-innodb.
Bugs fixed:
Cluster failures could sometimes occur when performing more than three parallel takeovers during node restarts or system restarts.
This affected MySQL Cluster NDB 6.3.x releases only. (Bug#34445)
Upgrades of a cluster using while a DataMemory setting in excess of 16 GB caused data nodes to fail. (Bug#34378)
Performing many SQL statements on NDB tables while in autocommit mode caused a memory leak in mysqld. (Bug#34275)
In certain rare circumstances, a race condition could occur between an aborted insert and a delete leading a data node crash.
(Bug#34260)
Multi-table updates using ordered indexes during handling of node failures could cause other data nodes to fail. (Bug#34216)
When configured with NDB support, MySQL failed to compile using gcc 4.3 on 64bit FreeBSD systems. (Bug#34169)
The failure of a DDL statement could sometimes lead to node failures when attempting to execute subsequent DDL statements.
(Bug#34160)
Extremely long SELECT statements (where the text of the statement was in excess of 50000 characters) against NDB tables returned
empty results. (Bug#34107)
When configured with NDB support, MySQL failed to compile on 64bit FreeBSD systems. (Bug#34046)
Statements executing multiple inserts performed poorly on NDB tables having AUTO_INCREMENT columns. (Bug#33534)
The ndb_waiter utility polled ndb_mgmd excessively when obtaining the status of cluster data nodes. (Bug#32025)
MySQL Cluster NDB 6.X/7.X
1755
See also Bug#32023.
Transaction atomicity was sometimes not preserved between reads and inserts under high loads. (Bug#31477)
Having tables with a great many columns could cause Cluster backups to fail. (Bug#30172)
Cluster Replication: Disk Data: Statements violating unique keys on Disk Data tables (such as attempting to insert NULL into a
NOT NULL column) could cause data nodes to fail. When the statement was executed from the binlog, this could also result in fail-
ure of the slave cluster. (Bug#34118)
Disk Data: Updating in-memory columns of one or more rows of Disk Data table, followed by deletion of these rows and re-
insertion of them, caused data node failures. (Bug#33619)
Cluster Replication: Setting --replicate-ignore-db=mysql caused the mysql.ndb_apply_status table not to be
replicated, breaking Cluster Replication. (Bug#28170)
17.15.2.19. Changes in MySQL Cluster NDB 6.3.8 (5.1.23-ndb-6.3.8) (29 January 2008)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23
(29 January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster API: Important Change: Because NDB_LE_MemoryUsage.page_size_kb shows memory page sizes in bytes rather
than kilobytes, it has been renamed to page_size_bytes. The name page_size_kb is now deprecated and thus subject to re-
moval in a future release, although it currently remains supported for reasons of backward compatibility. See The
Ndb_logevent_type Type, for more information about NDB_LE_MemoryUsage. (Bug#30271)
ndb_restore now supports basic attribute promotion; that is, data from a column of a given type can be restored to a column us-
ing a larger type. For example, Cluster backup data taken from a SMALLINT column can be restored to a MEDIUMINT, INT, or
BIGINT column.
For more information, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
Now only 2 local checkpoints are stored, rather than 3 as in previous MySQL Cluster versions. This lowers disk space requirements
and reduces the size and number of redo log files needed.
The mysqld option --ndb-batch-size has been added. This allows for controlling the size of batches used for running trans-
actions.
Node recovery can now be done in parallel, rather than sequentially, which can result in much faster recovery times.
Persistence of NDB tables can now be controlled using the session variables ndb_table_temporary and
ndb_table_no_logging. ndb_table_no_logging causes NDB tables not to be checkpointed to disk;
ndb_table_temporary does the same, and in addition, no schema files are created.
OPTIMIZE TABLE can now be interrupted. This can be done, for example, by killing the SQL thread performing the OPTIMIZE
operation.
Bugs fixed:
MySQL Cluster NDB 6.X/7.X
1756
Disk Data: Important Change: It is no longer possible on 32-bit systems to issue statements appearing to create Disk Data log files
or data files greater than 4 GB in size. (Trying to create log files or data files larger than 4 GB on 32-bit systems led to unrecover-
able data node failures; such statements now fail with NDB error 1515.) (Bug#29186)
Replication: The code implementing heartbeats did not check for possible errors in some circumstances; this kept the dump thread
hanging while waiting for heartbeats loop even though the slave was no longer connected. (Bug#33332)
High numbers of insert operations, delete operations, or both could cause NDB error 899 (ROWID ALREADY ALLOCATED) to occur un-
necessarily. (Bug#34033)
A periodic failure to flush the send buffer by the NDB TCP transporter could cause a unnecessary delay of 10 ms between opera-
tions. (Bug#34005)
DROP TABLE did not free all data memory. This bug was observed in MySQL Cluster NDB 6.3.7 only. (Bug#33802)
A race condition could occur (very rarely) when the release of a GCI was followed by a data node failure. (Bug#33793)
Some tuple scans caused the wrong memory page to be accessed, leading to invalid results. This issue could affect both in-memory
and Disk Data tables. (Bug#33739)
A failure to initialize an internal variable led to sporadic crashes during cluster testing. (Bug#33715)
The server failed to reject properly the creation of an NDB table having an unindexed AUTO_INCREMENT column. (Bug#30417)
Issuing an INSERT ... ON DUPLICATE KEY UPDATE concurrently with or following a TRUNCATE statement on an NDB ta-
ble failed with NDB error 4350 TRANSACTION ALREADY ABORTED. (Bug#29851)
The Cluster backup process could not detect when there was no more disk space and instead continued to run until killed manually.
Now the backup fails with an appropriate error when disk space is exhausted. (Bug#28647)
It was possible in config.ini to define cluster nodes having node IDs greater than the maximum allowed value. (Bug#28298)
Under some circumstances, a recovering data node did not use its own data, instead copying data from another node even when this
was not required. This in effect bypassed the optimized node recovery protocol and caused recovery times to be unnecessarily long.
(Bug#26913)
Cluster Replication: Consecutive DDL statements involving tables (CREATE TABLE, ALTER TABLE, and DROP TABLE) could
be executed so quickly that previous DDL statements upon which they depended were not yet written in the binary log.
For example, if DROP TABLE foo was issued immediately following CREATE TABLE foo, the DROP statement could fail be-
cause the CREATE had not yet been recorded. (Bug#34006)
Cluster Replication: ndb_restore -e restored excessively large values to the ndb_apply_status table's epoch column
when restoring to a MySQL Cluster version supporting Micro-GCPs from an older version that did not support these.
A workaround when restoring to MySQL Cluster releases supporting micro-GCPs previous to MySQL Cluster NDB 6.3.8 is to per-
form a 32-bit shift on the epoch column values to reduce them to their proper size. (Bug#33406)
Cluster API: Transactions containing inserts or reads would hang during NdbTransaction::execute() calls made from
NDB API applications built against a MySQL Cluster version that did not support micro-GCPs accessing a later version that suppor-
ted micro-GCPs. This issue was observed while upgrading from MySQL Cluster NDB 6.1.23 to MySQL Cluster NDB 6.2.10 when
the API application built against the earlier version attempted to access a data node already running the later version, even after dis-
abling micro-GCPs by setting TimeBetweenEpochs equal to 0. (Bug#33895)
Cluster API: When reading a BIT(64) value using NdbOperation:getValue(), 12 bytes were written to the buffer rather
than the expected 8 bytes. (Bug#33750)
17.15.2.20. Changes in MySQL Cluster NDB 6.3.7 (5.1.23-ndb-6.3.7) (19 December 2007)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
MySQL Cluster NDB 6.X/7.X
1757
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23
(29 January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Compressed local checkpoints and backups are now supported, resulting in a space savings of 50% or more over uncompressed
LCPs and backups. Cmpression of these can be enabled in the config.ini file using the two new data node configuration para-
meters CompressedLCP and CompressedBackup, respectively.
OPTIMIZE TABLE is now supported for NDBCLUSTER tables, subject to the following limitations:
Only in-memory tables are supported. OPTIMIZE still has no effect on Disk Data tables.
Only variable-length columns are supported. However, you can force columns defined using fixed-length data types to be dy-
namic using the ROW_FORMAT or COLUMN_FORMAT option with a CREATE TABLE or ALTER TABLE statement.
Memory reclaimed from an NDB table using OPTIMIZE is generally available to the cluster, and not confined to the table from
which it was recovered, unlike the case with memory freed using DELETE.
The performance of OPTIMIZE on NDB tables can be regulated by adjusting the value of the ndb_optimization_delay sys-
tem variable.
It is now possible to cause statements occurring within the same transaction to be run as a batch by setting the session variable
transaction_allow_batching to 1 or ON.
Note
To use this feature, autocommit must be disabled.
Bugs fixed:
Partitioning: When partition pruning on an NDB table resulted in an ordered index scan spanning only one partition, any descending
flag for the scan was wrongly discarded, causing ORDER BY DESC to be treated as ORDER BY ASC, MAX() to be handled incor-
rectly, and similar problems. (Bug#33061)
When all data and SQL nodes in the cluster were shut down abnormally (that is, other than by using STOP in the cluster manage-
ment client), ndb_mgm used excessive amounts of CPU. (Bug#33237)
When using micro-GCPs, if a node failed while preparing for a global checkpoint, the master node would use the wrong GCI.
(Bug#32922)
Under some conditions, performing an ALTER TABLE on an NDBCLUSTER table failed with a TABLE IS FULL error, even when
only 25% of DataMemory was in use and the result should have been a table using less memory (for example, changing a
VARCHAR(100) column to VARCHAR(80)). (Bug#32670)
Cluster Replication: Replication: Where a table being replicated had a TEXT or BLOB column, an UPDATE on the master that did
not refer explicitly to this column in the WHERE clause stopped the SQL thread on the slave with ERROR IN WRITE_ROWS EVENT:
ROW APPLICATION FAILED. GOT ERROR 4288 'BLOB HANDLE FOR COLUMN NOT AVAILABLE' FROM NDBCLUSTER.
(Bug#30674)
Cluster Replication: Creating the mysql.ndb_replication table with the wrong number of columns for the primary key
caused mysqld to crash. Now a CREATE TABLE [mysql.]ndb_replication statement that is invalid for this reason fails
with the error BAD SCHEMA FOR MYSQL.NDB_REPLICATION TABLE. MESSAGE: WRONG NUMBER OF PRIMARY KEYS, EXPECTED
NUMBER. (Bug#33159)
17.15.2.21. Changes in MySQL Cluster NDB 6.3.6 (5.1.22-ndb-6.3.6) (08 November 2007)
MySQL Cluster NDB 6.X/7.X
1758
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22
(24 September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Important Note: MySQL Cluster NDB 6.2 and 6.3 source archives are now available in separate commercial and GPL versions.
Due to licensing concerns, previous MySQL Cluster NDB 6.2 and 6.3 source archives were removed from the FTP site.
Unnecessary reads when performing a primary key or unique key update have been reduced, and in some cases, eliminated. (It is al-
most never necessary to read a record prior to an update, the lone exception to this being when a primary key is updated, since this
requires a delete followed by an insert, which must be prepared by reading the record.) Depending on the number of primary key
and unique key lookups that are performed per transaction, this can yield a considerable improvement in performance.
Batched operations are now better supported for DELETE and UPDATE. (UPDATE WHERE... and muliple DELETE.)
Introduced the Ndb_execute_count status variable, which measures the number of round trips made by queries to the NDB ker-
nel.
Bugs fixed:
An insert or update with combined range and equality constraints failed when run against an NDB table with the error GOT UNKNOWN
ERROR FROM NDB. An example of such a statement would be UPDATE t1 SET b = 5 WHERE a IN (7,8) OR a >=
10;. (Bug#31874)
An error with an if statement in sql/ha_ndbcluster.cc could potentially lead to an infinite loop in case of failure when
working with AUTO_INCREMENT columns in NDB tables. (Bug#31810)
The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
ndb_restore displayed incorrect backup file version information. This meant (for example) that, when attempting to restore a
backup made from a MySQL 5.1.22 cluster to a MySQL Cluster NDB 6.3.3 cluster, the restore process failed with the error
RESTORE PROGRAM OLDER THAN BACKUP VERSION. NOT SUPPORTED. USE NEW RESTORE PROGRAM. (Bug#31723)
Following an upgrade, ndb_mgmd would fail with an ArbitrationError. (Bug#31690)
The NDB management client command node_id REPORT MEMORY provided no output when node_id was the node ID of a
management or API node. Now, when this occurs, the management client responds with Node node_id: is not a data
node. (Bug#29485)
Performing DELETE operations after a data node had been shut down could lead to inconsistent data following a restart of the node.
(Bug#26450)
UPDATE IGNORE could sometimes fail on NDB tables due to the use of unitialized data when checking for duplicate keys to be ig-
nored. (Bug#25817)
Cluster Replication: Replication: Slave batching did not work correctly with UPDATE statements. (Bug#31787)
Cluster Replication: Replication: A node failure during replication could lead to buckets out of order; now active subscribers are
checked for, rather than empty buckets. (Bug#31701)
Cluster Replication: Updates performed unnecessary writes to the primary keys of the rows being updated. (Bug#31841)
MySQL Cluster NDB 6.X/7.X
1759
Cluster Replication: When the master mysqld crashed or was restarted, no LOST_EVENTS entry was made in the binlog.
(Bug#31484)
See also Bug#21494.
17.15.2.22. Changes in MySQL Cluster NDB 6.3.5 (5.1.22-ndb-6.3.5) (17 October 2007)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22
(24 September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
A query against a table with TEXT or BLOB columns that would return more than a certain amount of data failed with GOT ERROR
4350 'TRANSACTION ALREADY ABORTED' FROM NDBCLUSTER. (Bug#31482)
This regression was introduced by Bug#29102.
Cluster Replication: In some cases, not all tables were properly initialized before the binary log thread was started. (Bug#31618)
17.15.2.23. Changes in MySQL Cluster NDB 6.3.4 (5.1.22-ndb-6.3.4) (15 October 2007)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22
(24 September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Incompatible Change: The --ndb_optimized_node_selection startup option for mysqld now allows a wider range of
values and corresponding behaviors for SQL nodes when selecting a transaction coordinator.
You should be aware that the default value and behavior as well as the value type used for this option have changed, and that you
may need to update the setting used for this option in your my.cnf file prior to upgrading mysqld. See Section 5.1.4, Server Sys-
tem Variables, for more information.
Cluster Replication: Replication: A replication heartbeat mechanism has been added to facilitate monitoring. This provides an al-
ternative to checking log files, making it possible to detect in real time when a slave has failed.
Configuration of heartbeats is done via a new MASTER_HEARTBEAT_PERIOD = interval clause for the CHANGE MASTER
TO statement (see Section 12.6.2.1, CHANGE MASTER TO Syntax); monitoring can be done by checking the values of the status
variables Slave_heartbeat_period and Slave_received_heartbeats (see Section 5.1.7, Server Status Variables).
MySQL Cluster NDB 6.X/7.X
1760
The addition of replication heartbeats addresses a number of issues:
Relay logs were rotated every slave_net_timeout seconds even if no statements were being replicated.
SHOW SLAVE STATUS displayed an incorrect value for seconds_behind_master following a FLUSH LOGS statement.
Replication master-slave connections used slave_net_timeout for connection timeouts.
(Bug#20435, Bug#29309, Bug#30932)
Replication: On MySQL replication slaves having multiple network interfaces, it is now possible to set which interface to use for
connecting to the master. This can be done by using either the mysqld startup option --master-bind or the
MASTER_BIND='interface' clause in a CHANGE MASTER TO statement. (Bug#25939)
Cluster Replication: A new configuration parameter TimeBetweenEpochsTimeout allows a timeout to be set for time
between epochs. For more information, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes. (Bug#31276)
Cluster Replication: Support for a new conflict resolution function NDB$OLD() has been added for handling simultaneous up-
dates in multi-master and circular replication setups. A new status variable Ndb_conflict_fn_old tracks the number of times
that updates are prevented from being applied due to this type of conflict resolution. See Section 17.9.11, MySQL Cluster Replica-
tion Conflict Resolution, for more information.
Additional checks were implemented to catch unsupported online ALTER TABLE operations. Currently it is not possible to reorder
columns or to change the storage engine used for a table via online ALTER TABLE.
Some redundant checks made during online creation of indexes were removed.
A --bind-address option has been added to a number of MySQL client programs: mysql, mysqldump, mysqladmin,
mysqlbinlog, mysqlcheck, mysqlimport, and mysqlshow. This is for use on a computer having multiple network inter-
faces, and allows you to choose which interface is used to connect to the MySQL server.
Bugs fixed:
It was possible in some cases for a node group to be lost due to missed local checkpoints following a system restart. (Bug#31525)
NDB tables having names containing nonalphanumeric characters (such as $ ) were not discovered correctly. (Bug#31470)
A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart. (Bug#31257)
A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
Transaction timeouts were not handled well in some circumstances, leading to excessive number of transactions being aborted unne-
cessarily. (Bug#30379)
In some cases, the cluster managment server logged entries multiple times following a restart of mgmd. (Bug#29565)
ndb_mgm --help did not display any information about the -a option. (Bug#29509)
An interpreted program of sufficient size and complexity could cause all cluster data nodes to shut down due to buffer overruns.
(Bug#29390)
The cluster log was formatted inconsistently and contained extraneous newline characters. (Bug#25064)
A transaction was not aborted following the failure of statement. (Bug#31320)
Online ALTER operations involving a column whose data type has an implicit default value left behind temporary .frm files, caus-
ing subsequent DROP DATABASE statements to fail. (Bug#31097)
Errors could sometimes occur during an online ADD COLUMN under load. (Bug#31082)
Transactions were committed prematurely when LOCK TABLE and SET autocommit = 0 were used together. (Bug#30996)
The mysqld_safe script contained a syntax error. (Bug#30624)
MySQL Cluster NDB 6.X/7.X
1761
17.15.2.24. Changes in MySQL Cluster NDB 6.3.3 (5.1.22-ndb-6.3.3) (20 September 2007)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22
(24 September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Mapping of NDB error codes to MySQL storage engine error codes has been improved. (Bug#28423)
Cluster Replication: Replication: A server status variable ndb_conflict_fn_max now provides a count of the number of
times that conflict resolution for MySQL Cluster Replication has been applied.
See Section 17.9.11, MySQL Cluster Replication Conflict Resolution, for more information.
Bugs fixed:
Partitioning: EXPLAIN PARTITIONS reported partition usage by queries on NDB tables according to the standard MySQL hash
function than the hash function used in the NDB storage engine. (Bug#29550)
Attempting to restore a backup made on a cluster host using one endian to a machine using the other endian could cause the cluster
to fail. (Bug#29674)
The description of the --print option provided in the output from ndb_restore --help was incorrect. (Bug#27683)
Restoring a backup made on a cluster host using one endian to a machine using the other endian failed for BLOB and DATETIME
columns. (Bug#27543, Bug#30024)
Errors could sometimes occur during an online ADD COLUMN under load. (Bug#31082)
17.15.2.25. Changes in MySQL Cluster NDB 6.3.2 (5.1.22-ndb-6.3.2) (07 September 2007)
This is a new Beta development release, fixing recently discovered bugs in previous MySQL Cluster NDB 6.3 releases.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22
(24 September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Online ADD COLUMN, ADD INDEX, and DROP INDEX operations can now be performed explicitly for NDB tables, as well as on-
line renaming of tables and columns for NDB and MyISAM tables that is, without copying or locking of the affected tables us-
ing ALTER ONLINE TABLE.
MySQL Cluster NDB 6.X/7.X
1762
Indexes can also be created and dropped online using CREATE INDEX and DROP INDEX, respectively, using the ONLINE
keyword.
You can force operations that would otherwise be performed online to be done offline using the OFFLINE keyword.
See Section 12.1.7, ALTER TABLE Syntax, Section 12.1.13, CREATE INDEX Syntax, and Section 12.1.24, DROP INDEX
Syntax, for more information.
It is now possible to control whether fixed-width or variable-width storage is used for a given column of an NDB table by means of
the COLUMN_FORMAT specifier as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
It is also possible to control whether a given column of an NDB table is stored in memory or on disk, using the STORAGE specifier
as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
For permitted values and other information about COLUMN_FORMAT and STORAGE, see Section 12.1.17, CREATE TABLE Syn-
tax.
A new cluster management server startup option --bind-address makes it possible to restrict management client connections to
ndb_mgmd to a single host and port. For more information, see Section 17.6.24.3, Program Options for ndb_mgmd.
Cluster Replication: Multi-way replication failover and recovery for NDB is facilitated with the introduction of the -
-ndb-log-orig option. When mysqld is started with this option, the originating server ID and epoch of each binlog event is re-
corded in the mysql.ndb_binlog_index table, which now contains two additional columns orig_server_id and
orig_epoch for storing this information. In such cases, a single epoch on a slave may be represented by multiple rows in the
slave's ndb_binlog_index table, one for each epoch as it originated from a master.
Cluster Replication: The protocol for handling global checkpoints has been changed. It is now possible to control how often the
GCI number is updated, and how often global checkpoints are written to disk, using the TimeBetweenEpochs configuration
parameter. This improves the reliability and performance of MySQL Cluster Replication.
GCPs handled using the new protocol are sometimes referred to as micro-GCPs.
For more information, see TimeBetweenEpochs .
Bugs fixed:
When an NDB event was left behind but the corresponding table was later recreated and received a new table ID, the event could not
be dropped. (Bug#30877)
An insufficiently descriptive and potentially misleading Error 4006 (CONNECT FAILURE - OUT OF CONNECTION OBJECTS...) was
produced when either of the following two conditions occurred:
1. There were no more transaction records in the transaction coordinator
2. An NDB object in the NDB API was initialized with insufficient parallelism
Separate error messages are now generated for each of these two cases. (Bug#11313)
For micro-GCPs, the assignment of fake CGI events no longer cause buckets to be sent out of order. Now, when assigning a GCI
to a non-GCI event (that is, creating a pseudo-GCI or fake CGI), the GCI that is to arrive is always initiated, even if no known
GCI exists, which could occur in the event of a node failure. (Bug#30884)
17.15.2.26. Changes in MySQL Cluster NDB 6.3.1 (5.1.19-ndb-6.3.1) (04 July 2007)
This is a new Beta development release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.3 release.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.3 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.19 (see Section C.1.19, Changes in MySQL 5.1.19
(25 May 2007)).
MySQL Cluster NDB 6.X/7.X
1763
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Batching of transactions was not handled correctly in some cases. (Bug#29525)
17.15.2.27. Changes in MySQL Cluster NDB 6.3.0 (5.1.19-ndb-6.3.0) (02 July 2007)
This is the first development release for MySQL Cluster NDB 6.3, based on version 6.3 of the NDBCLUSTER storage engine.
Obtaining MySQL Cluster NDB 6.3. This is a source-only release, which you must compile and install using the instructions found in
Section 2.10, MySQL Installation Using a Source Distribution, and in Section 17.3.1, Building MySQL Cluster from Source Code.
You can download the GPL source tarball from the MySQL FTP site at ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/.
This Beta release incorporates all bugfixes and feature changes made in previous MySQL Cluster releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.19 (see Section C.1.19, Changes in MySQL 5.1.19 (25
May 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Reporting functionality has been significantly enhanced in this release:
A new configuration parameter BackupReportFrequency now makes it possible to cause the management client to provide
status reports at regular intervals as well as for such reports to be written to the cluster log (depending on cluster event logging
levels). See Section 17.3.4.6, Defining MySQL Cluster Data Nodes, for more information about this parameter.
A new REPORT command has been added in the cluster management client. REPORT BackupStatus allows you to obtain a
backup status report at any time during a backup. REPORT MemoryUsage reports the current data memory and index memory
used by each data node. For more about the REPORT command, see Section 17.7.2, Commands in the MySQL Cluster Man-
agement Client.
ndb_restore now provides running reports of its progress when restoring a backup. In addition, a complete report status re-
port on the backup is written to the cluster log.
A new configuration parameter ODirect causes NDB to attempt using O_DIRECT writes for LCP, backups, and redo logs, often
lowering CPU usage.
Cluster Replication: This release implements conflict resolution, which makes it possible to determine on a per-table basis whether
or not an update to a given row on the master should be applied on the slave. For more information, see Section 17.9.11, MySQL
Cluster Replication Conflict Resolution.
17.15.3. Changes in MySQL Cluster NDB 6.2
This section contains change history information for MySQL Cluster releases based on version 6.2 of the NDBCLUSTER storage engine.
For an overview of new features added in MySQL Cluster NDB 6.2, see Section 17.13.3, Features Added in MySQL Cluster NDB
6.2.
17.15.3.1. Changes in MySQL Cluster NDB 6.2.18 (5.1.34-ndb-6.2.18) (Not yet released)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in MySQL 5.1.32 (14
February 2009)).
MySQL Cluster NDB 6.X/7.X
1764
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Important Change: Partitioning: User-defined partitioning of an NDBCLUSTER table without any primary key sometimes failed,
and could cause mysqld to crash.
Now, if you wish to create an NDBCLUSTER table with user-defined partitioning, the table must have an explicit primary key, and
all columns listed in the partitioning expression must be part of the primary key. The hidden primary key used by the NDBCLUSTER
storage engine is not sufficient for this purpose. However, if the list of columns is empty (that is, the table is defined using PARTI-
TION BY [LINEAR] KEY()), then no explicit primary key is required.
This change does not effect the partitioning of tables using any storage engine other than NDBCLUSTER. (Bug#40709)
An internal NDB API buffer was not properly initialized. (Bug#44977)
When a data node had written its GCI marker to the first page of a megabyte, and that node was later killed during restart after hav-
ing processed that page (marker) but before completing a LCP, the data node could fail with filesystem errors. (Bug#44952)
See also Bug#42564.
Inspection of the code revealed that several assignment operators (=) were used in place of comparison operators (==) in Dbdih-
Main.cpp. (Bug#44567)
See also Bug#44570.
It was possible for NDB API applications to insert corrupt data into the database, which could subquently lead to data node crashes.
Now, stricter checking is enforced on input data for inserts and updates. (Bug#44132)
TransactionDeadlockDetectionTimeout values less than 100 were treated as 100. This could cause scans to time out un-
expectedly. (Bug#44099)
The file ndberror.c contained a C++-style comment, which caused builds to fail with some C compilers. (Bug#44036)
A race condition could occur when a data node failed to restart just before being included in the next global checkpoint. This could
cause other data nodes to fail. (Bug#43888)
When trying to use a data node with an older version of the management server, the data node crashed on startup. (Bug#43699)
Using indexes containing variable-sized columns could lead to internal errors when the indexes were being built. (Bug#43226)
In some cases, data node restarts during a system restart could fail due to insufficient redo log space. (Bug#43156)
Some queries using combinations of logical and comparison operators on an indexed column in the WHERE clause could fail with
the error GOT ERROR 4541 'INDEXBOUND HAS NO BOUND INFORMATION' FROM NDBCLUSTER. (Bug#42857)
ndb_restore --print_data did not handle DECIMAL columns correctly. (Bug#37171)
The output of ndbd --help did not provide clear information about the program's --initial and --initial-start op-
tions. (Bug#28905)
It was theoretically possible for the value of a nonexistent column to be read as NULL, rather than causing an error. (Bug#27843)
When aborting an operation involving both an insert and a delete, the insert and delete were aborted separately. This was because
the transaction coordinator did not know that the operations affected on same row, and, in the case of a committed-read (tuple or in-
dex) scan, the abort of the insert was performed first, then the row was examined after the insert was aborted but before the delete
was aborted. In some cases, this would leave the row in a inconsistent state. This could occur when a local checkpoint was per-
formed during a backup. This issue did not affect primary ley operations or scans that used locks (these are serialized).
After this fix, for ordered indexes, all operations that follow the operation to be aborted are now also aborted.
Disk Data: Partitioning: An NDBCLUSTER table created with a very large value for the MAX_ROWS option could if this table
was dropped and a new table with fewer partitions, but having the same table ID, was created cause ndbd to crash when per-
MySQL Cluster NDB 6.X/7.X
1765
forming a system restart. This was because the server attempted to examine each partition whether or not it actually existed.
(Bug#45154)
Disk Data: During a checkpoint, restore points are created for both the on-disk and in-memory parts of a Disk Data table. Under
certain rare conditions, the in-memory restore point could include or exclude a row that should have been in the snapshot. This
would later later lead to a crash during or following recovery. (Bug#41915)
Disk Data: When a log file group had an undo log file whose size was too small, restarting data nodes failed with READ UNDERFLOW
errors.
As a result of this fix, the minimum allowed INTIAL_SIZE for an undo log file is now 1M (1 megabyte). (Bug#29574)
Disk Data: This fix supercedes and improves on an earlier fix made for this bug in MySQL 5.1.18. (Bug#24521)
Cluster Replication: A failure when setting up replication events could lead to subsequent data node failures. (Bug#44915)
Cluster API: If the largest offset of a RecordSpecification used for an NdbRecord object was for the NULL bits (and thus
not a column), this offset was not taken into account when calculating the size used for the RecordSpecification. This meant
that the space for the NULL bits could be overwritten by key or other information. (Bug#43891)
Cluster API: The default NdbRecord structures created by NdbDictionary could have overlapping null bits and data fields.
(Bug#43590)
Cluster API: When performing insert or write operations, NdbRecord allows key columns to be specified in both the key record
and in the attribute record. Only one key column value for each key column should be sent to the NDB kernel, but this was not guar-
anteed. This is now ensured as follows: For insert and write operations, key column values are taken from the key record; for scan
takeover update operations, key column values are taken from the attribute record. (Bug#42238)
Cluster API: Ordered index scans using NdbRecord formerly expressed a BoundEQ range as separate lower and upper bounds,
resulting in 2 copies of the column values being sent to the NDB kernel.
Now, when a range is specified by NdbScanOperation::setBound(), the passed pointers, key lengths, and inclusive bits are
compared, and only one copy of the equal key columns is sent to the kernel. This makes such operations more efficient, as half the
amount of KeyInfo is now sent for a BoundEQ range as before. (Bug#38793)
17.15.3.2. Changes in MySQL Cluster NDB 6.2.19 (5.1.35-ndb-6.2.19) (Not yet released)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.35 (see Section C.1.2, Changes in MySQL 5.1.35 (13
May 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
17.15.3.3. Changes in MySQL Cluster NDB 6.2.17 (5.1.32-ndb-6.2.17) (Not yet released)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.32 (see Section C.1.5, Changes in MySQL 5.1.32 (14
February 2009)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Important Change: Formerly, when the management server failed to create a transporter for a data node connection,
net_write_timeout seconds elapsed before the data node was actually allowed to disconnect. Now in such cases the discon-
MySQL Cluster NDB 6.X/7.X
1766
nection occurs immediately. (Bug#41965)
See also Bug#41713.
Important Change: Replication: RESET MASTER and RESET SLAVE now reset the values shown for Last_IO_Error,
Last_IO_Errno, Last_SQL_Error, and Last_SQL_Errno in the output of SHOW SLAVE STATUS. (Bug#34654)
Cluster Replication: Important Note: This release of MySQL Cluster derives in part from MySQL 5.1.29, where the default value
for the --binlog-format option changed to STATEMENT. That change does not affect this or future MySQL Cluster NDB 6.x
releases, where the default value for this option remains MIXED, since MySQL Cluster Replication does not work with the state-
ment-based format. (Bug#40586)
Disk Data: It is now possible to specify default locations for Disk Data data files and undo log files, either together or separately,
using the data node configuration parameters FileSystemPathDD, FileSystemPathDataFiles, and FileSystem-
PathUndoFiles. For information about these configuration parameters, see Disk Data filesystem parameters.
It is also now possible to specify a log file group, tablespace, or both, that is created when the cluster is started, using the Ini-
tialLogFileGroup and InitialTablespace data node configuration parameters. For information about these configura-
tion parameters, see Disk Data object creation parameters.
Bugs fixed:
Packaging: Packages for MySQL Cluster were missing the libndbclient.so and libndbclient.a files. (Bug#42278)
Partitioning: Executing ALTER TABLE ... REORGANIZE PARTITION on an NDBCLUSTER table having only one partition
caused mysqld to crash. (Bug#41945)
See also Bug#40389.
Cluster API: Failed operations on BLOB and TEXT columns were not always reported correctly to the originating SQL node. Such
errors were sometimes reported as being due to timeouts, when the actual problem was a transporter overload due to insufficient
buffer space. (Bug#39867, Bug#39879)
Backup IDs greater than 2
31
were not handled correctly, causing negative values to be used in backup directory names and printouts.
(Bug#43042)
When using ndbmtd, NDB kernel threads could hang while trying to start the data nodes with LockPagesInMainMemory set
to 1. (Bug#43021)
When using multiple management servers and starting several API nodes (possibly including one or more SQL nodes) whose con-
nectstrings listed the management servers in different order, it was possible for 2 API nodes to be assigned the same node ID. When
this happened it was possible for an API node not to get fully connected, consequently producing a number of errors whose cause
was not easily recognizable. (Bug#42973)
ndb_error_reporter worked correctly only with GNU tar. (With other versions of tar, it produced empty archives.)
(Bug#42753)
Triggers on NDBCLUSTER tables caused such tables to become locked. (Bug#42751)
See also Bug#16229, Bug#18135.
When performing more than 32 index or tuple scans on a single fragment, the scans could be left hanging. This caused unnecessary
timeouts, and in addition could possibly lead to a hang of an LCP. (Bug#42559)
A data node failure that occurred between calls to NdbIndexScanOperation::readTuples(SF_OrderBy) and Ndb-
Transaction::Execute() was not correctly handled; a subsequent call to nextResult() caused a null pointer to be defer-
enced, leading to a segfault in mysqld. (Bug#42545)
Issuing SHOW GLOBAL STATUS LIKE 'NDB%' before mysqld had connected to the cluster caused a segmentation fault.
(Bug#42458)
Data node failures that occurred before all data nodes had connected to the cluster were not handled correctly, leading to additional
data node failures. (Bug#42422)
MySQL Cluster NDB 6.X/7.X
1767
When a cluster backup failed with Error 1304 (Node node_id1: Backup request from node_id2 failed to start), no clear reason
for the failure was provided.
As part of this fix, MySQL Cluster now retries backups in the event of sequence errors. (Bug#42354)
See also Bug#22698.
Issuing SHOW ENGINE NDBCLUSTER STATUS on an SQL node before the management server had connected to the cluster
caused mysqld to crash. (Bug#42264)
A maximum of 11 TUP scans were allowed in parallel. (Bug#42084)
Trying to execute an ALTER ONLINE TABLE ... ADD COLUMN statement while inserting rows into the table caused mysqld
to crash. (Bug#41905)
If the master node failed during a global checkpoint, it was possible in some circumstances for the new master to use an incorrect
value for the global checkpoint index. This could occur only when the cluster used more than one node group. (Bug#41469)
API nodes disconnected too agressively from cluster when data nodes were being restarted. This could sometimes lead to the API
node being unable to access the cluster at all during a rolling restart. (Bug#41462)
An abort path in the DBLQH kernel block failed to release a commit acknowledgement marker. This meant that, during node failure
handling, the local query handler could be added multiple times to the marker record which could lead to additional node failures
due an array overflow. (Bug#41296)
During node failure handling (of a data node other than the master), there was a chance that the master was waiting for a
GCP_NODEFINISHED signal from the failed node after having received it from all other data nodes. If this occurred while the
failed node had a transaction that was still being committed in the current epoch, the master node could crash in the DBTC kernel
block when discovering that a transaction actually belonged to an epoch which was already completed. (Bug#41295)
If a transaction was aborted during the handling of a data node failure, this could lead to the later handling of an API node failure
not being completed. (Bug#41214)
Given a MySQL Cluster containing no data (that is, whose data nodes had all been started using --initial, and into which no
data had yet been imported) and having an empty backup directory, executing START BACKUP with a user-specified backup ID
caused the data nodes to crash. (Bug#41031)
Issuing EXIT in the management client sometimes caused the client to hang. (Bug#40922)
Redo log creation was very slow on some platforms, causing MySQL Cluster to start more slowly than necessary with some com-
binations of hardware and operating system. This was due to all write operations being synchronized to disk while creating a redo
log file. Now this synchronization occurs only after the redo log has been created. (Bug#40734)
Transaction failures took longer to handle than was necessary.
When a data node acting as transaction coordinator (TC) failed, the surviving data nodes did not inform the API node initiating the
transaction of this until the failure had been processed by all protocols. However, the API node needed only to know about failure
handling by the transaction protocol that is, it needed to be informed only about the TC takeover process. Now, API nodes
(including MySQL servers acting as cluster SQL nodes) are informed as soon as the TC takeover is complete, so that it can carry on
operating more quickly. (Bug#40697)
It was theoretically possible for stale data to be read from NDBCLUSTER tables when the transaction isolation level was set to
ReadCommitted. (Bug#40543)
In some cases, NDB did not check correctly whether tables had changed before trying to use the query cache. This could result in a
crash of the debug MySQL server. (Bug#40464)
Restoring a MySQL Cluster from a dump made using mysqldump failed due to a spurious error: CAN'T EXECUTE THE GIVEN
COMMAND BECAUSE YOU HAVE ACTIVE LOCKED TABLES OR AN ACTIVE TRANSACTION. (Bug#40346)
O_DIRECT was incorrectly disabled when making MySQL Cluster backups. (Bug#40205)
Events logged after setting ALL CLUSTERLOG STATISTICS=15 in the management client did not always include the node ID
of the reporting node. (Bug#39839)
Start phase reporting was inconsistent between the management client and the cluster log. (Bug#39667)
MySQL Cluster NDB 6.X/7.X
1768
The MySQL Query Cache did not function correctly with NDBCLUSTER tables containing TEXT columns. (Bug#39295)
A segfault in Logger::Log caused ndbd to hang indefinitely. This fix improves on an earlier one for this issue, first made in
MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB 6.3.17. (Bug#39180)
See also Bug#38609.
Memory leaks could occur in handling of strings used for storing cluster metadata and providing output to users. (Bug#38662)
In the event that a MySQL Cluster backup failed due to file permissions issues, conflicting reports were issued in the management
client. (Bug#34526)
A duplicate key error raised when inserting into an NDBCLUSTER table caused the current transaction to abort, after which any SQL
statement other than a ROLLBACK failed. With this fix, the NDBCLUSTER storage engine now supports rollback of individual state-
ments in such cases, and it is no longer necessary to issue an explicit ROLLBACK and then retry the entire transaction. (Bug#32656)
Error messages for NDBCLUSTER error codes 1224 and 1227 were missing. (Bug#28496)
Partitioning: A query on a user-partitioned table caused MySQL to crash, where the query had the following characteristics:
The query's WHERE clause referenced an indexed column that was also in the partitioning key.
The query's WHERE clause included a value found in the partition.
The query's WHERE clause used the < or <> operators to compare with the indexed column's value with a constant.
The query used an ORDER BY clause, and the same indexed column was used in the ORDER BY clause.
The ORDER BY clause used an explcit or implicit ASC sort priority.
Two examples of such a query are given here, where a represents an indexed column used in the table's partitioning key:
1.
SELECT * FROM table WHERE a < constant ORDER BY a;
2.
SELECT * FROM table WHERE a <> constant ORDER BY a;
(Bug#40954)
This regression was introduced by Bug#30573, Bug#33257, Bug#33555.
Partitioning: Dropping or creating an index on a partitioned table managed by the InnoDB Plugin locked the table. (Bug#37453)
Disk Data: It was not possible to add an in-memory column online to a table that used a table-level or column-level STORAGE
DISK option. The same issue prevented ALTER ONLINE TABLE ... REORGANIZE PARTITION from working on Disk
Data tables. (Bug#42549)
Disk Data: Issuing concurrent CREATE TABLESPACE, ALTER TABLESPACE, CREATE LOGFILE GROUP, or ALTER LOG-
FILE GROUP statements on separate SQL nodes caused a resource leak that led to data node crashes when these statements were
used again later. (Bug#40921)
Disk Data: Disk-based variable-length columns were not always handled like their memory-based equivalents, which could poten-
tially lead to a crash of cluster data nodes. (Bug#39645)
Disk Data: Creating a Disk Data tablespace with a very large extent size caused the data nodes to fail. The issue was observed when
using extent sizes of 100 MB and larger. (Bug#39096)
Disk Data: Creation of a tablespace data file whose size was greater than 4 GB failed silently on 32-bit platforms. (Bug#37116)
See also Bug#29186.
Disk Data: O_SYNC was incorrectly disabled on platforms that do not support O_DIRECT. This issue was noted on Solaris but
could have affected other platforms not having O_DIRECT capability. (Bug#34638)
Disk Data: Trying to execute a CREATE LOGFILE GROUP statement using a value greater than 150M for
MySQL Cluster NDB 6.X/7.X
1769
UNDO_BUFFER_SIZE caused data nodes to crash.
As a result of this fix, the upper limit for UNDO_BUFFER_SIZE is now 600M; attempting to set a higher value now fails gracefully
with an error. (Bug#34102)
Disk Data: When attempting to create a tablespace that already existed, the error message returned was TABLE OR INDEX WITH
GIVEN NAME ALREADY EXISTS. (Bug#32662)
Disk Data: Using a path or filename longer than 128 characters for Disk Data undo log files and tablespace data files caused a num-
ber of issues, including failures of CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, and AL-
TER TABLESPACE statements, as well as crashes of management nodes and data nodes.
With this fix, the maximum length for path and file names used for Disk Data undo log files and tablespace data files is now the
same as the maximum for the operating system. (Bug#31769, Bug#31770, Bug#31772)
Disk Data: Starting a cluster under load such that Disk Data tables used most of the undo buffer could cause data node failures.
The fix for this bug also corrected an issue in the LGMAN kernel block where the amount of free space left in the undo buffer was
miscalculated, causing buffer overruns. This could cause records in the buffer to be overwritten, leading to problems when restarting
data nodes. (Bug#28077)
Disk Data: Attempting to perform a system restart of the cluster where there existed a logfile group without and undo log files
caused the data nodes to crash.
Note
While issuing a CREATE LOGFILE GROUP statement without an ADD UNDOFILE option fails with an error in the
MySQL server, this situation could arise if an SQL node failed during the execution of a valid CREATE LOGFILE
GROUP statement; it is also possible to create a logfile group without any undo log files using the NDB API.
(Bug#17614)
Cluster Replication: Sometimes, when using the --ndb_log_orig option, the orig_epoch and orig_server_id
columns of the ndb_binlog_index table on the slave contained the ID and epoch of the local server instead. (Bug#41601)
Cluster API: Some error messages from ndb_mgmd contained newline (\n) characters. This could break the MGM API protocol,
which uses the newline as a line separator. (Bug#43104)
Cluster API: When using an ordered index scan without putting all key columns in the read mask, this invalid use of the NDB API
went undetected, which resulted in the use of uninitialized memory. (Bug#42591)
Cluster API: The MGM API reset error codes on management server handles before checking them. This meant that calling an
MGM API function with a null handle caused applications to crash. (Bug#40455)
Cluster API: It was not always possible to access parent objects directly from NdbBlob, NdbOperation, and NdbScanOper-
ation objects. To alleviate this problem, a new getNdbOperation() method has been added to NdbBlob and new getNdb-
Transaction() methods have been added to NdbOperation and NdbScanOperation. In addition, a const variant of NdbOp-
eration::getErrorLine() is now also available. (Bug#40242)
Cluster API: NdbScanOperation::getBlobHandle() failed when used with incorrect column names or numbers.
(Bug#40241)
Cluster API: The NDB API example programs included in MySQL Cluster source distributions failed to compile. (Bug#37491)
See also Bug#40238.
Cluster API: mgmapi.h contained constructs which only worked in C++, but not in C. (Bug#27004)
17.15.3.4. Changes in MySQL Cluster NDB 6.2.16 (5.1.28-ndb-6.2.16) (08 October 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from ftp://ftp.mysql.com/pub/mysql/download/cluster_telco/mysql-5.1.28-ndb-6.2.16.
MySQL Cluster NDB 6.X/7.X
1770
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.28 (see Section C.1.10, Changes in MySQL 5.1.28 (28
August 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
It is no longer a requirement for database autodiscovery that an SQL node already be connected to the cluster at the time that a data-
base is created on another SQL node. It is no longer necessary to issue CREATE DATABASE (or CREATE SCHEMA) statements on
an SQL node joining the cluster after a database is created in order for the new SQL node to see the database and any NDCLUSTER
tables that it contains. (Bug#39612)
Bugs fixed:
Heavy DDL usage caused the mysqld processes to hang due to a timeout error (NDB error code 266). (Bug#39885)
Executing EXPLAIN SELECT on an NDBCLUSTER table could cause mysqld to crash. (Bug#39872)
Starting the MySQL Server with the --ndbcluster option plus an invalid command-line option (for example, using mysqld -
-ndbcluster --foobar) caused it to hang while shutting down the binlog thread. (Bug#39635)
Dropping and then re-creating a database on one SQL node caused other SQL nodes to hang. (Bug#39613)
Setting a low value of MaxNoOfLocalScans (< 100) and performing a large number of (certain) scans could cause the Transac-
tion Coordinator to run out of scan fragment records, and then crash. Now when this resource is exhausted, the cluster returns Error
291 (OUT OF SCANFRAG RECORDS IN TC (INCREASE MAXNOOFLOCALSCANS)) instead. (Bug#39549)
Creating a unique index on an NDBCLUSTER table caused a memory leak in the NDB subscription manager (SUMA) which could
lead to mysqld hanging, due to the fact that the resource shortage was not reported back to the NDB kernel correctly. (Bug#39518)
See also Bug#39450.
Unique identifiers in tables having no primary key were not cached. This fix has been observed to increase the efficiency of IN-
SERT operations on such tables by as much as 50%. (Bug#39267)
MgmtSrvr::allocNodeId() left a mutex locked following an AMBIGUITY FOR NODE IF %D error. (Bug#39158)
An invalid path specification caused mysql-test-run.pl to fail. (Bug#39026)
During transactional coordinator takeover (directly after node failure), the LQH finding an operation in the LOG_COMMIT state sent
an LQH_TRANS_CONF signal twice, causing the TC to fail. (Bug#38930)
An invalid memory access caused the management server to crash on Solaris Sparc platforms. (Bug#38628)
A segfault in Logger::Log caused ndbd to hang indefinitely. (Bug#38609)
ndb_mgmd failed to start on older Linux distributions (2.4 kernels) that did not support e-polling. (Bug#38592)
When restarting a data node, an excessively long shutodwn message could cause the node process to crash. (Bug#38580)
ndb_mgmd sometimes performed unnecessary network I/O with the client. This in combination with other factors led to long-
running threads that were attempting to write to clients that no longer existed. (Bug#38563)
ndb_restore failed with a floating point exception due to a division by zero error when trying to restore certain data files.
(Bug#38520)
A failed connection to the management server could cause a resource leak in ndb_mgmd. (Bug#38424)
Failure to parse configuration parameters could cause a memory leak in the NDB log parser. (Bug#38380)
MySQL Cluster NDB 6.X/7.X
1771
After a forced shutdown and initial restart of the cluster, it was possible for SQL nodes to retain .FRM files corresponding to NDB-
CLUSTER tables that had been dropped, and thus to be unaware that these tables no longer existed. In such cases, attempting to re-
create the tables using CREATE TABLE IF NOT EXISTS could fail with a spurious TABLE ... DOESN'T EXIST error.
(Bug#37921)
Renaming an NDBCLUSTER table on one SQL node, caused a trigger on this table to be deleted on another SQL node. (Bug#36658)
Attempting to add a UNIQUE INDEX twice to an NDBCLUSTER table, then deleting rows from the table could cause the MySQL
Server to crash. (Bug#35599)
ndb_restore failed when a single table was specified. (Bug#33801)
GCP_COMMIT did not wait for transaction takeover during node failure. This could cause GCP_SAVE_REQ to be executed too
early. This could also cause (very rarely) replication to skip rows. (Bug#30780)
Cluster Replication: In some cases, dropping a database on the master could cause table logging to fail on the slave, or, when using
a debug build, could cause the slave mysqld to fail completely. (Bug#39404)
Cluster Replication: During a parallel node restart, the starting nodes could (sometimes) incorrectly synchronize subscriptions
among themselves. Instead, this synchronization now takes place only among nodes that have actually (completely) started.
(Bug#38767)
Cluster Replication: Data was written to the binlog with --log-slave-updates disabled. (Bug#37472)
Cluster API: Passing a value greater than 65535 to NdbInterpretedCode::add_val() and NdbInterpreted-
Code::sub_val() caused these methods to have no effect. (Bug#39536)
Cluster API: The NdbScanOperation::readTuples() method could be called multiple times without error. (Bug#38717)
Cluster API: Certain Multi-Range Read scans involving IS NULL and IS NOT NULL comparisons failed with an error in the
NDB local query handler. (Bug#38204)
Cluster API: Problems with the public headers prevented NDB applications from being built with warnings turned on. (Bug#38177)
Cluster API: Creating an NdbScanFilter object using an NdbScanOperation object that had not yet had its
readTuples() method called resulted in a crash when later attempting to use the NdbScanFilter. (Bug#37986)
Cluster API: Executing an NdbRecord interpreted delete created with an ANYVALUE option caused the transaction to abort.
(Bug#37672)
Cluster API: Accesing the debug version of libndbclient via dlopen() resulted in a segmentation fault. (Bug#35927)
17.15.3.5. Changes in MySQL Cluster NDB 6.2.15 (5.1.23-ndb-6.2.15) (22 May 2008)
This is re-release of MySQL Cluster NDB 6.2.14 providing binaries for supported platforms. For more information, see Sec-
tion 17.15.3.6, Changes in MySQL Cluster NDB 6.2.14 (5.1.23-ndb-6.2.14) (05 March 2008).
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
17.15.3.6. Changes in MySQL Cluster NDB 6.2.14 (5.1.23-ndb-6.2.14) (05 March 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23 (29
January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
MySQL Cluster NDB 6.X/7.X
1772
Functionality added or changed:
Added the MaxBufferedEpochs data node configuration parameter, which controls the maximum number of unprocessed
epochs by which a subscribing node can lag. Subscribers which exceed this number are disconnected and forced to reconnect.
See Section 17.3.4.6, Defining MySQL Cluster Data Nodes, for more information.
Replication: Introduced the slave_exec_mode system variable to control whether idempotent or strict mode is used for replica-
tion conflict resolution. Idempotent mode suppresses duplicate-key, no-key-found, and some other errors, and is needed for circular
replication, multi-master replication, and some other complex replication setups when using MySQL Cluster. Strict mode is the de-
fault. (Bug#31609)
Cluster Replication: RESET MASTER now uses TRUNCATE rather than DELETE to clear the mysql.ndb_binlog_index ta-
ble. This improves the performance of the statement and is less likely to leave the table in a fragmented state. (Bug#34356)
Formerly, when the MySQL server crashed, the generated stack dump was numeric and required external tools to properly resolve
the names of functions. This is not very helpful to users having a limited knowledge of debugging techniques. In addition, the gener-
ated stack trace contained only the names of functions and was formatted differently for each platform due to different stack layouts.
Now it is possible to take advantage of newer versions of the GNU C Library provide a set of functions to obtain and manipulate
stack traces from within the program. On systems that use the ELF binary format, the stack trace contains important information
such as the shared object where the call was generated, an offset into the function, and the actual return address. Having the function
name also makes possible the name demangling of C++ functions.
The library generates meaningful stack traces on the following platforms: i386, x86_64, PowerPC, IA64, Alpha, and S390. On other
platforms, a numeric stack trace is still produced, and the use of the resolve_stack_dump utility is still required. (Bug#31891)
mysqltest now has mkdir and rmdir commands for creating and removing directories. (Bug#31004)
Added the Uptime_since_flush_status status variable, which indicates the number of seconds since the most recent
FLUSH STATUS statement. (Community contribution by Jeremy Cole) (Bug#24822)
Bugs fixed:
Incompatible Change: The UPDATE statement allowed NULL to be assigned to NOT NULL columns (the implicit default value for
the column data type was assigned). This was changed so that on error occurs.
This change was reverted, because the original report was determined not to be a bug: Assigning NULL to a NOT NULL column in
an UPDATE statement should produce an error only in strict SQL mode and set the column to the implicit default with a warning
otherwise, which was the original behavior. See Section 10.1.4, Data Type Default Values, and Bug#39265. (Bug#33699)
Important Change: Replication: When the master crashed during an update on a transactional table while in autocommit mode,
the slave failed. This fix causes every transaction (including autocommit transactions) to be recorded in the binlog as starting
with a BEGIN and ending with a COMMIT or ROLLBACK. (Bug#26395)
Replication: Important Note: Network timeouts between the master and the slave could result in corruption of the relay log. This
fix rectifies a long-standing replication issue when using unreliable networks, including replication over wide area networks such as
the Internet. If you experience reliability issues and see many YOU HAVE AN ERROR IN YOUR SQL SYNTAX errors on replication
slaves, we strongly recommend that you upgrade to a MySQL version which includes this fix. (Bug#26489)
Replication: When the Windows version of mysqlbinlog read 4.1 binlogs containing LOAD DATA INFILE statements, it out-
put backslashes as path separators, causing problems for client programs expecting forward slashes. In such cases, it now converts
\\ to / in directory paths. (Bug#34355)
Replication: SHOW SLAVE STATUS failed when slave I/O was about to terminate. (Bug#34305)
Replication: mysqlbinlog from a 5.1 or later MySQL distribution could not read binary logs generated by a 4.1 server when the
logs contained LOAD DATA INFILE statements. (Bug#34141)
This regression was introduced by Bug#32407.
Replication: A CREATE USER, DROP USER, or RENAME USER statement that fails on the master, or that is a duplicate of any of
these statements, is no longer written to the binlog; previously, either of these occurrences could cause the slave to fail.
MySQL Cluster NDB 6.X/7.X
1773
(Bug#33862)
See also Bug#29749.
Replication: mysqlbinlog failed to release all of its memory after terminating abnormally. (Bug#33247)
Replication: The error message generated due to lack of a default value for an extra column was not sufficiently informative.
(Bug#32971)
Replication: When a user variable was used inside an INSERT statement, the corresponding binlog event was not written to the
binlog correctly. (Bug#32580)
Replication: When using row-based replication, deletes from a table with a foreign key constraint failed on the slave. (Bug#32468)
Replication: SQL statements containing comments using -- syntax were not replayable by mysqlbinlog, even though such
statements replicated correctly. (Bug#32205)
Replication: When using row-based replication from a master running MySQL 5.1.21 or earlier to a slave running 5.1.22 or later,
updates of integer columns failed on the slave with ERROR IN UNKNOWN EVENT: ROW APPLICATION FAILED. (Bug#31583)
This regression was introduced by Bug#21842.
Replication: Replicating write, update, or delete events from a master running MySQL 5.1.15 or earlier to a slave running 5.1.16 or
later caused the slave to crash. (Bug#31581)
Replication: When using row-based replication, the slave stopped when attempting to delete nonexistent rows from a slave table
without a primary key. In addition, no error was reported when this occurred. (Bug#31552)
Replication: Issuing a DROP VIEW statement caused replication to fail if the view did not actually exist. (Bug#30998)
Replication: Replication of LOAD DATA INFILE could fail when read_buffer_size was larger than
max_allowed_packet. (Bug#30435)
Replication: Replication crashed with the NDB storage engine when mysqld was started with -
-character-set-server=ucs2. (Bug#29562)
Replication: Setting server_id did not update its value for the current session. (Bug#28908)
Replication: Some older servers wrote events to the binary log using different numbering from what is currently used, even though
the file format number in the file is the same. Slaves running MySQL 5.1.18 and later could not read these binary logs properly.
Binary logs from these older versions now are recognized and event numbers are mapped to the current numbering so that they can
be interpreted properly. (Bug#27779, Bug#32434)
This regression was introduced by Bug#22583.
Cluster Replication: Enabling the ndb_wait_connected system variable caused the server to wait for a partial connection plus
an additional 3 seconds for a complete connection to the cluster. This could lead to issues with setting up the binary log.
(Bug#34757)
Cluster API: Closing a scan before it was executed caused the application to segfault. (Bug#36375)
Cluster API: Using NDB API applications from older MySQL Cluster versions with libndbclient from newer ones caused the
cluster to fail. (Bug#36124)
Cluster API: Scans having no bounds set were handled incorrectly. (Bug#35876)
Use of stored functions in the WHERE clause for SHOW OPEN TABLES caused a server crash. (Bug#34166)
Large unsigned integers were improperly handled for prepared statements, resulting in truncation or conversion to negative num-
bers. (Bug#33798)
The server crashed when executing a query that had a subquery containing an equality X=Y where Y referred to a named select list
expression from the parent select. The server crashed when trying to use the X=Y equality for ref-based access. (Bug#33794)
ORDER BY ... DESC sorts could produce misordered results. (Bug#33697)
MySQL Cluster NDB 6.X/7.X
1774
The server could crash when REPEAT or another control instruction was used in conjunction with labels and a LEAVE instruction.
(Bug#33618)
SET GLOBAL myisam_max_sort_file_size=DEFAULT set myisam_max_sort_file_size to an incorrect value.
(Bug#33382)
See also Bug#31177.
Granting the UPDATE privilege on one column of a view caused the server to crash. (Bug#33201)
For DECIMAL columns used with the ROUND(X,D) or TRUNCATE(X,D) function with a nonconstant value of D, adding an OR-
DER BY for the function result produced misordered output. (Bug#33143)
See also Bug#33402, Bug#30617.
The SHOW ENGINE INNODB STATUS and SHOW ENGINE INNODB MUTEX statements incorrectly required the SUPER priv-
ilege rather than the PROCESS privilege. (Bug#32710)
Tables in the mysql database that stored the current sql_mode value as part of stored program definitions were not updated with
newer mode values (NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH). This causes various problems defining
stored programs if those modes were included in the current sql_mode value. (Bug#32633)
ROUND(X,D) or TRUNCATE(X,D) for nonconstant values of D could crash the server if these functions were used in an ORDER
BY that was resolved using filesort. (Bug#30889)
Resetting the query cache by issuing a SET GLOBAL query_cache_size=0 statement caused the server to crash if it concur-
rently was saving a new result set to the query cache. (Bug#30887)
The Table_locks_waited waited variable was not incremented in the cases that a lock had to be waited for but the waiting
thread was killed or the request was aborted. (Bug#30331)
The Com_create_function status variable was not incremented properly. (Bug#30252)
mysqld displayed the --enable-pstack option in its help message even if MySQL was configured without -
-with-pstack. (Bug#29836)
Views were treated as insertable even if some base table columns with no default value were omitted from the view definition. (This
is contrary to the condition for insertability that a view must contain all columns in the base table that do not have a default value.)
(Bug#29477)
Previously, the parser accepted the ODBC { OJ ... LEFT OUTER JOIN ...} syntax for writing left outer joins. The parser
now allows { OJ ... } to be used to write other types of joins, such as INNER JOIN or RIGHT OUTER JOIN. This helps
with compatibility with some third-party applications, but is not official ODBC syntax. (Bug#28317)
The parser rules for the SHOW PROFILE statement were revised to work with older versions of bison. (Bug#27433)
resolveip failed to produce correct results for host names that begin with a digit. (Bug#27427)
mysqlcheck -A -r did not correctly identify all tables that needed repairing. (Bug#25347)
InnoDB exhibited thread thrashing with more than 50 concurrent connections under an update-intensive workload. (Bug#22868)
Warnings for deprecated syntax constructs used in stored routines make sense to report only when the routine is being created, but
they were also being reported when the routine was parsed for loading into the execution cache. Now they are reported only at
routine creation time. (Bug#21801)
CREATE ... SELECT did not always set DEFAULT column values in the new table. (Bug#21380)
If a SELECT calls a stored function in a transaction, and a statement within the function fails, that statement should roll back. Fur-
thermore, if ROLLBACK is executed after that, the entire transaction should be rolled back. Before this fix, the failed statement did
not roll back when it failed (even though it might ultimately get rolled back by a ROLLBACK later that rolls back the entire transac-
tion). (Bug#12713)
See also Bug#34655.
MySQL Cluster NDB 6.X/7.X
1775
17.15.3.7. Changes in MySQL Cluster NDB 6.2.13 (5.1.23-ndb-6.2.13) (22 February 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23 (29
January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
A node failure during an initial node restart followed by another node start could cause the master data node to fail, because it incor-
rectly gave the node permission to start even if the invalidated node's LCP was still running. (Bug#34702)
17.15.3.8. Changes in MySQL Cluster NDB 6.2.12 (5.1.23-ndb-6.2.12) (12 February 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23 (29
January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Beginning with this version, MySQL Cluster NDB 6.3.x releases once again include the InnoDB storage engine. In order to enable
InnoDB, you must configure the build using --with-innodb.
Bugs fixed:
Upgrades of a cluster using while a DataMemory setting in excess of 16 GB caused data nodes to fail. (Bug#34378)
Performing many SQL statements on NDB tables while in autocommit mode caused a memory leak in mysqld. (Bug#34275)
In certain rare circumstances, a race condition could occur between an aborted insert and a delete leading a data node crash.
(Bug#34260)
Multi-table updates using ordered indexes during handling of node failures could cause other data nodes to fail. (Bug#34216)
When configured with NDB support, MySQL failed to compile using gcc 4.3 on 64bit FreeBSD systems. (Bug#34169)
The failure of a DDL statement could sometimes lead to node failures when attempting to execute subsequent DDL statements.
(Bug#34160)
Extremely long SELECT statements (where the text of the statement was in excess of 50000 characters) against NDB tables returned
empty results. (Bug#34107)
Statements executing multiple inserts performed poorly on NDB tables having AUTO_INCREMENT columns. (Bug#33534)
MySQL Cluster NDB 6.X/7.X
1776
The ndb_waiter utility polled ndb_mgmd excessively when obtaining the status of cluster data nodes. (Bug#32025)
See also Bug#32023.
Transaction atomicity was sometimes not preserved between reads and inserts under high loads. (Bug#31477)
Having tables with a great many columns could cause Cluster backups to fail. (Bug#30172)
Cluster Replication: Disk Data: Statements violating unique keys on Disk Data tables (such as attempting to insert NULL into a
NOT NULL column) could cause data nodes to fail. When the statement was executed from the binlog, this could also result in fail-
ure of the slave cluster. (Bug#34118)
Disk Data: Updating in-memory columns of one or more rows of Disk Data table, followed by deletion of these rows and re-
insertion of them, caused data node failures. (Bug#33619)
Cluster Replication: Setting --replicate-ignore-db=mysql caused the mysql.ndb_apply_status table not to be
replicated, breaking Cluster Replication. (Bug#28170)
17.15.3.9. Changes in MySQL Cluster NDB 6.2.11 (5.1.23-ndb-6.2.11) (28 January 2008)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and fea-
ture changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23 (29
January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster API: Important Change: Because NDB_LE_MemoryUsage.page_size_kb shows memory page sizes in bytes rather
than kilobytes, it has been renamed to page_size_bytes. The name page_size_kb is now deprecated and thus subject to re-
moval in a future release, although it currently remains supported for reasons of backward compatibility. See The
Ndb_logevent_type Type, for more information about NDB_LE_MemoryUsage. (Bug#30271)
Bugs fixed:
High numbers of insert operations, delete operations, or both could cause NDB error 899 (ROWID ALREADY ALLOCATED) to occur un-
necessarily. (Bug#34033)
A periodic failure to flush the send buffer by the NDB TCP transporter could cause a unnecessary delay of 10 ms between opera-
tions. (Bug#34005)
A race condition could occur (very rarely) when the release of a GCI was followed by a data node failure. (Bug#33793)
Some tuple scans caused the wrong memory page to be accessed, leading to invalid results. This issue could affect both in-memory
and Disk Data tables. (Bug#33739)
The server failed to reject properly the creation of an NDB table having an unindexed AUTO_INCREMENT column. (Bug#30417)
Issuing an INSERT ... ON DUPLICATE KEY UPDATE concurrently with or following a TRUNCATE statement on an NDB ta-
ble failed with NDB error 4350 TRANSACTION ALREADY ABORTED. (Bug#29851)
The Cluster backup process could not detect when there was no more disk space and instead continued to run until killed manually.
Now the backup fails with an appropriate error when disk space is exhausted. (Bug#28647)
It was possible in config.ini to define cluster nodes having node IDs greater than the maximum allowed value. (Bug#28298)
MySQL Cluster NDB 6.X/7.X
1777
Cluster Replication: ndb_restore -e restored excessively large values to the ndb_apply_status table's epoch column
when restoring to a MySQL Cluster version supporting Micro-GCPs from an older version that did not support these.
A workaround when restoring to MySQL Cluster releases supporting micro-GCPs previous to MySQL Cluster NDB 6.3.8 is to per-
form a 32-bit shift on the epoch column values to reduce them to their proper size. (Bug#33406)
Cluster API: Transactions containing inserts or reads would hang during NdbTransaction::execute() calls made from
NDB API applications built against a MySQL Cluster version that did not support micro-GCPs accessing a later version that suppor-
ted micro-GCPs. This issue was observed while upgrading from MySQL Cluster NDB 6.1.23 to MySQL Cluster NDB 6.2.10 when
the API application built against the earlier version attempted to access a data node already running the later version, even after dis-
abling micro-GCPs by setting TimeBetweenEpochs equal to 0. (Bug#33895)
Cluster API: When reading a BIT(64) value using NdbOperation:getValue(), 12 bytes were written to the buffer rather
than the expected 8 bytes. (Bug#33750)
17.15.3.10. Changes in MySQL Cluster NDB 6.2.10 (5.1.23-ndb-6.2.10) (19 December 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.23 (see Section C.1.15, Changes in MySQL 5.1.23 (29
January 2008)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Partitioning: When partition pruning on an NDB table resulted in an ordered index scan spanning only one partition, any descending
flag for the scan was wrongly discarded, causing ORDER BY DESC to be treated as ORDER BY ASC, MAX() to be handled incor-
rectly, and similar problems. (Bug#33061)
When all data and SQL nodes in the cluster were shut down abnormally (that is, other than by using STOP in the cluster manage-
ment client), ndb_mgm used excessive amounts of CPU. (Bug#33237)
When using micro-GCPs, if a node failed while preparing for a global checkpoint, the master node would use the wrong GCI.
(Bug#32922)
Under some conditions, performing an ALTER TABLE on an NDBCLUSTER table failed with a TABLE IS FULL error, even when
only 25% of DataMemory was in use and the result should have been a table using less memory (for example, changing a
VARCHAR(100) column to VARCHAR(80)). (Bug#32670)
17.15.3.11. Changes in MySQL Cluster NDB 6.2.9 (5.1.22-ndb-6.2.9) (22 November 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22 (24
September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1778
Added the ndb_mgm client command DUMP 8011, which dumps all subscribers to the cluster log. See DUMP 8011, for more in-
formation.
Bugs fixed:
A local checkpoint could sometimes be started before the previous LCP was restorable from a global checkpoint. (Bug#32519)
High numbers of API nodes on a slow or congested network could cause connection negotiation to time out prematurely, leading to
the following issues:
Excessive retries
Excessive CPU usage
Partially connected API nodes
(Bug#32359)
The failure of a master node could lead to subsequent failures in local checkpointing. (Bug#32160)
Adding a new TINYTEXT column to an NDB table which used COLUMN_FORMAT = DYNAMIC, and when binary logging was en-
abled, caused all cluster mysqld processes to crash. (Bug#30213)
After adding a new column of one of the TEXT or BLOB types to an NDB table which used COLUMN_FORMAT = DYNAMIC, it
was no longer possible to access or drop the table using SQL. (Bug#30205)
A restart of the cluster failed when more than 1 REDO phase was in use. (Bug#22696)
Cluster Replication: Replication: Where a table being replicated had a TEXT or BLOB column, an UPDATE on the master that did
not refer explicitly to this column in the WHERE clause stopped the SQL thread on the slave with ERROR IN WRITE_ROWS EVENT:
ROW APPLICATION FAILED. GOT ERROR 4288 'BLOB HANDLE FOR COLUMN NOT AVAILABLE' FROM NDBCLUSTER.
(Bug#30674)
Cluster Replication: Under certain conditions, the slave stopped processing relay logs. This resulted in the logs never being cleared
and the slave eventually running out of disk space. (Bug#31958)
17.15.3.12. Changes in MySQL Cluster NDB 6.2.8 (5.1.22-ndb-6.2.8) (08 November 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22 (24
September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Important Note: MySQL Cluster NDB 6.2 and 6.3 source archives are now available in separate commercial and GPL versions.
Due to licensing concerns, previous MySQL Cluster NDB 6.2 and 6.3 source archives were removed from the FTP site.
Bugs fixed:
In a cluster running in diskless mode and with arbitration disabled, the failure of a data node during an insert operation caused other
data node to fail. (Bug#31980)
MySQL Cluster NDB 6.X/7.X
1779
An insert or update with combined range and equality constraints failed when run against an NDB table with the error GOT UNKNOWN
ERROR FROM NDB. An example of such a statement would be UPDATE t1 SET b = 5 WHERE a IN (7,8) OR a >=
10;. (Bug#31874)
An error with an if statement in sql/ha_ndbcluster.cc could potentially lead to an infinite loop in case of failure when
working with AUTO_INCREMENT columns in NDB tables. (Bug#31810)
The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
Following an upgrade, ndb_mgmd would fail with an ArbitrationError. (Bug#31690)
The NDB management client command node_id REPORT MEMORY provided no output when node_id was the node ID of a
management or API node. Now, when this occurs, the management client responds with Node node_id: is not a data
node. (Bug#29485)
Performing DELETE operations after a data node had been shut down could lead to inconsistent data following a restart of the node.
(Bug#26450)
UPDATE IGNORE could sometimes fail on NDB tables due to the use of unitialized data when checking for duplicate keys to be ig-
nored. (Bug#25817)
Cluster Replication: Replication: A node failure during replication could lead to buckets out of order; now active subscribers are
checked for, rather than empty buckets. (Bug#31701)
Cluster Replication: When the master mysqld crashed or was restarted, no LOST_EVENTS entry was made in the binlog.
(Bug#31484)
See also Bug#21494.
17.15.3.13. Changes in MySQL Cluster NDB 6.2.7 (5.1.22-ndb-6.2.7) (10 October 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22 (24
September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster Replication: A new configuration parameter TimeBetweenEpochsTimeout allows a timeout to be set for time
between epochs. For more information, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes. (Bug#31276)
Additional checks were implemented to catch unsupported online ALTER TABLE operations. Currently it is not possible to reorder
columns or to change the storage engine used for a table via online ALTER TABLE.
Some redundant checks made during online creation of indexes were removed.
Bugs fixed:
It was possible in some cases for a node group to be lost due to missed local checkpoints following a system restart. (Bug#31525)
NDB tables having names containing nonalphanumeric characters (such as $ ) were not discovered correctly. (Bug#31470)
A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart. (Bug#31257)
MySQL Cluster NDB 6.X/7.X
1780
A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
Transaction timeouts were not handled well in some circumstances, leading to excessive number of transactions being aborted unne-
cessarily. (Bug#30379)
In some cases, the cluster managment server logged entries multiple times following a restart of mgmd. (Bug#29565)
ndb_mgm --help did not display any information about the -a option. (Bug#29509)
The cluster log was formatted inconsistently and contained extraneous newline characters. (Bug#25064)
Online ALTER operations involving a column whose data type has an implicit default value left behind temporary .frm files, caus-
ing subsequent DROP DATABASE statements to fail. (Bug#31097)
Transactions were committed prematurely when LOCK TABLE and SET autocommit = 0 were used together. (Bug#30996)
The mysqld_safe script contained a syntax error. (Bug#30624)
17.15.3.14. Changes in MySQL Cluster NDB 6.2.6 (5.1.22-ndb-6.2.6) (20 September 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22 (24
September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Mapping of NDB error codes to MySQL storage engine error codes has been improved. (Bug#28423)
Bugs fixed:
Partitioning: EXPLAIN PARTITIONS reported partition usage by queries on NDB tables according to the standard MySQL hash
function than the hash function used in the NDB storage engine. (Bug#29550)
When an NDB event was left behind but the corresponding table was later recreated and received a new table ID, the event could not
be dropped. (Bug#30877)
Attempting to restore a backup made on a cluster host using one endian to a machine using the other endian could cause the cluster
to fail. (Bug#29674)
The description of the --print option provided in the output from ndb_restore --help was incorrect. (Bug#27683)
Restoring a backup made on a cluster host using one endian to a machine using the other endian failed for BLOB and DATETIME
columns. (Bug#27543, Bug#30024)
An insufficiently descriptive and potentially misleading Error 4006 (CONNECT FAILURE - OUT OF CONNECTION OBJECTS...) was
produced when either of the following two conditions occurred:
1. There were no more transaction records in the transaction coordinator
2. An NDB object in the NDB API was initialized with insufficient parallelism
Separate error messages are now generated for each of these two cases. (Bug#11313)
For micro-GCPs, the assignment of fake CGI events no longer cause buckets to be sent out of order. Now, when assigning a GCI
MySQL Cluster NDB 6.X/7.X
1781
to a non-GCI event (that is, creating a pseudo-GCI or fake CGI), the GCI that is to arrive is always initiated, even if no known
GCI exists, which could occur in the event of a node failure. (Bug#30884)
17.15.3.15. Changes in MySQL Cluster NDB 6.2.5 (5.1.22-ndb-6.2.5) (06 September 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.22 (see Section C.1.16, Changes in MySQL 5.1.22 (24
September 2007 Release Candidate)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
The following improvements have been made in the ndb_size.pl utility:
The script can now be used with multiple databases; lists of databases and tables can also be excluded from analysis.
Schema name information has been added to index table calculations.
The database name is now an optional parameter, the exclusion of which causes all databases to be examined.
If selecting from INFORMATION_SCHEMA fails, the script now attempts to fall back to SHOW TABLES.
A --real_table_name option has been added; this designates a table to handle unique index size calculations.
The report title has been amended to cover cases where more than one database is being analyzed.
Support for a --socket option was also added.
For more information, see Section 17.6.21, ndb_size.pl NDBCLUSTER Size Requirement Estimator. (Bug#28683,
Bug#28253)
Online ADD COLUMN, ADD INDEX, and DROP INDEX operations can now be performed explicitly for NDB tables, as well as on-
line renaming of tables and columns for NDB and MyISAM tables that is, without copying or locking of the affected tables us-
ing ALTER ONLINE TABLE.
Indexes can also be created and dropped online using CREATE INDEX and DROP INDEX, respectively, using the ONLINE
keyword.
You can force operations that would otherwise be performed online to be done offline using the OFFLINE keyword.
See Section 12.1.7, ALTER TABLE Syntax, Section 12.1.13, CREATE INDEX Syntax, and Section 12.1.24, DROP INDEX
Syntax, for more information.
It is now possible to control whether fixed-width or variable-width storage is used for a given column of an NDB table by means of
the COLUMN_FORMAT specifier as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
It is also possible to control whether a given column of an NDB table is stored in memory or on disk, using the STORAGE specifier
as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
For permitted values and other information about COLUMN_FORMAT and STORAGE, see Section 12.1.17, CREATE TABLE Syn-
tax.
A new cluster management server startup option --bind-address makes it possible to restrict management client connections to
ndb_mgmd to a single host and port. For more information, see Section 17.6.24.3, Program Options for ndb_mgmd.
Cluster Replication: The protocol for handling global checkpoints has been changed. It is now possible to control how often the
MySQL Cluster NDB 6.X/7.X
1782
GCI number is updated, and how often global checkpoints are written to disk, using the TimeBetweenEpochs configuration
parameter. This improves the reliability and performance of MySQL Cluster Replication.
GCPs handled using the new protocol are sometimes referred to as micro-GCPs.
For more information, see TimeBetweenEpochs .
Bugs fixed:
When handling BLOB columns, the addition of read locks to the lock queue was not handled correctly. (Bug#30764)
Discovery of NDB tables did not work correctly with INFORMATION_SCHEMA. (Bug#30667)
A file system close operation could fail during a node or system restart. (Bug#30646)
Using the --ndb-cluster-connection-pool option for mysqld caused DDL statements to be executed twice.
(Bug#30598)
ndb_size.pl failed on tables with FLOAT columns whose definitions included commas (for example, FLOAT(6,2)).
(Bug#29228)
Reads on BLOB columns were not locked when they needed to be to guarantee consistency. (Bug#29102)
See also Bug#31482.
A query using joins between several large tables and requiring unique index lookups failed to complete, eventually returning UKNOWN
ERROR after a very long period of time. This occurred due to inadequate handling of instances where the Transaction Coordinator ran
out of TransactionBufferMemory, when the cluster should have returned NDB error code 4012 (REQUEST NDBD TIME-OUT).
(Bug#28804)
An attempt to perform a SELECT ... FROM INFORMATION_SCHEMA.TABLES whose result included information about NDB
tables for which the user had no privileges crashed the MySQL Server on which the query was performed. (Bug#26793)
Cluster Replication: Cluster replication did not handle large VARCHAR columns correctly. (Bug#29904)
Cluster Replication: An issue with the mysql.ndb_apply_status table could cause NDB schema autodiscovery to fail in cer-
tain rare circumstances. (Bug#20872)
Cluster API: A call to CHECK_TIMEDOUT_RET() in mgmapi.cpp should have been a call to
DBUG_CHECK_TIMEDOUT_RET(). (Bug#30681)
17.15.3.16. Changes in MySQL Cluster NDB 6.2.4 (5.1.19-ndb-6.2.4) (04 July 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.19 (see Section C.1.19, Changes in MySQL 5.1.19 (25
May 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
When restarting a data node, queries could hang during that node's start phase 5, and continue only after the node had entered phase
6. (Bug#29364)
Replica redo logs were inconsistently handled during a system restart. (Bug#29354)
MySQL Cluster NDB 6.X/7.X
1783
Disk Data: Performing Disk Data schema operations during a node restart could cause forced shutdowns of other data nodes.
(Bug#29501)
Disk Data: Disk data meta-information that existed in ndbd might not be visible to mysqld. (Bug#28720)
Disk Data: The number of free extents was incorrectly reported for some tablespaces. (Bug#28642)
Batching of transactions was not handled correctly in some cases. (Bug#29525)
17.15.3.17. Changes in MySQL Cluster NDB 6.2.3 (5.1.19-ndb-6.2.3) (02 July 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.18 (see Section C.1.20, Changes in MySQL 5.1.18 (08
May 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
When restarting a data node, queries could hang during that node's start phase 5, and continue only after the node had entered phase
6. (Bug#29364)
Replica redo logs were inconsistently handled during a system restart. (Bug#29354)
Disk Data: Performing Disk Data schema operations during a node restart could cause forced shutdowns of other data nodes.
(Bug#29501)
Disk Data: Disk data meta-information that existed in ndbd might not be visible to mysqld. (Bug#28720)
Disk Data: The number of free extents was incorrectly reported for some tablespaces. (Bug#28642)
Batching of transactions was not handled correctly in some cases. (Bug#29525)
17.15.3.18. Changes in MySQL Cluster NDB 6.2.2 (5.1.18-ndb-6.2.2) (07 May 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.2 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.18 (see Section C.1.20, Changes in MySQL 5.1.18 (08
May 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
New cluster management client DUMP commands were added to aid in tracking transactions, scan operations, and locks. See DUMP
2350, DUMP 2352, and DUMP 2550, for more information.
Added the mysqld option --ndb-cluster-connection-pool that allows a single MySQL server to use multiple connec-
tions to the cluster. This allows for scaling out using multiple MySQL clients per SQL node instead of or in addition to using mul-
MySQL Cluster NDB 6.X/7.X
1784
tiple SQL nodes with the cluster.
For more information about this option, see Section 17.4, MySQL Cluster Options and Variables.
17.15.3.19. Changes in MySQL Cluster NDB 6.2.1 (5.1.18-ndb-6.2.1) (30 April 2007)
This is a Beta development release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.2 release.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.2 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.18 (see Section C.1.20, Changes in MySQL 5.1.18
(08 May 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Multiple operations involving deletes followed by reads were not handled correctly.
Note
This issue could also affect MySQL Cluster Replication.
(Bug#28276)
Cluster API: Using NdbBlob::writeData() to write data in the middle of an existing blob value (that is, updating the value)
could overwrite some data past the end of the data to be changed. (Bug#27018)
Incorrect handling of fragmentation in a node takeover during a restart could cause stale data to be copied to the starting node, lead-
ing eventually to failure of the node. (Bug#27434)
An incorrect assertion was made when sending a TCKEYFAILREF or TCKEYCONF message to a failed data node. (Bug#26814)
17.15.3.20. Changes in MySQL Cluster NDB 6.2.0 (5.1.16-ndb-6.2.0) (03 March 2007)
This is the first MySQL Cluster NDB 6.2 development release, based on version 6.2 of the NDBCLUSTER storage engine.
Obtaining MySQL Cluster NDB 6.2. You can download the latest MySQL Cluster NDB 6.2 source code and binaries for supported
platforms from http://dev.mysql.com/downloads/cluster.
This Beta release incorporates bugfixes and changes made in previous MySQL Cluster releases, as well as all bugfixes and feature
changes which were added in mainline MySQL 5.1 through MySQL 5.1.16 (see Section C.1.22, Changes in MySQL 5.1.16 (26 Febru-
ary 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
An ndb_wait_connected system variable has been added for mysqld. It causes mysqld wait a specified amount of time to
be connected to the cluster before accepting client connections. For more information, see Section 17.4.3, MySQL Cluster System
Variables.
Cluster API: The Ndb::startTransaction() method now provides an alternative interface for starting a transaction. See
Ndb::startTransaction(), for more information.
MySQL Cluster NDB 6.X/7.X
1785
Cluster API: Methods were added to the Ndb_cluster_connection class to faciliate iterating over existing NDB objects. See
ndb_cluster_connection::get_next_ndb_object(), for more information.
It is now possible to disable arbitration by setting ArbitrationRank equal to 0 on all nodes.
A new TcpBind_INADDR_ANY configuration parameter allows data nodes node to bind INADDR_ANY instead of a host name or
IP address in the config.ini file.
Memory allocation has been improved on 32-bit architectures that enables using close to 3GB for DataMemory and In-
dexMemory combined.
17.15.4. Changes in MySQL Cluster NDB 6.1
This section contains change history information for MySQL Cluster releases based on version 6.1 of the NDBCLUSTER storage engine.
For an overview of features that were added added in MySQL Cluster NDB 6.1, see Section 17.13.2, Features Added in MySQL
Cluster NDB 6.1.
Note
MySQL Cluster NDB 6.1 is no longer being developed or maintained, and the information presented in the next few sec-
tions should be considered to be of historical interest only. If you are using MySQL Cluster NDB 6.1, you should upgrade
as soon as possible to the most recent version of MySQL Cluster NDB 6.2 or later MySQL Cluster release series.
17.15.4.1. Changes in MySQL Cluster NDB 6.1.23 (5.1.15-ndb-6.1.23) (20 November 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
Cluster Replication: Under certain conditions, the slave stopped processing relay logs. This resulted in the logs never being cleared
and the slave eventually running out of disk space. (Bug#31958)
17.15.4.2. Changes in MySQL Cluster NDB 6.1.22 (5.1.15-ndb-6.1.22) (19 October 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
MySQL Cluster NDB 6.X/7.X
1786
Bugs fixed:
It was possible in some cases for a node group to be lost due to missed local checkpoints following a system restart. (Bug#31525)
Cluster Replication: Replication: A node failure during replication could lead to buckets out of order; now active subscribers are
checked for, rather than empty buckets. (Bug#31701)
17.15.4.3. Changes in MySQL Cluster NDB 6.1.21 (5.1.15-ndb-6.1.21) (01 October 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart. (Bug#31257)
A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
17.15.4.4. Changes in MySQL Cluster NDB 6.1.20 (5.1.15-ndb-6.1.20) (14 September 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Cluster Replication: Replication: Incorrect handling of INSERT plus DELETE operations with regard to local checkpoints caused
data node failures in multi-master replication setups. (Bug#30914)
17.15.4.5. Changes in MySQL Cluster NDB 6.1.19 (5.1.15-ndb-6.1.19) (01 August 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
MySQL Cluster NDB 6.X/7.X
1787
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Whenever a TCP send buffer is over 80% full, temporary error 1218 (SEND BUFFERS OVERLOADED IN NDB KERNEL) is now re-
turned. See SendBufferMemory for more information.
An INFO event is now sent if the time between global checkpoints is excessive, or if DUMP 7901 is issued in the management cli-
ent.
17.15.4.6. Changes in MySQL Cluster NDB 6.1.18 (5.1.15-ndb-6.1.18) (Not released)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
When restarting a data node, queries could hang during that node's start phase 5, and continue only after the node had entered phase
6. (Bug#29364)
Replication: Storage engine error conditions in row-based replication were not correctly reported to the user. (Bug#29570)
Disk Data: Disk data meta-information that existed in ndbd might not be visible to mysqld. (Bug#28720)
Disk Data: The number of free extents was incorrectly reported for some tablespaces. (Bug#28642)
17.15.4.7. Changes in MySQL Cluster NDB 6.1.17 (5.1.15-ndb-6.1.17) (03 July 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1788
Cluster Replication: Replication: Batching of updates on cluster replication slaves, enabled using the -
-slave-allow-batching option for mysqld.
Bugs fixed:
Replica redo logs were inconsistently handled during a system restart. (Bug#29354)
17.15.4.8. Changes in MySQL Cluster NDB 6.1.16 (5.1.15-ndb-6.1.16) (29 June 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
When a node failed to respond to a COPY_GCI signal as part of a global checkpoint, the master node was killed instead of the node
that actually failed. (Bug#29331)
An invalid comparison made during REDO validation that could lead to an ERROR WHILE READING REDO LOG condition.
(Bug#29118)
The wrong data pages were sometimes invalidated following a global checkpoint. (Bug#29067)
If at least 2 files were involved in REDO invalidation, then file 0 of page 0 was not updated and so pointed to an invalid part of the
redo log. (Bug#29057)
Disk Data: When dropping a page, the stack's bottom entry could sometime be left cold rather than hot, violating the rules for
stack pruning. (Bug#29176)
17.15.4.9. Changes in MySQL Cluster NDB 6.1.15 (5.1.15-ndb-6.1.15) (20 June 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Memory corruption could occur due to a problem in the DBTUP kernel block. (Bug#29229)
MySQL Cluster NDB 6.X/7.X
1789
17.15.4.10. Changes in MySQL Cluster NDB 6.1.14 (5.1.15-ndb-6.1.14) (19 June 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
In the event that two data nodes in the same node group and participating in a GCP crashed before they had written their respective
P0.sysfile files, QMGR could refuse to start, issuing an invalid INSUFFICIENT NODES FOR RESTART error instead. (Bug#29167)
17.15.4.11. Changes in MySQL Cluster NDB 6.1.13 (5.1.15-ndb-6.1.13) (15 June 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Read ahead was implemented for backups of Disk Data tables, resulting in a 10 to 15% increase in backup speed of Disk Data
tables. (Bug#29099)
Bugs fixed:
Cluster API: NdbApi.hpp depended on ndb_global.h, which was not actually installed, causing the compilation of programs
that used NdbApi.hpp to fail. (Bug#35853)
17.15.4.12. Changes in MySQL Cluster NDB 6.1.12 (5.1.15-ndb-6.1.12) (13 June 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
MySQL Cluster NDB 6.X/7.X
1790
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
New cluster management client DUMP commands were added to aid in tracking transactions, scan operations, and locks. See DUMP
2350, DUMP 2352, and DUMP 2550.
Backup dump output was extended to provide more information.
Bugs fixed:
It is now possible to set the maximum size of the allocation unit for table memory using the MaxAllocate configuration paramet-
er. (Bug#29044)
17.15.4.13. Changes in MySQL Cluster NDB 6.1.11 (5.1.15-ndb-6.1.11) (06 June 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Important Change: The TimeBetweenWatchdogCheckInitial configuration parameter was added to allow setting of a
separate watchdog timeout for memory allocation during startup of the data nodes. See Section 17.3.4.6, Defining MySQL Cluster
Data Nodes, for more information. (Bug#28899)
A new configuration parameter ODirect causes NDB to attempt using O_DIRECT writes for LCP, backups, and redo logs, often
lowering CPU usage.
It is now possible to set the size of redo log files (fragment log files) using the FragmentLogFileSize configuration parameter.
Bugs fixed:
Having large amounts of memory locked caused swapping to disk. (Bug#28751)
LCP files were not removed following an initial system restart. (Bug#28726)
Disk Data: Repeated INSERT and DELETE operations on a Disk Data table having one or more large VARCHAR columns could
cause data nodes to fail. (Bug#20612)
17.15.4.14. Changes in MySQL Cluster NDB 6.1.10 (5.1.15-ndb-6.1.10) (30 May 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
MySQL Cluster NDB 6.X/7.X
1791
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
A new times printout was added in the ndbd watchdog thread.
Some unneeded printouts in the ndbd out file were removed.
The names of some log and other files were changed to avoid issues with the tar command's 99-character file name limit.
Bugs fixed:
A regression in the heartbeat monitoring code could lead to node failure under high load. This issue affected MySQL 5.1.19 and
MySQL Cluster NDB 6.1.10 only. (Bug#28783)
A corrupt schema file could cause a FILE ALREADY OPEN error. (Bug#28770)
Setting InitialNoOpenFiles equal to MaxNoOfOpenFiles caused an error. This was due to the fact that the actual value of
MaxNoOfOpenFiles as used by the cluster was offset by 1 from the value set in config.ini. (Bug#28749)
A race condition could result when nonmaster nodes (in addition to the master node) tried to update active status due to a local
checkpoint (that is, between NODE_FAILREP and COPY_GCIREQ events). Now only the master updates the active status.
(Bug#28717)
A fast global checkpoint under high load with high usage of the redo buffer caused data nodes to fail. (Bug#28653)
Disk Data: When loading data into a cluster following a version upgrade, the data nodes could forcibly shut down due to page and
buffer management failures (that is, ndbrequire failures in PGMAN). (Bug#28525)
17.15.4.15. Changes in MySQL Cluster NDB 6.1.9 (5.1.15-ndb-6.1.9) (24 May 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
When an API node sent more than 1024 signals in a single batch, NDB would process only the first 1024 of these, and then hang.
(Bug#28443)
Disk Data: The cluster backup process scanned in ACC index order, which had bad effects for disk data. (Bug#28593)
17.15.4.16. Changes in MySQL Cluster NDB 6.1.8 (5.1.15-ndb-6.1.8) (05 May 2007)
MySQL Cluster NDB 6.X/7.X
1792
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Local checkpoint files relating to dropped NDB tables were not removed. (Bug#28348)
Repeated insertion of data generated by mysqldump into NDB tables could eventually lead to failure of the cluster. (Bug#27437)
Disk Data: Extremely large inserts into Disk Data tables could lead to data node failure in some circumstances. (Bug#27942)
Cluster API: In a multi-operation transaction, a delete operation followed by the insertion of an implicit NULL failed to overwrite
an existing value. (Bug#20535)
Setting MaxNoOfTables very low and relative to DataMemory caused OUT OF MEMORY IN NDB KERNEL errors when inserting
relatively small amounts of data into NDB tables. (Bug#24173)
17.15.4.17. Changes in MySQL Cluster NDB 6.1.7 (5.1.15-ndb-6.1.7) (05 May 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster Replication: Incompatible Change: The schema for the ndb_apply_status table in the mysql system database has
changed. When upgrading to this release from a previous MySQL Cluster NDB 6.x or mainline MySQL 5.1 release, you must drop
the mysql.ndb_apply_status table, then restart the server in order for the table to be re-created with the new schema.
See Section 17.9.4, MySQL Cluster Replication Schema and Tables, for additional information.
Bugs fixed:
The cluster waited 30 seconds instead of 30 milliseconds before reading table statistics. (Bug#28093)
Under certain rare circumstances, ndbd could get caught in an infinite loop when one transaction took a read lock and then a second
transaction attempted to obtain a write lock on the same tuple in the lock queue. (Bug#28073)
Under some circumstances, a node restart could fail to update the Global Checkpoint Index (GCI). (Bug#28023)
MySQL Cluster NDB 6.X/7.X
1793
An INSERT followed by a delete DELETE on the same NDB table caused a memory leak. (Bug#27756)
This regression was introduced by Bug#20612.
Under certain rare circumstances performing a DROP TABLE or TRUNCATE on an NDB table could cause a node failure or forced
cluster shutdown. (Bug#27581)
Memory usage of a mysqld process grew even while idle. (Bug#27560)
Performing a delete followed by an insert during a local checkpoint could cause a ROWID ALREADY ALLOCATED error. (Bug#27205)
Cluster Replication: Disk Data: An issue with replication of Disk Data tables could in some cases lead to node failure.
(Bug#28161)
Disk Data: Changes to a Disk Data table made as part of a transaction could not be seen by the client performing the changes until
the transaction had been committed. (Bug#27757)
Disk Data: When restarting a data node following the creation of a large number of Disk Data objects (approximately 200 such ob-
jects), the cluster could not assign a node ID to the restarting node. (Bug#25741)
Disk Data: Changing a column specification or issuing a TRUNCATE statement on a Disk Data table caused the table to become an
in-memory table.
This fix supersedes an incomplete fix that was made for this issue in MySQL 5.1.15. (Bug#24667, Bug#25296)
Cluster Replication: Some queries that updated multiple tables were not backed up correctly. (Bug#27748)
Cluster Replication: It was possible for API nodes to begin interacting with the cluster subscription manager before they were fully
connected to the cluster. (Bug#27728)
Cluster Replication: Under very high loads, checkpoints could be read or written with checkpoint indexes out of order.
(Bug#27651)
Cluster API: An issue with the way in which the NdbDictionary::Dictionary::listEvents() method freed resources
could sometimes lead to memory corruption. (Bug#27663)
mysqldump could not dump log tables. (Bug#26121)
The --with-readline option for configure did not work for commercial source packages, but no error message was printed
to that effect. Now a message is printed. (Bug#25530)
17.15.4.18. Changes in MySQL Cluster NDB 6.1.6 (5.1.15-ndb-6.1.6) (Not released)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster Replication: Incompatible Change: The schema for the ndb_apply_status table in the mysql system database has
changed. When upgrading to this release from a previous MySQL Cluster NDB 6.x or mainline MySQL 5.1 release, you must drop
the mysql.ndb_apply_status table, then restart the server in order for the table to be re-created with the new schema.
See Section 17.9.4, MySQL Cluster Replication Schema and Tables, for additional information.
MySQL Cluster NDB 6.X/7.X
1794
Bugs fixed:
A data node failing while another data node was restarting could leave the cluster in an inconsistent state. In certain rare cases, this
could lead to a race condition and the eventual forced shutdown of the cluster. (Bug#27466)
It was not possible to set LockPagesInMainMemory equal to 0. (Bug#27291)
A race condition could sometimes occur if the node acting as master failed while node IDs were still being allocated during startup.
(Bug#27286)
When a data node was taking over as the master node, a race condition could sometimes occur as the node was assuming responsib-
ility for handling of global checkpoints. (Bug#27283)
mysqld could crash shortly after a data node failure following certain DML operations. (Bug#27169)
The same failed request from an API node could be handled by the cluster multiple times, resulting in reduced performance.
(Bug#27087)
The failure of a data node while restarting could cause other data nodes to hang or crash. (Bug#27003)
mysqld processes would sometimes crash under high load.
Note
This fix improves on and replaces a fix for this bug that was made in MySQL Cluster NDB 6.1.5.
(Bug#26825)
Disk Data: DROP INDEX on a Disk Data table did not always move data from memory into the tablespace. (Bug#25877)
Cluster Replication: Trying to replicate a large number of frequent updates with a relatively small relay log (max-re-
lay-log-size set to 1M or less) could cause the slave to crash. (Bug#27529)
Cluster API: An issue with the way in which the NdbDictionary::Dictionary::listEvents() method freed resources
could sometimes lead to memory corruption. (Bug#27663)
Cluster API: A delete operation using a scan followed by an insert using a scan could cause a data node to fail. (Bug#27203)
17.15.4.19. Changes in MySQL Cluster NDB 6.1.5 (5.1.15-ndb-6.1.5) (15 March 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
Cluster Replication: Incompatible Change: The schema for the ndb_apply_status table in the mysql system database has
changed. When upgrading to this release from a previous MySQL Cluster NDB 6.x or mainline MySQL 5.1 release, you must drop
the mysql.ndb_apply_status table, then restart the server in order for the table to be re-created with the new schema.
See Section 17.9.4, MySQL Cluster Replication Schema and Tables, for additional information.
MySQL Cluster NDB 6.X/7.X
1795
Bugs fixed:
Creating a table on one SQL node while in single user mode caused other SQL nodes to crash. (Bug#26997)
mysqld processes would sometimes crash under high load.
Note
This fix was reverted in MySQL Cluster NDB 6.1.6.
(Bug#26825)
An infinite loop in an internal logging function could cause trace logs to fill up with UNKNOWN SIGNAL TYPE error messages and
thus grow to unreasonable sizes. (Bug#26720)
Disk Data: When creating a log file group, setting INITIAL_SIZE to less than UNDO_BUFFER_SIZE caused data nodes to
crash. (Bug#25743)
17.15.4.20. Changes in MySQL Cluster NDB 6.1.4 (5.1.15-ndb-6.1.4) (09 March 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
An ndb_wait_connected system variable has been added for mysqld. It causes mysqld wait a specified amount of time to
be connected to the cluster before accepting client connections. For more information, see Section 17.4.3, MySQL Cluster System
Variables.
Cluster API: It is now possible to specify the transaction coordinator when starting a transaction. See
Ndb::startTransaction(), for more information.
Cluster API: It is now possible to iterate over all existing NDB objects using three new methods of the
Ndb_cluster_connection class:
lock_ndb_objects()
get_next_ndb_object()
unlock_ndb_objects()
For more information about these methods and their use, see ndb_cluster_connection::get_next_ndb_object(), in
the MySQL Cluster API Guide.
Data node memory allocation has been improved. On 32-bit platforms, it should now be possible to use close to 3GB RAM for In-
dexMemory and DataMemory combined.
Bugs fixed:
Using only the --print_data option (and no other options) with ndb_restore caused ndb_restore to fail. (Bug#26741)
MySQL Cluster NDB 6.X/7.X
1796
This regression was introduced by Bug#14612.
An inadvertent use of unaligned data caused ndb_restore to fail on some 64-bit platforms, including Sparc and Itanium-2.
(Bug#26739)
Assigning a node ID greater than 63 to an SQL node caused an out of bounds error in mysqld. It should now be possible to assign
to SQL nodes node IDs up to 255. (Bug#26663)
17.15.4.21. Changes in MySQL Cluster NDB 6.1.3 (5.1.15-ndb-6.1.3) (25 February 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
The ndbd_redo_log_reader utility is now part of the default build. For more information, see Section 17.6.16, nd-
bd_redo_log_reader Check and Print Content of Cluster Redo Log.
The ndb_show_tables utility now displays information about table events. See Section 17.6.20, ndb_show_tables Dis-
play List of NDB Tables, for more information.
Cluster API: A new listEvents() method has been added to the Dictionary class. See Dictionary::listEvents(),
for more information.
It is now possible to disable arbitration by setting ArbitrationRank = 0 on all management and SQL nodes.
Bugs fixed:
An invalid pointer was returned following a FSCLOSECONF signal when accessing the REDO logs during a node restart or system
restart. (Bug#26515)
The InvalidUndoBufferSize error used the same error code (763) as the IncompatibleVersions error. InvalidUn-
doBufferSize now uses its own error code (779). (Bug#26490)
The failure of a data node when restarting it with --initial could lead to failures of subsequent data node restarts. (Bug#26481)
Takeover for local checkpointing due to multiple failures of master nodes was sometimes incorrectly handled. (Bug#26457)
The LockPagesInMainMemory parameter was not read until after distributed communication had already started between
cluster nodes. When the value of this parameter was 1, this could sometimes result in data node failure due to missed heartbeats.
(Bug#26454)
Under some circumstances, following the restart of a management node, all data nodes would connect to it normally, but some of
them subsequently failed to log any events to the management node. (Bug#26293)
No appropriate error message was provided when there was insufficient REDO log file space for the cluster to start. (Bug#25801)
A memory allocation failure in SUMA (the cluster Subscription Manager) could cause the cluster to crash. (Bug#25239)
The message ERROR 0 IN READAUTOINCREMENTVALUE(): NO ERROR was written to the error log whenever SHOW TABLE
MySQL Cluster NDB 6.X/7.X
1797
STATUS was performed on a Cluster table that did not have an AUTO_INCREMENT column.
Note
This improves on and supersedes an earlier fix that was made for this issue in MySQL 5.1.12.
(Bug#21033)
Disk Data: A memory overflow could occur with tables having a large amount of data stored on disk, or with queries using a very
high degree of parallelism on Disk Data tables. (Bug#26514)
Disk Data: Use of a tablespace whose INITIAL_SIZE was greater than 1 GB could cause the cluster to crash. (Bug#26487)
17.15.4.22. Changes in MySQL Cluster NDB 6.1.2 (5.1.15-ndb-6.1.2) (07 February 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in previous MySQL Cluster NDB 6.1 releases, as well as all bugfixes and
feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15 (25
January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Bugs fixed:
Using node IDs greater than 48 could sometimes lead to incorrect memory access and a subsequent forced shutdown of the cluster.
(Bug#26267)
17.15.4.23. Changes in MySQL Cluster NDB 6.1.1 (5.1.15-ndb-6.1.1) (01 February 2007)
This is a bugfix release, fixing recently discovered bugs in the previous MySQL Cluster NDB 6.1 release.
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
This Beta release incorporates all bugfixes and changes made in the previous MySQL Cluster NDB 6.1 release, as well as all bugfixes
and feature changes which were added in mainline MySQL 5.1 through MySQL 5.1.15 (see Section C.1.23, Changes in MySQL 5.1.15
(25 January 2007)).
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
A single cluster can now support up to 255 API nodes, including MySQL servers acting as SQL nodes. See Section 17.12.8, Issues
Exclusive to MySQL Cluster, for more information.
Bugs fixed:
A memory leak could cause problems during a node or cluster shutdown or failure. (Bug#25997)
Cluster API: Disk Data: A delete and a read performed in the same operation could cause one or more data nodes to crash. This
MySQL Cluster NDB 6.X/7.X
1798
could occur when the operation affected more than 5 columns concurrently, or when one or more of the columns was of the
VARCHAR type and was stored on disk. (Bug#25794)
An element could sometimes be inserted twice into the hash table, causing a data node to crash. (Bug#25286)
17.15.4.24. Changes in MySQL Cluster NDB 6.1.0 (5.1.14-ndb-6.1.0) (20 December 2006)
This is the first MySQL Cluster NDB 6.1 release, incorporating new features and bugfixes made for the NDBCLUSTER storage engine
made since branching from MySQL 5.1.14 standard (see Section C.1.24, Changes in MySQL 5.1.14 (05 December 2006)).
MySQL Cluster NDB 6.1 no longer in development. MySQL Cluster NDB 6.1 (formerly known as MySQL Cluster Carrier Grade
Edition 6.1.x) is no longer being developed or maintained; if you are using a MySQL Cluster NDB 6.1 release, you should consider
upgrading to MySQL Cluster NDB 6.2 or 6.3.
Note
Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in this version.
Functionality added or changed:
A new configuration parameter MemReportFrequency allows for additional control of data node memory usage. Previously,
only warnings at predetermined percentages of memory allocation were given; setting this parameter allows for that behavior to be
overridden. For more information, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes.
Bugs fixed:
When a data node was shut down using the management client STOP command, a connection event (NDB_LE_Connected) was
logged instead of a disconnection event (NDB_LE_Disconnected). (Bug#22773)
SELECT statements with a BLOB or TEXT column in the selected column list and a WHERE condition including a primary key look-
up on a VARCHAR primary key produced empty result sets. (Bug#19956)
Disk Data: MEDIUMTEXT columns of Disk Data tables were stored in memory rather than on disk, even if the columns were not in-
dexed. (Bug#25001)
Disk Data: Performing a node restart with a newly dropped Disk Data table could lead to failure of the node during the restart.
(Bug#24917)
Disk Data: When restoring from backup a cluster containing any Disk Data tables with hidden primary keys, a node failure resulted
which could lead to a crash of the cluster. (Bug#24166)
Disk Data: Repeated CREATE, DROP, or TRUNCATE in various combinations with system restarts between these operations could
lead to the eventual failure of a system restart. (Bug#21948)
Disk Data: Extents that should have been available for re-use following a DROP TABLE operation were not actually made avail-
able again until after the cluster had performed a local checkpoint. (Bug#17605)
Cluster API: Invoking the NdbTransaction::execute() method using execution type Commit and abort option
AO_IgnoreError could lead to a crash of the transaction coordinator (DBTC). (Bug#25090)
Cluster API: A unique index lookup on a nonexistent tuple could lead to a data node timeout (error 4012). (Bug#25059)
Cluster API: When using the NdbTransaction::execute() method, a very long timeout (greater than 5 minutes) could res-
ult if the last data node being polled was disconnected from the cluster. (Bug#24949)
Cluster API: Due to an error in the computation of table fragment arrays, some transactions were not executed from the correct
starting point. (Bug#24914)
Under certain rare circumstances, local checkpoints were not performed properly, leading to an inability to restart one or more data
nodes. (Bug#24664)
MySQL Cluster NDB 6.X/7.X
1799
17.16. Unified Changelogs MySQL Cluster NDB 6.X and 7.X
This section contains unified changelog information for each MySQL Cluster release series (NDB 6.1, NDB 6.2, NDB 6.3, and NDB
7.0).
For general information about features added in MySQL Cluster, see Section 17.13, MySQL Cluster Development Roadmap. For re-
lease-specific MySQL Cluster changelogs, see Section 17.15, Changes in MySQL Cluster NDB 6.X and 7.X.
An overview of features added in MySQL 5.1 not specific to MySQL Cluster can be found here: Section 1.4.1, What Is New in
MySQL 5.1. For a complete list of all bugfixes and features changes made in MySQL 5.1 that are not specific to MySQL Cluster, see
Section C.1, Changes in Release 5.1.x (Production).
17.16.1. Unified Changelog MySQL Cluster NDB 7.0.x
This section contains unified change history highlights for all MySQL Cluster releases based on version 7.0 of the NDBCLUSTER stor-
age engine through MySQL Cluster NDB 7.0.7. Included are all changelog entries in the categories MySQL Cluster, Disk Data, and
Cluster API.
Early MySQL Cluster NDB 7.0 releases tagged NDB 6.4.x are also included in this listing.
For an overview of features that were added added in MySQL Cluster NDB 7.0, see Section 17.13.5, Features Added in MySQL
Cluster NDB 7.0.
Changes in MySQL Cluster NDB 7.0.6 (5.1.34-ndb-7.0.6)
Changes in MySQL Cluster NDB 7.0.5 (5.1.32-ndb-7.0.5)
Changes in MySQL Cluster NDB 7.0.4 (5.1.32-ndb-7.0.4)
Changes in MySQL Cluster NDB 6.4.3 (5.1.32-ndb-6.4.3)
Changes in MySQL Cluster NDB 6.4.2 (5.1.31-ndb-6.4.2)
Changes in MySQL Cluster NDB 6.4.1 (5.1.31-ndb-6.4.1)
Changes in MySQL Cluster NDB 6.4.0 (5.1.30-ndb-6.4.0)
Changes in MySQL Cluster NDB 7.0.6 (5.1.34-ndb-7.0.6)
Functionality added or changed:
The ndb_config utility program can now provide an offline dump of all MySQL Cluster configuration parameters including in-
formation such as default and permitted values, brief description, and applicable section of the config.ini file. A dump in text
format is produced when running ndb_config with the new --configinfo option, and in XML format when the options -
-configinfo --xml are used together. For more information and examples, see Section 17.6.6, ndb_config Extract
MySQL Cluster Configuration Information.
Bugs fixed:
Important Change: Partitioning: User-defined partitioning of an NDBCLUSTER table without any primary key sometimes failed,
and could cause mysqld to crash.
Now, if you wish to create an NDBCLUSTER table with user-defined partitioning, the table must have an explicit primary key, and
all columns listed in the partitioning expression must be part of the primary key. The hidden primary key used by the NDBCLUSTER
storage engine is not sufficient for this purpose. However, if the list of columns is empty (that is, the table is defined using PARTI-
TION BY [LINEAR] KEY()), then no explicit primary key is required.
This change does not effect the partitioning of tables using any storage engine other than NDBCLUSTER. (Bug#40709)
Important Note: It was not possible to perform an online upgrade from any MySQL Cluster NDB 6.x release to MySQL Cluster
NDB 7.0.5 or any to earlier MySQL Cluster NDB 7.0 release.
MySQL Cluster NDB 6.X/7.X
1800
With this fix, it is possible in MySQL Cluster NDB 7.0.6 and later to perform online upgrades from MySQL Cluster NDB 6.3.8 and
later MySQL Cluster NDB 6.3 releases, or from MySQL Cluster NDB 7.0.5 or later MySQL Cluster NDB 7.0 releases. Online up-
grades to MySQL Cluster NDB 7.0 releases previous to MySQL Cluster NDB 7.0.6 from earlier MySQL Cluster releases remain
unsupported; online upgrades from MySQL Cluster NDB 7.0 releases previous to MySQL Cluster NDB 7.0.5 (including NDB 6.4.x
beta releases) to later MySQL Cluster NDB 7.0 releases also remain unsupported. (Bug#44294)
An internal NDB API buffer was not properly initialized. (Bug#44977)
When a data node had written its GCI marker to the first page of a megabyte, and that node was later killed during restart after hav-
ing processed that page (marker) but before completing a LCP, the data node could fail with filesystem errors. (Bug#44952)
See also Bug#42564.
When restarting a data nodes, management and API nodes reconnecting to it failed to re-use existing ports that had already been dy-
namically allocated for communications with that data node. (Bug#44866)
When ndb_config could not find the file referenced by the --config-file option, it tried to read my.cnf instead, then
failed with a misleading error message. (Bug#44846)
When a data node was down so long that its most recent local checkpoint depended on a global checkpoint that was no longer
restorable, it was possible for it to be unable to use optimized node recovery when being restarted later. (Bug#44844)
See also Bug#26913.
Online upgrades to MySQL Cluster NDB 7.0 from a MySQL Cluster NDB 6.3 release could fail due to changes in the handling of
key lengths and unique indexes during node recovery. (Bug#44827)
Use of __builtin_expect() had the side effect that compiler warnings about misuse of = (assignment) instead of == in com-
parisons were lost when building in debug mode. This is no longer employed when configuring the build with the --with-debug
option. (Bug#44570)
See also Bug#44567.
Inspection of the code revealed that several assignment operators (=) were used in place of comparison operators (==) in Dbdih-
Main.cpp. (Bug#44567)
See also Bug#44570.
When using large numbers of configuration parameters, the management server took an excessive amount of time (several minutes
or more) to load these from the configuration cache when starting. This problem occurred when there were more than 32 configura-
tion parameters specified, and became progressively worse with each additional multiple of 32 configuration parameters.
(Bug#44488)
Building the MySQL Cluster NDB 7.0 tree failed when using the icc compiler. (Bug#44310)
SSL connections to SQL nodes failed on big-endian platforms. (Bug#44295)
Signals providing node state information (NODE_STATE_REP and CHANGE_NODE_STATE_REQ) were not propagated to all
blocks of ndbmtd. This could cause the following problems:
Inconsistent redo logs when performing a graceful shutdown;
Data nodes crashing when later restarting the cluster, data nodes needing to perform node recovery during the system restart, or
both.
(Bug#44291)
See also Bug#42564.
An NDB internal timing function did not work correctly on Windows and could cause mysqld to fail on some AMD processors, or
when running inside a virtual machine. (Bug#44276)
It was possible for NDB API applications to insert corrupt data into the database, which could subquently lead to data node crashes.
Now, stricter checking is enforced on input data for inserts and updates. (Bug#44132)
MySQL Cluster NDB 6.X/7.X
1801
ndb_restore failed when trying to restore data on a big-endian machine from a backup file created on a little-endian machine.
(Bug#44069)
Repeated starting and stopping of data nodes could cause ndb_mgmd to fail. This issue was observed on Solaris/SPARC.
(Bug#43974)
A number of incorrectly formatted output strings in the source code caused compiler warnings. (Bug#43878)
When trying to use a data node with an older version of the management server, the data node crashed on startup. (Bug#43699)
In some cases, data node restarts during a system restart could fail due to insufficient redo log space. (Bug#43156)
NDBCLUSTER did not build correctly on Solaris 9 platforms. (Bug#39080)
See also Bug#39036, Bug#39038.
The output of ndbd --help did not provide clear information about the program's --initial and --initial-start op-
tions. (Bug#28905)
It was theoretically possible for the value of a nonexistent column to be read as NULL, rather than causing an error. (Bug#27843)
Disk Data: During a checkpoint, restore points are created for both the on-disk and in-memory parts of a Disk Data table. Under
certain rare conditions, the in-memory restore point could include or exclude a row that should have been in the snapshot. This
would later later lead to a crash during or following recovery.
This issue was somewhat more likely to be encountered when using ndbmtd. (Bug#41915)
Disk Data: This fix supercedes and improves on an earlier fix made for this bug in MySQL 5.1.18. (Bug#24521)
Changes in MySQL Cluster NDB 7.0.5 (5.1.32-ndb-7.0.5)
Functionality added or changed:
Two new server status variables Ndb_scan_count and Ndb_pruned_scan_count have been introduced.
Ndb_scan_count gives the number of scans executed since the cluster was last started. Ndb_pruned_scan_count gives the
number of scans for which NDBCLUSTER was able to use partition pruning. Together, these variables can be used to help determine
in the MySQL server whether table scans are pruned by NDBCLUSTER. (Bug#44153)
Bugs fixed:
Important Note: Due to problem discovered after the code freeze for this release, it is not possible to perform an online upgrade
from any MySQL Cluster NDB 6.x release to MySQL Cluster NDB 7.0.5 or any earlier MySQL Cluster NDB 7.0 release.
This issue is fixed in MySQL Cluster NDB 7.0.6 and later for upgrades from MySQL Cluster NDB 6.3.8 and later MySQL Cluster
NDB 6.3 releases, or from MySQL Cluster NDB 7.0.5. (Bug#44294)
Cluster Replication: If data node failed during an event creation operation, there was a slight risk that a surviving data node could
send an invalid table reference back to NDB, causing the operation to fail with a false Error 723 (NO SUCH TABLE). This could take
place when a data node failed as a mysqld process was setting up MySQL Cluster Replication. (Bug#43754)
Cluster API: The following issues occurred when performing an online (rolling) upgrade of a cluster to a version of MySQL
Cluster that supports configuration caching from a version that does not:
1. When using multiple management servers, after upgrading and restarting one ndb_mgmd, any remaining management servers
using the previous version of ndb_mgmd could not synchronize their configuration data.
2. The MGM API ndb_mgm_get_configuration() function failed to obtain configuration data.
(Bug#43641)
Cluster API: The following issues occurred when performing an online (rolling) upgrade of a cluster to a version of MySQL
Cluster that supports configuration caching from a version that does not:
MySQL Cluster NDB 6.X/7.X
1802
1. When using multiple management servers, after upgrading and restarting one ndb_mgmd, any remaining management servers
using the previous version of ndb_mgmd could not synchronize their configuration data.
2. The MGM API ndb_mgm_get_configuration() function failed to obtain configuration data.
(Bug#43641)
If the number of fragments per table rises above a certain threshold, the DBDIH kernel block's on-disk table-definition grows large
enough to occupy 2 pages. However, in MySQL Cluster NDB 7.0 (including MySQL Cluster NDB 6.4 releases), only 1 page was
actually written, causing table definitions stored on disk to be incomplete.
This issue was not observed in MySQL Cluster release series prior to MySQL Cluster NDB 7.0. (Bug#44135)
TransactionDeadlockDetectionTimeout values less than 100 were treated as 100. This could cause scans to time out un-
expectedly. (Bug#44099)
The file ndberror.c contained a C++-style comment, which caused builds to fail with some C compilers. (Bug#44036)
A race condition could occur when a data node failed to restart just before being included in the next global checkpoint. This could
cause other data nodes to fail. (Bug#43888)
The setting for ndb_use_transactions was ignored. This issue was only known to occur in MySQL Cluster NDB 6.4.3 and
MySQL Cluster NDB 7.0.4. (Bug#43236)
When a data node process had been killed after allocating a node ID, but before making contact with any other data node processes,
it was not possible to restart it due to a node ID allocation failure.
This issue could effect either ndbd or ndbmtd processes. (Bug#43224)
This regression was introduced by Bug#42973.
ndb_restore crashed when trying to restore a backup made to a MySQL Cluster running on a platform having different endian-
ness from that on which the original backup was taken. (Bug#39540)
PID files for the data and management node daemons were not removed following a normal shutdown. (Bug#37225)
ndb_restore --print_data did not handle DECIMAL columns correctly. (Bug#37171)
Invoking the management client START BACKUP command from the system shell (for example, as ndb_mgm -e "START
BACKUP") did not work correctly, unless the backup ID was included when the command was invoked.
Now, the backup ID is no longer required in such cases, and the backup ID that is automatically generated is printed to stdout, simil-
ar to how this is done when invoking START BACKUP within the management client. (Bug#31754)
When aborting an operation involving both an insert and a delete, the insert and delete were aborted separately. This was because
the transaction coordinator did not know that the operations affected on same row, and, in the case of a committed-read (tuple or in-
dex) scan, the abort of the insert was performed first, then the row was examined after the insert was aborted but before the delete
was aborted. In some cases, this would leave the row in a inconsistent state. This could occur when a local checkpoint was per-
formed during a backup. This issue did not affect primary ley operations or scans that used locks (these are serialized).
After this fix, for ordered indexes, all operations that follow the operation to be aborted are now also aborted.
Disk Data: When using multi-threaded data nodes, DROP TABLE statements on Disk Data tables could hang. (Bug#43825)
Disk Data: This fix completes one that was made for this issue in MySQL Cluster NDB-7.0.4, which did not rectify the problem in
all cases. (Bug#43632)
Cluster API: If the largest offset of a RecordSpecification used for an NdbRecord object was for the NULL bits (and thus
not a column), this offset was not taken into account when calculating the size used for the RecordSpecification. This meant
that the space for the NULL bits could be overwritten by key or other information. (Bug#43891)
Cluster API: BIT columns created using the native NDB API format that were not created as nullable could still sometimes be
overwritten, or cause other columns to be overwritten.
This issue did not effect tables having BIT columns created using the mysqld format (always used by MySQL Cluster SQL nodes).
MySQL Cluster NDB 6.X/7.X
1803
(Bug#43802)
Changes in MySQL Cluster NDB 7.0.4 (5.1.32-ndb-7.0.4)
Functionality added or changed:
Important Change: The default values for a number of MySQL Cluster configuration parameters relating to memory usage and
buffering have changed. These parameters include RedoBuffer, LongMessageBuffer, BackupMemory, BackupDat-
aBufferSize, BackupLogBufferSize, BackupWriteSize, BackupMaxWriteSize, SendBufferMemory (when
applied to TCP transporters), and ReceiveBufferMemory.
For more information, see Section 17.3, MySQL Cluster Configuration.
When restoring from backup, ndb_restore now reports the last global checkpoint reached when the backup was taken.
(Bug#37384)
Bugs fixed:
Cluster API: Partition pruning did not work correctly for queries involving multiple range scans.
As part of the fix for this issue, several improvements have been made in the NDB API, including the addition of a new NdbScan-
Operation::getPruned() method, a new variant of NdbIndexScanOperation::setBound(), and a new
Ndb::PartitionSpec data structure. For more information about these changes, see NdbScanOpera-
tion::getPruned(), NdbIndexScanOperation::setBound, and The PartitionSpec Structure. (Bug#37934)
Cluster API: Partition pruning did not work correctly for queries involving multiple range scans.
As part of the fix for this issue, several improvements have been made in the NDB API, including the addition of a new NdbScan-
Operation::getPruned() method, a new variant of NdbIndexScanOperation::setBound(), and a new
Ndb::PartitionSpec data structure. For more information about these changes, see NdbScanOpera-
tion::getPruned(), NdbIndexScanOperation::setBound, and The PartitionSpec Structure. (Bug#37934)
TimeBetweenLocalCheckpoints was measured from the end of one local checkpoint to the beginning of the next, rather than
from the beginning of one LCP to the beginning of the next. This meant that the time spent performing the LCP was not taken into
account when determining the TimeBetweenLocalCheckpoints interval, so that LCPs were not started often enough, pos-
sibly causing data nodes to run out of redo log space prematurely. (Bug#43567)
The management server failed to start correctly in daemon mode. (Bug#43559)
Following a DROP NODEGROUP command, the output of SHOW in the ndb_mgm cliently was not updated to reflect the fact that the
data nodes affected by this command were no longer part of a node group. (Bug#43413)
Using indexes containing variable-sized columns could lead to internal errors when the indexes were being built. (Bug#43226)
When using ndbmtd, multiple data node failures caused the remaining data nodes to fail as well. (Bug#43109)
It was not possible to add new data nodes to the cluster online using multi-threaded data node processes (ndbmtd). (Bug#43108)
Some queries using combinations of logical and comparison operators on an indexed column in the WHERE clause could fail with
the error GOT ERROR 4541 'INDEXBOUND HAS NO BOUND INFORMATION' FROM NDBCLUSTER. (Bug#42857)
Disk Data: When using multi-threaded data nodes, dropping a Disk Data table followed by a data node restart led to a crash.
(Bug#43632)
Disk Data: When using ndbmtd, repeated high-volume inserts (on the order of 10000 rows inserted at a time) on a Disk Data table
would eventually lead to a data node crash. (Bug#41398)
Disk Data: When a log file group had an undo log file whose size was too small, restarting data nodes failed with READ UNDERFLOW
errors.
As a result of this fix, the minimum allowed INTIAL_SIZE for an undo log file is now 1M (1 megabyte). (Bug#29574)
MySQL Cluster NDB 6.X/7.X
1804
Cluster API: The default NdbRecord structures created by NdbDictionary could have overlapping null bits and data fields.
(Bug#43590)
Cluster API: When performing insert or write operations, NdbRecord allows key columns to be specified in both the key record
and in the attribute record. Only one key column value for each key column should be sent to the NDB kernel, but this was not guar-
anteed. This is now ensured as follows: For insert and write operations, key column values are taken from the key record; for scan
takeover update operations, key column values are taken from the attribute record. (Bug#42238)
Cluster API: Ordered index scans using NdbRecord formerly expressed a BoundEQ range as separate lower and upper bounds,
resulting in 2 copies of the column values being sent to the NDB kernel.
Now, when a range is specified by NdbScanOperation::setBound(), the passed pointers, key lengths, and inclusive bits are
compared, and only one copy of the equal key columns is sent to the kernel. This makes such operations more efficient, as half the
amount of KeyInfo is now sent for a BoundEQ range as before. (Bug#38793)
Changes in MySQL Cluster NDB 6.4.3 (5.1.32-ndb-6.4.3)
Functionality added or changed:
A new data node configuration parameter MaxLCPStartDelay has been introduced to facilitate parallel node recovery by caus-
ing a local checkpoint to be delayed while recovering nodes are synchronizing data dictionaries and other meta-information. For
more information about this parameter, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes. (Bug#43053)
New options are introduced for ndb_restore for determining which tables or databases should be restored:
--include-tables and --include-databases can be used to restore specific tables or databases.
--exclude-tables and --exclude-databases can be used to exclude the specified tables or databases from being re-
stored.
For more information about these options, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
(Bug#40429)
Disk Data: It is now possible to specify default locations for Disk Data data files and undo log files, either together or separately,
using the data node configuration parameters FileSystemPathDD, FileSystemPathDataFiles, and FileSystem-
PathUndoFiles. For information about these configuration parameters, see Disk Data filesystem parameters.
It is also now possible to specify a log file group, tablespace, or both, that is created when the cluster is started, using the Ini-
tialLogFileGroup and InitialTablespace data node configuration parameters. For information about these configura-
tion parameters, see Disk Data object creation parameters.
Bugs fixed:
Important Note: It is not possible in this release to install the InnoDB plugin if InnoDB support has been compiled into mysqld.
(Bug#42610)
This regression was introduced by Bug#29263.
Packaging: Packages for MySQL Cluster were missing the libndbclient.so and libndbclient.a files. (Bug#42278)
Partitioning: Executing ALTER TABLE ... REORGANIZE PARTITION on an NDBCLUSTER table having only one partition
caused mysqld to crash. (Bug#41945)
See also Bug#40389.
Backup IDs greater than 2
31
were not handled correctly, causing negative values to be used in backup directory names and printouts.
(Bug#43042)
When using ndbmtd, NDB kernel threads could hang while trying to start the data nodes with LockPagesInMainMemory set
to 1. (Bug#43021)
When using multiple management servers and starting several API nodes (possibly including one or more SQL nodes) whose con-
MySQL Cluster NDB 6.X/7.X
1805
nectstrings listed the management servers in different order, it was possible for 2 API nodes to be assigned the same node ID. When
this happened it was possible for an API node not to get fully connected, consequently producing a number of errors whose cause
was not easily recognizable. (Bug#42973)
When using multi-threaded data nodes, IndexMemory, MaxNoOfLocalOperations, and MaxNoOfLocalScans were ef-
fectively multiplied by the number of local query handlers in use by each ndbmtd instance. (Bug#42765)
See also Bug#42215.
ndb_error_reporter worked correctly only with GNU tar. (With other versions of tar, it produced empty archives.)
(Bug#42753)
Triggers on NDBCLUSTER tables caused such tables to become locked. (Bug#42751)
See also Bug#16229, Bug#18135.
When performing more than 32 index or tuple scans on a single fragment, the scans could be left hanging. This caused unnecessary
timeouts, and in addition could possibly lead to a hang of an LCP. (Bug#42559)
A data node failure that occurred between calls to NdbIndexScanOperation::readTuples(SF_OrderBy) and Ndb-
Transaction::Execute() was not correctly handled; a subsequent call to nextResult() caused a null pointer to be defer-
enced, leading to a segfault in mysqld. (Bug#42545)
If the cluster configuration cache file was larger than 32K, the management server would not start. (Bug#42543)
Issuing SHOW GLOBAL STATUS LIKE 'NDB%' before mysqld had connected to the cluster caused a segmentation fault.
(Bug#42458)
When using ndbmtd for all data nodes, repeated failures of one data node during DML operations caused other data nodes to fail.
(Bug#42450)
Data node failures that occurred before all data nodes had connected to the cluster were not handled correctly, leading to additional
data node failures. (Bug#42422)
When using multi-threaded data nodes, their DataMemory and IndexMemory usage as reported was multiplied by the number of
local query handlers (worker threads), making it appear that much more memory was being used than was actually the case.
(Bug#42215)
See also Bug#42765.
Given a MySQL Cluster containing no data (that is, whose data nodes had all been started using --initial, and into which no
data had yet been imported) and having an empty backup directory, executing START BACKUP with a user-specified backup ID
caused the data nodes to crash. (Bug#41031)
In some cases, NDB did not check correctly whether tables had changed before trying to use the query cache. This could result in a
crash of the debug MySQL server. (Bug#40464)
Disk Data: It was not possible to add an in-memory column online to a table that used a table-level or column-level STORAGE
DISK option. The same issue prevented ALTER ONLINE TABLE ... REORGANIZE PARTITION from working on Disk
Data tables. (Bug#42549)
Disk Data: Repeated insert and delete operations on disk-based tables could lead to failures in the NDB Tablespace Manager (TS-
MAN kernel block). (Bug#40344)
Disk Data: Creating a Disk Data tablespace with a very large extent size caused the data nodes to fail. The issue was observed when
using extent sizes of 100 MB and larger. (Bug#39096)
Disk Data: Trying to execute a CREATE LOGFILE GROUP statement using a value greater than 150M for
UNDO_BUFFER_SIZE caused data nodes to crash.
As a result of this fix, the upper limit for UNDO_BUFFER_SIZE is now 600M; attempting to set a higher value now fails gracefully
with an error. (Bug#34102)
Disk Data: When attempting to create a tablespace that already existed, the error message returned was TABLE OR INDEX WITH
GIVEN NAME ALREADY EXISTS. (Bug#32662)
MySQL Cluster NDB 6.X/7.X
1806
Disk Data: Using a path or filename longer than 128 characters for Disk Data undo log files and tablespace data files caused a num-
ber of issues, including failures of CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, and AL-
TER TABLESPACE statements, as well as crashes of management nodes and data nodes.
With this fix, the maximum length for path and file names used for Disk Data undo log files and tablespace data files is now the
same as the maximum for the operating system. (Bug#31769, Bug#31770, Bug#31772)
Disk Data: Attempting to perform a system restart of the cluster where there existed a logfile group without and undo log files
caused the data nodes to crash.
Note
While issuing a CREATE LOGFILE GROUP statement without an ADD UNDOFILE option fails with an error in the
MySQL server, this situation could arise if an SQL node failed during the execution of a valid CREATE LOGFILE
GROUP statement; it is also possible to create a logfile group without any undo log files using the NDB API.
(Bug#17614)
Cluster API: Some error messages from ndb_mgmd contained newline (\n) characters. This could break the MGM API protocol,
which uses the newline as a line separator. (Bug#43104)
Cluster API: When using an ordered index scan without putting all key columns in the read mask, this invalid use of the NDB API
went undetected, which resulted in the use of uninitialized memory. (Bug#42591)
Changes in MySQL Cluster NDB 6.4.2 (5.1.31-ndb-6.4.2)
Bugs fixed:
Connections using IPv6 were not handled correctly by mysqld. (Bug#42413)
See also Bug#42412, Bug#38247.
When a cluster backup failed with Error 1304 (Node node_id1: Backup request from node_id2 failed to start), no clear reason
for the failure was provided.
As part of this fix, MySQL Cluster now retries backups in the event of sequence errors. (Bug#42354)
See also Bug#22698.
Issuing SHOW ENGINE NDBCLUSTER STATUS on an SQL node before the management server had connected to the cluster
caused mysqld to crash. (Bug#42264)
When using ndbmtd, setting MaxNoOfThreads to a value higher than the actual number of cores available and with insufficient
SharedGlobalMemory caused the data nodes to crash.
The fix for this issue changes the behavior of ndbmtd such that its internal job buffers no longer rely on
SharedGlobalMemory. (Bug#42254)
Changes in MySQL Cluster NDB 6.4.1 (5.1.31-ndb-6.4.1)
Functionality added or changed:
Important Change: Formerly, when the management server failed to create a transporter for a data node connection,
net_write_timeout seconds elapsed before the data node was actually allowed to disconnect. Now in such cases the discon-
nection occurs immediately. (Bug#41965)
See also Bug#41713.
Formerly, when using MySQL Cluster Replication, records for empty epochs that is, epochs in which no changes to NDB-
CLUSTER data or tables took place were inserted into the ndb_apply_status and ndb_binlog_index tables on the
slave even when --log-slave-updates was disabled. Beginning with MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB
6.3.13 this was changed so that these empty eopchs were no longer logged. However, it is now possible to re-enable the older be-
MySQL Cluster NDB 6.X/7.X
1807
havior (and cause empty epochs to be logged) by using the --ndb-log-empty-epochs option. For more information, see
Section 16.1.3.3, Replication Slave Options and Variables.
See also Bug#37472.
Bugs fixed:
A maximum of 11 TUP scans were allowed in parallel. (Bug#42084)
The management server could hang after attempting to halt it with the STOP command in the management client. (Bug#42056)
See also Bug#40922.
When using ndbmtd, one thread could flood another thread, which would cause the system to stop with a JOB BUFFER FULL condi-
tion (currently implemented as an abort). This could be caused by committing or aborting a large transaction (50000 rows or more)
on a single data node running ndbmtd. To prevent this from happening, the number of signals that can be accepted by the system
threads is calculated before excuting them, and only executing them if sufficient space is found. (Bug#42052)
MySQL Cluster would not compile when using libwrap. This issue was known to occur only in MySQL Cluster NDB 6.4.0.
(Bug#41918)
Trying to execute an ALTER ONLINE TABLE ... ADD COLUMN statement while inserting rows into the table caused mysqld
to crash. (Bug#41905)
When a data node connects to the management server, the node sends its node ID and transporter type; the management server then
verifies that there is a transporter set up for that node and that it is in the correct state, and then sends back an acknowledgement to
the connecting node. If the transporter was not in the correct state, no reply was sent back to the connecting node, which would then
hang until a read timeout occurred (60 seconds). Now, if the transporter is not in the correct state, the management server acknow-
ledges this promptly, and the node immediately disconnects. (Bug#41713)
See also Bug#41965.
Issuing EXIT in the management client sometimes caused the client to hang. (Bug#40922)
In the event that a MySQL Cluster backup failed due to file permissions issues, conflicting reports were issued in the management
client. (Bug#34526)
If all data nodes were shut down, MySQL clients were unable to access NDBCLUSTER tables and data even after the data nodes
were restarted, unless the MySQL clients themselves were restarted. (Bug#33626)
Changes in MySQL Cluster NDB 6.4.0 (5.1.30-ndb-6.4.0)
Functionality added or changed:
Important Change: MySQL Cluster now caches its configuration data. This means that, by default, the management server only
reads the global configuration file (usually named config.ini) the first time that it is started, and does not automatically re-read
the this file when restarted. This behavior can be controlled using new management server options (--config-dir,
--initial, and --reload) that have been added for this purpose. For more information, see Section 17.3.4, MySQL Cluster
Configuration Files, and Section 17.6.24.3, Program Options for ndb_mgmd.
It is now possible while in Single User Mode to restart all data nodes using ALL RESTART in the management client. Restarting of
individual nodes while in Single User Mode remains disallowed. (Bug#31056)
It is now possible to add data nodes to a MySQL Cluster online that is, to a running MySQL Cluster without shutting it down.
For information about the procedure for adding data nodes online, see Section 17.7.8, Adding MySQL Cluster Data Nodes
Online.
A multi-threaded version of the MySQL Cluster data node daemon is now available. The multi-threaded ndbmtd binary is similar
to ndbd and functions in much the same way, but is intended for use on machines with multiple CPU cores.
For more information, see Section 17.6.3, ndbmtd The MySQL Cluster Data Node Daemon (Multi-Threaded).
MySQL Cluster NDB 6.X/7.X
1808
It is now possible when performing a cluster backup to determine whether the backup matches the state of the data when the backup
began or when it ended, using the new START BACKUP options SNAPSHOTSTART and SNAPSHOTEND in the management cli-
ent. See Section 17.7.3.2, Using The MySQL Cluster Management Client to Create a Backup, for more information.
Bugs fixed:
API nodes disconnected too agressively from cluster when data nodes were being restarted. This could sometimes lead to the API
node being unable to access the cluster at all during a rolling restart. (Bug#41462)
When long signal buffer exhaustion in the ndbd process resulted in a signal being dropped, the usual handling mechanism did not
take fragmented signals into account. This could result in a crash of the data node because the fragmented signal handling mechan-
ism was not able to work with the missing fragments. (Bug#39235)
The failure of a master node during a DDL operation caused the cluster to be unavailable for further DDL operations until it was re-
started; failures of nonmaster nodes during DLL operations caused the cluster to become completely inaccessible. (Bug#36718)
Status messages shown in the management client when restarting a management node were inappropriate and misleading. Now,
when restarting a management node, the messages displayed are as follows, where node_id is the management node's node ID:
ndb_mgm> node_id RESTART
Shutting down MGM node node_id for restart
Node node_id is being restarted
ndb_mgm>
(Bug#29275)
A data node failure when NoOfReplicas was greater than 2 caused all cluster SQL nodes to crash. (Bug#18621)
17.16.2. Unified Changelog MySQL Cluster NDB 6.3.x
This section contains unified change history highlights for all MySQL Cluster releases based on version 6.3 of the NDBCLUSTER stor-
age engine through MySQL Cluster NDB 6.3.26. Included are all changelog entries in the categories MySQL Cluster, Disk Data, and
Cluster API.
For an overview of features that were added added in MySQL Cluster NDB 6.3, see Section 17.13.4, Features Added in MySQL
Cluster NDB 6.3.
Changes in MySQL Cluster NDB 6.3.25 (5.1.34-ndb-6.3.25)
Changes in MySQL Cluster NDB 6.3.24 (5.1.32-ndb-6.3.24)
Changes in MySQL Cluster NDB 6.3.23 (5.1.32-ndb-6.3.23)
Changes in MySQL Cluster NDB 6.3.22 (5.1.31-ndb-6.3.22)
Changes in MySQL Cluster NDB 6.3.21 (5.1.31-ndb-6.3.21)
Changes in MySQL Cluster NDB 6.3.20 (5.1.30-ndb-6.3.20)
Changes in MySQL Cluster NDB 6.3.19 (5.1.29-ndb-6.3.19)
Changes in MySQL Cluster NDB 6.3.18 (5.1.28-ndb-6.3.18)
Changes in MySQL Cluster NDB 6.3.17 (5.1.27-ndb-6.3.17)
Changes in MySQL Cluster NDB 6.3.16 (5.1.24-ndb-6.3.16)
Changes in MySQL Cluster NDB 6.3.15 (5.1.24-ndb-6.3.15)
Changes in MySQL Cluster NDB 6.3.14 (5.1.24-ndb-6.3.14)
Changes in MySQL Cluster NDB 6.3.13 (5.1.24-ndb-6.3.13)
MySQL Cluster NDB 6.X/7.X
1809
Changes in MySQL Cluster NDB 6.3.10 (5.1.23-ndb-6.3.10)
Changes in MySQL Cluster NDB 6.3.9 (5.1.23-ndb-6.3.9)
Changes in MySQL Cluster NDB 6.3.8 (5.1.23-ndb-6.3.8)
Changes in MySQL Cluster NDB 6.3.7 (5.1.23-ndb-6.3.7)
Changes in MySQL Cluster NDB 6.3.6 (5.1.22-ndb-6.3.6)
Changes in MySQL Cluster NDB 6.3.5 (5.1.22-ndb-6.3.5)
Changes in MySQL Cluster NDB 6.3.4 (5.1.22-ndb-6.3.4)
Changes in MySQL Cluster NDB 6.3.3 (5.1.22-ndb-6.3.3)
Changes in MySQL Cluster NDB 6.3.2 (5.1.22-ndb-6.3.2)
Changes in MySQL Cluster NDB 6.3.0 (5.1.19-ndb-6.3.0)
Changes in MySQL Cluster NDB 6.3.25 (5.1.34-ndb-6.3.25)
Functionality added or changed:
Two new server status variables Ndb_scan_count and Ndb_pruned_scan_count have been introduced.
Ndb_scan_count gives the number of scans executed since the cluster was last started. Ndb_pruned_scan_count gives the
number of scans for which NDBCLUSTER was able to use partition pruning. Together, these variables can be used to help determine
in the MySQL server whether table scans are pruned by NDBCLUSTER. (Bug#44153)
The ndb_config utility program can now provide an offline dump of all MySQL Cluster configuration parameters including in-
formation such as default and permitted values, brief description, and applicable section of the config.ini file. A dump in text
format is produced when running ndb_config with the new --configinfo option, and in XML format when the options -
-configinfo --xml are used together. For more information and examples, see Section 17.6.6, ndb_config Extract
MySQL Cluster Configuration Information.
Bugs fixed:
Important Change: Partitioning: User-defined partitioning of an NDBCLUSTER table without any primary key sometimes failed,
and could cause mysqld to crash.
Now, if you wish to create an NDBCLUSTER table with user-defined partitioning, the table must have an explicit primary key, and
all columns listed in the partitioning expression must be part of the primary key. The hidden primary key used by the NDBCLUSTER
storage engine is not sufficient for this purpose. However, if the list of columns is empty (that is, the table is defined using PARTI-
TION BY [LINEAR] KEY()), then no explicit primary key is required.
This change does not effect the partitioning of tables using any storage engine other than NDBCLUSTER. (Bug#40709)
When ndb_config could not find the file referenced by the --config-file option, it tried to read my.cnf instead, then
failed with a misleading error message. (Bug#44846)
When a data node was down so long that its most recent local checkpoint depended on a global checkpoint that was no longer
restorable, it was possible for it to be unable to use optimized node recovery when being restarted later. (Bug#44844)
See also Bug#26913.
Inspection of the code revealed that several assignment operators (=) were used in place of comparison operators (==) in Dbdih-
Main.cpp. (Bug#44567)
See also Bug#44570.
It was possible for NDB API applications to insert corrupt data into the database, which could subquently lead to data node crashes.
Now, stricter checking is enforced on input data for inserts and updates. (Bug#44132)
MySQL Cluster NDB 6.X/7.X
1810
ndb_restore failed when trying to restore data on a big-endian machine from a backup file created on a little-endian machine.
(Bug#44069)
The file ndberror.c contained a C++-style comment, which caused builds to fail with some C compilers. (Bug#44036)
When trying to use a data node with an older version of the management server, the data node crashed on startup. (Bug#43699)
In some cases, data node restarts during a system restart could fail due to insufficient redo log space. (Bug#43156)
NDBCLUSTER did not build correctly on Solaris 9 platforms. (Bug#39080)
See also Bug#39036, Bug#39038.
ndb_restore --print_data did not handle DECIMAL columns correctly. (Bug#37171)
The output of ndbd --help did not provide clear information about the program's --initial and --initial-start op-
tions. (Bug#28905)
It was theoretically possible for the value of a nonexistent column to be read as NULL, rather than causing an error. (Bug#27843)
Disk Data: This fix supercedes and improves on an earlier fix made for this bug in MySQL 5.1.18. (Bug#24521)
Changes in MySQL Cluster NDB 6.3.24 (5.1.32-ndb-6.3.24)
Bugs fixed:
Cluster Replication: If data node failed during an event creation operation, there was a slight risk that a surviving data node could
send an invalid table reference back to NDB, causing the operation to fail with a false Error 723 (NO SUCH TABLE). This could take
place when a data node failed as a mysqld process was setting up MySQL Cluster Replication. (Bug#43754)
Cluster API: Partition pruning did not work correctly for queries involving multiple range scans.
As part of the fix for this issue, several improvements have been made in the NDB API, including the addition of a new NdbScan-
Operation::getPruned() method, a new variant of NdbIndexScanOperation::setBound(), and a new
Ndb::PartitionSpec data structure. For more information about these changes, see NdbScanOpera-
tion::getPruned(), NdbIndexScanOperation::setBound, and The PartitionSpec Structure. (Bug#37934)
Cluster API: Partition pruning did not work correctly for queries involving multiple range scans.
As part of the fix for this issue, several improvements have been made in the NDB API, including the addition of a new NdbScan-
Operation::getPruned() method, a new variant of NdbIndexScanOperation::setBound(), and a new
Ndb::PartitionSpec data structure. For more information about these changes, see NdbScanOpera-
tion::getPruned(), NdbIndexScanOperation::setBound, and The PartitionSpec Structure. (Bug#37934)
TransactionDeadlockDetectionTimeout values less than 100 were treated as 100. This could cause scans to time out un-
expectedly. (Bug#44099)
A race condition could occur when a data node failed to restart just before being included in the next global checkpoint. This could
cause other data nodes to fail. (Bug#43888)
TimeBetweenLocalCheckpoints was measured from the end of one local checkpoint to the beginning of the next, rather than
from the beginning of one LCP to the beginning of the next. This meant that the time spent performing the LCP was not taken into
account when determining the TimeBetweenLocalCheckpoints interval, so that LCPs were not started often enough, pos-
sibly causing data nodes to run out of redo log space prematurely. (Bug#43567)
Using indexes containing variable-sized columns could lead to internal errors when the indexes were being built. (Bug#43226)
When a data node process had been killed after allocating a node ID, but before making contact with any other data node processes,
it was not possible to restart it due to a node ID allocation failure.
This issue could effect either ndbd or ndbmtd processes. (Bug#43224)
This regression was introduced by Bug#42973.
MySQL Cluster NDB 6.X/7.X
1811
Some queries using combinations of logical and comparison operators on an indexed column in the WHERE clause could fail with
the error GOT ERROR 4541 'INDEXBOUND HAS NO BOUND INFORMATION' FROM NDBCLUSTER. (Bug#42857)
ndb_restore crashed when trying to restore a backup made to a MySQL Cluster running on a platform having different endian-
ness from that on which the original backup was taken. (Bug#39540)
When aborting an operation involving both an insert and a delete, the insert and delete were aborted separately. This was because
the transaction coordinator did not know that the operations affected on same row, and, in the case of a committed-read (tuple or in-
dex) scan, the abort of the insert was performed first, then the row was examined after the insert was aborted but before the delete
was aborted. In some cases, this would leave the row in a inconsistent state. This could occur when a local checkpoint was per-
formed during a backup. This issue did not affect primary ley operations or scans that used locks (these are serialized).
After this fix, for ordered indexes, all operations that follow the operation to be aborted are now also aborted.
Disk Data: When a log file group had an undo log file whose size was too small, restarting data nodes failed with READ UNDERFLOW
errors.
As a result of this fix, the minimum allowed INTIAL_SIZE for an undo log file is now 1M (1 megabyte). (Bug#29574)
Cluster API: If the largest offset of a RecordSpecification used for an NdbRecord object was for the NULL bits (and thus
not a column), this offset was not taken into account when calculating the size used for the RecordSpecification. This meant
that the space for the NULL bits could be overwritten by key or other information. (Bug#43891)
Cluster API: BIT columns created using the native NDB API format that were not created as nullable could still sometimes be
overwritten, or cause other columns to be overwritten.
This issue did not effect tables having BIT columns created using the mysqld format (always used by MySQL Cluster SQL nodes).
(Bug#43802)
Cluster API: The default NdbRecord structures created by NdbDictionary could have overlapping null bits and data fields.
(Bug#43590)
Cluster API: When performing insert or write operations, NdbRecord allows key columns to be specified in both the key record
and in the attribute record. Only one key column value for each key column should be sent to the NDB kernel, but this was not guar-
anteed. This is now ensured as follows: For insert and write operations, key column values are taken from the key record; for scan
takeover update operations, key column values are taken from the attribute record. (Bug#42238)
Cluster API: Ordered index scans using NdbRecord formerly expressed a BoundEQ range as separate lower and upper bounds,
resulting in 2 copies of the column values being sent to the NDB kernel.
Now, when a range is specified by NdbScanOperation::setBound(), the passed pointers, key lengths, and inclusive bits are
compared, and only one copy of the equal key columns is sent to the kernel. This makes such operations more efficient, as half the
amount of KeyInfo is now sent for a BoundEQ range as before. (Bug#38793)
Changes in MySQL Cluster NDB 6.3.23 (5.1.32-ndb-6.3.23)
Functionality added or changed:
A new data node configuration parameter MaxLCPStartDelay has been introduced to facilitate parallel node recovery by caus-
ing a local checkpoint to be delayed while recovering nodes are synchronizing data dictionaries and other meta-information. For
more information about this parameter, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes. (Bug#43053)
Bugs fixed:
Packaging: Packages for MySQL Cluster were missing the libndbclient.so and libndbclient.a files. (Bug#42278)
Partitioning: Executing ALTER TABLE ... REORGANIZE PARTITION on an NDBCLUSTER table having only one partition
caused mysqld to crash. (Bug#41945)
See also Bug#40389.
Backup IDs greater than 2
31
were not handled correctly, causing negative values to be used in backup directory names and printouts.
MySQL Cluster NDB 6.X/7.X
1812
(Bug#43042)
When using ndbmtd, NDB kernel threads could hang while trying to start the data nodes with LockPagesInMainMemory set
to 1. (Bug#43021)
When using multiple management servers and starting several API nodes (possibly including one or more SQL nodes) whose con-
nectstrings listed the management servers in different order, it was possible for 2 API nodes to be assigned the same node ID. When
this happened it was possible for an API node not to get fully connected, consequently producing a number of errors whose cause
was not easily recognizable. (Bug#42973)
ndb_error_reporter worked correctly only with GNU tar. (With other versions of tar, it produced empty archives.)
(Bug#42753)
Triggers on NDBCLUSTER tables caused such tables to become locked. (Bug#42751)
See also Bug#16229, Bug#18135.
Given a MySQL Cluster containing no data (that is, whose data nodes had all been started using --initial, and into which no
data had yet been imported) and having an empty backup directory, executing START BACKUP with a user-specified backup ID
caused the data nodes to crash. (Bug#41031)
In some cases, NDB did not check correctly whether tables had changed before trying to use the query cache. This could result in a
crash of the debug MySQL server. (Bug#40464)
Disk Data: It was not possible to add an in-memory column online to a table that used a table-level or column-level STORAGE
DISK option. The same issue prevented ALTER ONLINE TABLE ... REORGANIZE PARTITION from working on Disk
Data tables. (Bug#42549)
Disk Data: Creating a Disk Data tablespace with a very large extent size caused the data nodes to fail. The issue was observed when
using extent sizes of 100 MB and larger. (Bug#39096)
Disk Data: Trying to execute a CREATE LOGFILE GROUP statement using a value greater than 150M for
UNDO_BUFFER_SIZE caused data nodes to crash.
As a result of this fix, the upper limit for UNDO_BUFFER_SIZE is now 600M; attempting to set a higher value now fails gracefully
with an error. (Bug#34102)
Disk Data: When attempting to create a tablespace that already existed, the error message returned was TABLE OR INDEX WITH
GIVEN NAME ALREADY EXISTS. (Bug#32662)
Disk Data: Using a path or filename longer than 128 characters for Disk Data undo log files and tablespace data files caused a num-
ber of issues, including failures of CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, and AL-
TER TABLESPACE statements, as well as crashes of management nodes and data nodes.
With this fix, the maximum length for path and file names used for Disk Data undo log files and tablespace data files is now the
same as the maximum for the operating system. (Bug#31769, Bug#31770, Bug#31772)
Disk Data: Attempting to perform a system restart of the cluster where there existed a logfile group without and undo log files
caused the data nodes to crash.
Note
While issuing a CREATE LOGFILE GROUP statement without an ADD UNDOFILE option fails with an error in the
MySQL server, this situation could arise if an SQL node failed during the execution of a valid CREATE LOGFILE
GROUP statement; it is also possible to create a logfile group without any undo log files using the NDB API.
(Bug#17614)
Cluster API: Some error messages from ndb_mgmd contained newline (\n) characters. This could break the MGM API protocol,
which uses the newline as a line separator. (Bug#43104)
Cluster API: When using an ordered index scan without putting all key columns in the read mask, this invalid use of the NDB API
went undetected, which resulted in the use of uninitialized memory. (Bug#42591)
Changes in MySQL Cluster NDB 6.3.22 (5.1.31-ndb-6.3.22)
MySQL Cluster NDB 6.X/7.X
1813
Functionality added or changed:
New options are introduced for ndb_restore for determining which tables or databases should be restored:
--include-tables and --include-databases can be used to restore specific tables or databases.
--exclude-tables and --exclude-databases can be used to exclude the specified tables or databases from being re-
stored.
For more information about these options, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
(Bug#40429)
Bugs fixed:
When performing more than 32 index or tuple scans on a single fragment, the scans could be left hanging. This caused unnecessary
timeouts, and in addition could possibly lead to a hang of an LCP. (Bug#42559)
A data node failure that occurred between calls to NdbIndexScanOperation::readTuples(SF_OrderBy) and Ndb-
Transaction::Execute() was not correctly handled; a subsequent call to nextResult() caused a null pointer to be defer-
enced, leading to a segfault in mysqld. (Bug#42545)
Issuing SHOW GLOBAL STATUS LIKE 'NDB%' before mysqld had connected to the cluster caused a segmentation fault.
(Bug#42458)
Data node failures that occurred before all data nodes had connected to the cluster were not handled correctly, leading to additional
data node failures. (Bug#42422)
When a cluster backup failed with Error 1304 (Node node_id1: Backup request from node_id2 failed to start), no clear reason
for the failure was provided.
As part of this fix, MySQL Cluster now retries backups in the event of sequence errors. (Bug#42354)
See also Bug#22698.
Issuing SHOW ENGINE NDBCLUSTER STATUS on an SQL node before the management server had connected to the cluster
caused mysqld to crash. (Bug#42264)
Changes in MySQL Cluster NDB 6.3.21 (5.1.31-ndb-6.3.21)
Functionality added or changed:
Important Change: Formerly, when the management server failed to create a transporter for a data node connection,
net_write_timeout seconds elapsed before the data node was actually allowed to disconnect. Now in such cases the discon-
nection occurs immediately. (Bug#41965)
See also Bug#41713.
It is now possible while in Single User Mode to restart all data nodes using ALL RESTART in the management client. Restarting of
individual nodes while in Single User Mode remains disallowed. (Bug#31056)
Formerly, when using MySQL Cluster Replication, records for empty epochs that is, epochs in which no changes to NDB-
CLUSTER data or tables took place were inserted into the ndb_apply_status and ndb_binlog_index tables on the
slave even when --log-slave-updates was disabled. Beginning with MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB
6.3.13 this was changed so that these empty eopchs were no longer logged. However, it is now possible to re-enable the older be-
havior (and cause empty epochs to be logged) by using the --ndb-log-empty-epochs option. For more information, see
Section 16.1.3.3, Replication Slave Options and Variables.
See also Bug#37472.
Bugs fixed:
MySQL Cluster NDB 6.X/7.X
1814
A maximum of 11 TUP scans were allowed in parallel. (Bug#42084)
Trying to execute an ALTER ONLINE TABLE ... ADD COLUMN statement while inserting rows into the table caused mysqld
to crash. (Bug#41905)
If the master node failed during a global checkpoint, it was possible in some circumstances for the new master to use an incorrect
value for the global checkpoint index. This could occur only when the cluster used more than one node group. (Bug#41469)
API nodes disconnected too agressively from cluster when data nodes were being restarted. This could sometimes lead to the API
node being unable to access the cluster at all during a rolling restart. (Bug#41462)
It was not possible to perform online upgrades from a MySQL Cluster NDB 6.2 release to MySQL Cluster NDB 6.3.8 or a later
MySQL Cluster NDB 6.3 release. (Bug#41435)
Cluster log files were opened twice by internal log-handling code, resulting in a resource leak. (Bug#41362)
An abort path in the DBLQH kernel block failed to release a commit acknowledgement marker. This meant that, during node failure
handling, the local query handler could be added multiple times to the marker record which could lead to additional node failures
due an array overflow. (Bug#41296)
During node failure handling (of a data node other than the master), there was a chance that the master was waiting for a
GCP_NODEFINISHED signal from the failed node after having received it from all other data nodes. If this occurred while the
failed node had a transaction that was still being committed in the current epoch, the master node could crash in the DBTC kernel
block when discovering that a transaction actually belonged to an epoch which was already completed. (Bug#41295)
Issuing EXIT in the management client sometimes caused the client to hang. (Bug#40922)
In the event that a MySQL Cluster backup failed due to file permissions issues, conflicting reports were issued in the management
client. (Bug#34526)
If all data nodes were shut down, MySQL clients were unable to access NDBCLUSTER tables and data even after the data nodes
were restarted, unless the MySQL clients themselves were restarted. (Bug#33626)
Disk Data: Starting a cluster under load such that Disk Data tables used most of the undo buffer could cause data node failures.
The fix for this bug also corrected an issue in the LGMAN kernel block where the amount of free space left in the undo buffer was
miscalculated, causing buffer overruns. This could cause records in the buffer to be overwritten, leading to problems when restarting
data nodes. (Bug#28077)
Cluster API: mgmapi.h contained constructs which only worked in C++, but not in C. (Bug#27004)
Changes in MySQL Cluster NDB 6.3.20 (5.1.30-ndb-6.3.20)
Bugs fixed:
If a transaction was aborted during the handling of a data node failure, this could lead to the later handling of an API node failure
not being completed. (Bug#41214)
Issuing SHOW TABLES repeatedly could cause NDBCLUSTER tables to be dropped. (Bug#40854)
Statements of the form UPDATE ... ORDER BY ... LIMIT run against NDBCLUSTER tables failed to update all matching
rows, or failed with the error CAN'T FIND RECORD IN 'TABLE_NAME'. (Bug#40081)
Start phase reporting was inconsistent between the management client and the cluster log. (Bug#39667)
Status messages shown in the management client when restarting a management node were inappropriate and misleading. Now,
when restarting a management node, the messages displayed are as follows, where node_id is the management node's node ID:
ndb_mgm> node_id RESTART
Shutting down MGM node node_id for restart
Node node_id is being restarted
ndb_mgm>
(Bug#29275)
MySQL Cluster NDB 6.X/7.X
1815
Disk Data: This improves on a previous fix for this issue that was made in MySQL Cluster 6.3.8. (Bug#37116)
See also Bug#29186.
Cluster API: When creating a scan using an NdbScanFilter object, it was possible to specify conditions against a BIT column,
but the correct rows were not returned when the scan was executed.
As part of this fix, 4 new comparison operators have been implemented for use with scans on BIT columns:
COL_AND_MASK_EQ_MASK
COL_AND_MASK_NE_MASK
COL_AND_MASK_EQ_ZERO
COL_AND_MASK_NE_ZERO
For more information about these operators, see The NdbScanFilter::BinaryCondition Type.
Equivalent methods are now also defined for NdbInterpretedCode; for more information, see NdbInterpretedCode Bit-
wise Comparison Operations. (Bug#40535)
Changes in MySQL Cluster NDB 6.3.19 (5.1.29-ndb-6.3.19)
Functionality added or changed:
Cluster API: Important Change: MGM API applications exited without raising any errors if the connection to the management
server was lost. The fix for this issue includes two changes:
1. The MGM API now provides its own SIGPIPE handler to catch the broken pipe error that occurs when writing to a closed
or reset socket. This means that MGM API now behaves the same as NDB API in this regard.
2. A new function ndb_mgm_set_ignore_sigpipe() has been added to the MGM API. This function makes it possible to
bypass the SIGPIPE handler provded by the MGM API.
(Bug#40498)
When performing an initial start of a data node, fragment log files were always created sparsely that is, not all bytes were written.
Now it is possible to override this behavior using the new InitFragmentLogFiles configuration parameter. (Bug#40847)
Bugs fixed:
Cluster API: Failed operations on BLOB and TEXT columns were not always reported correctly to the originating SQL node. Such
errors were sometimes reported as being due to timeouts, when the actual problem was a transporter overload due to insufficient
buffer space. (Bug#39867, Bug#39879)
Cluster API: Failed operations on BLOB and TEXT columns were not always reported correctly to the originating SQL node. Such
errors were sometimes reported as being due to timeouts, when the actual problem was a transporter overload due to insufficient
buffer space. (Bug#39867, Bug#39879)
Undo logs and data files were created in 32K increments. Now these files are created in 512K increments, resulting in shorter cre-
ation times. (Bug#40815)
Redo log creation was very slow on some platforms, causing MySQL Cluster to start more slowly than necessary with some com-
binations of hardware and operating system. This was due to all write operations being synchronized to disk while creating a redo
log file. Now this synchronization occurs only after the redo log has been created. (Bug#40734)
Transaction failures took longer to handle than was necessary.
When a data node acting as transaction coordinator (TC) failed, the surviving data nodes did not inform the API node initiating the
transaction of this until the failure had been processed by all protocols. However, the API node needed only to know about failure
handling by the transaction protocol that is, it needed to be informed only about the TC takeover process. Now, API nodes
(including MySQL servers acting as cluster SQL nodes) are informed as soon as the TC takeover is complete, so that it can carry on
MySQL Cluster NDB 6.X/7.X
1816
operating more quickly. (Bug#40697)
It was theoretically possible for stale data to be read from NDBCLUSTER tables when the transaction isolation level was set to
ReadCommitted. (Bug#40543)
The LockExecuteThreadToCPU and LockMaintThreadsToCPU parameters did not work on Solaris. (Bug#40521)
SET SESSION ndb_optimized_node_selection = 1 failed with an invalid warning message. (Bug#40457)
A restarting data node could fail with an error in the DBDIH kernel block when a local or global checkpoint was started or triggered
just as the node made a request for data from another data node. (Bug#40370)
Restoring a MySQL Cluster from a dump made using mysqldump failed due to a spurious error: CAN'T EXECUTE THE GIVEN
COMMAND BECAUSE YOU HAVE ACTIVE LOCKED TABLES OR AN ACTIVE TRANSACTION. (Bug#40346)
O_DIRECT was incorrectly disabled when making MySQL Cluster backups. (Bug#40205)
Heavy DDL usage caused the mysqld processes to hang due to a timeout error (NDB error code 266). (Bug#39885)
Executing EXPLAIN SELECT on an NDBCLUSTER table could cause mysqld to crash. (Bug#39872)
Events logged after setting ALL CLUSTERLOG STATISTICS=15 in the management client did not always include the node ID
of the reporting node. (Bug#39839)
The MySQL Query Cache did not function correctly with NDBCLUSTER tables containing TEXT columns. (Bug#39295)
A segfault in Logger::Log caused ndbd to hang indefinitely. This fix improves on an earlier one for this issue, first made in
MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB 6.3.17. (Bug#39180)
See also Bug#38609.
Memory leaks could occur in handling of strings used for storing cluster metadata and providing output to users. (Bug#38662)
A duplicate key error raised when inserting into an NDBCLUSTER table caused the current transaction to abort, after which any SQL
statement other than a ROLLBACK failed. With this fix, the NDBCLUSTER storage engine now supports rollback of individual state-
ments in such cases, and it is no longer necessary to issue an explicit ROLLBACK and then retry the entire transaction. (Bug#32656)
Error messages for NDBCLUSTER error codes 1224 and 1227 were missing. (Bug#28496)
Disk Data: Issuing concurrent CREATE TABLESPACE, ALTER TABLESPACE, CREATE LOGFILE GROUP, or ALTER LOG-
FILE GROUP statements on separate SQL nodes caused a resource leak that led to data node crashes when these statements were
used again later. (Bug#40921)
Disk Data: Disk-based variable-length columns were not always handled like their memory-based equivalents, which could poten-
tially lead to a crash of cluster data nodes. (Bug#39645)
Disk Data: O_SYNC was incorrectly disabled on platforms that do not support O_DIRECT. This issue was noted on Solaris but
could have affected other platforms not having O_DIRECT capability. (Bug#34638)
Cluster API: The MGM API reset error codes on management server handles before checking them. This meant that calling an
MGM API function with a null handle caused applications to crash. (Bug#40455)
Cluster API: It was not always possible to access parent objects directly from NdbBlob, NdbOperation, and NdbScanOper-
ation objects. To alleviate this problem, a new getNdbOperation() method has been added to NdbBlob and new getNdb-
Transaction() methods have been added to NdbOperation and NdbScanOperation. In addition, a const variant of NdbOp-
eration::getErrorLine() is now also available. (Bug#40242)
Cluster API: NdbScanOperation::getBlobHandle() failed when used with incorrect column names or numbers.
(Bug#40241)
Cluster API: The MGM API function ndb_mgm_listen_event() ignored bind addresses.
As part of this fix, it is now possible to specify bind addresses in connectstrings. See Section 17.3.4.3, The MySQL Cluster Con-
nectstring, for more information. (Bug#38473)
MySQL Cluster NDB 6.X/7.X
1817
Cluster API: The NDB API example programs included in MySQL Cluster source distributions failed to compile. (Bug#37491)
See also Bug#40238.
Changes in MySQL Cluster NDB 6.3.18 (5.1.28-ndb-6.3.18)
Functionality added or changed:
It is no longer a requirement for database autodiscovery that an SQL node already be connected to the cluster at the time that a data-
base is created on another SQL node. It is no longer necessary to issue CREATE DATABASE (or CREATE SCHEMA) statements on
an SQL node joining the cluster after a database is created in order for the new SQL node to see the database and any NDCLUSTER
tables that it contains. (Bug#39612)
Bugs fixed:
When a transaction included a multi-row insert to an NDBCLUSTER table that caused a constraint violation, the transaction failed to
roll back. (Bug#395638)
Starting the MySQL Server with the --ndbcluster option plus an invalid command-line option (for example, using mysqld -
-ndbcluster --foobar) caused it to hang while shutting down the binlog thread. (Bug#39635)
Dropping and then re-creating a database on one SQL node caused other SQL nodes to hang. (Bug#39613)
Setting a low value of MaxNoOfLocalScans (< 100) and performing a large number of (certain) scans could cause the Transac-
tion Coordinator to run out of scan fragment records, and then crash. Now when this resource is exhausted, the cluster returns Error
291 (OUT OF SCANFRAG RECORDS IN TC (INCREASE MAXNOOFLOCALSCANS)) instead. (Bug#39549)
Creating a unique index on an NDBCLUSTER table caused a memory leak in the NDB subscription manager (SUMA) which could
lead to mysqld hanging, due to the fact that the resource shortage was not reported back to the NDB kernel correctly. (Bug#39518)
See also Bug#39450.
Embedded libmysqld with NDB did not drop table events. (Bug#39450)
Unique identifiers in tables having no primary key were not cached. This fix has been observed to increase the efficiency of IN-
SERT operations on such tables by as much as 50%. (Bug#39267)
When restarting a data node, an excessively long shutodwn message could cause the node process to crash. (Bug#38580)
After a forced shutdown and initial restart of the cluster, it was possible for SQL nodes to retain .FRM files corresponding to NDB-
CLUSTER tables that had been dropped, and thus to be unaware that these tables no longer existed. In such cases, attempting to re-
create the tables using CREATE TABLE IF NOT EXISTS could fail with a spurious TABLE ... DOESN'T EXIST error.
(Bug#37921)
A statement of the form DELETE FROM table WHERE primary_key=value or UPDATE table WHERE
primary_key=value where there was no row whose primary key column had the stated value appeared to succeed, with the
server reporting that 1 row had been changed.
This issue was only known to affect MySQL Cluster NDB 6.3.11 and later NDB 6.3 versions. (Bug#37153)
Cluster API: Passing a value greater than 65535 to NdbInterpretedCode::add_val() and NdbInterpreted-
Code::sub_val() caused these methods to have no effect. (Bug#39536)
Changes in MySQL Cluster NDB 6.3.17 (5.1.27-ndb-6.3.17)
Bugs fixed:
Packaging: Support for the InnoDB storage engine was missing from the GPL source releases. An updated GPL source tarball
mysql-5.1.27-ndb-6.3.17-innodb.tar.gz which includes code for building InnoDB can be found on the MySQL FTP
site.
MySQL Cluster NDB 6.X/7.X
1818
MgmtSrvr::allocNodeId() left a mutex locked following an AMBIGUITY FOR NODE IF %D error. (Bug#39158)
An invalid path specification caused mysql-test-run.pl to fail. (Bug#39026)
During transactional coordinator takeover (directly after node failure), the LQH finding an operation in the LOG_COMMIT state sent
an LQH_TRANS_CONF signal twice, causing the TC to fail. (Bug#38930)
An invalid memory access caused the management server to crash on Solaris Sparc platforms. (Bug#38628)
A segfault in Logger::Log caused ndbd to hang indefinitely. (Bug#38609)
ndb_mgmd failed to start on older Linux distributions (2.4 kernels) that did not support e-polling. (Bug#38592)
ndb_mgmd sometimes performed unnecessary network I/O with the client. This in combination with other factors led to long-
running threads that were attempting to write to clients that no longer existed. (Bug#38563)
ndb_restore failed with a floating point exception due to a division by zero error when trying to restore certain data files.
(Bug#38520)
A failed connection to the management server could cause a resource leak in ndb_mgmd. (Bug#38424)
Failure to parse configuration parameters could cause a memory leak in the NDB log parser. (Bug#38380)
Renaming an NDBCLUSTER table on one SQL node, caused a trigger on this table to be deleted on another SQL node. (Bug#36658)
Attempting to add a UNIQUE INDEX twice to an NDBCLUSTER table, then deleting rows from the table could cause the MySQL
Server to crash. (Bug#35599)
ndb_restore failed when a single table was specified. (Bug#33801)
GCP_COMMIT did not wait for transaction takeover during node failure. This could cause GCP_SAVE_REQ to be executed too
early. This could also cause (very rarely) replication to skip rows. (Bug#30780)
Cluster API: Support for Multi-Range Read index scans using the old API (using, for example, NdbIndexScanOpera-
tion::setBound() or NdbIndexScanOperation::end_of_bound()) were dropped in MySQL Cluster NDB 6.2. This
functionality is restored in MySQL Cluster NDB 6.3 beginning with 6.3.17, but remains unavailable in MySQL Cluster NDB 6.2.
Both MySQL Cluster NDB 6.2 and 6.3 support Multi-Range Read scans via the NdbRecord API. (Bug#38791)
Cluster API: The NdbScanOperation::readTuples() method could be called multiple times without error. (Bug#38717)
Cluster API: Certain Multi-Range Read scans involving IS NULL and IS NOT NULL comparisons failed with an error in the
NDB local query handler. (Bug#38204)
Cluster API: Problems with the public headers prevented NDB applications from being built with warnings turned on. (Bug#38177)
Cluster API: Creating an NdbScanFilter object using an NdbScanOperation object that had not yet had its
readTuples() method called resulted in a crash when later attempting to use the NdbScanFilter. (Bug#37986)
Cluster API: Executing an NdbRecord interpreted delete created with an ANYVALUE option caused the transaction to abort.
(Bug#37672)
Changes in MySQL Cluster NDB 6.3.16 (5.1.24-ndb-6.3.16)
Functionality added or changed:
Event buffer lag reports are now written to the cluster log. (Bug#37427)
Added the --no-binlog option for ndb_restore. When used, this option prevents information being written to SQL node
binary logs from the restoration of a cluster backup. (Bug#30452)
Bugs fixed:
Cluster API: Changing the system time on data nodes could cause MGM API applications to hang and the data nodes to crash.
MySQL Cluster NDB 6.X/7.X
1819
Bug#35607)
Cluster API: Changing the system time on data nodes could cause MGM API applications to hang and the data nodes to crash.
(Bug#35607)
Failure of a data node could sometimes cause mysqld to crash. (Bug#37628)
DELETE ... WHERE unique_index_column=value deleted the wrong row from the table. (Bug#37516)
If subscription was terminated while a node was down, the epoch was not properly acknowledged by that node. (Bug#37442)
libmysqld failed to wait for the cluster binlog thread to terminate before exiting. (Bug#37429)
In rare circumstances, a connection followed by a disconnection could give rise to a stale connection where the connection still
existed but was not seen by the transporter. (Bug#37338)
Queries against NDBCLUSTER tables were cached only if autocommit was in use. (Bug#36692)
Cluster API: When some operations succeeded and some failed following a call to NdbTransaction::execute(Commit,
AO_IgnoreOnError), a race condition could cause spurious occurrences of NDB API Error 4011 (INTERNAL ERROR).
(Bug#37158)
Cluster API: Creating a table on an SQL node, then starting an NDB API application that listened for events from this table, then
dropping the table from an SQL node, prevented data node restarts. (Bug#32949, Bug#37279)
Cluster API: A buffer overrun in NdbBlob::setValue() caused erroneous results on Mac OS X. (Bug#31284)
Changes in MySQL Cluster NDB 6.3.15 (5.1.24-ndb-6.3.15)
Bugs fixed:
In certain rare situations, ndb_size.pl could fail with the error CAN'T USE STRING ("VALUE") AS A HASH REF WHILE
"STRICT REFS" IN USE. (Bug#43022)
Under some circumstances, a failed CREATE TABLE could mean that subsequent CREATE TABLE statements caused node fail-
ures. (Bug#37092)
A fail attempt to create an NDB table could in some cases lead to resource leaks or cluster failures. (Bug#37072)
Attempting to create a native backup of NDB tables having a large number of NULL columns and data could lead to node failures.
(Bug#37039)
Checking of API node connections was not efficiently handled. (Bug#36843)
Attempting to delete a nonexistent row from a table containing a TEXT or BLOB column within a transaction caused the transaction
to fail. (Bug#36756)
See also Bug#36851.
If the combined total of tables and indexes in the cluster was greater than 4096, issuing START BACKUP caused data nodes to fail.
(Bug#36044)
Where column values to be compared in a query were of the VARCHAR or VARBINARY types, NDBCLUSTER passed a value pad-
ded to the full size of the column, which caused unnecessary data to be sent to the data nodes. This also had the effect of wasting
CPU and network bandwidth, and causing condition pushdown to be disabled where it could (and should) otherwise have been ap-
plied. (Bug#35393)
When dropping a table failed for any reason (such as when in single user mode) then the corresponding .ndb file was still removed.
Cluster API: Ordered index scans were not pruned correctly where a partitioning key was specified with an EQ-bound.
(Bug#36950)
Cluster API: When an insert operation involving BLOB data was attempted on a row which already existed, no duplicate key error
was correctly reported and the transaction is incorrectly aborted. In some cases, the existing row could also become corrupted.
MySQL Cluster NDB 6.X/7.X
1820
Bug#36851)
See also Bug#26756.
Cluster API: NdbApi.hpp depended on ndb_global.h, which was not actually installed, causing the compilation of programs
that used NdbApi.hpp to fail. (Bug#35853)
Changes in MySQL Cluster NDB 6.3.14 (5.1.24-ndb-6.3.14)
Bugs fixed:
SET GLOBAL ndb_extra_logging caused mysqld to crash. (Bug#36547)
A race condition caused by a failure in epoll handling could cause data nodes to fail. (Bug#36537)
Under certain rare circumstances, the failure of the new master node while attempting a node takeover would cause takeover errors
to repeat without being resolved. (Bug#36199, Bug#36246, Bug#36247, Bug#36276)
When more than one SQL node connected to the cluster at the same time, creation of the mysql.ndb_schema table failed on one
of them with an explicit TABLE EXISTS error, which was not necessary. (Bug#35943)
mysqld failed to start after running mysql_upgrade. (Bug#35708)
Notification of a cascading master node failures could sometimes not be transmitted correctly (that is, transmission of the
NF_COMPLETEREP signal could fail), leading to transactions hanging and timing out (NDB error 4012), scans hanging, and failure
of the management server process. (Bug#32645)
If an API node disconnected and then reconnected during Start Phase 8, then the connection could be blocked that is, the QMGR
kernel block failed to detect that the API node was in fact connected to the cluster, causing issues with the NDB Subscription Man-
ager (SUMA).
NDB error 1427 (API NODE DIED, WHEN SUB_START_REQ REACHED NODE) was incorrectly classified as a schema error rather
than a temporary error.
Cluster API: Accesing the debug version of libndbclient via dlopen() resulted in a segmentation fault. (Bug#35927)
Cluster API: Attempting to pass a nonexistent column name to the equal() and setValue() methods of NdbOperation
caused NDB API applications to crash. Now the column name is checked, and an error is returned in the event that the column is not
found. (Bug#33747)
Cluster API: Relocation errors were encountered when trying to compile NDB API applications on a number of platforms, includ-
ing 64-bit Linux. As a result, libmysys, libmystrings, and libdbug have been changed from normal libraries to noinst
libtool helper libraries. They are no longer installed as separate libraries; instead, all necessary symbols from these are added
directly to libndbclient. This means that NDB API programs now need to be linked only using -lndbclient. (Bug#29791)
Changes in MySQL Cluster NDB 6.3.13 (5.1.24-ndb-6.3.13)
Bugs fixed:
Important Change: mysqld_safe now traps Signal 13 (SIGPIPE) so that this signal no longer kills the MySQL server process.
(Bug#33984)
Node or system restarts could fail due an unitialized variable in the DTUP kernel block. This issue was found in MySQL Cluster
NDB 6.3.11. (Bug#35797)
If an error occured while executing a statement involving a BLOB or TEXT column of an NDB table, a memory leak could result.
(Bug#35593)
It was not possible to determine the value used for the --ndb-cluster-connection-pool option in the mysql client. Now
this value is reported as a system status variable. (Bug#35573)
The ndb_waiter utility wrongly calculated timeouts. (Bug#35435)
MySQL Cluster NDB 6.X/7.X
1821
A SELECT on a table with a nonindexed, large VARCHAR column which resulted in condition pushdown on this column could
cause mysqld to crash. (Bug#35413)
ndb_restore incorrectly handled some datatypes when applying log files from backups. (Bug#35343)
In some circumstances, a stopped data node was handled incorrectly, leading to redo log space being exhausted following an initial
restart of the node, or an initial or partial restart of the cluster (the wrong CGI might be used in such cases). This could happen, for
example, when a node was stopped following the creation of a new table, but before a new LCP could be executed. (Bug#35241)
SELECT ... LIKE ... queries yielded incorrect results when used on NDB tables. As part of this fix, condition pushdown of
such queries has been disabled; re-enabling it is expected to be done as part of a later, permanent fix for this issue. (Bug#35185)
ndb_mgmd reported errors to STDOUT rather than to STDERR. (Bug#35169)
Nested Multi-Range Read scans failed when the second Multi-Range Read released the first read's unprocessed operations, some-
times leading to an SQL node crash. (Bug#35137)
In some situations, a problem with synchronizing checkpoints between nodes could cause a system restart or a node restart to fail
with ERROR 630 DURING RESTORE OF TX. (Bug#34756)
A node failure during an initial node restart followed by another node start could cause the master data node to fail, because it incor-
rectly gave the node permission to start even if the invalidated node's LCP was still running. (Bug#34702)
When a secondary index on a DECIMAL column was used to retrieve data from an NDB table, no results were returned even if the
target table had a matched value in the column that was defined with the secondary index. (Bug#34515)
An UPDATE on an NDB table that set a new value for a unique key column could cause subsequent queries to fail. (Bug#34208)
If a data node in one node group was placed in the not started state (using node_id RESTART -n), it was not possible to stop
a data node in a different node group. (Bug#34201)
Numerous NDBCLUSTER test failures occurred in builds compiled using icc on IA64 platforms. (Bug#31239)
If a START BACKUP command was issued while ndb_restore was running, the backup being restored could be overwritten.
(Bug#26498)
REPLACE statements did not work correctly with NDBCLUSTER tables when all columns were not explicitly listed. (Bug#22045)
CREATE TABLE and ALTER TABLE statements using ENGINE=NDB or ENGINE=NDBCLUSTER caused mysqld to fail on Sol-
aris 10 for x86 platforms. (Bug#19911)
Cluster API: Closing a scan before it was executed caused the application to segfault. (Bug#36375)
Cluster API: Using NDB API applications from older MySQL Cluster versions with libndbclient from newer ones caused the
cluster to fail. (Bug#36124)
Cluster API: Some ordered index scans could return tuples out of order. (Bug#35908)
Cluster API: Scans having no bounds set were handled incorrectly. (Bug#35876)
Cluster API: NdbScanFilter::getNdbOperation(), which was inadvertently removed in MySQL Cluster NDB 6.3.11,
has been restored. (Bug#35854)
Changes in MySQL Cluster NDB 6.3.10 (5.1.23-ndb-6.3.10)
Bugs fixed:
Due to the reduction of the number of local checkpoints from 3 to 2 in MySQL Cluster NDB 6.3.8, a data node using ndbd from
MySQL Cluster NDB 6.3.8 or later started using a file system from an earlier version could incorrectly invalidate local checkpoints
too early during the startup process, causing the node to fail. (Bug#34596)
Changes in MySQL Cluster NDB 6.3.9 (5.1.23-ndb-6.3.9)
MySQL Cluster NDB 6.X/7.X
1822
Bugs fixed:
Cluster failures could sometimes occur when performing more than three parallel takeovers during node restarts or system restarts.
This affected MySQL Cluster NDB 6.3.x releases only. (Bug#34445)
Upgrades of a cluster using while a DataMemory setting in excess of 16 GB caused data nodes to fail. (Bug#34378)
Performing many SQL statements on NDB tables while in autocommit mode caused a memory leak in mysqld. (Bug#34275)
In certain rare circumstances, a race condition could occur between an aborted insert and a delete leading a data node crash.
(Bug#34260)
Multi-table updates using ordered indexes during handling of node failures could cause other data nodes to fail. (Bug#34216)
When configured with NDB support, MySQL failed to compile using gcc 4.3 on 64bit FreeBSD systems. (Bug#34169)
The failure of a DDL statement could sometimes lead to node failures when attempting to execute subsequent DDL statements.
(Bug#34160)
Extremely long SELECT statements (where the text of the statement was in excess of 50000 characters) against NDB tables returned
empty results. (Bug#34107)
When configured with NDB support, MySQL failed to compile on 64bit FreeBSD systems. (Bug#34046)
Statements executing multiple inserts performed poorly on NDB tables having AUTO_INCREMENT columns. (Bug#33534)
The ndb_waiter utility polled ndb_mgmd excessively when obtaining the status of cluster data nodes. (Bug#32025)
See also Bug#32023.
Transaction atomicity was sometimes not preserved between reads and inserts under high loads. (Bug#31477)
Having tables with a great many columns could cause Cluster backups to fail. (Bug#30172)
Cluster Replication: Disk Data: Statements violating unique keys on Disk Data tables (such as attempting to insert NULL into a
NOT NULL column) could cause data nodes to fail. When the statement was executed from the binlog, this could also result in fail-
ure of the slave cluster. (Bug#34118)
Disk Data: Updating in-memory columns of one or more rows of Disk Data table, followed by deletion of these rows and re-
insertion of them, caused data node failures. (Bug#33619)
Changes in MySQL Cluster NDB 6.3.8 (5.1.23-ndb-6.3.8)
Functionality added or changed:
Cluster API: Important Change: Because NDB_LE_MemoryUsage.page_size_kb shows memory page sizes in bytes rather
than kilobytes, it has been renamed to page_size_bytes. The name page_size_kb is now deprecated and thus subject to re-
moval in a future release, although it currently remains supported for reasons of backward compatibility. See The
Ndb_logevent_type Type, for more information about NDB_LE_MemoryUsage. (Bug#30271)
ndb_restore now supports basic attribute promotion; that is, data from a column of a given type can be restored to a column us-
ing a larger type. For example, Cluster backup data taken from a SMALLINT column can be restored to a MEDIUMINT, INT, or
BIGINT column.
For more information, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup.
Now only 2 local checkpoints are stored, rather than 3 as in previous MySQL Cluster versions. This lowers disk space requirements
and reduces the size and number of redo log files needed.
The mysqld option --ndb-batch-size has been added. This allows for controlling the size of batches used for running trans-
actions.
Node recovery can now be done in parallel, rather than sequentially, which can result in much faster recovery times.
MySQL Cluster NDB 6.X/7.X
1823
Persistence of NDB tables can now be controlled using the session variables ndb_table_temporary and
ndb_table_no_logging. ndb_table_no_logging causes NDB tables not to be checkpointed to disk;
ndb_table_temporary does the same, and in addition, no schema files are created.
OPTIMIZE TABLE can now be interrupted. This can be done, for example, by killing the SQL thread performing the OPTIMIZE
operation.
Bugs fixed:
Disk Data: Important Change: It is no longer possible on 32-bit systems to issue statements appearing to create Disk Data log files
or data files greater than 4 GB in size. (Trying to create log files or data files larger than 4 GB on 32-bit systems led to unrecover-
able data node failures; such statements now fail with NDB error 1515.) (Bug#29186)
Replication: The code implementing heartbeats did not check for possible errors in some circumstances; this kept the dump thread
hanging while waiting for heartbeats loop even though the slave was no longer connected. (Bug#33332)
High numbers of insert operations, delete operations, or both could cause NDB error 899 (ROWID ALREADY ALLOCATED) to occur un-
necessarily. (Bug#34033)
A periodic failure to flush the send buffer by the NDB TCP transporter could cause a unnecessary delay of 10 ms between opera-
tions. (Bug#34005)
DROP TABLE did not free all data memory. This bug was observed in MySQL Cluster NDB 6.3.7 only. (Bug#33802)
A race condition could occur (very rarely) when the release of a GCI was followed by a data node failure. (Bug#33793)
Some tuple scans caused the wrong memory page to be accessed, leading to invalid results. This issue could affect both in-memory
and Disk Data tables. (Bug#33739)
A failure to initialize an internal variable led to sporadic crashes during cluster testing. (Bug#33715)
The server failed to reject properly the creation of an NDB table having an unindexed AUTO_INCREMENT column. (Bug#30417)
Issuing an INSERT ... ON DUPLICATE KEY UPDATE concurrently with or following a TRUNCATE statement on an NDB ta-
ble failed with NDB error 4350 TRANSACTION ALREADY ABORTED. (Bug#29851)
The Cluster backup process could not detect when there was no more disk space and instead continued to run until killed manually.
Now the backup fails with an appropriate error when disk space is exhausted. (Bug#28647)
It was possible in config.ini to define cluster nodes having node IDs greater than the maximum allowed value. (Bug#28298)
Under some circumstances, a recovering data node did not use its own data, instead copying data from another node even when this
was not required. This in effect bypassed the optimized node recovery protocol and caused recovery times to be unnecessarily long.
(Bug#26913)
Cluster API: Transactions containing inserts or reads would hang during NdbTransaction::execute() calls made from
NDB API applications built against a MySQL Cluster version that did not support micro-GCPs accessing a later version that suppor-
ted micro-GCPs. This issue was observed while upgrading from MySQL Cluster NDB 6.1.23 to MySQL Cluster NDB 6.2.10 when
the API application built against the earlier version attempted to access a data node already running the later version, even after dis-
abling micro-GCPs by setting TimeBetweenEpochs equal to 0. (Bug#33895)
Cluster API: When reading a BIT(64) value using NdbOperation:getValue(), 12 bytes were written to the buffer rather
than the expected 8 bytes. (Bug#33750)
Changes in MySQL Cluster NDB 6.3.7 (5.1.23-ndb-6.3.7)
Functionality added or changed:
Compressed local checkpoints and backups are now supported, resulting in a space savings of 50% or more over uncompressed
LCPs and backups. Cmpression of these can be enabled in the config.ini file using the two new data node configuration para-
meters CompressedLCP and CompressedBackup, respectively.
MySQL Cluster NDB 6.X/7.X
1824
OPTIMIZE TABLE is now supported for NDBCLUSTER tables, subject to the following limitations:
Only in-memory tables are supported. OPTIMIZE still has no effect on Disk Data tables.
Only variable-length columns are supported. However, you can force columns defined using fixed-length data types to be dy-
namic using the ROW_FORMAT or COLUMN_FORMAT option with a CREATE TABLE or ALTER TABLE statement.
Memory reclaimed from an NDB table using OPTIMIZE is generally available to the cluster, and not confined to the table from
which it was recovered, unlike the case with memory freed using DELETE.
The performance of OPTIMIZE on NDB tables can be regulated by adjusting the value of the ndb_optimization_delay sys-
tem variable.
It is now possible to cause statements occurring within the same transaction to be run as a batch by setting the session variable
transaction_allow_batching to 1 or ON.
Note
To use this feature, autocommit must be disabled.
Bugs fixed:
Partitioning: When partition pruning on an NDB table resulted in an ordered index scan spanning only one partition, any descending
flag for the scan was wrongly discarded, causing ORDER BY DESC to be treated as ORDER BY ASC, MAX() to be handled incor-
rectly, and similar problems. (Bug#33061)
When all data and SQL nodes in the cluster were shut down abnormally (that is, other than by using STOP in the cluster manage-
ment client), ndb_mgm used excessive amounts of CPU. (Bug#33237)
When using micro-GCPs, if a node failed while preparing for a global checkpoint, the master node would use the wrong GCI.
(Bug#32922)
Under some conditions, performing an ALTER TABLE on an NDBCLUSTER table failed with a TABLE IS FULL error, even when
only 25% of DataMemory was in use and the result should have been a table using less memory (for example, changing a
VARCHAR(100) column to VARCHAR(80)). (Bug#32670)
Changes in MySQL Cluster NDB 6.3.6 (5.1.22-ndb-6.3.6)
Functionality added or changed:
Unnecessary reads when performing a primary key or unique key update have been reduced, and in some cases, eliminated. (It is al-
most never necessary to read a record prior to an update, the lone exception to this being when a primary key is updated, since this
requires a delete followed by an insert, which must be prepared by reading the record.) Depending on the number of primary key
and unique key lookups that are performed per transaction, this can yield a considerable improvement in performance.
Batched operations are now better supported for DELETE and UPDATE. (UPDATE WHERE... and muliple DELETE.)
Introduced the Ndb_execute_count status variable, which measures the number of round trips made by queries to the NDB ker-
nel.
Bugs fixed:
An insert or update with combined range and equality constraints failed when run against an NDB table with the error GOT UNKNOWN
ERROR FROM NDB. An example of such a statement would be UPDATE t1 SET b = 5 WHERE a IN (7,8) OR a >=
10;. (Bug#31874)
An error with an if statement in sql/ha_ndbcluster.cc could potentially lead to an infinite loop in case of failure when
working with AUTO_INCREMENT columns in NDB tables. (Bug#31810)
The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
MySQL Cluster NDB 6.X/7.X
1825
ndb_restore displayed incorrect backup file version information. This meant (for example) that, when attempting to restore a
backup made from a MySQL 5.1.22 cluster to a MySQL Cluster NDB 6.3.3 cluster, the restore process failed with the error
RESTORE PROGRAM OLDER THAN BACKUP VERSION. NOT SUPPORTED. USE NEW RESTORE PROGRAM. (Bug#31723)
Following an upgrade, ndb_mgmd would fail with an ArbitrationError. (Bug#31690)
The NDB management client command node_id REPORT MEMORY provided no output when node_id was the node ID of a
management or API node. Now, when this occurs, the management client responds with Node node_id: is not a data
node. (Bug#29485)
Performing DELETE operations after a data node had been shut down could lead to inconsistent data following a restart of the node.
(Bug#26450)
UPDATE IGNORE could sometimes fail on NDB tables due to the use of unitialized data when checking for duplicate keys to be ig-
nored. (Bug#25817)
Changes in MySQL Cluster NDB 6.3.5 (5.1.22-ndb-6.3.5)
Bugs fixed:
A query against a table with TEXT or BLOB columns that would return more than a certain amount of data failed with GOT ERROR
4350 'TRANSACTION ALREADY ABORTED' FROM NDBCLUSTER. (Bug#31482)
This regression was introduced by Bug#29102.
Changes in MySQL Cluster NDB 6.3.4 (5.1.22-ndb-6.3.4)
Functionality added or changed:
Incompatible Change: The --ndb_optimized_node_selection startup option for mysqld now allows a wider range of
values and corresponding behaviors for SQL nodes when selecting a transaction coordinator.
You should be aware that the default value and behavior as well as the value type used for this option have changed, and that you
may need to update the setting used for this option in your my.cnf file prior to upgrading mysqld. See Section 5.1.4, Server Sys-
tem Variables, for more information.
Incompatible Change: The --ndb_optimized_node_selection startup option for mysqld now allows a wider range of
values and corresponding behaviors for SQL nodes when selecting a transaction coordinator.
You should be aware that the default value and behavior as well as the value type used for this option have changed, and that you
may need to update the setting used for this option in your my.cnf file prior to upgrading mysqld. See Section 5.1.4, Server Sys-
tem Variables, for more information.
Bugs fixed:
It was possible in some cases for a node group to be lost due to missed local checkpoints following a system restart. (Bug#31525)
NDB tables having names containing nonalphanumeric characters (such as $ ) were not discovered correctly. (Bug#31470)
A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart. (Bug#31257)
A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
Transaction timeouts were not handled well in some circumstances, leading to excessive number of transactions being aborted unne-
cessarily. (Bug#30379)
In some cases, the cluster managment server logged entries multiple times following a restart of mgmd. (Bug#29565)
ndb_mgm --help did not display any information about the -a option. (Bug#29509)
An interpreted program of sufficient size and complexity could cause all cluster data nodes to shut down due to buffer overruns.
MySQL Cluster NDB 6.X/7.X
1826
Bug#29390)
The cluster log was formatted inconsistently and contained extraneous newline characters. (Bug#25064)
Changes in MySQL Cluster NDB 6.3.3 (5.1.22-ndb-6.3.3)
Functionality added or changed:
Mapping of NDB error codes to MySQL storage engine error codes has been improved. (Bug#28423)
Bugs fixed:
Partitioning: EXPLAIN PARTITIONS reported partition usage by queries on NDB tables according to the standard MySQL hash
function than the hash function used in the NDB storage engine. (Bug#29550)
Attempting to restore a backup made on a cluster host using one endian to a machine using the other endian could cause the cluster
to fail. (Bug#29674)
The description of the --print option provided in the output from ndb_restore --help was incorrect. (Bug#27683)
Restoring a backup made on a cluster host using one endian to a machine using the other endian failed for BLOB and DATETIME
columns. (Bug#27543, Bug#30024)
Changes in MySQL Cluster NDB 6.3.2 (5.1.22-ndb-6.3.2)
Functionality added or changed:
Online ADD COLUMN, ADD INDEX, and DROP INDEX operations can now be performed explicitly for NDB tables, as well as on-
line renaming of tables and columns for NDB and MyISAM tables that is, without copying or locking of the affected tables us-
ing ALTER ONLINE TABLE.
Indexes can also be created and dropped online using CREATE INDEX and DROP INDEX, respectively, using the ONLINE
keyword.
You can force operations that would otherwise be performed online to be done offline using the OFFLINE keyword.
See Section 12.1.7, ALTER TABLE Syntax, Section 12.1.13, CREATE INDEX Syntax, and Section 12.1.24, DROP INDEX
Syntax, for more information.
It is now possible to control whether fixed-width or variable-width storage is used for a given column of an NDB table by means of
the COLUMN_FORMAT specifier as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
It is also possible to control whether a given column of an NDB table is stored in memory or on disk, using the STORAGE specifier
as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
For permitted values and other information about COLUMN_FORMAT and STORAGE, see Section 12.1.17, CREATE TABLE Syn-
tax.
A new cluster management server startup option --bind-address makes it possible to restrict management client connections to
ndb_mgmd to a single host and port. For more information, see Section 17.6.24.3, Program Options for ndb_mgmd.
Bugs fixed:
When an NDB event was left behind but the corresponding table was later recreated and received a new table ID, the event could not
be dropped. (Bug#30877)
An insufficiently descriptive and potentially misleading Error 4006 (CONNECT FAILURE - OUT OF CONNECTION OBJECTS...) was
produced when either of the following two conditions occurred:
MySQL Cluster NDB 6.X/7.X
1827
1. There were no more transaction records in the transaction coordinator
2. An NDB object in the NDB API was initialized with insufficient parallelism
Separate error messages are now generated for each of these two cases. (Bug#11313)
Changes in MySQL Cluster NDB 6.3.0 (5.1.19-ndb-6.3.0)
Functionality added or changed:
Reporting functionality has been significantly enhanced in this release:
A new configuration parameter BackupReportFrequency now makes it possible to cause the management client to provide
status reports at regular intervals as well as for such reports to be written to the cluster log (depending on cluster event logging
levels). See Section 17.3.4.6, Defining MySQL Cluster Data Nodes, for more information about this parameter.
A new REPORT command has been added in the cluster management client. REPORT BackupStatus allows you to obtain a
backup status report at any time during a backup. REPORT MemoryUsage reports the current data memory and index memory
used by each data node. For more about the REPORT command, see Section 17.7.2, Commands in the MySQL Cluster Man-
agement Client.
ndb_restore now provides running reports of its progress when restoring a backup. In addition, a complete report status re-
port on the backup is written to the cluster log.
A new configuration parameter ODirect causes NDB to attempt using O_DIRECT writes for LCP, backups, and redo logs, often
lowering CPU usage.
17.16.3. Unified Changelog MySQL Cluster NDB 6.2.x
This section contains unified change history highlights for all MySQL Cluster releases based on version 6.2 of the NDBCLUSTER stor-
age engine through MySQL Cluster NDB 6.2.19. Included are all changelog entries in the categories MySQL Cluster, Disk Data, and
Cluster API.
For an overview of features that were added added in MySQL Cluster NDB 6.2, see Section 17.13.3, Features Added in MySQL
Cluster NDB 6.2.
Changes in MySQL Cluster NDB 6.2.18 (5.1.34-ndb-6.2.18)
Changes in MySQL Cluster NDB 6.2.17 (5.1.32-ndb-6.2.17)
Changes in MySQL Cluster NDB 6.2.16 (5.1.28-ndb-6.2.16)
Changes in MySQL Cluster NDB 6.2.14 (5.1.23-ndb-6.2.14)
Changes in MySQL Cluster NDB 6.2.13 (5.1.23-ndb-6.2.13)
Changes in MySQL Cluster NDB 6.2.12 (5.1.23-ndb-6.2.12)
Changes in MySQL Cluster NDB 6.2.11 (5.1.23-ndb-6.2.11)
Changes in MySQL Cluster NDB 6.2.10 (5.1.23-ndb-6.2.10)
Changes in MySQL Cluster NDB 6.2.9 (5.1.22-ndb-6.2.9)
Changes in MySQL Cluster NDB 6.2.8 (5.1.22-ndb-6.2.8)
Changes in MySQL Cluster NDB 6.2.7 (5.1.22-ndb-6.2.7)
Changes in MySQL Cluster NDB 6.2.6 (5.1.22-ndb-6.2.6)
Changes in MySQL Cluster NDB 6.2.5 (5.1.22-ndb-6.2.5)
MySQL Cluster NDB 6.X/7.X
1828
Changes in MySQL Cluster NDB 6.2.4 (5.1.19-ndb-6.2.4)
Changes in MySQL Cluster NDB 6.2.3 (5.1.19-ndb-6.2.3)
Changes in MySQL Cluster NDB 6.2.2 (5.1.18-ndb-6.2.2)
Changes in MySQL Cluster NDB 6.2.1 (5.1.18-ndb-6.2.1)
Changes in MySQL Cluster NDB 6.2.0 (5.1.16-ndb-6.2.0)
Changes in MySQL Cluster NDB 6.2.18 (5.1.34-ndb-6.2.18)
Bugs fixed:
Important Change: Partitioning: User-defined partitioning of an NDBCLUSTER table without any primary key sometimes failed,
and could cause mysqld to crash.
Now, if you wish to create an NDBCLUSTER table with user-defined partitioning, the table must have an explicit primary key, and
all columns listed in the partitioning expression must be part of the primary key. The hidden primary key used by the NDBCLUSTER
storage engine is not sufficient for this purpose. However, if the list of columns is empty (that is, the table is defined using PARTI-
TION BY [LINEAR] KEY()), then no explicit primary key is required.
This change does not effect the partitioning of tables using any storage engine other than NDBCLUSTER. (Bug#40709)
An internal NDB API buffer was not properly initialized. (Bug#44977)
When a data node had written its GCI marker to the first page of a megabyte, and that node was later killed during restart after hav-
ing processed that page (marker) but before completing a LCP, the data node could fail with filesystem errors. (Bug#44952)
See also Bug#42564.
Inspection of the code revealed that several assignment operators (=) were used in place of comparison operators (==) in Dbdih-
Main.cpp. (Bug#44567)
See also Bug#44570.
It was possible for NDB API applications to insert corrupt data into the database, which could subquently lead to data node crashes.
Now, stricter checking is enforced on input data for inserts and updates. (Bug#44132)
TransactionDeadlockDetectionTimeout values less than 100 were treated as 100. This could cause scans to time out un-
expectedly. (Bug#44099)
The file ndberror.c contained a C++-style comment, which caused builds to fail with some C compilers. (Bug#44036)
A race condition could occur when a data node failed to restart just before being included in the next global checkpoint. This could
cause other data nodes to fail. (Bug#43888)
When trying to use a data node with an older version of the management server, the data node crashed on startup. (Bug#43699)
Using indexes containing variable-sized columns could lead to internal errors when the indexes were being built. (Bug#43226)
In some cases, data node restarts during a system restart could fail due to insufficient redo log space. (Bug#43156)
Some queries using combinations of logical and comparison operators on an indexed column in the WHERE clause could fail with
the error GOT ERROR 4541 'INDEXBOUND HAS NO BOUND INFORMATION' FROM NDBCLUSTER. (Bug#42857)
ndb_restore --print_data did not handle DECIMAL columns correctly. (Bug#37171)
The output of ndbd --help did not provide clear information about the program's --initial and --initial-start op-
tions. (Bug#28905)
It was theoretically possible for the value of a nonexistent column to be read as NULL, rather than causing an error. (Bug#27843)
When aborting an operation involving both an insert and a delete, the insert and delete were aborted separately. This was because
the transaction coordinator did not know that the operations affected on same row, and, in the case of a committed-read (tuple or in-
MySQL Cluster NDB 6.X/7.X
1829
dex) scan, the abort of the insert was performed first, then the row was examined after the insert was aborted but before the delete
was aborted. In some cases, this would leave the row in a inconsistent state. This could occur when a local checkpoint was per-
formed during a backup. This issue did not affect primary ley operations or scans that used locks (these are serialized).
After this fix, for ordered indexes, all operations that follow the operation to be aborted are now also aborted.
Disk Data: Partitioning: An NDBCLUSTER table created with a very large value for the MAX_ROWS option could if this table
was dropped and a new table with fewer partitions, but having the same table ID, was created cause ndbd to crash when per-
forming a system restart. This was because the server attempted to examine each partition whether or not it actually existed.
(Bug#45154)
Disk Data: During a checkpoint, restore points are created for both the on-disk and in-memory parts of a Disk Data table. Under
certain rare conditions, the in-memory restore point could include or exclude a row that should have been in the snapshot. This
would later later lead to a crash during or following recovery. (Bug#41915)
Disk Data: When a log file group had an undo log file whose size was too small, restarting data nodes failed with READ UNDERFLOW
errors.
As a result of this fix, the minimum allowed INTIAL_SIZE for an undo log file is now 1M (1 megabyte). (Bug#29574)
Disk Data: This fix supercedes and improves on an earlier fix made for this bug in MySQL 5.1.18. (Bug#24521)
Cluster API: If the largest offset of a RecordSpecification used for an NdbRecord object was for the NULL bits (and thus
not a column), this offset was not taken into account when calculating the size used for the RecordSpecification. This meant
that the space for the NULL bits could be overwritten by key or other information. (Bug#43891)
Cluster API: The default NdbRecord structures created by NdbDictionary could have overlapping null bits and data fields.
(Bug#43590)
Cluster API: When performing insert or write operations, NdbRecord allows key columns to be specified in both the key record
and in the attribute record. Only one key column value for each key column should be sent to the NDB kernel, but this was not guar-
anteed. This is now ensured as follows: For insert and write operations, key column values are taken from the key record; for scan
takeover update operations, key column values are taken from the attribute record. (Bug#42238)
Cluster API: Ordered index scans using NdbRecord formerly expressed a BoundEQ range as separate lower and upper bounds,
resulting in 2 copies of the column values being sent to the NDB kernel.
Now, when a range is specified by NdbScanOperation::setBound(), the passed pointers, key lengths, and inclusive bits are
compared, and only one copy of the equal key columns is sent to the kernel. This makes such operations more efficient, as half the
amount of KeyInfo is now sent for a BoundEQ range as before. (Bug#38793)
Changes in MySQL Cluster NDB 6.2.17 (5.1.32-ndb-6.2.17)
Functionality added or changed:
Important Change: Formerly, when the management server failed to create a transporter for a data node connection,
net_write_timeout seconds elapsed before the data node was actually allowed to disconnect. Now in such cases the discon-
nection occurs immediately. (Bug#41965)
See also Bug#41713.
Disk Data: It is now possible to specify default locations for Disk Data data files and undo log files, either together or separately,
using the data node configuration parameters FileSystemPathDD, FileSystemPathDataFiles, and FileSystem-
PathUndoFiles. For information about these configuration parameters, see Disk Data filesystem parameters.
It is also now possible to specify a log file group, tablespace, or both, that is created when the cluster is started, using the Ini-
tialLogFileGroup and InitialTablespace data node configuration parameters. For information about these configura-
tion parameters, see Disk Data object creation parameters.
Bugs fixed:
Packaging: Packages for MySQL Cluster were missing the libndbclient.so and libndbclient.a files. (Bug#42278)
MySQL Cluster NDB 6.X/7.X
1830
Partitioning: Executing ALTER TABLE ... REORGANIZE PARTITION on an NDBCLUSTER table having only one partition
caused mysqld to crash. (Bug#41945)
See also Bug#40389.
Cluster API: Failed operations on BLOB and TEXT columns were not always reported correctly to the originating SQL node. Such
errors were sometimes reported as being due to timeouts, when the actual problem was a transporter overload due to insufficient
buffer space. (Bug#39867, Bug#39879)
Cluster API: Failed operations on BLOB and TEXT columns were not always reported correctly to the originating SQL node. Such
errors were sometimes reported as being due to timeouts, when the actual problem was a transporter overload due to insufficient
buffer space. (Bug#39867, Bug#39879)
Backup IDs greater than 2
31
were not handled correctly, causing negative values to be used in backup directory names and printouts.
(Bug#43042)
When using ndbmtd, NDB kernel threads could hang while trying to start the data nodes with LockPagesInMainMemory set
to 1. (Bug#43021)
When using multiple management servers and starting several API nodes (possibly including one or more SQL nodes) whose con-
nectstrings listed the management servers in different order, it was possible for 2 API nodes to be assigned the same node ID. When
this happened it was possible for an API node not to get fully connected, consequently producing a number of errors whose cause
was not easily recognizable. (Bug#42973)
ndb_error_reporter worked correctly only with GNU tar. (With other versions of tar, it produced empty archives.)
(Bug#42753)
Triggers on NDBCLUSTER tables caused such tables to become locked. (Bug#42751)
See also Bug#16229, Bug#18135.
When performing more than 32 index or tuple scans on a single fragment, the scans could be left hanging. This caused unnecessary
timeouts, and in addition could possibly lead to a hang of an LCP. (Bug#42559)
A data node failure that occurred between calls to NdbIndexScanOperation::readTuples(SF_OrderBy) and Ndb-
Transaction::Execute() was not correctly handled; a subsequent call to nextResult() caused a null pointer to be defer-
enced, leading to a segfault in mysqld. (Bug#42545)
Issuing SHOW GLOBAL STATUS LIKE 'NDB%' before mysqld had connected to the cluster caused a segmentation fault.
(Bug#42458)
Data node failures that occurred before all data nodes had connected to the cluster were not handled correctly, leading to additional
data node failures. (Bug#42422)
When a cluster backup failed with Error 1304 (Node node_id1: Backup request from node_id2 failed to start), no clear reason
for the failure was provided.
As part of this fix, MySQL Cluster now retries backups in the event of sequence errors. (Bug#42354)
See also Bug#22698.
Issuing SHOW ENGINE NDBCLUSTER STATUS on an SQL node before the management server had connected to the cluster
caused mysqld to crash. (Bug#42264)
A maximum of 11 TUP scans were allowed in parallel. (Bug#42084)
Trying to execute an ALTER ONLINE TABLE ... ADD COLUMN statement while inserting rows into the table caused mysqld
to crash. (Bug#41905)
If the master node failed during a global checkpoint, it was possible in some circumstances for the new master to use an incorrect
value for the global checkpoint index. This could occur only when the cluster used more than one node group. (Bug#41469)
API nodes disconnected too agressively from cluster when data nodes were being restarted. This could sometimes lead to the API
node being unable to access the cluster at all during a rolling restart. (Bug#41462)
An abort path in the DBLQH kernel block failed to release a commit acknowledgement marker. This meant that, during node failure
MySQL Cluster NDB 6.X/7.X
1831
handling, the local query handler could be added multiple times to the marker record which could lead to additional node failures
due an array overflow. (Bug#41296)
During node failure handling (of a data node other than the master), there was a chance that the master was waiting for a
GCP_NODEFINISHED signal from the failed node after having received it from all other data nodes. If this occurred while the
failed node had a transaction that was still being committed in the current epoch, the master node could crash in the DBTC kernel
block when discovering that a transaction actually belonged to an epoch which was already completed. (Bug#41295)
If a transaction was aborted during the handling of a data node failure, this could lead to the later handling of an API node failure
not being completed. (Bug#41214)
Given a MySQL Cluster containing no data (that is, whose data nodes had all been started using --initial, and into which no
data had yet been imported) and having an empty backup directory, executing START BACKUP with a user-specified backup ID
caused the data nodes to crash. (Bug#41031)
Issuing EXIT in the management client sometimes caused the client to hang. (Bug#40922)
Redo log creation was very slow on some platforms, causing MySQL Cluster to start more slowly than necessary with some com-
binations of hardware and operating system. This was due to all write operations being synchronized to disk while creating a redo
log file. Now this synchronization occurs only after the redo log has been created. (Bug#40734)
Transaction failures took longer to handle than was necessary.
When a data node acting as transaction coordinator (TC) failed, the surviving data nodes did not inform the API node initiating the
transaction of this until the failure had been processed by all protocols. However, the API node needed only to know about failure
handling by the transaction protocol that is, it needed to be informed only about the TC takeover process. Now, API nodes
(including MySQL servers acting as cluster SQL nodes) are informed as soon as the TC takeover is complete, so that it can carry on
operating more quickly. (Bug#40697)
It was theoretically possible for stale data to be read from NDBCLUSTER tables when the transaction isolation level was set to
ReadCommitted. (Bug#40543)
In some cases, NDB did not check correctly whether tables had changed before trying to use the query cache. This could result in a
crash of the debug MySQL server. (Bug#40464)
Restoring a MySQL Cluster from a dump made using mysqldump failed due to a spurious error: CAN'T EXECUTE THE GIVEN
COMMAND BECAUSE YOU HAVE ACTIVE LOCKED TABLES OR AN ACTIVE TRANSACTION. (Bug#40346)
O_DIRECT was incorrectly disabled when making MySQL Cluster backups. (Bug#40205)
Events logged after setting ALL CLUSTERLOG STATISTICS=15 in the management client did not always include the node ID
of the reporting node. (Bug#39839)
Start phase reporting was inconsistent between the management client and the cluster log. (Bug#39667)
The MySQL Query Cache did not function correctly with NDBCLUSTER tables containing TEXT columns. (Bug#39295)
A segfault in Logger::Log caused ndbd to hang indefinitely. This fix improves on an earlier one for this issue, first made in
MySQL Cluster NDB 6.2.16 and MySQL Cluster NDB 6.3.17. (Bug#39180)
See also Bug#38609.
Memory leaks could occur in handling of strings used for storing cluster metadata and providing output to users. (Bug#38662)
In the event that a MySQL Cluster backup failed due to file permissions issues, conflicting reports were issued in the management
client. (Bug#34526)
A duplicate key error raised when inserting into an NDBCLUSTER table caused the current transaction to abort, after which any SQL
statement other than a ROLLBACK failed. With this fix, the NDBCLUSTER storage engine now supports rollback of individual state-
ments in such cases, and it is no longer necessary to issue an explicit ROLLBACK and then retry the entire transaction. (Bug#32656)
Error messages for NDBCLUSTER error codes 1224 and 1227 were missing. (Bug#28496)
Disk Data: It was not possible to add an in-memory column online to a table that used a table-level or column-level STORAGE
DISK option. The same issue prevented ALTER ONLINE TABLE ... REORGANIZE PARTITION from working on Disk
Data tables. (Bug#42549)
MySQL Cluster NDB 6.X/7.X
1832
Disk Data: Issuing concurrent CREATE TABLESPACE, ALTER TABLESPACE, CREATE LOGFILE GROUP, or ALTER LOG-
FILE GROUP statements on separate SQL nodes caused a resource leak that led to data node crashes when these statements were
used again later. (Bug#40921)
Disk Data: Disk-based variable-length columns were not always handled like their memory-based equivalents, which could poten-
tially lead to a crash of cluster data nodes. (Bug#39645)
Disk Data: Creating a Disk Data tablespace with a very large extent size caused the data nodes to fail. The issue was observed when
using extent sizes of 100 MB and larger. (Bug#39096)
Disk Data: Creation of a tablespace data file whose size was greater than 4 GB failed silently on 32-bit platforms. (Bug#37116)
See also Bug#29186.
Disk Data: O_SYNC was incorrectly disabled on platforms that do not support O_DIRECT. This issue was noted on Solaris but
could have affected other platforms not having O_DIRECT capability. (Bug#34638)
Disk Data: Trying to execute a CREATE LOGFILE GROUP statement using a value greater than 150M for
UNDO_BUFFER_SIZE caused data nodes to crash.
As a result of this fix, the upper limit for UNDO_BUFFER_SIZE is now 600M; attempting to set a higher value now fails gracefully
with an error. (Bug#34102)
Disk Data: When attempting to create a tablespace that already existed, the error message returned was TABLE OR INDEX WITH
GIVEN NAME ALREADY EXISTS. (Bug#32662)
Disk Data: Using a path or filename longer than 128 characters for Disk Data undo log files and tablespace data files caused a num-
ber of issues, including failures of CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, and AL-
TER TABLESPACE statements, as well as crashes of management nodes and data nodes.
With this fix, the maximum length for path and file names used for Disk Data undo log files and tablespace data files is now the
same as the maximum for the operating system. (Bug#31769, Bug#31770, Bug#31772)
Disk Data: Starting a cluster under load such that Disk Data tables used most of the undo buffer could cause data node failures.
The fix for this bug also corrected an issue in the LGMAN kernel block where the amount of free space left in the undo buffer was
miscalculated, causing buffer overruns. This could cause records in the buffer to be overwritten, leading to problems when restarting
data nodes. (Bug#28077)
Disk Data: Attempting to perform a system restart of the cluster where there existed a logfile group without and undo log files
caused the data nodes to crash.
Note
While issuing a CREATE LOGFILE GROUP statement without an ADD UNDOFILE option fails with an error in the
MySQL server, this situation could arise if an SQL node failed during the execution of a valid CREATE LOGFILE
GROUP statement; it is also possible to create a logfile group without any undo log files using the NDB API.
(Bug#17614)
Cluster API: Some error messages from ndb_mgmd contained newline (\n) characters. This could break the MGM API protocol,
which uses the newline as a line separator. (Bug#43104)
Cluster API: When using an ordered index scan without putting all key columns in the read mask, this invalid use of the NDB API
went undetected, which resulted in the use of uninitialized memory. (Bug#42591)
Cluster API: The MGM API reset error codes on management server handles before checking them. This meant that calling an
MGM API function with a null handle caused applications to crash. (Bug#40455)
Cluster API: It was not always possible to access parent objects directly from NdbBlob, NdbOperation, and NdbScanOper-
ation objects. To alleviate this problem, a new getNdbOperation() method has been added to NdbBlob and new getNdb-
Transaction() methods have been added to NdbOperation and NdbScanOperation. In addition, a const variant of NdbOp-
eration::getErrorLine() is now also available. (Bug#40242)
Cluster API: NdbScanOperation::getBlobHandle() failed when used with incorrect column names or numbers.
(Bug#40241)
MySQL Cluster NDB 6.X/7.X
1833
Cluster API: The NDB API example programs included in MySQL Cluster source distributions failed to compile. (Bug#37491)
See also Bug#40238.
Cluster API: mgmapi.h contained constructs which only worked in C++, but not in C. (Bug#27004)
Changes in MySQL Cluster NDB 6.2.16 (5.1.28-ndb-6.2.16)
Functionality added or changed:
It is no longer a requirement for database autodiscovery that an SQL node already be connected to the cluster at the time that a data-
base is created on another SQL node. It is no longer necessary to issue CREATE DATABASE (or CREATE SCHEMA) statements on
an SQL node joining the cluster after a database is created in order for the new SQL node to see the database and any NDCLUSTER
tables that it contains. (Bug#39612)
Bugs fixed:
Heavy DDL usage caused the mysqld processes to hang due to a timeout error (NDB error code 266). (Bug#39885)
Executing EXPLAIN SELECT on an NDBCLUSTER table could cause mysqld to crash. (Bug#39872)
Starting the MySQL Server with the --ndbcluster option plus an invalid command-line option (for example, using mysqld -
-ndbcluster --foobar) caused it to hang while shutting down the binlog thread. (Bug#39635)
Dropping and then re-creating a database on one SQL node caused other SQL nodes to hang. (Bug#39613)
Setting a low value of MaxNoOfLocalScans (< 100) and performing a large number of (certain) scans could cause the Transac-
tion Coordinator to run out of scan fragment records, and then crash. Now when this resource is exhausted, the cluster returns Error
291 (OUT OF SCANFRAG RECORDS IN TC (INCREASE MAXNOOFLOCALSCANS)) instead. (Bug#39549)
Creating a unique index on an NDBCLUSTER table caused a memory leak in the NDB subscription manager (SUMA) which could
lead to mysqld hanging, due to the fact that the resource shortage was not reported back to the NDB kernel correctly. (Bug#39518)
See also Bug#39450.
Unique identifiers in tables having no primary key were not cached. This fix has been observed to increase the efficiency of IN-
SERT operations on such tables by as much as 50%. (Bug#39267)
MgmtSrvr::allocNodeId() left a mutex locked following an AMBIGUITY FOR NODE IF %D error. (Bug#39158)
An invalid path specification caused mysql-test-run.pl to fail. (Bug#39026)
During transactional coordinator takeover (directly after node failure), the LQH finding an operation in the LOG_COMMIT state sent
an LQH_TRANS_CONF signal twice, causing the TC to fail. (Bug#38930)
An invalid memory access caused the management server to crash on Solaris Sparc platforms. (Bug#38628)
A segfault in Logger::Log caused ndbd to hang indefinitely. (Bug#38609)
ndb_mgmd failed to start on older Linux distributions (2.4 kernels) that did not support e-polling. (Bug#38592)
When restarting a data node, an excessively long shutodwn message could cause the node process to crash. (Bug#38580)
ndb_mgmd sometimes performed unnecessary network I/O with the client. This in combination with other factors led to long-
running threads that were attempting to write to clients that no longer existed. (Bug#38563)
ndb_restore failed with a floating point exception due to a division by zero error when trying to restore certain data files.
(Bug#38520)
A failed connection to the management server could cause a resource leak in ndb_mgmd. (Bug#38424)
Failure to parse configuration parameters could cause a memory leak in the NDB log parser. (Bug#38380)
MySQL Cluster NDB 6.X/7.X
1834
After a forced shutdown and initial restart of the cluster, it was possible for SQL nodes to retain .FRM files corresponding to NDB-
CLUSTER tables that had been dropped, and thus to be unaware that these tables no longer existed. In such cases, attempting to re-
create the tables using CREATE TABLE IF NOT EXISTS could fail with a spurious TABLE ... DOESN'T EXIST error.
(Bug#37921)
Renaming an NDBCLUSTER table on one SQL node, caused a trigger on this table to be deleted on another SQL node. (Bug#36658)
Attempting to add a UNIQUE INDEX twice to an NDBCLUSTER table, then deleting rows from the table could cause the MySQL
Server to crash. (Bug#35599)
ndb_restore failed when a single table was specified. (Bug#33801)
GCP_COMMIT did not wait for transaction takeover during node failure. This could cause GCP_SAVE_REQ to be executed too
early. This could also cause (very rarely) replication to skip rows. (Bug#30780)
Cluster API: Passing a value greater than 65535 to NdbInterpretedCode::add_val() and NdbInterpreted-
Code::sub_val() caused these methods to have no effect. (Bug#39536)
Cluster API: The NdbScanOperation::readTuples() method could be called multiple times without error. (Bug#38717)
Cluster API: Certain Multi-Range Read scans involving IS NULL and IS NOT NULL comparisons failed with an error in the
NDB local query handler. (Bug#38204)
Cluster API: Problems with the public headers prevented NDB applications from being built with warnings turned on. (Bug#38177)
Cluster API: Creating an NdbScanFilter object using an NdbScanOperation object that had not yet had its
readTuples() method called resulted in a crash when later attempting to use the NdbScanFilter. (Bug#37986)
Cluster API: Executing an NdbRecord interpreted delete created with an ANYVALUE option caused the transaction to abort.
(Bug#37672)
Cluster API: Accesing the debug version of libndbclient via dlopen() resulted in a segmentation fault. (Bug#35927)
Changes in MySQL Cluster NDB 6.2.14 (5.1.23-ndb-6.2.14)
Functionality added or changed:
Added the MaxBufferedEpochs data node configuration parameter, which controls the maximum number of unprocessed
epochs by which a subscribing node can lag. Subscribers which exceed this number are disconnected and forced to reconnect.
See Section 17.3.4.6, Defining MySQL Cluster Data Nodes, for more information.
Bugs fixed:
Incompatible Change: The UPDATE statement allowed NULL to be assigned to NOT NULL columns (the implicit default value for
the column data type was assigned). This was changed so that on error occurs.
This change was reverted, because the original report was determined not to be a bug: Assigning NULL to a NOT NULL column in
an UPDATE statement should produce an error only in strict SQL mode and set the column to the implicit default with a warning
otherwise, which was the original behavior. See Section 10.1.4, Data Type Default Values, and Bug#39265. (Bug#33699)
Cluster API: Closing a scan before it was executed caused the application to segfault. (Bug#36375)
Cluster API: Using NDB API applications from older MySQL Cluster versions with libndbclient from newer ones caused the
cluster to fail. (Bug#36124)
Cluster API: Scans having no bounds set were handled incorrectly. (Bug#35876)
Changes in MySQL Cluster NDB 6.2.13 (5.1.23-ndb-6.2.13)
Bugs fixed:
MySQL Cluster NDB 6.X/7.X
1835
A node failure during an initial node restart followed by another node start could cause the master data node to fail, because it incor-
rectly gave the node permission to start even if the invalidated node's LCP was still running. (Bug#34702)
Changes in MySQL Cluster NDB 6.2.12 (5.1.23-ndb-6.2.12)
Bugs fixed:
Upgrades of a cluster using while a DataMemory setting in excess of 16 GB caused data nodes to fail. (Bug#34378)
Performing many SQL statements on NDB tables while in autocommit mode caused a memory leak in mysqld. (Bug#34275)
In certain rare circumstances, a race condition could occur between an aborted insert and a delete leading a data node crash.
(Bug#34260)
Multi-table updates using ordered indexes during handling of node failures could cause other data nodes to fail. (Bug#34216)
When configured with NDB support, MySQL failed to compile using gcc 4.3 on 64bit FreeBSD systems. (Bug#34169)
The failure of a DDL statement could sometimes lead to node failures when attempting to execute subsequent DDL statements.
(Bug#34160)
Extremely long SELECT statements (where the text of the statement was in excess of 50000 characters) against NDB tables returned
empty results. (Bug#34107)
Statements executing multiple inserts performed poorly on NDB tables having AUTO_INCREMENT columns. (Bug#33534)
The ndb_waiter utility polled ndb_mgmd excessively when obtaining the status of cluster data nodes. (Bug#32025)
See also Bug#32023.
Transaction atomicity was sometimes not preserved between reads and inserts under high loads. (Bug#31477)
Having tables with a great many columns could cause Cluster backups to fail. (Bug#30172)
Cluster Replication: Disk Data: Statements violating unique keys on Disk Data tables (such as attempting to insert NULL into a
NOT NULL column) could cause data nodes to fail. When the statement was executed from the binlog, this could also result in fail-
ure of the slave cluster. (Bug#34118)
Disk Data: Updating in-memory columns of one or more rows of Disk Data table, followed by deletion of these rows and re-
insertion of them, caused data node failures. (Bug#33619)
Changes in MySQL Cluster NDB 6.2.11 (5.1.23-ndb-6.2.11)
Functionality added or changed:
Cluster API: Important Change: Because NDB_LE_MemoryUsage.page_size_kb shows memory page sizes in bytes rather
than kilobytes, it has been renamed to page_size_bytes. The name page_size_kb is now deprecated and thus subject to re-
moval in a future release, although it currently remains supported for reasons of backward compatibility. See The
Ndb_logevent_type Type, for more information about NDB_LE_MemoryUsage. (Bug#30271)
Bugs fixed:
High numbers of insert operations, delete operations, or both could cause NDB error 899 (ROWID ALREADY ALLOCATED) to occur un-
necessarily. (Bug#34033)
A periodic failure to flush the send buffer by the NDB TCP transporter could cause a unnecessary delay of 10 ms between opera-
tions. (Bug#34005)
A race condition could occur (very rarely) when the release of a GCI was followed by a data node failure. (Bug#33793)
Some tuple scans caused the wrong memory page to be accessed, leading to invalid results. This issue could affect both in-memory
MySQL Cluster NDB 6.X/7.X
1836
and Disk Data tables. (Bug#33739)
The server failed to reject properly the creation of an NDB table having an unindexed AUTO_INCREMENT column. (Bug#30417)
Issuing an INSERT ... ON DUPLICATE KEY UPDATE concurrently with or following a TRUNCATE statement on an NDB ta-
ble failed with NDB error 4350 TRANSACTION ALREADY ABORTED. (Bug#29851)
The Cluster backup process could not detect when there was no more disk space and instead continued to run until killed manually.
Now the backup fails with an appropriate error when disk space is exhausted. (Bug#28647)
It was possible in config.ini to define cluster nodes having node IDs greater than the maximum allowed value. (Bug#28298)
Cluster API: Transactions containing inserts or reads would hang during NdbTransaction::execute() calls made from
NDB API applications built against a MySQL Cluster version that did not support micro-GCPs accessing a later version that suppor-
ted micro-GCPs. This issue was observed while upgrading from MySQL Cluster NDB 6.1.23 to MySQL Cluster NDB 6.2.10 when
the API application built against the earlier version attempted to access a data node already running the later version, even after dis-
abling micro-GCPs by setting TimeBetweenEpochs equal to 0. (Bug#33895)
Cluster API: When reading a BIT(64) value using NdbOperation:getValue(), 12 bytes were written to the buffer rather
than the expected 8 bytes. (Bug#33750)
Changes in MySQL Cluster NDB 6.2.10 (5.1.23-ndb-6.2.10)
Bugs fixed:
Partitioning: When partition pruning on an NDB table resulted in an ordered index scan spanning only one partition, any descending
flag for the scan was wrongly discarded, causing ORDER BY DESC to be treated as ORDER BY ASC, MAX() to be handled incor-
rectly, and similar problems. (Bug#33061)
When all data and SQL nodes in the cluster were shut down abnormally (that is, other than by using STOP in the cluster manage-
ment client), ndb_mgm used excessive amounts of CPU. (Bug#33237)
When using micro-GCPs, if a node failed while preparing for a global checkpoint, the master node would use the wrong GCI.
(Bug#32922)
Under some conditions, performing an ALTER TABLE on an NDBCLUSTER table failed with a TABLE IS FULL error, even when
only 25% of DataMemory was in use and the result should have been a table using less memory (for example, changing a
VARCHAR(100) column to VARCHAR(80)). (Bug#32670)
Changes in MySQL Cluster NDB 6.2.9 (5.1.22-ndb-6.2.9)
Functionality added or changed:
Added the ndb_mgm client command DUMP 8011, which dumps all subscribers to the cluster log. See DUMP 8011, for more in-
formation.
Bugs fixed:
A local checkpoint could sometimes be started before the previous LCP was restorable from a global checkpoint. (Bug#32519)
High numbers of API nodes on a slow or congested network could cause connection negotiation to time out prematurely, leading to
the following issues:
Excessive retries
Excessive CPU usage
Partially connected API nodes
(Bug#32359)
The failure of a master node could lead to subsequent failures in local checkpointing. (Bug#32160)
MySQL Cluster NDB 6.X/7.X
1837
Adding a new TINYTEXT column to an NDB table which used COLUMN_FORMAT = DYNAMIC, and when binary logging was en-
abled, caused all cluster mysqld processes to crash. (Bug#30213)
After adding a new column of one of the TEXT or BLOB types to an NDB table which used COLUMN_FORMAT = DYNAMIC, it
was no longer possible to access or drop the table using SQL. (Bug#30205)
A restart of the cluster failed when more than 1 REDO phase was in use. (Bug#22696)
Changes in MySQL Cluster NDB 6.2.8 (5.1.22-ndb-6.2.8)
Bugs fixed:
In a cluster running in diskless mode and with arbitration disabled, the failure of a data node during an insert operation caused other
data node to fail. (Bug#31980)
An insert or update with combined range and equality constraints failed when run against an NDB table with the error GOT UNKNOWN
ERROR FROM NDB. An example of such a statement would be UPDATE t1 SET b = 5 WHERE a IN (7,8) OR a >=
10;. (Bug#31874)
An error with an if statement in sql/ha_ndbcluster.cc could potentially lead to an infinite loop in case of failure when
working with AUTO_INCREMENT columns in NDB tables. (Bug#31810)
The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
Following an upgrade, ndb_mgmd would fail with an ArbitrationError. (Bug#31690)
The NDB management client command node_id REPORT MEMORY provided no output when node_id was the node ID of a
management or API node. Now, when this occurs, the management client responds with Node node_id: is not a data
node. (Bug#29485)
Performing DELETE operations after a data node had been shut down could lead to inconsistent data following a restart of the node.
(Bug#26450)
UPDATE IGNORE could sometimes fail on NDB tables due to the use of unitialized data when checking for duplicate keys to be ig-
nored. (Bug#25817)
Changes in MySQL Cluster NDB 6.2.7 (5.1.22-ndb-6.2.7)
Bugs fixed:
It was possible in some cases for a node group to be lost due to missed local checkpoints following a system restart. (Bug#31525)
NDB tables having names containing nonalphanumeric characters (such as $ ) were not discovered correctly. (Bug#31470)
A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart. (Bug#31257)
A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
Transaction timeouts were not handled well in some circumstances, leading to excessive number of transactions being aborted unne-
cessarily. (Bug#30379)
In some cases, the cluster managment server logged entries multiple times following a restart of mgmd. (Bug#29565)
ndb_mgm --help did not display any information about the -a option. (Bug#29509)
The cluster log was formatted inconsistently and contained extraneous newline characters. (Bug#25064)
Changes in MySQL Cluster NDB 6.2.6 (5.1.22-ndb-6.2.6)
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1838
Mapping of NDB error codes to MySQL storage engine error codes has been improved. (Bug#28423)
Bugs fixed:
Partitioning: EXPLAIN PARTITIONS reported partition usage by queries on NDB tables according to the standard MySQL hash
function than the hash function used in the NDB storage engine. (Bug#29550)
When an NDB event was left behind but the corresponding table was later recreated and received a new table ID, the event could not
be dropped. (Bug#30877)
Attempting to restore a backup made on a cluster host using one endian to a machine using the other endian could cause the cluster
to fail. (Bug#29674)
The description of the --print option provided in the output from ndb_restore --help was incorrect. (Bug#27683)
Restoring a backup made on a cluster host using one endian to a machine using the other endian failed for BLOB and DATETIME
columns. (Bug#27543, Bug#30024)
An insufficiently descriptive and potentially misleading Error 4006 (CONNECT FAILURE - OUT OF CONNECTION OBJECTS...) was
produced when either of the following two conditions occurred:
1. There were no more transaction records in the transaction coordinator
2. An NDB object in the NDB API was initialized with insufficient parallelism
Separate error messages are now generated for each of these two cases. (Bug#11313)
Changes in MySQL Cluster NDB 6.2.5 (5.1.22-ndb-6.2.5)
Functionality added or changed:
The following improvements have been made in the ndb_size.pl utility:
The script can now be used with multiple databases; lists of databases and tables can also be excluded from analysis.
Schema name information has been added to index table calculations.
The database name is now an optional parameter, the exclusion of which causes all databases to be examined.
If selecting from INFORMATION_SCHEMA fails, the script now attempts to fall back to SHOW TABLES.
A --real_table_name option has been added; this designates a table to handle unique index size calculations.
The report title has been amended to cover cases where more than one database is being analyzed.
Support for a --socket option was also added.
For more information, see Section 17.6.21, ndb_size.pl NDBCLUSTER Size Requirement Estimator. (Bug#28683,
Bug#28253)
Online ADD COLUMN, ADD INDEX, and DROP INDEX operations can now be performed explicitly for NDB tables, as well as on-
line renaming of tables and columns for NDB and MyISAM tables that is, without copying or locking of the affected tables us-
ing ALTER ONLINE TABLE.
Indexes can also be created and dropped online using CREATE INDEX and DROP INDEX, respectively, using the ONLINE
keyword.
You can force operations that would otherwise be performed online to be done offline using the OFFLINE keyword.
See Section 12.1.7, ALTER TABLE Syntax, Section 12.1.13, CREATE INDEX Syntax, and Section 12.1.24, DROP INDEX
Syntax, for more information.
It is now possible to control whether fixed-width or variable-width storage is used for a given column of an NDB table by means of
the COLUMN_FORMAT specifier as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
MySQL Cluster NDB 6.X/7.X
1839
It is also possible to control whether a given column of an NDB table is stored in memory or on disk, using the STORAGE specifier
as part of the column's definition in a CREATE TABLE or ALTER TABLE statement.
For permitted values and other information about COLUMN_FORMAT and STORAGE, see Section 12.1.17, CREATE TABLE Syn-
tax.
A new cluster management server startup option --bind-address makes it possible to restrict management client connections to
ndb_mgmd to a single host and port. For more information, see Section 17.6.24.3, Program Options for ndb_mgmd.
Bugs fixed:
When handling BLOB columns, the addition of read locks to the lock queue was not handled correctly. (Bug#30764)
Discovery of NDB tables did not work correctly with INFORMATION_SCHEMA. (Bug#30667)
A file system close operation could fail during a node or system restart. (Bug#30646)
Using the --ndb-cluster-connection-pool option for mysqld caused DDL statements to be executed twice.
(Bug#30598)
ndb_size.pl failed on tables with FLOAT columns whose definitions included commas (for example, FLOAT(6,2)).
(Bug#29228)
Reads on BLOB columns were not locked when they needed to be to guarantee consistency. (Bug#29102)
See also Bug#31482.
A query using joins between several large tables and requiring unique index lookups failed to complete, eventually returning UKNOWN
ERROR after a very long period of time. This occurred due to inadequate handling of instances where the Transaction Coordinator ran
out of TransactionBufferMemory, when the cluster should have returned NDB error code 4012 (REQUEST NDBD TIME-OUT).
(Bug#28804)
An attempt to perform a SELECT ... FROM INFORMATION_SCHEMA.TABLES whose result included information about NDB
tables for which the user had no privileges crashed the MySQL Server on which the query was performed. (Bug#26793)
Cluster API: A call to CHECK_TIMEDOUT_RET() in mgmapi.cpp should have been a call to
DBUG_CHECK_TIMEDOUT_RET(). (Bug#30681)
Changes in MySQL Cluster NDB 6.2.4 (5.1.19-ndb-6.2.4)
Bugs fixed:
When restarting a data node, queries could hang during that node's start phase 5, and continue only after the node had entered phase
6. (Bug#29364)
Replica redo logs were inconsistently handled during a system restart. (Bug#29354)
Disk Data: Performing Disk Data schema operations during a node restart could cause forced shutdowns of other data nodes.
(Bug#29501)
Disk Data: Disk data meta-information that existed in ndbd might not be visible to mysqld. (Bug#28720)
Disk Data: The number of free extents was incorrectly reported for some tablespaces. (Bug#28642)
Changes in MySQL Cluster NDB 6.2.3 (5.1.19-ndb-6.2.3)
Functionality added or changed:
Important Change: The TimeBetweenWatchdogCheckInitial configuration parameter was added to allow setting of a
separate watchdog timeout for memory allocation during startup of the data nodes. See Section 17.3.4.6, Defining MySQL Cluster
MySQL Cluster NDB 6.X/7.X
1840
Data Nodes, for more information. (Bug#28899)
Cluster API: Important Change: A new NdbRecord object has been added to the NDB API. This object provides mapping to a
record stored in NDB. See The NdbRecord Interface, for more information.
auto_increment_increment and auto_increment_offset are now supported for NDB tables. (Bug#26342)
A REPORT BackupStatus command has been added in the cluster management client. This command allows you to obtain a
backup status report at any time during a backup. For more about this command, see Section 17.7.2, Commands in the MySQL
Cluster Management Client.
Reporting functionality has been significantly enhanced in this release:
A new configuration parameter BackupReportFrequency now makes it possible to cause the management client to provide
status reports at regular intervals as well as for such reports to be written to the cluster log (depending on cluster event logging
levels). See Section 17.3.4.6, Defining MySQL Cluster Data Nodes, for more information about this parameter.
A new REPORT command has been added in the cluster management client. REPORT BackupStatus allows you to obtain a
backup status report at any time during a backup. REPORT MemoryUsage reports the current data memory and index memory
used by each data node. For more about the REPORT command, see Section 17.7.2, Commands in the MySQL Cluster Man-
agement Client.
ndb_restore now provides running reports of its progress when restoring a backup. In addition, a complete report status re-
port on the backup is written to the cluster log.
A new configuration parameter ODirect causes NDB to attempt using O_DIRECT writes for LCP, backups, and redo logs, often
lowering CPU usage.
ndb_restore now provides running reports of its progress when restoring a backup. In addition, a complete report status report
on the backup is written to the cluster log.
A new configuration parameter BackupReportFrequency now makes it possible to cause the management client to provide
status reports at regular intervals as well as for such reports to be written to the cluster log (depending on cluster event logging
levels). See Section 17.3.4.6, Defining MySQL Cluster Data Nodes, for more information about this parameter.
A new memory allocator has been implemented for the NDB kernel, which allocates memory to tables 32K page by 32K page rather
than allocating it in variable-sized chunks as previously. This removes much of the memory overhead that was associated with the
old memory allocator.
Bugs fixed:
When a node failed to respond to a COPY_GCI signal as part of a global checkpoint, the master node was killed instead of the node
that actually failed. (Bug#29331)
Memory corruption could occur due to a problem in the DBTUP kernel block. (Bug#29229)
A query having a large IN(...) or NOT IN(...) list in the WHERE condition on an NDB table could cause mysqld to crash.
(Bug#29185)
In the event that two data nodes in the same node group and participating in a GCP crashed before they had written their respective
P0.sysfile files, QMGR could refuse to start, issuing an invalid INSUFFICIENT NODES FOR RESTART error instead. (Bug#29167)
An invalid comparison made during REDO validation that could lead to an ERROR WHILE READING REDO LOG condition.
(Bug#29118)
Attempting to restore a NULL row to a VARBINARY column caused ndb_restore to fail. (Bug#29103)
ndb_error_reporter now preserves timestamps on files. (Bug#29074)
The wrong data pages were sometimes invalidated following a global checkpoint. (Bug#29067)
If at least 2 files were involved in REDO invalidation, then file 0 of page 0 was not updated and so pointed to an invalid part of the
redo log. (Bug#29057)
MySQL Cluster NDB 6.X/7.X
1841
It is now possible to set the maximum size of the allocation unit for table memory using the MaxAllocate configuration paramet-
er. (Bug#29044)
When shutting down mysqld, the NDB binlog process was not shut down before log cleanup began. (Bug#28949)
A corrupt schema file could cause a FILE ALREADY OPEN error. (Bug#28770)
Having large amounts of memory locked caused swapping to disk. (Bug#28751)
Setting InitialNoOpenFiles equal to MaxNoOfOpenFiles caused an error. This was due to the fact that the actual value of
MaxNoOfOpenFiles as used by the cluster was offset by 1 from the value set in config.ini. (Bug#28749)
LCP files were not removed following an initial system restart. (Bug#28726)
UPDATE IGNORE statements involving the primary keys of multiple tables could result in data corruption. (Bug#28719)
A race condition could result when nonmaster nodes (in addition to the master node) tried to update active status due to a local
checkpoint (that is, between NODE_FAILREP and COPY_GCIREQ events). Now only the master updates the active status.
(Bug#28717)
A fast global checkpoint under high load with high usage of the redo buffer caused data nodes to fail. (Bug#28653)
The management client's response to START BACKUP WAIT COMPLETED did not include the backup ID. (Bug#27640)
Disk Data: When dropping a page, the stack's bottom entry could sometime be left cold rather than hot, violating the rules for
stack pruning. (Bug#29176)
Disk Data: When loading data into a cluster following a version upgrade, the data nodes could forcibly shut down due to page and
buffer management failures (that is, ndbrequire failures in PGMAN). (Bug#28525)
Disk Data: Repeated INSERT and DELETE operations on a Disk Data table having one or more large VARCHAR columns could
cause data nodes to fail. (Bug#20612)
Cluster API: The timeout set using the MGM API ndb_mgm_set_timeout() function was incorrectly interpreted as seconds
rather than as milliseconds. (Bug#29063)
Cluster API: An invalid error code could be set on transaction objects by BLOB handling code. (Bug#28724)
Changes in MySQL Cluster NDB 6.2.2 (5.1.18-ndb-6.2.2)
Functionality added or changed:
New cluster management client DUMP commands were added to aid in tracking transactions, scan operations, and locks. See DUMP
2350, DUMP 2352, and DUMP 2550, for more information.
Added the mysqld option --ndb-cluster-connection-pool that allows a single MySQL server to use multiple connec-
tions to the cluster. This allows for scaling out using multiple MySQL clients per SQL node instead of or in addition to using mul-
tiple SQL nodes with the cluster.
For more information about this option, see Section 17.4, MySQL Cluster Options and Variables.
Changes in MySQL Cluster NDB 6.2.1 (5.1.18-ndb-6.2.1)
Bugs fixed:
Multiple operations involving deletes followed by reads were not handled correctly.
Note
This issue could also affect MySQL Cluster Replication.
(Bug#28276)
MySQL Cluster NDB 6.X/7.X
1842
Cluster API: Using NdbBlob::writeData() to write data in the middle of an existing blob value (that is, updating the value)
could overwrite some data past the end of the data to be changed. (Bug#27018)
Changes in MySQL Cluster NDB 6.2.0 (5.1.16-ndb-6.2.0)
Functionality added or changed:
An ndb_wait_connected system variable has been added for mysqld. It causes mysqld wait a specified amount of time to
be connected to the cluster before accepting client connections. For more information, see Section 17.4.3, MySQL Cluster System
Variables.
Cluster API: The Ndb::startTransaction() method now provides an alternative interface for starting a transaction. See
Ndb::startTransaction(), for more information.
Cluster API: Methods were added to the Ndb_cluster_connection class to faciliate iterating over existing NDB objects. See
ndb_cluster_connection::get_next_ndb_object(), for more information.
17.16.4. Unfified Changelog MySQL Cluster NDB 6.1.x
This section contains unified change history highlights for all MySQL Cluster releases based on version 6.1 of the NDBCLUSTER stor-
age engine through MySQL Cluster NDB 5.1.15-ndb-6.1.23. Included are all changelog entries in the categories MySQL Cluster, Disk
Data, and Cluster API.
For an overview of features that were added added in MySQL Cluster NDB 6.1, see Section 17.13.2, Features Added in MySQL
Cluster NDB 6.1.
Note
MySQL Cluster NDB 6.1 is no longer being developed or maintained, and the information presented in this section should
be considered to be of historical interest only. If you are using MySQL Cluster NDB 6.1, you should upgrade as soon as
possible to the most recent version of MySQL Cluster NDB 6.2 or later MySQL Cluster release series.
Changes in MySQL Cluster NDB 6.1.23 (5.1.15-ndb-6.1.23)
Changes in MySQL Cluster NDB 6.1.22 (5.1.15-ndb-6.1.22)
Changes in MySQL Cluster NDB 6.1.21 (5.1.15-ndb-6.1.21)
Changes in MySQL Cluster NDB 6.1.19 (5.1.15-ndb-6.1.19)
Changes in MySQL Cluster NDB 6.1.18 (5.1.15-ndb-6.1.18)
Changes in MySQL Cluster NDB 6.1.17 (5.1.15-ndb-6.1.17)
Changes in MySQL Cluster NDB 6.1.16 (5.1.15-ndb-6.1.16)
Changes in MySQL Cluster NDB 6.1.15 (5.1.15-ndb-6.1.15)
Changes in MySQL Cluster NDB 6.1.14 (5.1.15-ndb-6.1.14)
Changes in MySQL Cluster NDB 6.1.13 (5.1.15-ndb-6.1.13)
Changes in MySQL Cluster NDB 6.1.12 (5.1.15-ndb-6.1.12)
Changes in MySQL Cluster NDB 6.1.11 (5.1.15-ndb-6.1.11)
Changes in MySQL Cluster NDB 6.1.10 (5.1.15-ndb-6.1.10)
Changes in MySQL Cluster NDB 6.1.9 (5.1.15-ndb-6.1.9)
Changes in MySQL Cluster NDB 6.1.8 (5.1.15-ndb-6.1.8)
MySQL Cluster NDB 6.X/7.X
1843
Changes in MySQL Cluster NDB 6.1.7 (5.1.15-ndb-6.1.7)
Changes in MySQL Cluster NDB 6.1.6 (5.1.15-ndb-6.1.6)
Changes in MySQL Cluster NDB 6.1.5 (5.1.15-ndb-6.1.5)
Changes in MySQL Cluster NDB 6.1.4 (5.1.15-ndb-6.1.4)
Changes in MySQL Cluster NDB 6.1.3 (5.1.15-ndb-6.1.3)
Changes in MySQL Cluster NDB 6.1.2 (5.1.15-ndb-6.1.2)
Changes in MySQL Cluster NDB 6.1.1 (5.1.15-ndb-6.1.1)
Changes in MySQL Cluster NDB 6.1.0 (5.1.14-ndb-6.1.0)
Changes in MySQL Cluster NDB 6.1.23 (5.1.15-ndb-6.1.23)
Bugs fixed:
The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
Changes in MySQL Cluster NDB 6.1.22 (5.1.15-ndb-6.1.22)
Bugs fixed:
It was possible in some cases for a node group to be lost due to missed local checkpoints following a system restart. (Bug#31525)
Changes in MySQL Cluster NDB 6.1.21 (5.1.15-ndb-6.1.21)
Bugs fixed:
A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart. (Bug#31257)
A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
Changes in MySQL Cluster NDB 6.1.19 (5.1.15-ndb-6.1.19)
Functionality added or changed:
Whenever a TCP send buffer is over 80% full, temporary error 1218 (SEND BUFFERS OVERLOADED IN NDB KERNEL) is now re-
turned. See SendBufferMemory for more information.
Changes in MySQL Cluster NDB 6.1.18 (5.1.15-ndb-6.1.18)
Bugs fixed:
When restarting a data node, queries could hang during that node's start phase 5, and continue only after the node had entered phase
6. (Bug#29364)
Disk Data: Disk data meta-information that existed in ndbd might not be visible to mysqld. (Bug#28720)
Disk Data: The number of free extents was incorrectly reported for some tablespaces. (Bug#28642)
Changes in MySQL Cluster NDB 6.1.17 (5.1.15-ndb-6.1.17)
MySQL Cluster NDB 6.X/7.X
1844
Bugs fixed:
Replica redo logs were inconsistently handled during a system restart. (Bug#29354)
Changes in MySQL Cluster NDB 6.1.16 (5.1.15-ndb-6.1.16)
Bugs fixed:
When a node failed to respond to a COPY_GCI signal as part of a global checkpoint, the master node was killed instead of the node
that actually failed. (Bug#29331)
An invalid comparison made during REDO validation that could lead to an ERROR WHILE READING REDO LOG condition.
(Bug#29118)
The wrong data pages were sometimes invalidated following a global checkpoint. (Bug#29067)
If at least 2 files were involved in REDO invalidation, then file 0 of page 0 was not updated and so pointed to an invalid part of the
redo log. (Bug#29057)
Disk Data: When dropping a page, the stack's bottom entry could sometime be left cold rather than hot, violating the rules for
stack pruning. (Bug#29176)
Changes in MySQL Cluster NDB 6.1.15 (5.1.15-ndb-6.1.15)
Bugs fixed:
Memory corruption could occur due to a problem in the DBTUP kernel block. (Bug#29229)
Changes in MySQL Cluster NDB 6.1.14 (5.1.15-ndb-6.1.14)
Bugs fixed:
In the event that two data nodes in the same node group and participating in a GCP crashed before they had written their respective
P0.sysfile files, QMGR could refuse to start, issuing an invalid INSUFFICIENT NODES FOR RESTART error instead. (Bug#29167)
Changes in MySQL Cluster NDB 6.1.13 (5.1.15-ndb-6.1.13)
Bugs fixed:
Cluster API: NdbApi.hpp depended on ndb_global.h, which was not actually installed, causing the compilation of programs
that used NdbApi.hpp to fail. (Bug#35853)
Changes in MySQL Cluster NDB 6.1.12 (5.1.15-ndb-6.1.12)
Functionality added or changed:
New cluster management client DUMP commands were added to aid in tracking transactions, scan operations, and locks. See DUMP
2350, DUMP 2352, and DUMP 2550.
Bugs fixed:
It is now possible to set the maximum size of the allocation unit for table memory using the MaxAllocate configuration paramet-
er. (Bug#29044)
MySQL Cluster NDB 6.X/7.X
1845
Changes in MySQL Cluster NDB 6.1.11 (5.1.15-ndb-6.1.11)
Functionality added or changed:
Important Change: The TimeBetweenWatchdogCheckInitial configuration parameter was added to allow setting of a
separate watchdog timeout for memory allocation during startup of the data nodes. See Section 17.3.4.6, Defining MySQL Cluster
Data Nodes, for more information. (Bug#28899)
A new configuration parameter ODirect causes NDB to attempt using O_DIRECT writes for LCP, backups, and redo logs, often
lowering CPU usage.
Bugs fixed:
Having large amounts of memory locked caused swapping to disk. (Bug#28751)
LCP files were not removed following an initial system restart. (Bug#28726)
Disk Data: Repeated INSERT and DELETE operations on a Disk Data table having one or more large VARCHAR columns could
cause data nodes to fail. (Bug#20612)
Changes in MySQL Cluster NDB 6.1.10 (5.1.15-ndb-6.1.10)
Functionality added or changed:
A new times printout was added in the ndbd watchdog thread.
Some unneeded printouts in the ndbd out file were removed.
Bugs fixed:
A regression in the heartbeat monitoring code could lead to node failure under high load. This issue affected MySQL 5.1.19 and
MySQL Cluster NDB 6.1.10 only. (Bug#28783)
A corrupt schema file could cause a FILE ALREADY OPEN error. (Bug#28770)
Setting InitialNoOpenFiles equal to MaxNoOfOpenFiles caused an error. This was due to the fact that the actual value of
MaxNoOfOpenFiles as used by the cluster was offset by 1 from the value set in config.ini. (Bug#28749)
A race condition could result when nonmaster nodes (in addition to the master node) tried to update active status due to a local
checkpoint (that is, between NODE_FAILREP and COPY_GCIREQ events). Now only the master updates the active status.
(Bug#28717)
A fast global checkpoint under high load with high usage of the redo buffer caused data nodes to fail. (Bug#28653)
Disk Data: When loading data into a cluster following a version upgrade, the data nodes could forcibly shut down due to page and
buffer management failures (that is, ndbrequire failures in PGMAN). (Bug#28525)
Changes in MySQL Cluster NDB 6.1.9 (5.1.15-ndb-6.1.9)
Bugs fixed:
When an API node sent more than 1024 signals in a single batch, NDB would process only the first 1024 of these, and then hang.
(Bug#28443)
Disk Data: The cluster backup process scanned in ACC index order, which had bad effects for disk data. (Bug#28593)
Changes in MySQL Cluster NDB 6.1.8 (5.1.15-ndb-6.1.8)
MySQL Cluster NDB 6.X/7.X
1846
Bugs fixed:
Local checkpoint files relating to dropped NDB tables were not removed. (Bug#28348)
Repeated insertion of data generated by mysqldump into NDB tables could eventually lead to failure of the cluster. (Bug#27437)
Disk Data: Extremely large inserts into Disk Data tables could lead to data node failure in some circumstances. (Bug#27942)
Cluster API: In a multi-operation transaction, a delete operation followed by the insertion of an implicit NULL failed to overwrite
an existing value. (Bug#20535)
Changes in MySQL Cluster NDB 6.1.7 (5.1.15-ndb-6.1.7)
Functionality added or changed:
Cluster Replication: Incompatible Change: The schema for the ndb_apply_status table in the mysql system database has
changed. When upgrading to this release from a previous MySQL Cluster NDB 6.x or mainline MySQL 5.1 release, you must drop
the mysql.ndb_apply_status table, then restart the server in order for the table to be re-created with the new schema.
See Section 17.9.4, MySQL Cluster Replication Schema and Tables, for additional information.
Bugs fixed:
The cluster waited 30 seconds instead of 30 milliseconds before reading table statistics. (Bug#28093)
Under certain rare circumstances, ndbd could get caught in an infinite loop when one transaction took a read lock and then a second
transaction attempted to obtain a write lock on the same tuple in the lock queue. (Bug#28073)
Under some circumstances, a node restart could fail to update the Global Checkpoint Index (GCI). (Bug#28023)
An INSERT followed by a delete DELETE on the same NDB table caused a memory leak. (Bug#27756)
This regression was introduced by Bug#20612.
Under certain rare circumstances performing a DROP TABLE or TRUNCATE on an NDB table could cause a node failure or forced
cluster shutdown. (Bug#27581)
Memory usage of a mysqld process grew even while idle. (Bug#27560)
Performing a delete followed by an insert during a local checkpoint could cause a ROWID ALREADY ALLOCATED error. (Bug#27205)
Cluster Replication: Disk Data: An issue with replication of Disk Data tables could in some cases lead to node failure.
(Bug#28161)
Disk Data: Changes to a Disk Data table made as part of a transaction could not be seen by the client performing the changes until
the transaction had been committed. (Bug#27757)
Disk Data: When restarting a data node following the creation of a large number of Disk Data objects (approximately 200 such ob-
jects), the cluster could not assign a node ID to the restarting node. (Bug#25741)
Disk Data: Changing a column specification or issuing a TRUNCATE statement on a Disk Data table caused the table to become an
in-memory table.
This fix supersedes an incomplete fix that was made for this issue in MySQL 5.1.15. (Bug#24667, Bug#25296)
Cluster API: An issue with the way in which the NdbDictionary::Dictionary::listEvents() method freed resources
could sometimes lead to memory corruption. (Bug#27663)
Changes in MySQL Cluster NDB 6.1.6 (5.1.15-ndb-6.1.6)
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1847
Cluster Replication: Incompatible Change: The schema for the ndb_apply_status table in the mysql system database has
changed. When upgrading to this release from a previous MySQL Cluster NDB 6.x or mainline MySQL 5.1 release, you must drop
the mysql.ndb_apply_status table, then restart the server in order for the table to be re-created with the new schema.
See Section 17.9.4, MySQL Cluster Replication Schema and Tables, for additional information.
Bugs fixed:
A data node failing while another data node was restarting could leave the cluster in an inconsistent state. In certain rare cases, this
could lead to a race condition and the eventual forced shutdown of the cluster. (Bug#27466)
It was not possible to set LockPagesInMainMemory equal to 0. (Bug#27291)
A race condition could sometimes occur if the node acting as master failed while node IDs were still being allocated during startup.
(Bug#27286)
When a data node was taking over as the master node, a race condition could sometimes occur as the node was assuming responsib-
ility for handling of global checkpoints. (Bug#27283)
mysqld could crash shortly after a data node failure following certain DML operations. (Bug#27169)
The same failed request from an API node could be handled by the cluster multiple times, resulting in reduced performance.
(Bug#27087)
The failure of a data node while restarting could cause other data nodes to hang or crash. (Bug#27003)
mysqld processes would sometimes crash under high load.
Note
This fix improves on and replaces a fix for this bug that was made in MySQL Cluster NDB 6.1.5.
(Bug#26825)
Disk Data: DROP INDEX on a Disk Data table did not always move data from memory into the tablespace. (Bug#25877)
Cluster API: An issue with the way in which the NdbDictionary::Dictionary::listEvents() method freed resources
could sometimes lead to memory corruption. (Bug#27663)
Cluster API: A delete operation using a scan followed by an insert using a scan could cause a data node to fail. (Bug#27203)
Changes in MySQL Cluster NDB 6.1.5 (5.1.15-ndb-6.1.5)
Functionality added or changed:
Cluster Replication: Incompatible Change: The schema for the ndb_apply_status table in the mysql system database has
changed. When upgrading to this release from a previous MySQL Cluster NDB 6.x or mainline MySQL 5.1 release, you must drop
the mysql.ndb_apply_status table, then restart the server in order for the table to be re-created with the new schema.
See Section 17.9.4, MySQL Cluster Replication Schema and Tables, for additional information.
Bugs fixed:
Creating a table on one SQL node while in single user mode caused other SQL nodes to crash. (Bug#26997)
mysqld processes would sometimes crash under high load.
Note
This fix was reverted in MySQL Cluster NDB 6.1.6.
MySQL Cluster NDB 6.X/7.X
1848
(Bug#26825)
An infinite loop in an internal logging function could cause trace logs to fill up with UNKNOWN SIGNAL TYPE error messages and
thus grow to unreasonable sizes. (Bug#26720)
Disk Data: When creating a log file group, setting INITIAL_SIZE to less than UNDO_BUFFER_SIZE caused data nodes to
crash. (Bug#25743)
Changes in MySQL Cluster NDB 6.1.4 (5.1.15-ndb-6.1.4)
Functionality added or changed:
An ndb_wait_connected system variable has been added for mysqld. It causes mysqld wait a specified amount of time to
be connected to the cluster before accepting client connections. For more information, see Section 17.4.3, MySQL Cluster System
Variables.
Cluster API: It is now possible to specify the transaction coordinator when starting a transaction. See
Ndb::startTransaction(), for more information.
Cluster API: It is now possible to iterate over all existing NDB objects using three new methods of the
Ndb_cluster_connection class:
lock_ndb_objects()
get_next_ndb_object()
unlock_ndb_objects()
For more information about these methods and their use, see ndb_cluster_connection::get_next_ndb_object(), in
the MySQL Cluster API Guide.
Bugs fixed:
Using only the --print_data option (and no other options) with ndb_restore caused ndb_restore to fail. (Bug#26741)
This regression was introduced by Bug#14612.
An inadvertent use of unaligned data caused ndb_restore to fail on some 64-bit platforms, including Sparc and Itanium-2.
(Bug#26739)
Changes in MySQL Cluster NDB 6.1.3 (5.1.15-ndb-6.1.3)
Functionality added or changed:
The ndbd_redo_log_reader utility is now part of the default build. For more information, see Section 17.6.16, nd-
bd_redo_log_reader Check and Print Content of Cluster Redo Log.
The ndb_show_tables utility now displays information about table events. See Section 17.6.20, ndb_show_tables Dis-
play List of NDB Tables, for more information.
Cluster API: A new listEvents() method has been added to the Dictionary class. See Dictionary::listEvents(),
for more information.
Bugs fixed:
An invalid pointer was returned following a FSCLOSECONF signal when accessing the REDO logs during a node restart or system
restart. (Bug#26515)
The InvalidUndoBufferSize error used the same error code (763) as the IncompatibleVersions error. InvalidUn-
MySQL Cluster NDB 6.X/7.X
1849
doBufferSize now uses its own error code (779). (Bug#26490)
The failure of a data node when restarting it with --initial could lead to failures of subsequent data node restarts. (Bug#26481)
Takeover for local checkpointing due to multiple failures of master nodes was sometimes incorrectly handled. (Bug#26457)
The LockPagesInMainMemory parameter was not read until after distributed communication had already started between
cluster nodes. When the value of this parameter was 1, this could sometimes result in data node failure due to missed heartbeats.
(Bug#26454)
Under some circumstances, following the restart of a management node, all data nodes would connect to it normally, but some of
them subsequently failed to log any events to the management node. (Bug#26293)
No appropriate error message was provided when there was insufficient REDO log file space for the cluster to start. (Bug#25801)
A memory allocation failure in SUMA (the cluster Subscription Manager) could cause the cluster to crash. (Bug#25239)
The message ERROR 0 IN READAUTOINCREMENTVALUE(): NO ERROR was written to the error log whenever SHOW TABLE
STATUS was performed on a Cluster table that did not have an AUTO_INCREMENT column.
Note
This improves on and supersedes an earlier fix that was made for this issue in MySQL 5.1.12.
(Bug#21033)
Disk Data: A memory overflow could occur with tables having a large amount of data stored on disk, or with queries using a very
high degree of parallelism on Disk Data tables. (Bug#26514)
Disk Data: Use of a tablespace whose INITIAL_SIZE was greater than 1 GB could cause the cluster to crash. (Bug#26487)
Changes in MySQL Cluster NDB 6.1.2 (5.1.15-ndb-6.1.2)
Bugs fixed:
Using node IDs greater than 48 could sometimes lead to incorrect memory access and a subsequent forced shutdown of the cluster.
(Bug#26267)
Changes in MySQL Cluster NDB 6.1.1 (5.1.15-ndb-6.1.1)
Functionality added or changed:
A single cluster can now support up to 255 API nodes, including MySQL servers acting as SQL nodes. See Section 17.12.8, Issues
Exclusive to MySQL Cluster, for more information.
Bugs fixed:
A memory leak could cause problems during a node or cluster shutdown or failure. (Bug#25997)
Cluster API: Disk Data: A delete and a read performed in the same operation could cause one or more data nodes to crash. This
could occur when the operation affected more than 5 columns concurrently, or when one or more of the columns was of the
VARCHAR type and was stored on disk. (Bug#25794)
Cluster API: Disk Data: A delete and a read performed in the same operation could cause one or more data nodes to crash. This
could occur when the operation affected more than 5 columns concurrently, or when one or more of the columns was of the
VARCHAR type and was stored on disk. (Bug#25794)
Changes in MySQL Cluster NDB 6.1.0 (5.1.14-ndb-6.1.0)
Functionality added or changed:
MySQL Cluster NDB 6.X/7.X
1850
A new configuration parameter MemReportFrequency allows for additional control of data node memory usage. Previously,
only warnings at predetermined percentages of memory allocation were given; setting this parameter allows for that behavior to be
overridden. For more information, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes.
Bugs fixed:
When a data node was shut down using the management client STOP command, a connection event (NDB_LE_Connected) was
logged instead of a disconnection event (NDB_LE_Disconnected). (Bug#22773)
SELECT statements with a BLOB or TEXT column in the selected column list and a WHERE condition including a primary key look-
up on a VARCHAR primary key produced empty result sets. (Bug#19956)
Disk Data: MEDIUMTEXT columns of Disk Data tables were stored in memory rather than on disk, even if the columns were not in-
dexed. (Bug#25001)
Disk Data: Performing a node restart with a newly dropped Disk Data table could lead to failure of the node during the restart.
(Bug#24917)
Disk Data: When restoring from backup a cluster containing any Disk Data tables with hidden primary keys, a node failure resulted
which could lead to a crash of the cluster. (Bug#24166)
Disk Data: Repeated CREATE, DROP, or TRUNCATE in various combinations with system restarts between these operations could
lead to the eventual failure of a system restart. (Bug#21948)
Disk Data: Extents that should have been available for re-use following a DROP TABLE operation were not actually made avail-
able again until after the cluster had performed a local checkpoint. (Bug#17605)
Cluster API: Invoking the NdbTransaction::execute() method using execution type Commit and abort option
AO_IgnoreError could lead to a crash of the transaction coordinator (DBTC). (Bug#25090)
Cluster API: A unique index lookup on a nonexistent tuple could lead to a data node timeout (error 4012). (Bug#25059)
Cluster API: When using the NdbTransaction::execute() method, a very long timeout (greater than 5 minutes) could res-
ult if the last data node being polled was disconnected from the cluster. (Bug#24949)
Cluster API: Due to an error in the computation of table fragment arrays, some transactions were not executed from the correct
starting point. (Bug#24914)
MySQL Cluster NDB 6.X/7.X
1851
Chapter 18. Partitioning
This chapter discusses MySQL's implementation of user-defined partitioning. You can determine whether your MySQL Server supports
partitioning by means of a SHOW VARIABLES command such as this one:
mysql> SHOW VARIABLES LIKE '%partition%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| have_partitioning | YES |
+-------------------+-------+
1 row in set (0.00 sec)
Note
Prior to MySQL 5.1.6, this variable was named have_partition_engine. (Bug#16718)
You can also check the output of the SHOW PLUGINS statement, as shown here:
mysql> SHOW PLUGINS;
+------------+----------+----------------+---------+---------+
| Name | Status | Type | Library | License |
+------------+----------+----------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ndbcluster | DISABLED | STORAGE ENGINE | NULL | GPL |
+------------+----------+----------------+---------+---------+
11 rows in set (0.00 sec)
If you do not see the have_partitioning variable with the value YES listed in the output of an appropriate SHOW VARIABLES
statement, or if you do not see the partition plugin listed with the value ACTIVE for the Status column in the output of SHOW
PLUGINS (show in bold text in the example just given), then your version of MySQL does not support partitioning.
MySQL Community binaries provided by Sun Microsystems include partitioning support. For information about partitioning support
offered in commercial MySQL Server binaries, see MySQL Enterprise Server 5.1, on the MySQL website.
If you are compiling MySQL 5.1 from source, the build must be configured using --with-partition to enable partitioning.
If your MySQL binary is built with partitioning support, nothing further needs to be done in order to enable it (for example, no special
entries are required in your my.cnf file).
An introduction to partitioning and partitioning concepts may be found in Section 18.1, Overview of Partitioning in MySQL.
MySQL supports several types of partitioning, which are discussed in Section 18.2, Partition Types, as well as subpartitioning, which
is described in Section 18.2.5, Subpartitioning.
Methods of adding, removing, and altering partitions in existing partitioned tables are covered in Section 18.3, Partition Management.
Table maintenance commands for use with partitioned tables are discussed in Section 18.3.3, Maintenance of Partitions.
Beginning with MySQL 5.1.6, the PARTITIONS table in the INFORMATION_SCHEMA database provides information about partitions
and partitioned tables. See Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table, for more information; for some ex-
amples of queries against this table, see Section 18.2.6, How MySQL Partitioning Handles NULL.
Important
Partitioned tables created with MySQL versions prior to 5.1.6 cannot be read by a 5.1.6 or later MySQL Server. In addi-
tion, the INFORMATION_SCHEMA.TABLES table cannot be used if such tables are present on a 5.1.6 server. Beginning
with MySQL 5.1.7, a suitable warning message is generated instead, to alert the user that incompatible partitioned tables
have been found by the server.
1852
If you are using partitioned tables which were created in MySQL 5.1.5 or earlier, be sure to see Section C.1.32, Changes
in MySQL 5.1.6 (01 February 2006) for more information and suggested workarounds before upgrading to MySQL 5.1.6
or later.
The partitioning implementation in MySQL 5.1 is still undergoing development. For known issues with MySQL partitioning, see Sec-
tion 18.5, Restrictions and Limitations on Partitioning, where we have noted these.
You may also find the following resources to be useful when working with partitioned tables.
Additional Resources. Other sources of information about user-defined partitioning in MySQL include the following:
MySQL Partitioning Forum
This is the official discussion forum for those interested in or experimenting with MySQL Partitioning technology. It features an-
nouncements and updates from MySQL developers and others. It is monitored by members of the Partitioning Development and
Documentation Teams.
Mikael Ronstrm's Blog
MySQL Partitioning Architect and Lead Developer Mikael Ronstrm frequently posts articles here concerning his work with
MySQL Partitioning and MySQL Cluster.
PlanetMySQL
A MySQL news site featuring MySQL-related blogs, which should be of interest to anyone using my MySQL. We encourage you to
check here for links to blogs kept by those working with MySQL Partitioning, or to have your own blog added to those covered.
MySQL 5.1 binaries are available from http://dev.mysql.com/downloads/mysql/5.1.html. However, for the latest partitioning bugfixes
and feature additions, you can obtain the source from our Bazaar repository. To enable partitioning, you need to compile the server us-
ing the --with-partition option. For more information about building MySQL, see Section 2.10, MySQL Installation Using a
Source Distribution. If you have problems compiling a partitioning-enabled MySQL 5.1 build, check the MySQL Partitioning Forum
and ask for assistance there if you do not find a solution to your problem already posted.
18.1. Overview of Partitioning in MySQL
This section provides a conceptual overview of partitioning in MySQL 5.1.
For information on partitioning restrictions and feature limitations, see Section 18.5, Restrictions and Limitations on Partitioning.
The SQL standard does not provide much in the way of guidance regarding the physical aspects of data storage. The SQL language it-
self is intended to work independently of any data structures or media underlying the schemas, tables, rows, or columns with which it
works. Nonetheless, most advanced database management systems have evolved some means of determining the physical location to be
used for storing specific pieces of data in terms of the file system, hardware or even both. In MySQL, the InnoDB storage engine has
long supported the notion of a tablespace, and the MySQL Server, even prior to the introduction of partitioning, could be configured to
employ different physical directories for storing different databases (see Section 7.6.1, Using Symbolic Links, for an explanation of
how this is done).
Partitioning takes this notion a step further, by allowing you to distribute portions of individual tables across a file system according to
rules which you can set largely as needed. In effect, different portions of a table are stored as separate tables in different locations. The
user-selected rule by which the division of data is accomplished is known as a partitioning function, which in MySQL can be the modu-
lus, simple matching against a set of ranges or value lists, an internal hashing function, or a linear hashing function. The function is se-
lected according to the partitioning type specified by the user, and takes as its parameter the value of a user-supplied expression. This
expression can be either an integer column value, or a function acting on one or more column values and returning an integer. The value
of this expression is passed to the partitioning function, which returns an integer value representing the number of the partition in which
that particular record should be stored. This function must be nonconstant and nonrandom. It may not contain any queries, but may use
an SQL expression that is valid in MySQL, as long as that expression returns either NULL or an integer intval such that
-MAXVALUE <= intval <= MAXVALUE
(MAXVALUE is used to represent the least upper bound for the type of integer in question. -MAXVALUE represents the greatest lower
bound.) There are some additional restrictions on partitioning functions; see Section 18.5, Restrictions and Limitations on
Partitioning, for more information about these.
Partitioning
1853
Examples of partitioning functions can be found in the discussions of partitioning types later in this chapter (see Section 18.2, Partition
Types), as well as in the partitioning syntax descriptions given in Section 12.1.17, CREATE TABLE Syntax.
This is known as horizontal partitioning that is, different rows of a table may be assigned to different physical partitions. MySQL 5.1
does not support vertical partitioning, in which different columns of a table are assigned to different physical partitions. There are not at
this time any plans to introduce vertical partitioning into MySQL 5.1.
For information about determining whether your MySQL Server binary supports user-defined partitioning, see Chapter 18, Partitioning.
For creating partitioned tables, you can use most storage engines that are supported by your MySQL server; the MySQL partitioning en-
gine runs in a separate layer and can interact with any of these. In MySQL 5.1, all partitions of the same partitioned table must use the
same storage engine; for example, you cannot use MyISAM for one partition and InnoDB for another. However, there is nothing pre-
venting you from using different storage engines for different partitioned tables on the same MySQL server or even in the same data-
base.
Note
MySQL partitioning cannot be used with the MERGE or CSV storage engines. Beginning with MySQL 5.1.15, FEDER-
ATED tables also cannot be partitioned (Bug#22451). Prior to MySQL 5.1.6, it was also not feasible to create a partitioned
table using the BLACKHOLE storage engine (Bug#14524).
Partitioning by KEY or LINEAR KEY is possible with NDBCLUSTER, but other types of user-defined partitioning are not
supported for tables using this storage engine. In addition, an NDBCLUSTER table that employs user-defined partitioning
must have an explicit primary key, and any columns referenced in the table's partitioning expression must be part of the
primary key. However, if no columns are listed in the PARTITION BY KEY or PARTITION BY LINEAR KEY clause
of the CREATE TABLE or ALTER TABLE statement used to create or modify a user-partitioned NDBCLUSTER table,
then the table is not required to have an explicit primary key.
For more information, see Section 18.5.2, Partitioning Limitations Relating to Storage Engines, and Section 17.12.1,
Noncompliance with SQL Syntax in MySQL Cluster.
To employ a particular storage engine for a partitioned table, it is necessary only to use the [STORAGE] ENGINE option just as you
would for a nonpartitioned table. However, you should keep in mind that [STORAGE] ENGINE (and other table options) need to be
listed before any partitioning options are used in a CREATE TABLE statement. This example shows how to create a table that is parti-
tioned by hash into 6 partitions and which uses the InnoDB storage engine:
CREATE TABLE ti (id INT, amount DECIMAL(7,2), tr_date DATE)
ENGINE=INNODB
PARTITION BY HASH( MONTH(tr_date) )
PARTITIONS 6;
Note
Each PARTITION clause can include a [STORAGE] ENGINE option, but in MySQL 5.1 this has no effect.
Important
Partitioning applies to all data and indexes of a table; you cannot partition only the data and not the indexes, or vice versa,
nor can you partition only a portion of the table.
Data and indexes for each partition can be assigned to a specific directory using the DATA DIRECTORY and INDEX DIRECTORY op-
tions for the PARTITION clause of the CREATE TABLE statement used to create the partitioned table.
Note
Prior to MySQL 5.1.18, these options were permitted even when the NO_DIR_IN_CREATE server SQL mode was in ef-
fect. (Bug#24633)
The DATA DIRECTORY and INDEX DIRECTORY options have no effect when defining partitions for tables using the
InnoDB storage engine.
DATA DIRECTORY and INDEX DIRECTORY are not supported for individual partitions or subpartitions on Windows.
Beginning with MySQL 5.1.24, these options are ignored on Windows, except that a warning is generated. (Bug#30459)
In addition, MAX_ROWS and MIN_ROWS can be used to determine the maximum and minimum numbers of rows, respectively, that can
be stored in each partition. See Section 18.3, Partition Management, for more information on these options.
Partitioning
1854
Some of the advantages of partitioning include:
Being able to store more data in one table than can be held on a single disk or file system partition.
Data that loses its usefulness can often be easily be removed from the table by dropping the partition containing only that data. Con-
versely, the process of adding new data can in some cases be greatly facilitated by adding a new partition specifically for that data.
Some queries can be greatly optimized in virtue of the fact that data satisfying a given WHERE clause can be stored only on one or
more partitions, thereby excluding any remaining partitions from the search. Because partitions can be altered after a partitioned ta-
ble has been created, you can reorganize your data to enhance frequent queries that may not have been so when the partitioning
scheme was first set up. This capability, sometimes referred to as partition pruning, was implemented in MySQL 5.1.6. For more in-
formation, see Section 18.4, Partition Pruning.
Other benefits usually associated with partitioning include those in the following list. These features are not currently implemented in
MySQL Partitioning, but are high on our list of priorities.
Queries involving aggregate functions such as SUM() and COUNT() can easily be parallelized. A simple example of such a query
might be SELECT salesperson_id, COUNT(orders) as order_total FROM sales GROUP BY salesper-
son_id;. By parallelized, we mean that the query can be run simultaneously on each partition, and the final result obtained
merely by summing the results obtained for all partitions.
Achieving greater query throughput in virtue of spreading data seeks over multiple disks.
Be sure to check this section and chapter frequently for updates as Partitioning development continues.
18.2. Partition Types
This section discusses the types of partitioning which are available in MySQL 5.1. These include:
RANGE partitioning: Assigns rows to partitions based on column values falling within a given range. See Section 18.2.1, RANGE
Partitioning.
LIST partitioning: Similar to partitioning by range, except that the partition is selected based on columns matching one of a set of
discrete values. See Section 18.2.2, LIST Partitioning.
HASH partitioning: A partition is selected based on the value returned by a user-defined expression that operates on column values
in rows to be inserted into the table. The function may consist of any expression valid in MySQL that yields a nonnegative integer
value. See Section 18.2.3, HASH Partitioning.
KEY partitioning: Similar to partitioning by hash, except that only one or more columns to be evaluated are supplied, and the
MySQL server provides its own hashing function. These columns can contain other than integer values, since the hashing function
supplied by MySQL guarantees an integer result regardless of the column data type. See Section 18.2.4, KEY Partitioning.
A very common use of database partitioning is to segregate data by date. Some database systems support explicit date partitioning,
which MySQL does not implement in 5.1. However, it is not difficult in MySQL to create partitioning schemes based on DATE, TIME,
or DATETIME columns, or based on expressions making use of such columns.
When partitioning by KEY or LINEAR KEY, you can use a DATE, TIME, or DATETIME column as the partitioning column without
performing any modification of the column value. For example, this table creation statement is perfectly valid in MySQL:
CREATE TABLE members (
firstname VARCHAR(25) NOT NULL,
lastname VARCHAR(25) NOT NULL,
username VARCHAR(16) NOT NULL,
email VARCHAR(35),
joined DATE NOT NULL
)
PARTITION BY KEY(joined)
PARTITIONS 6;
MySQL's other partitioning types, however, require a partitioning expression that yields an integer value or NULL. If you wish to use
Partitioning
1855
date-based partitioning by RANGE, LIST, HASH, or LINEAR HASH, you can simply employ a function that operates on a DATE,
TIME, or DATETIME column and returns such a value, as shown here:
CREATE TABLE members (
firstname VARCHAR(25) NOT NULL,
lastname VARCHAR(25) NOT NULL,
username VARCHAR(16) NOT NULL,
email VARCHAR(35),
joined DATE NOT NULL
)
PARTITION BY RANGE( YEAR(joined) ) (
PARTITION p0 VALUES LESS THAN (1960),
PARTITION p1 VALUES LESS THAN (1970),
PARTITION p2 VALUES LESS THAN (1980),
PARTITION p3 VALUES LESS THAN (1990),
PARTITION p4 VALUES LESS THAN MAXVALUE
);
Additional examples of partitioning using dates may be found here:
Section 18.2.1, RANGE Partitioning
Section 18.2.3, HASH Partitioning
Section 18.2.3.1, LINEAR HASH Partitioning
For more complex examples of date-based partitioning, see:
Section 18.4, Partition Pruning
Section 18.2.5, Subpartitioning
MySQL partitioning is optimized for use with the TO_DAYS() and YEAR() functions. However, you can use other date and time
functions that return an integer or NULL, such as WEEKDAY(), DAYOFYEAR(), or MONTH(). See Section 11.6, Date and Time
Functions, for more information about such functions.
It is important to remember regardless of the type of partitioning that you use that partitions are always numbered automatically
and in sequence when created, starting with 0. When a new row is inserted into a partitioned table, it is these partition numbers that are
used in identifying the correct partition. For example, if your table uses 4 partitions, these partitions are numbered 0, 1, 2, and 3. For
the RANGE and LIST partitioning types, it is necessary to ensure that there is a partition defined for each partition number. For HASH
partitioning, the user function employed must return an integer value greater than 0. For KEY partitioning, this issue is taken care of
automatically by the hashing function which the MySQL server employs internally.
Names of partitions generally follow the rules governing other MySQL identifiers, such as those for tables and databases. However, you
should note that partition names are not case-sensitive. For example, the following CREATE TABLE statement fails as shown:
mysql> CREATE TABLE t2 (val INT)
-> PARTITION BY LIST(val)(
-> PARTITION mypart VALUES IN (1,3,5),
-> PARTITION MyPart VALUES IN (2,4,6)
-> );
ERROR 1488 (HY000): Duplicate partition name mypart
Failure occurs because MySQL sees no difference between the partition names mypart and MyPart.
When you specify the number of partitions for the table, this must be expressed as a positive, nonzero integer literal with no leading zer-
oes, and may not be an expression such as 0.8E+01 or 6-2, even if it evaluates to an integer value. (Beginning with MySQL 5.1.12,
decimal fractions are no longer truncated, but instead are disallowed entirely.)
In the sections that follow, we do not necessarily provide all possible forms for the syntax that can be used for creating each partition
type; this information may be found in Section 12.1.17, CREATE TABLE Syntax.
18.2.1. RANGE Partitioning
A table that is partitioned by range is partitioned in such a way that each partition contains rows for which the partitioning expression
value lies within a given range. Ranges should be contiguous but not overlapping, and are defined using the VALUES LESS THAN op-
Partitioning
1856
erator. For the next few examples, suppose that you are creating a table such as the following to hold personnel records for a chain of 20
video stores, numbered 1 through 20:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT NOT NULL,
store_id INT NOT NULL
);
This table can be partitioned by range in a number of ways, depending on your needs. One way would be to use the store_id
column. For instance, you might decide to partition the table 4 ways by adding a PARTITION BY RANGE clause as shown here:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT NOT NULL,
store_id INT NOT NULL
)
PARTITION BY RANGE (store_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN (21)
);
In this partitioning scheme, all rows corresponding to employees working at stores 1 through 5 are stored in partition p0, to those em-
ployed at stores 6 through 10 are stored in partition p1, and so on. Note that each partition is defined in order, from lowest to highest.
This is a requirement of the PARTITION BY RANGE syntax; you can think of it as being analogous to a series of if ... elseif
... statements in C or Java in this regard.
It is easy to determine that a new row containing the data (72, 'Michael', 'Widenius', '1998-06-25', NULL, 13) is
inserted into partition p2, but what happens when your chain adds a 21
st
store? Under this scheme, there is no rule that covers a row
whose store_id is greater than 20, so an error results because the server does not know where to place it. You can keep this from oc-
curring by using a catchall VALUES LESS THAN clause in the CREATE TABLE statement that provides for all values greater than
highest value explicitly named:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT NOT NULL,
store_id INT NOT NULL
)
PARTITION BY RANGE (store_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
Note
Another way to avoid an error when no matching value is found is to use the IGNORE keyword as part of the INSERT
statement. For an example, see Section 18.2.2, LIST Partitioning. Also see Section 12.2.5, INSERT Syntax, for gen-
eral information about IGNORE.
MAXVALUE represents an integer value that is always greater than the largest possible integer value (in mathematical language, it serves
as a least upper bound). Now, any rows whose store_id column value is greater than or equal to 16 (the highest value defined) are
stored in partition p3. At some point in the future when the number of stores has increased to 25, 30, or more you can use an AL-
TER TABLE statement to add new partitions for stores 21-25, 26-30, and so on (see Section 18.3, Partition Management, for details
of how to do this).
In much the same fashion, you could partition the table based on employee job codes that is, based on ranges of job_code column
values. For example assuming that two-digit job codes are used for regular (in-store) workers, three-digit codes are used for office
and support personnel, and four-digit codes are used for management positions you could create the partitioned table using the fol-
Partitioning
1857
lowing:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT NOT NULL,
store_id INT NOT NULL
)
PARTITION BY RANGE (job_code) (
PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (1000),
PARTITION p2 VALUES LESS THAN (10000)
);
In this instance, all rows relating to in-store workers would be stored in partition p0, those relating to office and support staff in p1, and
those relating to managers in partition p2.
It is also possible to use an expression in VALUES LESS THAN clauses. However, MySQL must be able to evaluate the expression's
return value as part of a LESS THAN (<) comparison.
Rather than splitting up the table data according to store number, you can use an expression based on one of the two DATE columns in-
stead. For example, let us suppose that you wish to partition based on the year that each employee left the company; that is, the value of
YEAR(separated). An example of a CREATE TABLE statement that implements such a partitioning scheme is shown here:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY RANGE ( YEAR(separated) ) (
PARTITION p0 VALUES LESS THAN (1991),
PARTITION p1 VALUES LESS THAN (1996),
PARTITION p2 VALUES LESS THAN (2001),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
In this scheme, for all employees who left before 1991, the rows are stored in partition p0; for those who left in the years 1991 through
1995, in p1; for those who left in the years 1996 through 2000, in p2; and for any workers who left after the year 2000, in p3.
Range partitioning is particularly useful when:
You want or need to delete old data. If you are using the partitioning scheme shown immediately above, you can simply use AL-
TER TABLE employees DROP PARTITION p0; to delete all rows relating to employees who stopped working for the firm
prior to 1991. (See Section 12.1.7, ALTER TABLE Syntax, and Section 18.3, Partition Management, for more information.)
For a table with a great many rows, this can be much more efficient than running a DELETE query such as DELETE FROM em-
ployees WHERE YEAR(separated) <= 1990;.
You want to use a column containing date or time values, or containing values arising from some other series.
You frequently run queries that depend directly on the column used for partitioning the table. For example, when executing a query
such as EXPLAIN PARTITIONS SELECT COUNT(*) FROM employees WHERE separated BETWEEN
'2000-01-01' AND '2000-12-31' GROUP BY store_id;, MySQL can quickly determine that only partition p2 needs
to be scanned because the remaining partitions cannot contain any records satisfying the WHERE clause. See Section 18.4, Partition
Pruning, for more information about how this is accomplished.
18.2.2. LIST Partitioning
List partitioning in MySQL is similar to range partitioning in many ways. As in partitioning by RANGE, each partition must be explicitly
defined. The chief difference is that, in list partitioning, each partition is defined and selected based on the membership of a column
value in one of a set of value lists, rather than in one of a set of contiguous ranges of values. This is done by using PARTITION BY
LIST(expr) where expr is a column value or an expression based on a column value and returning an integer value, and then defin-
ing each partition by means of a VALUES IN (value_list), where value_list is a comma-separated list of integers.
Partitioning
1858
Note
In MySQL 5.1, it is possible to match against only a list of integers (and possibly NULL see Section 18.2.6, How
MySQL Partitioning Handles NULL) when partitioning by LIST.
Unlike the case with partitions defined by range, list partitions do not need to be declared in any particular order. For more detailed syn-
tactical information, see Section 12.1.17, CREATE TABLE Syntax.
For the examples that follow, we assume that the basic definition of the table to be partitioned is provided by the CREATE TABLE
statement shown here:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
);
(This is the same table used as a basis for the examples in Section 18.2.1, RANGE Partitioning.)
Suppose that there are 20 video stores distributed among 4 franchises as shown in the following table.
Region Store ID Numbers
North 3, 5, 6, 9, 17
East 1, 2, 10, 11, 19, 20
West 4, 12, 13, 14, 18
Central 7, 8, 15, 16
To partition this table in such a way that rows for stores belonging to the same region are stored in the same partition, you could use the
CREATE TABLE statement shown here:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY LIST(store_id) (
PARTITION pNorth VALUES IN (3,5,6,9,17),
PARTITION pEast VALUES IN (1,2,10,11,19,20),
PARTITION pWest VALUES IN (4,12,13,14,18),
PARTITION pCentral VALUES IN (7,8,15,16)
);
This makes it easy to add or drop employee records relating to specific regions to or from the table. For instance, suppose that all stores
in the West region are sold to another company. All rows relating to employees working at stores in that region can be deleted with the
query ALTER TABLE employees DROP PARTITION pWest;, which can be executed much more efficiently than the equival-
ent DELETE statement DELETE FROM employees WHERE store_id IN (4,12,13,14,18);.
As with RANGE partitioning, it is possible to combine LIST partitioning with partitioning by hash or key to produce a composite parti-
tioning (subpartitioning). See Section 18.2.5, Subpartitioning.
Unlike the case with RANGE partitioning, there is no catch-all such as MAXVALUE; all expected values for the partitioning expression
should be covered in PARTITION ... VALUES IN (...) clauses. An INSERT statement containing an unmatched partitioning
column value fails with an error, as shown in this example:
mysql> CREATE TABLE h2 (
-> c1 INT,
-> c2 INT
-> )
-> PARTITION BY LIST(c1) (
-> PARTITION p0 VALUES IN (1, 4, 7),
-> PARTITION p1 VALUES IN (2, 5, 8)
-> );
Partitioning
1859
Query OK, 0 rows affected (0.11 sec)
mysql> INSERT INTO h2 VALUES (3, 5);
ERROR 1525 (HY000): TABLE HAS NO PARTITION FOR VALUE 3
When inserting multiple rows using a single INSERT statement, any rows coming before the row containing the unmatched value are
inserted, but any coming after it are not:
mysql> SELECT * FROM h2;
Empty set (0.00 sec)
mysql> INSERT INTO h2 VALUES (4, 7), (3, 5), (6, 0);
ERROR 1525 (HY000): TABLE HAS NO PARTITION FOR VALUE 3
mysql> SELECT * FROM h2;
+------+------+
| c1 | c2 |
+------+------+
| 4 | 7 |
+------+------+
1 row in set (0.00 sec)
You can cause this type of error to be ignored by using the IGNORE key word. If you do so, rows containing unmatched partitioning
column values are not inserted, but any rows with matching values are inserted, and no errors are reported:
mysql> TRUNCATE h2;
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM h2;
Empty set (0.00 sec)
mysql> INSERT IGNORE INTO h2 VALUES (2, 5), (6, 10), (7, 5), (3, 1), (1, 9);
Query OK, 3 rows affected (0.00 sec)
Records: 5 Duplicates: 2 Warnings: 0
mysql> SELECT * FROM h2;
+------+------+
| c1 | c2 |
+------+------+
| 7 | 5 |
| 1 | 9 |
| 2 | 5 |
+------+------+
3 rows in set (0.00 sec)
18.2.3. HASH Partitioning
Partitioning by HASH is used primarily to ensure an even distribution of data among a predetermined number of partitions. With range
or list partitioning, you must specify explicitly into which partition a given column value or set of column values is to be stored; with
hash partitioning, MySQL takes care of this for you, and you need only specify a column value or expression based on a column value
to be hashed and the number of partitions into which the partitioned table is to be divided.
To partition a table using HASH partitioning, it is necessary to append to the CREATE TABLE statement a PARTITION BY HASH
(expr) clause, where expr is an expression that returns an integer. This can simply be the name of a column whose type is one of
MySQL's integer types. In addition, you will most likely want to follow this with a PARTITIONS num clause, where num is a positive
integer representing the number of partitions into which the table is to be divided.
For example, the following statement creates a table that uses hashing on the store_id column and is divided into 4 partitions:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY HASH(store_id)
PARTITIONS 4;
If you do not include a PARTITIONS clause, the number of partitions defaults to 1.
Using the PARTITIONS keyword without a number following it results in a syntax error.
You can also use an SQL expression that returns an integer for expr. For instance, you might want to partition based on the year in
which an employee was hired. This can be done as shown here:
CREATE TABLE employees (
Partitioning
1860
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY HASH( YEAR(hired) )
PARTITIONS 4;
expr must return a nonconstant, nonrandom integer value (in other words, it should be varying but deterministic), and must not contain
any prohibited constructs as described in Section 18.5, Restrictions and Limitations on Partitioning. You should also keep in mind
that this expression is evaluated each time a row is inserted or updated (or possibly deleted); this means that very complex expressions
may give rise to performance issues, particularly when performing operations (such as batch inserts) that affect a great many rows at
one time.
The most efficient hashing function is one which operates upon a single table column and whose value increases or decreases consist-
ently with the column value, as this allows for pruning on ranges of partitions. That is, the more closely that the expression varies
with the value of the column on which it is based, the more efficiently MySQL can use the expression for hash partitioning.
For example, where date_col is a column of type DATE, then the expression TO_DAYS(date_col) is said to vary directly with
the value of date_col, because for every change in the value of date_col, the value of the expression changes in a consistent man-
ner. The variance of the expression YEAR(date_col) with respect to date_col is not quite as direct as that of
TO_DAYS(date_col), because not every possible change in date_col produces an equivalent change in YEAR(date_col).
Even so, YEAR(date_col) is a good candidate for a hashing function, because it varies directly with a portion of date_col and
there is no possible change in date_col that produces a disproportionate change in YEAR(date_col).
By way of contrast, suppose that you have a column named int_col whose type is INT. Now consider the expression
POW(5-int_col,3) + 6. This would be a poor choice for a hashing function because a change in the value of int_col is not
guaranteed to produce a proportional change in the value of the expression. Changing the value of int_col by a given amount can
produce by widely different changes in the value of the expression. For example, changing int_col from 5 to 6 produces a change of
-1 in the value of the expression, but changing the value of int_col from 6 to 7 produces a change of -7 in the expression value.
In other words, the more closely the graph of the column value versus the value of the expression follows a straight line as traced by the
equation y=nx where n is some nonzero constant, the better the expression is suited to hashing. This has to do with the fact that the
more nonlinear an expression is, the more uneven the distribution of data among the partitions it tends to produce.
In theory, pruning is also possible for expressions involving more than one column value, but determining which of such expressions
are suitable can be quite difficult and time-consuming. For this reason, the use of hashing expressions involving multiple columns is not
particularly recommended.
When PARTITION BY HASH is used, MySQL determines which partition of num partitions to use based on the modulus of the result
of the user function. In other words, for an expression expr, the partition in which the record is stored is partition number N, where N
= MOD(expr, num). For example, suppose table t1 is defined as follows, so that it has 4 partitions:
CREATE TABLE t1 (col1 INT, col2 CHAR(5), col3 DATE)
PARTITION BY HASH( YEAR(col3) )
PARTITIONS 4;
If you insert a record into t1 whose col3 value is '2005-09-15', then the partition in which it is stored is determined as follows:
MOD(YEAR('2005-09-01'),4)
= MOD(2005,4)
= 1
MySQL 5.1 also supports a variant of HASH partitioning known as linear hashing which employs a more complex algorithm for de-
termining the placement of new rows inserted into the partitioned table. See Section 18.2.3.1, LINEAR HASH Partitioning, for a de-
scription of this algorithm.
The user function is evaluated each time a record is inserted or updated. It may also depending on the circumstances be evaluated
when records are deleted.
Note
If a table to be partitioned has a UNIQUE key, then any columns supplied as arguments to the HASH user function or to the
KEY's column_list must be part of that key.
Partitioning
1861
18.2.3.1. LINEAR HASH Partitioning
MySQL also supports linear hashing, which differs from regular hashing in that linear hashing utilizes a linear powers-of-two algorithm
whereas regular hashing employs the modulus of the hashing function's value.
Syntactically, the only difference between linear-hash partitioning and regular hashing is the addition of the LINEAR keyword in the
PARTITION BY clause, as shown here:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY LINEAR HASH( YEAR(hired) )
PARTITIONS 4;
Given an expression expr, the partition in which the record is stored when linear hashing is used is partition number N from among
num partitions, where N is derived according to the following algorithm:
1. Find the next power of 2 greater than num. We call this value V; it can be calculated as:
V = POWER(2, CEILING(LOG(2, num)))
(For example, suppose that num is 13. Then LOG(2,13) is 3.7004397181411. CEILING(3.7004397181411) is 4, and V =
POWER(2,4), which is 16.)
2. Set N = F(column_list) & (V - 1).
3. While N >= num:
Set V = CEIL(V / 2)
Set N = N & (V - 1)
For example, suppose that the table t1, using linear hash partitioning and having 6 partitions, is created using this statement:
CREATE TABLE t1 (col1 INT, col2 CHAR(5), col3 DATE)
PARTITION BY LINEAR HASH( YEAR(col3) )
PARTITIONS 6;
Now assume that you want to insert two records into t1 having the col3 column values '2003-04-14' and '1998-10-19'. The
partition number for the first of these is determined as follows:
V = POWER(2, CEILING( LOG(2,6) )) = 8
N = YEAR('2003-04-14') & (8 - 1)
= 2003 & 7
= 3
(3 >= 6 is FALSE: record stored in partition #3)
The number of the partition where the second record is stored is calculated as shown here:
V = 8
N = YEAR('1998-10-19') & (8-1)
= 1998 & 7
= 6
(6 >= 6 is TRUE: additional step required)
N = 6 & CEILING(8 / 2)
= 6 & 3
= 2
(2 >= 6 is FALSE: record stored in partition #2)
The advantage in partitioning by linear hash is that the adding, dropping, merging, and splitting of partitions is made much faster, which
can be beneficial when dealing with tables containing extremely large amounts (terabytes) of data. The disadvantage is that data is less
Partitioning
1862
likely to be evenly distributed between partitions as compared with the distribution obtained using regular hash partitioning.
18.2.4. KEY Partitioning
Partitioning by key is similar to partitioning by hash, except that where hash partitioning employs a user-defined expression, the hashing
function for key partitioning is supplied by the MySQL server. MySQL Cluster uses MD5() for this purpose; for tables using other stor-
age engines, the server employs its own internal hashing function which is based on the same algorithm as PASSWORD().
The syntax rules for CREATE TABLE ... PARTITION BY KEY are similar to those for creating a table that is partitioned by hash.
The major differences are that:
KEY is used rather than HASH.
KEY takes only a list of one or more column names. Beginning with MySQL 5.1.5, the column or columns used as the partitioning
key must comprise part or all of the table's primary key, if the table has one.
Beginning with MySQL 5.1.6, KEY takes a list of zero or more column names. Where no column name is specified as the partition-
ing key, the table's primary key is used, if there is one. For example, the following CREATE TABLE statement is valid in MySQL
5.1.6 or later:
CREATE TABLE k1 (
id INT NOT NULL PRIMARY KEY,
name VARCHAR(20)
)
PARTITION BY KEY()
PARTITIONS 2;
If there is no primary key but there is a unique key, then the unique key is used for the partitioning key:
CREATE TABLE k1 (
id INT NOT NULL,
name VARCHAR(20),
UNIQUE KEY (id)
)
PARTITION BY KEY()
PARTITIONS 2;
However, if the unique key column were not defined as NOT NULL, then the previous statement would fail.
In both of these cases, the partitioning key is the id column, even though it is not shown in the output of SHOW CREATE TABLE
or in the PARTITION_EXPRESSION column of the INFORMATION_SCHEMA.PARTITIONS table.
Unlike the case with other partitioning types, columns used for partitioning by KEY are not restricted to integer or NULL values. For
example, the following CREATE TABLE statement is valid:
CREATE TABLE tm1 (
s1 CHAR(32) PRIMARY KEY
)
PARTITION BY KEY(s1)
PARTITIONS 10;
The preceding statement would not be valid, were a different partitioning type to be specified.
Note
In this case, simply using PARTITION BY KEY() would also be valid and have the same effect as PARTITION BY
KEY(s1), since s1 is the table's primary key.
For additional information about this issue, see Section 18.5, Restrictions and Limitations on Partitioning.
Note
Also beginning with MySQL 5.1.6, tables using the NDBCLUSTER storage engine are implicitly partitioned by KEY, again
using the table's primary key as the partitioning key. In the event that the MySQL Cluster table has no explicit primary
key, the hidden primary key generated by the NDBCLUSTER storage engine for each MySQL Cluster table is used as the
partitioning key.
Partitioning
1863
Beginning with MySQL Cluster NDB 6.2.18, MySQL Cluster NDB 6.3.25, and MySQL Cluster NDB 7.0.6, if you define
an explicit partitioning scheme for an NDBCLUSTER table, the table must have an explicit primary key, and any columns
used in the partitioning expression must be part of this key. However, if the table uses an empty partitioning expression
that is, PARTITION BY KEY() with no column references then no explicit primary key is required.
Important
For a key-partitioned table using any MySQL storage engine other than NDBCLUSTER, you cannot execute an ALTER
TABLE DROP PRIMARY KEY, as doing so generates the error ERROR 1466 (HY000): FIELD IN LIST OF
FIELDS FOR PARTITION FUNCTION NOT FOUND IN TABLE. This is not an issue for MySQL Cluster tables which are parti-
tioned by KEY; in such cases, the table is reorganized using the hidden primary key as the table's new partitioning key.
See Chapter 17, MySQL Cluster NDB 6.X/7.X.
It is also possible to partition a table by linear key. Here is a simple example:
CREATE TABLE tk (
col1 INT NOT NULL,
col2 CHAR(5),
col3 DATE
)
PARTITION BY LINEAR KEY (col1)
PARTITIONS 3;
Using LINEAR has the same effect on KEY partitioning as it does on HASH partitioning, with the partition number being derived using a
powers-of-two algorithm rather than modulo arithmetic. See Section 18.2.3.1, LINEAR HASH Partitioning, for a description of this
algorithm and its implications.
18.2.5. Subpartitioning
Subpartitioning also known as composite partitioning is the further division of each partition in a partitioned table. For example,
consider the following CREATE TABLE statement:
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE( YEAR(purchased) )
SUBPARTITION BY HASH( TO_DAYS(purchased) )
SUBPARTITIONS 2 (
PARTITION p0 VALUES LESS THAN (1990),
PARTITION p1 VALUES LESS THAN (2000),
PARTITION p2 VALUES LESS THAN MAXVALUE
);
Table ts has 3 RANGE partitions. Each of these partitions p0, p1, and p2 is further divided into 2 subpartitions. In effect, the en-
tire table is divided into 3 * 2 = 6 partitions. However, due to the action of the PARTITION BY RANGE clause, the first 2 of these
store only those records with a value less than 1990 in the purchased column.
In MySQL 5.1, it is possible to subpartition tables that are partitioned by RANGE or LIST. Subpartitions may use either HASH or KEY
partitioning. This is also known as composite partitioning.
It is also possible to define subpartitions explicitly using SUBPARTITION clauses to specify options for individual subpartitions. For
example, a more verbose fashion of creating the same table ts as shown in the previous example would be:
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE( YEAR(purchased) )
SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0,
SUBPARTITION s1
),
PARTITION p1 VALUES LESS THAN (2000) (
SUBPARTITION s2,
SUBPARTITION s3
),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION s4,
SUBPARTITION s5
)
);
Some syntactical items of note:
Partitioning
1864
Each partition must have the same number of subpartitions.
If you explicitly define any subpartitions using SUBPARTITION on any partition of a partitioned table, you must define them all. In
other words, the following statement will fail:
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE( YEAR(purchased) )
SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0,
SUBPARTITION s1
),
PARTITION p1 VALUES LESS THAN (2000),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION s2,
SUBPARTITION s3
)
);
This statement would still fail even if it included a SUBPARTITIONS 2 clause.
Each SUBPARTITION clause must include (at a minimum) a name for the subpartition. Otherwise, you may set any desired option
for the subpartition or allow it to assume its default setting for that option.
In MySQL 5.1.7 and earlier, names of subpartitions were required to be unique within each partition, but did not have to be unique
within the table as a whole. Beginning with MySQL 5.1.8, subpartition names must be unique across the entire table. For example,
the following CREATE TABLE statement is valid in MySQL 5.1.8 and later:
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE( YEAR(purchased) )
SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0,
SUBPARTITION s1
),
PARTITION p1 VALUES LESS THAN (2000) (
SUBPARTITION s2,
SUBPARTITION s3
),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION s4,
SUBPARTITION s5
)
);
(The previous statement is also valid for versions of MySQL prior to 5.1.8.)
Subpartitions can be used with especially large tables to distribute data and indexes across many disks. Suppose that you have 6 disks
mounted as /disk0, /disk1, /disk2, and so on. Now consider the following example:
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE( YEAR(purchased) )
SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0
DATA DIRECTORY = '/disk0/data'
INDEX DIRECTORY = '/disk0/idx',
SUBPARTITION s1
DATA DIRECTORY = '/disk1/data'
INDEX DIRECTORY = '/disk1/idx'
),
PARTITION p1 VALUES LESS THAN (2000) (
SUBPARTITION s2
DATA DIRECTORY = '/disk2/data'
INDEX DIRECTORY = '/disk2/idx',
SUBPARTITION s3
DATA DIRECTORY = '/disk3/data'
INDEX DIRECTORY = '/disk3/idx'
),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION s4
DATA DIRECTORY = '/disk4/data'
INDEX DIRECTORY = '/disk4/idx',
SUBPARTITION s5
DATA DIRECTORY = '/disk5/data'
INDEX DIRECTORY = '/disk5/idx'
)
);
Partitioning
1865
In this case, a separate disk is used for the data and for the indexes of each RANGE. Many other variations are possible; another example
might be:
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
DATA DIRECTORY = '/disk0'
INDEX DIRECTORY = '/disk1',
SUBPARTITION s0b
DATA DIRECTORY = '/disk2'
INDEX DIRECTORY = '/disk3'
),
PARTITION p1 VALUES LESS THAN (2000) (
SUBPARTITION s1a
DATA DIRECTORY = '/disk4/data'
INDEX DIRECTORY = '/disk4/idx',
SUBPARTITION s1b
DATA DIRECTORY = '/disk5/data'
INDEX DIRECTORY = '/disk5/idx'
),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION s2a,
SUBPARTITION s2b
)
);
Here, the storage is as follows:
Rows with purchased dates from before 1990 take up a vast amount of space, so are split up 4 ways, with a separate disk dedic-
ated to the data and to the indexes for each of the two subpartitions (s0a and s0b) making up partition p0. In other words:
The data for subpartition s0a is stored on /disk0.
The indexes for subpartition s0a are stored on /disk1.
The data for subpartition s0b is stored on /disk2.
The indexes for subpartition s0b are stored on /disk3.
Rows containing dates ranging from 1990 to 1999 (partition p1) do not require as much room as those from before 1990. These are
split between 2 disks (/disk4 and /disk5) rather than 4 disks as with the legacy records stored in p0:
Data and indexes belonging to p1's first subpartition (s1a) are stored on /disk4 the data in /disk4/data, and the in-
dexes in /disk4/idx.
Data and indexes belonging to p1's second subpartition (s1b) are stored on /disk5 the data in /disk5/data, and the in-
dexes in /disk5/idx.
Rows reflecting dates from the year 2000 to the present (partition p2) do not take up as much space as required by either of the two
previous ranges. Currently, it is sufficient to store all of these in the default location.
In future, when the number of purchases for the decade beginning with the year 2000 grows to a point where the default location no
longer provides sufficient space, the corresponding rows can be moved using an ALTER TABLE ... REORGANIZE PARTI-
TION statement. See Section 18.3, Partition Management, for an explanation of how this can be done.
Beginning with MySQL 5.1.18, the DATA DIRECTORY and INDEX DIRECTORY options are disallowed when the
NO_DIR_IN_CREATE server SQL mode is in effect. This is true for partitions and subpartitions.
18.2.6. How MySQL Partitioning Handles NULL
Partitioning in MySQL does nothing to disallow NULL as the value of a partitioning expression, whether it is a column value or the
value of a user-supplied expression. Even though it is permitted to use NULL as the value of an expression that must otherwise yield an
integer, it is important to keep in mind that NULL is not a number. Beginning with MySQL 5.1.8, the partitioning implementation treats
NULL as being less than any non-NULL value, just as ORDER BY does.
This means that treatment of NULL varies between partitioning of different types, and may produce behavior which you do not expect if
you are not prepared for it. This being the case, we discuss in this section how each MySQL partitioning type handles NULL values
Partitioning
1866
when determining the partition in which a row should be stored, and provide examples for each.
Handling of NULL with RANGE partitioning. If you insert a row into a table partitioned by RANGE such that the column value used to
determine the partition is NULL, the row is inserted into the lowest partition. For example, consider these two tables in a database
named p, created as follows:
mysql> CREATE TABLE t1 (
-> c1 INT,
-> c2 VARCHAR(20)
-> )
-> PARTITION BY RANGE(c1) (
-> PARTITION p0 VALUES LESS THAN (0),
-> PARTITION p1 VALUES LESS THAN (10),
-> PARTITION p2 VALUES LESS THAN MAXVALUE
-> );
Query OK, 0 rows affected (0.09 sec)
mysql> CREATE TABLE t2 (
-> c1 INT,
-> c2 VARCHAR(20)
-> )
-> PARTITION BY RANGE(c1) (
-> PARTITION p0 VALUES LESS THAN (-5),
-> PARTITION p1 VALUES LESS THAN (0),
-> PARTITION p2 VALUES LESS THAN (10),
-> PARTITION p3 VALUES LESS THAN MAXVALUE
-> );
Query OK, 0 rows affected (0.09 sec)
You can see the partitions created by these two CREATE TABLE statements using the following query against the PARTITIONS table
in the INFORMATION_SCHEMA database:
mysql> SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH
> FROM INFORMATION_SCHEMA.PARTITIONS
> WHERE TABLE_SCHEMA = 'p' AND TABLE_NAME LIKE 't_';
+------------+----------------+------------+----------------+-------------+
| TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH |
+------------+----------------+------------+----------------+-------------+
| t1 | p0 | 0 | 0 | 0 |
| t1 | p1 | 0 | 0 | 0 |
| t1 | p2 | 0 | 0 | 0 |
| t2 | p0 | 0 | 0 | 0 |
| t2 | p1 | 0 | 0 | 0 |
| t2 | p2 | 0 | 0 | 0 |
| t2 | p3 | 0 | 0 | 0 |
+------------+----------------+------------+----------------+-------------+
7 rows in set (0.00 sec)
(For more information about this table, see Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table.) Now let us popu-
late each of these tables with a single row containing a NULL in the column used as the partitioning key, and verify that the rows were
inserted using a pair of SELECT statements:
mysql> INSERT INTO t1 VALUES (NULL, 'mothra');
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO t2 VALUES (NULL, 'mothra');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM t1;
+------+--------+
| id | name |
+------+--------+
| NULL | mothra |
+------+--------+
1 row in set (0.00 sec)
mysql> SELECT * FROM t2;
+------+--------+
| id | name |
+------+--------+
| NULL | mothra |
+------+--------+
1 row in set (0.00 sec)
You can see which partitions are used to store the inserted rows by rerunning the previous query against INFORMA-
TION_SCHEMA.PARTITIONS and inspecting the output:
mysql> SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH
> FROM INFORMATION_SCHEMA.PARTITIONS
> WHERE TABLE_SCHEMA = 'p' AND TABLE_NAME LIKE 't_';
+------------+----------------+------------+----------------+-------------+
| TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH |
+------------+----------------+------------+----------------+-------------+
| t1 | p0 | 1 | 20 | 20 |
| t1 | p1 | 0 | 0 | 0 |
Partitioning
1867
| t1 | p2 | 0 | 0 | 0 |
| t2 | p0 | 1 | 20 | 20 |
| t2 | p1 | 0 | 0 | 0 |
| t2 | p2 | 0 | 0 | 0 |
| t2 | p3 | 0 | 0 | 0 |
+------------+----------------+------------+----------------+-------------+
7 rows in set (0.01 sec)
You can also demonstrate that these rows were stored in the lowest partition of each table by dropping these partitions, and then re-
running the SELECT statements:
mysql> ALTER TABLE t1 DROP PARTITION p0;
Query OK, 0 rows affected (0.16 sec)
mysql> ALTER TABLE t2 DROP PARTITION p0;
Query OK, 0 rows affected (0.16 sec)
mysql> SELECT * FROM t1;
Empty set (0.00 sec)
mysql> SELECT * FROM t2;
Empty set (0.00 sec)
(For more information on ALTER TABLE ... DROP PARTITION, see Section 12.1.7, ALTER TABLE Syntax.)
Important
Prior to MySQL 5.1.8, RANGE partitioning treated a partitioning expression value of NULL as 0 with respect to determin-
ing placement. (The only way to circumvent this behavior was to design tables so as not to allow nulls, usually by declar-
ing columns NOT NULL.) If you have a RANGE partitioning scheme that depends on this earlier behavior, you must re-
implement it when upgrading to MySQL 5.1.8 or later. (Bug#15447)
NULL is also treated in this way for partitioning expressions that use SQL functions. Suppose that we define a table using a CREATE
TABLE statement such as this one:
CREATE TABLE tndate (
id INT,
dt DATE
)
PARTITION BY RANGE( YEAR(dt) ) (
PARTITION p0 VALUES LESS THAN (1990),
PARTITION p1 VALUES LESS THAN (2000),
PARTITION p2 VALUES LESS THAN MAXVALUE
);
As with other MySQL functions, YEAR(NULL) returns NULL. A row with a dt column value of NULL is treated as though the parti-
tioning expression evaluated to a value less than any other value, and so is inserted into partition p0.
Handling of NULL with LIST partitioning. A table that is partitioned by LIST admits NULL values if and only if one of its partitions
is defined using that value-list that contains NULL. The converse of this is that a table partitioned by LIST which does not explicitly use
NULL in a value list rejects rows resulting in a NULL value for the partitioning expression, as shown in this example:
mysql> CREATE TABLE ts1 (
-> c1 INT,
-> c2 VARCHAR(20)
-> )
-> PARTITION BY LIST(c1) (
-> PARTITION p0 VALUES IN (0, 3, 6),
-> PARTITION p1 VALUES IN (1, 4, 7),
-> PARTITION p2 VALUES IN (2, 5, 8)
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO ts1 VALUES (9, 'mothra');
ERROR 1504 (HY000): TABLE HAS NO PARTITION FOR VALUE 9
mysql> INSERT INTO ts1 VALUES (NULL, 'mothra');
ERROR 1504 (HY000): TABLE HAS NO PARTITION FOR VALUE NULL
Only rows having a c1 value between 0 and 8 inclusive can be inserted into ts1. NULL falls outside this range, just like the number 9.
We can create tables ts2 and ts3 having value lists containing NULL, as shown here:
mysql> CREATE TABLE ts2 (
-> c1 INT,
-> c2 VARCHAR(20)
-> )
-> PARTITION BY LIST(c1) (
-> PARTITION p0 VALUES IN (0, 3, 6),
-> PARTITION p1 VALUES IN (1, 4, 7),
-> PARTITION p2 VALUES IN (2, 5, 8),
-> PARTITION p3 VALUES IN (NULL)
Partitioning
1868
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE TABLE ts3 (
-> c1 INT,
-> c2 VARCHAR(20)
-> )
-> PARTITION BY LIST(c1) (
-> PARTITION p0 VALUES IN (0, 3, 6),
-> PARTITION p1 VALUES IN (1, 4, 7, NULL),
-> PARTITION p2 VALUES IN (2, 5, 8)
-> );
Query OK, 0 rows affected (0.01 sec)
When defining value lists for partitioning, you can (and should) treat NULL just as you would any other value. For example, both VAL-
UES IN (NULL) and VALUES IN (1, 4, 7, NULL) are valid, as are VALUES IN (1, NULL, 4, 7), VALUES IN
(NULL, 1, 4, 7), and so on. You can insert a row having NULL for column c1 into each of the tables ts2 and ts3:
mysql> INSERT INTO ts2 VALUES (NULL, 'mothra');
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO ts3 VALUES (NULL, 'mothra');
Query OK, 1 row affected (0.00 sec)
By issuing the appropriate query against INFORMATION_SCHEMA.PARTITIONS, you can determine which partitions were used to
store the rows just inserted (we assume, as in the previous examples, that the partitioned tables were created in the p database):
mysql> SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH
> FROM INFORMATION_SCHEMA.PARTITIONS
> WHERE TABLE_SCHEMA = 'p' AND TABLE_NAME LIKE 'ts_';
+------------+----------------+------------+----------------+-------------+
| TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH |
+------------+----------------+------------+----------------+-------------+
| ts2 | p0 | 0 | 0 | 0 |
| ts2 | p1 | 0 | 0 | 0 |
| ts2 | p2 | 0 | 0 | 0 |
| ts2 | p3 | 1 | 20 | 20 |
| ts3 | p0 | 0 | 0 | 0 |
| ts3 | p1 | 1 | 20 | 20 |
| ts3 | p2 | 0 | 0 | 0 |
+------------+----------------+------------+----------------+-------------+
7 rows in set (0.01 sec)
As shown earlier in this section, you can also verify which partitions were used for storing the rows by deleting these partitions and then
performing a SELECT.
Handling of NULL with HASH and KEY partitioning. NULL is handled somewhat differently for tables partitioned by HASH or KEY.
In these cases, any partition expression that yields a NULL value is treated as though its return value were zero. We can verify this beha-
vior by examining the effects on the file system of creating a table partitioned by HASH and populating it with a record containing ap-
propriate values. Suppose that you have a table th (also in the p database) created using the following statement:
mysql> CREATE TABLE th (
-> c1 INT,
-> c2 VARCHAR(20)
-> )
-> PARTITION BY HASH(c1)
-> PARTITIONS 2;
Query OK, 0 rows affected (0.00 sec)
The partitions belonging to this table can be viewed like this:
mysql> SELECT TABLE_NAME,PARTITION_NAME,TABLE_ROWS,AVG_ROW_LENGTH,DATA_LENGTH
> FROM INFORMATION_SCHEMA.PARTITIONS
> WHERE TABLE_SCHEMA = 'p' AND TABLE_NAME ='th';
+------------+----------------+------------+----------------+-------------+
| TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH |
+------------+----------------+------------+----------------+-------------+
| th | p0 | 0 | 0 | 0 |
| th | p1 | 0 | 0 | 0 |
+------------+----------------+------------+----------------+-------------+
2 rows in set (0.00 sec)
Note that TABLE_ROWS for each partition is 0. Now insert two rows into th whose c1 column values are NULL and 0, and verify
that these rows were inserted:
mysql> INSERT INTO th VALUES (NULL, 'mothra'), (0, 'gigan');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM th;
+------+---------+
| c1 | c2 |
+------+---------+
Partitioning
1869
| NULL | mothra |
+------+---------+
| 0 | gigan |
+------+---------+
2 rows in set (0.01 sec)
Recall that for any integer N, the value of NULL MOD N is always NULL. For tables that are partitioned by HASH or KEY, this result is
treated for determining the correct partition as 0. Checking the INFORMATION_SCHEMA.PARTITIONS table once again, we can see
that both rows were inserted into partition p0:
mysql> SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH
> FROM INFORMATION_SCHEMA.PARTITIONS
> WHERE TABLE_SCHEMA = 'p' AND TABLE_NAME ='th';
+------------+----------------+------------+----------------+-------------+
| TABLE_NAME | PARTITION_NAME | TABLE_ROWS | AVG_ROW_LENGTH | DATA_LENGTH |
+------------+----------------+------------+----------------+-------------+
| th | p0 | 2 | 20 | 20 |
| th | p1 | 0 | 0 | 0 |
+------------+----------------+------------+----------------+-------------+
2 rows in set (0.00 sec)
If you repeat this example using PARTITION BY KEY in place of PARTITION BY HASH in the definition of the table, you can
verify easily that NULL is also treated like 0 for this type of partitioning as well.
18.3. Partition Management
MySQL 5.1 provides a number of ways to modify partitioned tables. It is possible to add, drop, redefine, merge, or split existing parti-
tions. All of these actions can be carried out using the partitioning extensions to the ALTER TABLE command (see Section 12.1.7,
ALTER TABLE Syntax, for syntax definitions). There are also ways to obtain information about partitioned tables and partitions. We
discuss these topics in the sections that follow.
For information about partition management in tables partitioned by RANGE or LIST, see Section 18.3.1, Management of RANGE
and LIST Partitions.
For a discussion of managing HASH and KEY partitions, see Section 18.3.2, Management of HASH and KEY Partitions.
See Section 18.3.4, Obtaining Information About Partitions, for a discussion of mechanisms provided in MySQL 5.1 for obtaining
information about partitioned tables and partitions.
For a discussion of performing maintenance operations on partitions, see Section 18.3.3, Maintenance of Partitions.
Note
In MySQL 5.1, all partitions of a partitioned table must have the same number of subpartitions, and it is not possible to
change the subpartitioning once the table has been created.
The statement ALTER TABLE ... PARTITION BY ... is available and is functional beginning with MySQL 5.1.6; previously in
MySQL 5.1, this was accepted as valid syntax, but the statement did nothing.
To change a table's partitioning scheme, it is necessary only to use the ALTER TABLE command with a partition_options
clause. This clause has the same syntax as that as used with CREATE TABLE for creating a partitioned table, and always begins with
the keywords PARTITION BY. For example, suppose that you have a table partitioned by range using the following CREATE TABLE
statement:
CREATE TABLE trb3 (id INT, name VARCHAR(50), purchased DATE)
PARTITION BY RANGE( YEAR(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990),
PARTITION p1 VALUES LESS THAN (1995),
PARTITION p2 VALUES LESS THAN (2000),
PARTITION p3 VALUES LESS THAN (2005)
);
To repartition this table so that it is partitioned by key into two partitions using the id column value as the basis for the key, you can
use this statement:
ALTER TABLE trb3 PARTITION BY KEY(id) PARTITIONS 2;
This has the same effect on the structure of the table as dropping the table and re-creating it using CREATE TABLE trb3 PARTI-
TION BY KEY(id) PARTITIONS 2;.
Partitioning
1870
In MySQL 5.1.7 and earlier MySQL 5.1 releases, ALTER TABLE ... ENGINE = ... removed all partitioning from the affected
table. Beginning with MySQL 5.1.8, this statement changes only the storage engine used by the table, and leaves the table's partitioning
scheme intact. As of MySQL 5.1.8, use ALTER TABLE ... REMOVE PARTITIONING to remove a table's partitioning. See Sec-
tion 12.1.7, ALTER TABLE Syntax.
Important
Only a single PARTITION BY, ADD PARTITION, DROP PARTITION, REORGANIZE PARTITION, or COALESCE
PARTITION clause can be used in a given ALTER TABLE statement. If you (for example) wish to drop a partition and
reorganize a table's remaining partitions, you must do so in two separate ALTER TABLE statements (one using DROP
PARTITION and then a second one using REORGANIZE PARITITIONS).
18.3.1. Management of RANGE and LIST Partitions
Range and list partitions are very similar with regard to how the adding and dropping of partitions are handled. For this reason we dis-
cuss the management of both sorts of partitioning in this section. For information about working with tables that are partitioned by hash
or key, see Section 18.3.2, Management of HASH and KEY Partitions. Dropping a RANGE or LIST partition is more straightforward
than adding one, so we discuss this first.
Dropping a partition from a table that is partitioned by either RANGE or by LIST can be accomplished using the ALTER TABLE state-
ment with a DROP PARTITION clause. Here is a very basic example, which supposes that you have already created a table which is
partitioned by range and then populated with 10 records using the following CREATE TABLE and INSERT statements:
mysql> CREATE TABLE tr (id INT, name VARCHAR(50), purchased DATE)
-> PARTITION BY RANGE( YEAR(purchased) ) (
-> PARTITION p0 VALUES LESS THAN (1990),
-> PARTITION p1 VALUES LESS THAN (1995),
-> PARTITION p2 VALUES LESS THAN (2000),
-> PARTITION p3 VALUES LESS THAN (2005)
-> );
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO tr VALUES
-> (1, 'desk organiser', '2003-10-15'),
-> (2, 'CD player', '1993-11-05'),
-> (3, 'TV set', '1996-03-10'),
-> (4, 'bookcase', '1982-01-10'),
-> (5, 'exercise bike', '2004-05-09'),
-> (6, 'sofa', '1987-06-05'),
-> (7, 'popcorn maker', '2001-11-22'),
-> (8, 'aquarium', '1992-08-04'),
-> (9, 'study desk', '1984-09-16'),
-> (10, 'lava lamp', '1998-12-25');
Query OK, 10 rows affected (0.01 sec)
You can see which items should have been inserted into partition p2 as shown here:
mysql> SELECT * FROM tr
-> WHERE purchased BETWEEN '1995-01-01' AND '1999-12-31';
+------+-----------+------------+
| id | name | purchased |
+------+-----------+------------+
| 3 | TV set | 1996-03-10 |
| 10 | lava lamp | 1998-12-25 |
+------+-----------+------------+
2 rows in set (0.00 sec)
To drop the partition named p2, execute the following command:
mysql> ALTER TABLE tr DROP PARTITION p2;
Query OK, 0 rows affected (0.03 sec)
Note
The NDBCLUSTER storage engine does not support ALTER TABLE ... DROP PARTITION. It does, however, sup-
port the other partitioning-related extensions to ALTER TABLE that are described in this chapter.
It is very important to remember that, when you drop a partition, you also delete all the data that was stored in that partition. You can
see that this is the case by re-running the previous SELECT query:
mysql> SELECT * FROM tr WHERE purchased
-> BETWEEN '1995-01-01' AND '1999-12-31';
Partitioning
1871
Empty set (0.00 sec)
Because of this, the requirement was added in MySQL 5.1.10 that you have the DROP privilege for a table before you can execute AL-
TER TABLE ... DROP PARTITION on that table.
If you wish to drop all data from all partitions while preserving the table definition and its partitioning scheme, use the TRUNCATE
TABLE command. (See Section 12.2.10, TRUNCATE Syntax.)
If you intend to change the partitioning of a table without losing data, use ALTER TABLE ... REORGANIZE PARTITION instead.
See below or in Section 12.1.7, ALTER TABLE Syntax, for information about REORGANIZE PARTITION.
If you now execute a SHOW CREATE TABLE command, you can see how the partitioning makeup of the table has been changed:
mysql> SHOW CREATE TABLE tr\G
*************************** 1. row ***************************
Table: tr
Create Table: CREATE TABLE `tr` (
`id` int(11) default NULL,
`name` varchar(50) default NULL,
`purchased` date default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE ( YEAR(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1995) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (2005) ENGINE = MyISAM
)
1 row in set (0.01 sec)
When you insert new rows into the changed table with purchased column values between '1995-01-01' and '2004-12-31'
inclusive, those rows will be stored in partition p3. You can verify this as follows:
mysql> INSERT INTO tr VALUES (11, 'pencil holder', '1995-07-12');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM tr WHERE purchased
-> BETWEEN '1995-01-01' AND '2004-12-31';
+------+----------------+------------+
| id | name | purchased |
+------+----------------+------------+
| 11 | pencil holder | 1995-07-12 |
| 1 | desk organiser | 2003-10-15 |
| 5 | exercise bike | 2004-05-09 |
| 7 | popcorn maker | 2001-11-22 |
+------+----------------+------------+
4 rows in set (0.00 sec)
mysql> ALTER TABLE tr DROP PARTITION p3;
Query OK, 0 rows affected (0.03 sec)
mysql> SELECT * FROM tr WHERE purchased
-> BETWEEN '1995-01-01' AND '2004-12-31';
Empty set (0.00 sec)
Note that the number of rows dropped from the table as a result of ALTER TABLE ... DROP PARTITION is not reported by the
server as it would be by the equivalent DELETE query.
Dropping LIST partitions uses exactly the same ALTER TABLE ... DROP PARTITION syntax as used for dropping RANGE parti-
tions. However, there is one important difference in the effect this has on your use of the table afterward: You can no longer insert into
the table any rows having any of the values that were included in the value list defining the deleted partition. (See Section 18.2.2,
LIST Partitioning, for an example.)
To add a new range or list partition to a previously partitioned table, use the ALTER TABLE ... ADD PARTITION statement. For
tables which are partitioned by RANGE, this can be used to add a new range to the end of the list of existing partitions. For example,
suppose that you have a partitioned table containing membership data for your organisation, which is defined as follows:
CREATE TABLE members (
id INT,
fname VARCHAR(25),
lname VARCHAR(25),
dob DATE
)
PARTITION BY RANGE( YEAR(dob) ) (
PARTITION p0 VALUES LESS THAN (1970),
PARTITION p1 VALUES LESS THAN (1980),
PARTITION p2 VALUES LESS THAN (1990)
);
Partitioning
1872
Suppose further that the minimum age for members is 16. As the calendar approaches the end of 2005, you realize that you will soon be
admitting members who were born in 1990 (and later in years to come). You can modify the members table to accommodate new
members born in the years 1990-1999 as shown here:
ALTER TABLE ADD PARTITION (PARTITION p3 VALUES LESS THAN (2000));
Important
With tables that are partitioned by range, you can use ADD PARTITION to add new partitions to the high end of the parti-
tions list only. Trying to add a new partition in this manner between or before existing partitions will result in an error as
shown here:
mysql> ALTER TABLE members
> ADD PARTITION (
> PARTITION p3 VALUES LESS THAN (1960));
ERROR 1463 (HY000): VALUES LESS THAN value must be strictly
increasing for each partition
In a similar fashion, you can add new partitions to a table that is partitioned by LIST. For example, given a table defined like so:
CREATE TABLE tt (
id INT,
data INT
)
PARTITION BY LIST(data) (
PARTITION p0 VALUES IN (5, 10, 15),
PARTITION p1 VALUES IN (6, 12, 18)
);
You can add a new partition in which to store rows having the data column values 7, 14, and 21 as shown:
ALTER TABLE tt ADD PARTITION (PARTITION p2 VALUES IN (7, 14, 21));
Note that you cannot add a new LIST partition encompassing any values that are already included in the value list of an existing parti-
tion. If you attempt to do so, an error will result:
mysql> ALTER TABLE tt ADD PARTITION
> (PARTITION np VALUES IN (4, 8, 12));
ERROR 1465 (HY000): Multiple definition of same constant
in list partitioning
Because any rows with the data column value 12 have already been assigned to partition p1, you cannot create a new partition on ta-
ble tt that includes 12 in its value list. To accomplish this, you could drop p1, and add np and then a new p1 with a modified defini-
tion. However, as discussed earlier, this would result in the loss of all data stored in p1 and it is often the case that this is not what
you really want to do. Another solution might appear to be to make a copy of the table with the new partitioning and to copy the data in-
to it using CREATE TABLE ... SELECT ..., then drop the old table and rename the new one, but this could be very time-
consuming when dealing with a large amounts of data. This also might not be feasible in situations where high availability is a require-
ment.
Beginning with MySQL 5.1.6, you can add multiple partitions in a single ALTER TABLE ... ADD PARTITION statement as
shown here:
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
hired DATE NOT NULL
)
PARTITION BY RANGE( YEAR(hired) ) (
PARTITION p1 VALUES LESS THAN (1991),
PARTITION p2 VALUES LESS THAN (1996),
PARTITION p3 VALUES LESS THAN (2001),
PARTITION p4 VALUES LESS THAN (2005)
);
ALTER TABLE employees ADD PARTITION (
PARTITION p5 VALUES LESS THAN (2010),
PARTITION p6 VALUES LESS THAN MAXVALUE
);
Fortunately, MySQL's partitioning implementation provides ways to redefine partitions without losing data. Let us look first at a couple
Partitioning
1873
of simple examples involving RANGE partitioning. Recall the members table which is now defined as shown here:
mysql> SHOW CREATE TABLE members\G
*************************** 1. row ***************************
Table: members
Create Table: CREATE TABLE `members` (
`id` int(11) default NULL,
`fname` varchar(25) default NULL,
`lname` varchar(25) default NULL,
`dob` date default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE ( YEAR(dob) ) (
PARTITION p0 VALUES LESS THAN (1970) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1980) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (1990) ENGINE = MyISAM.
PARTITION p3 VALUES LESS THAN (2000) ENGINE = MyISAM
)
Suppose that you would like to move all rows representing members born before 1960 into a separate partition. As we have already
seen, this cannot be done using ALTER TABLE ... ADD PARTITION. However, you can use another partition-related extension to
ALTER TABLE in order to accomplish this:
ALTER TABLE members REORGANIZE PARTITION p0 INTO (
PARTITION s0 VALUES LESS THAN (1960),
PARTITION s1 VALUES LESS THAN (1970)
);
In effect, this command splits partition p0 into two new partitions s0 and s1. It also moves the data that was stored in p0 into the new
partitions according to the rules embodied in the two PARTITION ... VALUES ... clauses, so that s0 contains only those records
for which YEAR(dob) is less than 1960 and s1 contains those rows in which YEAR(dob) is greater than or equal to 1960 but less
than 1970.
A REORGANIZE PARTITION clause may also be used for merging adjacent partitions. You can return the members table to its pre-
vious partitioning as shown here:
ALTER TABLE members REORGANIZE PARTITION s0,s1 INTO (
PARTITION p0 VALUES LESS THAN (1970)
);
No data is lost in splitting or merging partitions using REORGANIZE PARTITION. In executing the above statement, MySQL moves
all of the records that were stored in partitions s0 and s1 into partition p0.
The general syntax for REORGANIZE PARTITION is:
ALTER TABLE tbl_name
REORGANIZE PARTITION partition_list
INTO (partition_definitions);
Here, tbl_name is the name of the partitioned table, and partition_list is a comma-separated list of names of one or more ex-
isting partitions to be changed. partition_definitions is a comma-separated list of new partition definitions, which follow the
same rules as for the partition_definitions list used in CREATE TABLE (see Section 12.1.17, CREATE TABLE Syntax). It
should be noted that you are not limited to merging several partitions into one, or to splitting one partition into many, when using RE-
ORGANIZE PARTITION. For example, you can reorganize all four partitions of the members table into two, as follows:
ALTER TABLE members REORGANIZE PARTITION p0,p1,p2,p3 INTO (
PARTITION m0 VALUES LESS THAN (1980),
PARTITION m1 VALUES LESS THAN (2000)
);
You can also use REORGANIZE PARTITION with tables that are partitioned by LIST. Let us return to the problem of adding a new
partition to the list-partitioned tt table and failing because the new partition had a value that was already present in the value-list of one
of the existing partitions. We can handle this by adding a partition that contains only nonconflicting values, and then reorganizing the
new partition and the existing one so that the value which was stored in the existing one is now moved to the new one:
ALTER TABLE tt ADD PARTITION (PARTITION np VALUES IN (4, 8));
ALTER TABLE tt REORGANIZE PARTITION p1,np INTO (
PARTITION p1 VALUES IN (6, 18),
PARTITION np VALUES in (4, 8, 12)
);
Partitioning
1874
Here are some key points to keep in mind when using ALTER TABLE ... REORGANIZE PARTITION to repartition tables that are
partitioned by RANGE or LIST:
The PARTITION clauses used to determine the new partitioning scheme are subject to the same rules as those used with a CREATE
TABLE statement.
Most importantly, you should remember that the new partitioning scheme cannot have any overlapping ranges (applies to tables par-
titioned by RANGE) or sets of values (when reorganizing tables partitioned by LIST).
Note
Prior to MySQL 5.1.4, you could not reuse the names of existing partitions in the INTO clause, even when those partitions
were being dropped or redefined. See Section C.1.34, Changes in MySQL 5.1.4 (21 December 2005), for more informa-
tion.
The combination of partitions in the partition_definitions list should account for the same range or set of values overall as
the combined partitions named in the partition_list.
For instance, in the members table used as an example in this section, partitions p1 and p2 together cover the years 1980 through
1999. Therefore, any reorganization of these two partitions should cover the same range of years overall.
For tables partitioned by RANGE, you can reorganize only adjacent partitions; you cannot skip over range partitions.
For instance, you could not reorganize the members table used as an example in this section using a statement beginning with AL-
TER TABLE members REORGANIZE PARTITION p0,p2 INTO ... because p0 covers the years prior to 1970 and p2
the years from 1990 through 1999 inclusive, and thus the two are not adjacent partitions.
You cannot use REORGANIZE PARTITION to change the table's partitioning type; that is, you cannot (for example) change
RANGE partitions to HASH partitions or vice versa. You also cannot use this command to change the partitioning expression or
column. To accomplish either of these tasks without dropping and re-creating the table, you can use ALTER TABLE ... PAR-
TITION BY .... For example:
ALTER TABLE members
PARTITION BY HASH( YEAR(dob) )
PARTITIONS 8;
18.3.2. Management of HASH and KEY Partitions
Tables which are partitioned by hash or by key are very similar to one another with regard to making changes in a partitioning setup,
and both differ in a number of ways from tables which have been partitioned by range or list. For that reason, this section addresses the
modification of tables partitioned by hash or by key only. For a discussion of adding and dropping of partitions of tables that are parti-
tioned by range or list, see Section 18.3.1, Management of RANGE and LIST Partitions.
You cannot drop partitions from tables that are partitioned by HASH or KEY in the same way that you can from tables that are parti-
tioned by RANGE or LIST. However, you can merge HASH or KEY partitions using the ALTER TABLE ... COALESCE PARTI-
TION command. For example, suppose that you have a table containing data about clients, which is divided into twelve partitions. The
clients table is defined as shown here:
CREATE TABLE clients (
id INT,
fname VARCHAR(30),
lname VARCHAR(30),
signed DATE
)
PARTITION BY HASH( MONTH(signed) )
PARTITIONS 12;
To reduce the number of partitions from twelve to eight, execute the following ALTER TABLE command:
mysql> ALTER TABLE clients COALESCE PARTITION 4;
Query OK, 0 rows affected (0.02 sec)
COALESCE works equally well with tables that are partitioned by HASH, KEY, LINEAR HASH, or LINEAR KEY. Here is an example
similar to the previous one, differing only in that the table is partitioned by LINEAR KEY:
Partitioning
1875
mysql> CREATE TABLE clients_lk (
-> id INT,
-> fname VARCHAR(30),
-> lname VARCHAR(30),
-> signed DATE
-> )
-> PARTITION BY LINEAR KEY(signed)
-> PARTITIONS 12;
Query OK, 0 rows affected (0.03 sec)
mysql> ALTER TABLE clients_lk COALESCE PARTITION 4;
Query OK, 0 rows affected (0.06 sec)
Records: 0 Duplicates: 0 Warnings: 0
Note that the number following COALESCE PARTITION is the number of partitions to merge into the remainder in other words, it
is the number of partitions to remove from the table.
If you attempt to remove more partitions than the table has, the result is an error like the one shown:
mysql> ALTER TABLE clients COALESCE PARTITION 18;
ERROR 1478 (HY000): Cannot remove all partitions, use DROP TABLE instead
To increase the number of partitions for the clients table from 12 to 18. use ALTER TABLE ... ADD PARTITION as shown
here:
ALTER TABLE clients ADD PARTITION PARTITIONS 6;
18.3.3. Maintenance of Partitions
A number of table and partition maintenance tasks can be carried out using SQL statements intended for such purposes on partitioned
tables in MySQL 5.1.
Table maintenance of partitioned tables can be accomplished using the statements CHECK TABLE, OPTIMIZE TABLE, ANALYZE
TABLE, and REPAIR TABLE, which are supported for partitioned tables as of MySQL 5.1.27.
Also beginning with MySQL 5.1.27, you can use a number of extensions to ALTER TABLE for performing operations of this type on
one or more partitions directly, as described in the following list:
Rebuilding partitions. Rebuilds the partition; this has the same effect as dropping all records stored in the partition, then reinsert-
ing them. This can be useful for purposes of defragmentation.
Example:
ALTER TABLE t1 REBUILD PARTITION p0, p1;
Optimizing partitions. If you have deleted a large number of rows from a partition or if you have made many changes to a parti-
tioned table with variable-length rows (that is, having VARCHAR, BLOB, or TEXT columns), you can use ALTER TABLE ...
OPTIMIZE PARTITION to reclaim any unused space and to defragment the partition data file.
Example:
ALTER TABLE t1 OPTIMIZE PARTITION p0, p1;
Using OPTIMIZE PARTITION on a given partition is equivalent to running CHECK PARTITION, ANALYZE PARTITION, and
REPAIR PARTITION on that partition.
Analyzing partitions. This reads and stores the key distributions for partitions.
Example:
ALTER TABLE t1 ANALYZE PARTITION p3;
Repairing partitions. This repairs corrupted partitions.
Example:
Partitioning
1876
ALTER TABLE t1 REPAIR PARTITION p0,p1;
Checking partitions. You can check partitions for errors in much the same way that you can use CHECK TABLE with nonparti-
tioned tables.
Example:
ALTER TABLE trb3 CHECK PARTITION p1;
This command will tell you if the data or indexes in partition p1 of table t1 are corrupted. If this is the case, use ALTER TABLE
... REPAIR PARTITION to repair the partition.
Note
The statements ALTER TABLE ... ANALYZE PARTITION, ALTER TABLE ... CHECK PARTITION, ALTER
TABLE ... OPTIMIZE PARTITION, and ALTER TABLE ... REPAIR PARTITION were originally introduced
in MySQL 5.1.5, but did not work properly and were disabled in MySQL 5.1.24. They were re-introduced in MySQL
5.1.27. (Bug#20129) The use of these partitioning-specific ALTER TABLE statements with tables which are not parti-
tioned is not supported; beginning with MySQL 5.1.31, it is expressly disallowed. (Bug#39434)
ALTER TABLE ... REBUILD PARTITION was also introduced in MySQL 5.1.5.
18.3.4. Obtaining Information About Partitions
This section discusses obtaining information about existing partitions, which can be done in a number of ways. These include:
Using the SHOW CREATE TABLE statement to view the partitioning clauses used in creating a partitioned table.
Using the SHOW TABLE STATUS statement to determine whether a table is partitioned.
Querying the INFORMATION_SCHEMA.PARTITIONS table.
Using the statement EXPLAIN PARTITIONS SELECT to see which partitions are used by a given SELECT.
As discussed elsewhere in this chapter, SHOW CREATE TABLE includes in its output the PARTITION BY clause used to create a par-
titioned table. For example:
mysql> SHOW CREATE TABLE trb3\G
*************************** 1. row ***************************
Table: trb3
Create Table: CREATE TABLE `trb3` (
`id` int(11) default NULL,
`name` varchar(50) default NULL,
`purchased` date default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (YEAR(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1995) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (2000) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (2005) ENGINE = MyISAM
)
1 row in set (0.00 sec)
Note
In early MySQL 5.1 releases, the PARTITIONS clause was not shown for tables partitioned by HASH or KEY. This issue
was fixed in MySQL 5.1.6.
SHOW TABLE STATUS works with partitioned tables. Beginning with MySQL 5.1.9, its output is the same as that for nonpartitioned
tables, except that the Create_options column contains the string partitioned. In MySQL 5.1.8 and earlier, the Engine
column always contained the value PARTITION; beginning with MySQL 5.1.9, this column contains the name of the storage engine
used by all partitions of the table. (See Section 12.5.5.38, SHOW TABLE STATUS Syntax, for more information about this state-
ment.)
Partitioning
1877
You can also obtain information about partitions from INFORMATION_SCHEMA, which contains a PARTITIONS table. See Sec-
tion 20.19, The INFORMATION_SCHEMA PARTITIONS Table.
Beginning with MySQL 5.1.5, it is possible to determine which partitions of a partitioned table are involved in a given SELECT query
using EXPLAIN PARTITIONS. The PARTITIONS keyword adds a partitions column to the output of EXPLAIN listing the par-
titions from which records would be matched by the query.
Suppose that you have a table trb1 defined and populated as follows:
CREATE TABLE trb1 (id INT, name VARCHAR(50), purchased DATE)
PARTITION BY RANGE(id)
(
PARTITION p0 VALUES LESS THAN (3),
PARTITION p1 VALUES LESS THAN (7),
PARTITION p2 VALUES LESS THAN (9),
PARTITION p3 VALUES LESS THAN (11)
);
INSERT INTO trb1 VALUES
(1, 'desk organiser', '2003-10-15'),
(2, 'CD player', '1993-11-05'),
(3, 'TV set', '1996-03-10'),
(4, 'bookcase', '1982-01-10'),
(5, 'exercise bike', '2004-05-09'),
(6, 'sofa', '1987-06-05'),
(7, 'popcorn maker', '2001-11-22'),
(8, 'aquarium', '1992-08-04'),
(9, 'study desk', '1984-09-16'),
(10, 'lava lamp', '1998-12-25');
You can see which partitions are used in a query such as SELECT * FROM trb1;, as shown here:
mysql> EXPLAIN PARTITIONS SELECT * FROM trb1\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: trb1
partitions: p0,p1,p2,p3
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 10
Extra: Using filesort
In this case, all four partitions are searched. However, when a limiting condition making use of the partitioning key is added to the
query, you can see that only those partitions containing matching values are scanned, as shown here:
mysql> EXPLAIN PARTITIONS SELECT * FROM trb1 WHERE id < 5\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: trb1
partitions: p0,p1
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 10
Extra: Using where
EXPLAIN PARTITIONS provides information about keys used and possible keys, just as with the standard EXPLAIN SELECT state-
ment:
mysql> ALTER TABLE trb1 ADD PRIMARY KEY (id);
Query OK, 10 rows affected (0.03 sec)
Records: 10 Duplicates: 0 Warnings: 0
mysql> EXPLAIN PARTITIONS SELECT * FROM trb1 WHERE id < 5\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: trb1
partitions: p0,p1
type: range
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
Partitioning
1878
ref: NULL
rows: 7
Extra: Using where
You should take note of the following restrictions and limitations on EXPLAIN PARTITIONS:
You cannot use the PARTITIONS and EXTENDED keywords together in the same EXPLAIN ... SELECT statement. Attempt-
ing to do so produces a syntax error.
If EXPLAIN PARTITIONS is used to examine a query against a nonpartitioned table, no error is produced, but the value of the
partitions column is always NULL.
As of MySQL 5.1.28, the rows column of EXPLAIN PARTITIONS output always displays the total number of records in the table.
Previously, this was the number of matching rows. (Bug#35745)
See also Section 12.3.2, EXPLAIN Syntax.
18.4. Partition Pruning
This section discusses an optimization known as partition pruning, which was implemented for partitioned tables in MySQL 5.1.6. The
core concept behind partition pruning is relatively simple, and can be described as Do not scan partitions where there can be no match-
ing values. For example, suppose you have a partitioned table t1 defined by this statement:
CREATE TABLE t1 (
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
region_code TINYINT UNSIGNED NOT NULL,
dob DATE NOT NULL
)
PARTITION BY RANGE( region_code ) (
PARTITION p0 VALUES LESS THAN (64),
PARTITION p1 VALUES LESS THAN (128),
PARTITION p2 VALUES LESS THAN (192),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
Consider the case where you wish to obtain results from a query such as this one:
SELECT fname, lname, region_code, dob
FROM t1
WHERE region_code > 125 AND region_code < 130;
It is easy to see that none of the rows which ought to be returned will be in either of the partitions p0 or p3; that is, we need to search
only in partitions p1 and p2 to find matching rows. By doing so, it is possible to expend much more time and effort in finding matching
rows than it is to scan all partitions in the table. This cutting away of unneeded partitions is known as pruning. When the optimizer
can make use of partition pruning in performing a query, execution of the query can be an order of magnitude faster than the same query
against a nonpartitioned table containing the same column definitions and data.
The query optimizer can perform pruning whenever a WHERE condition can be reduced to either one of the following:
partition_column = constant
partition_column IN (constant1, constant2, ..., constantN)
In the first case, the optimizer simply evaluates the partitioning expression for the value given, determines which partition contains that
value, and scans only this partition. In many cases, the equals sign can be replaced with another arithmetic comparison, including <, >,
<=, >=, and <>. Some queries using BETWEEN in the WHERE clause can also take advantage of partition pruning. See the examples
later in this section.
In the second case, the optimizer evaluates the partitioning expression for each value in the list, creates a list of matching partitions, and
then scans only the partitions in this partition list.
Pruning can also be applied to short ranges, which the optimizer can convert into equivalent lists of values. For instance, in the previous
example, the WHERE clause can be converted to WHERE region_code IN (125, 126, 127, 128, 129, 130). Then the
optimizer can determine that the first three values in the list are found in partition p1, the remaining three values in partition p2, and
Partitioning
1879
that the other partitions contain no relevant values and so do not need to be searched for matching rows.
This type of optimization can be applied whenever the partitioning expression consists of an equality or a range which can be reduced to
a set of equalities, or when the partitioning expression represents an increasing or decreasing relationship. Pruning can also be applied
for tables partitioned on a DATE or DATETIME column when the partitioning expression uses the YEAR() or TO_DAYS() function.
Note
We plan to add pruning support in a future MySQL release for additional functions that act on a DATE or DATETIME
value, return an integer, and are increasing or decreasing.
For example, suppose that table t2, defined as shown here, is partitioned on a DATE column:
CREATE TABLE t2 (
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
region_code TINYINT UNSIGNED NOT NULL,
dob DATE NOT NULL
)
PARTITION BY RANGE( YEAR(dob) ) (
PARTITION d0 VALUES LESS THAN (1970),
PARTITION d1 VALUES LESS THAN (1975),
PARTITION d2 VALUES LESS THAN (1980),
PARTITION d3 VALUES LESS THAN (1985),
PARTITION d4 VALUES LESS THAN (1990),
PARTITION d5 VALUES LESS THAN (2000),
PARTITION d6 VALUES LESS THAN (2005),
PARTITION d7 VALUES LESS THAN MAXVALUE
);
The following queries on t2 can make of use partition pruning:
SELECT * FROM t2 WHERE dob = '1982-06-23';
SELECT * FROM t2 WHERE dob BETWEEN '1991-02-15' AND '1997-04-25';
SELECT * FROM t2 WHERE dob >= '1984-06-21' AND dob <= '1999-06-21'
In the case of the last query, the optimizer can also act as follows:
1. Find the partition containing the low end of the range.
YEAR('1984-06-21') yields the value 1984, which is found in partition d3.
2. Find the partition containing the high end of the range.
YEAR('1999-06-21') evaluates to 1999, which is found in partition d5.
3. Scan only these two partitions and any partitions that may lie between them.
In this case, this means that only partitions d3, d4, and d5 are scanned. The remaining partitions may be safely ignored (and are
ignored).
Important
Invalid DATE and DATETIME values referenced in the WHERE clause of a query on a partitioned table are treated as
NULL. This means that a query such as SELECT * FROM partitioned_table WHERE date_column <
'2008-12-00' does not return any values (see Bug#40972).
So far, we have looked only at examples using RANGE partitioning, but pruning can be applied with other partitioning types as well.
Consider a table that is partitioned by LIST, where the partitioning expression is increasing or decreasing, such as the table t3 shown
here. (In this example, we assume for the sake of brevity that the region_code column is limited to values between 1 and 10 inclus-
ive.)
CREATE TABLE t3 (
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
region_code TINYINT UNSIGNED NOT NULL,
dob DATE NOT NULL
)
PARTITION BY LIST(region_code) (
Partitioning
1880
PARTITION r0 VALUES IN (1, 3),
PARTITION r1 VALUES IN (2, 5, 8),
PARTITION r2 VALUES IN (4, 9),
PARTITION r3 VALUES IN (6, 7, 10)
);
For a query such as SELECT * FROM t3 WHERE region_code BETWEEN 1 AND 3, the optimizer determines in which parti-
tions the values 1, 2, and 3 are found (r0 and r1) and skips the remaining ones (r2 and r3).
For tables that are partitioned by HASH or KEY, partition pruning is also possible in cases in which the WHERE clause uses a simple =
relation against a column used in the partitioning expression. Consider a table created like this:
CREATE TABLE t4 (
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
region_code TINYINT UNSIGNED NOT NULL,
dob DATE NOT NULL
)
PARTITION BY KEY(region_code)
PARTITIONS 8;
Any query such as this one can be pruned:
SELECT * FROM t4 WHERE region_code = 7;
Pruning can also be employed for short ranges, because the optimizer can turn such conditions into IN relations. For example, using the
same table t4 as defined previously, queries such as these can be pruned:
SELECT * FROM t4 WHERE region_code > 2 AND region_code < 6;
SELECT * FROM t4 WHERE region_code BETWEEN 3 AND 5;
In both these cases, the WHERE clause is transformed by the optimizer into WHERE region_code IN (3, 4, 5).
Important
This optimization is used only if the range size is smaller than the number of partitions. Consider this query:
SELECT * FROM t4 WHERE region_code BETWEEN 4 AND 8;
The range in the WHERE clause covers 5 values (4, 5, 6, 7, 8), but t4 has only 4 partitions. This means that the previous
query cannot be pruned.
Pruning can be used only on integer columns of tables partitioned by HASH or KEY. For example, this query on table t4 cannot use
pruning because dob is a DATE column:
SELECT * FROM t4 WHERE dob >= '2001-04-14' AND dob <= '2005-10-15';
However, if the table stores year values in an INT column, then a query having WHERE year_col >= 2001 AND year_col
<= 2005 can be pruned.
18.5. Restrictions and Limitations on Partitioning
This section discusses current restrictions and limitations on MySQL partitioning support, as listed here:
Prohibited constructs. Beginning with MySQL 5.1.12, the following constructs are not permitted in partitioning expressions:
Stored functions, stored procedures, UDFs, or plugins.
Declared variables or user variables.
For a list of SQL functions which are permitted in partitioning expressions, see Section 18.5.3, Partitioning Limitations Relating to
Functions.
Arithmetic and logical operators. Use of the arithmetic operators +, , and * is permitted in partitioning expressions. However,
the result must be an integer value or NULL (except in the case of [LINEAR] KEY partitioning, as discussed elswhere in this
chapter see Section 18.2, Partition Types, for more information).
Partitioning
1881
Beginning with MySQL 5.1.23, the DIV operator is also supported, and the / operator is disallowed. (Bug#30188, Bug#33182)
Beginning with MySQL 5.1.12, the bit operators |, &, ^, <<, >>, and ~ are not permitted in partitioning expressions.
Server SQL mode. Tables employing user-defined partitioning do not preserve the SQL mode in effect at the time that they were
created. As discussed in Section 5.1.8, Server SQL Modes, the results of many MySQL functions and operators may change ac-
cording to the server SQL mode. Therefore, a change in the SQL mode at any time after the creation of partitioned tables may lead
to major changes in the behavior of such tables, and could easily lead to corruption or loss of data. For these reasons, it is strongly
recommended that you never change the server SQL mode after creating partitioned tables.
Examples. The following examples illustrate some changes in behavior of partitioned tables due to a change in the server SQL
mode:
1. Error handling. Suppose you create a partitioned table whose partitioning expression is one such as column DIV 0 or
column MOD 0, as shown here:
mysql> CREATE TABLE tn (c1 INT)
-> PARTITION BY LIST(1 DIV c1) (
-> PARTITION p0 VALUES IN (NULL),
-> PARTITION p1 VALUES IN (1)
-> );
Query OK, 0 rows affected (0.05 sec)
The default behavior for MySQL is to return NULL for the result of a division by zero, without producing any errors:
mysql> SELECT @@SQL_MODE;
+------------+
| @@SQL_MODE |
+------------+
| |
+------------+
1 row in set (0.00 sec)
mysql> INSERT INTO tn VALUES (NULL), (0), (1);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
However, changing the server SQL mode to treat division by zero as an error and to enforce strict error handling causes the
same INSERT statement to fail, as shown here:
mysql> SET SQL_MODE='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO tn VALUES (NULL), (0), (1);
ERROR 1365 (22012): DIVISION BY 0
2. Table accessibility. Sometimes a change in the server SQL mode can make partitioned tables unusable. The following CRE-
ATE TABLE statement can be executed successfully only if the NO_UNSIGNED_SUBTRACTION mode is in effect:
mysql> SELECT @@SQL_MODE;
+------------+
| @@SQL_MODE |
+------------+
| |
+------------+
1 row in set (0.00 sec)
mysql> CREATE TABLE tu (c1 BIGINT UNSIGNED)
-> PARTITION BY RANGE(c1 - 10) (
-> PARTITION p0 VALUES LESS THAN (-5),
-> PARTITION p1 VALUES LESS THAN (0),
-> PARTITION p2 VALUES LESS THAN (5),
-> PARTITION p3 VALUES LESS THAN (10),
-> PARTITION p4 VALUES LESS THAN (MAXVALUE)
-> );
ERROR 1563 (HY000): PARTITION CONSTANT IS OUT OF PARTITION FUNCTION DOMAIN
mysql> SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @@SQL_MODE;
+-------------------------+
| @@SQL_MODE |
+-------------------------+
| NO_UNSIGNED_SUBTRACTION |
+-------------------------+
1 row in set (0.00 sec)
Partitioning
1882
mysql> CREATE TABLE tu (c1 BIGINT UNSIGNED)
-> PARTITION BY RANGE(c1 - 10) (
-> PARTITION p0 VALUES LESS THAN (-5),
-> PARTITION p1 VALUES LESS THAN (0),
-> PARTITION p2 VALUES LESS THAN (5),
-> PARTITION p3 VALUES LESS THAN (10),
-> PARTITION p4 VALUES LESS THAN (MAXVALUE)
-> );
Query OK, 0 rows affected (0.05 sec)
If you remove the NO_UNSIGNED_SUBTRACTION server SQL mode after creating tu, you may no longer be able to access
this table:
mysql> SET SQL_MODE='';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT * FROM tu;
ERROR 1563 (HY000): PARTITION CONSTANT IS OUT OF PARTITION FUNCTION DOMAIN
mysql> INSERT INTO tu VALUES (20);
ERROR 1563 (HY000): PARTITION CONSTANT IS OUT OF PARTITION FUNCTION DOMAIN
Performance considerations.
File system operations. Partitioning and repartitioning operations (such as ALTER TABLE with PARTITION BY ..., RE-
ORGANIZE PARTITIONS, or REMOVE PARTITIONING) depend on file system operations for their implementation. This
means that the speed of these operations is affected by such factors as file system type and characteristics, disk speed, swap
space, file handling efficiency of the operating system, and MySQL server options and variables that relate to file handling. In
particular, you should make sure that large_files_support is enabled and that open_files_limit is set properly.
For partitioned tables using the MyISAM storage engine, increasing myisam_max_sort_file_size may improve perform-
ance; partitioning and repartitioning operations involving InnoDB tables may be made more efficient by enabling in-
nodb_file_per_table.
Table locks. The process executing a partitioning operation on a table takes a write lock on the table. Reads from such tables
are relatively unaffected; pending INSERT and UPDATE operations are performed as soon as the partitioning operation has
completed.
Storage engine. Partitioning operations, queries, and update operations generally tend to be faster with MyISAM tables than
with InnoDB or NDB tables.
Use of indexes and partition pruning. As with nonpartitioned tables, proper use of indexes can speed up queries on partitioned
tables significantly. In addition, designing partitioned tables and queries on these tables to take advantage of partition pruning
can improve performance dramatically. See Section 18.4, Partition Pruning, for more information.
Performance with LOAD DATA. Prior to MySQL 5.1.23, LOAD DATA performed very poorly when importing into partitioned
tables. The statement now uses buffering to improve performance; however, the buffer uses 130 KB memory per partition to
achieve this. (Bug#26527)
Maximum number of partitions. The maximum number of partitions possible for a given table is 1024. This includes subparti-
tions.
If, when creating tables with a very large number of partitions (but which is less than the maximum stated previously), you en-
counter an error message such as GOT ERROR 24 FROM STORAGE ENGINE, this means that you may need to increase the value of the
open_files_limit system variable. See Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors.
Foreign keys not supported. Partitioned tables do not support foreign keys. This means that:
1. Definitions of tables employing user-defined partitioning may not contain foreign key references to other tables.
2. No table definition may contain a foreign key reference to a partitioned table.
The scope of these restrictions includes tables that use the InnoDB storage engine.
ALTER TABLE ... ORDER BY. An ALTER TABLE ... ORDER BY column statement run against a partitioned table
causes ordering of rows only within each partition.
FULLTEXT indexes. Partitioned tables do not support FULLTEXT indexes. This includes partitioned tables employing the My-
ISAM storage engine.
Spatial columns. Columns with spatial data types such as POINT or GEOMETRY cannot be used in partitioned tables.
Partitioning
1883
Temporary tables. As of MySQL 5.1.8, temporary tables cannot be partitioned. (Bug#17497)
Log tables. Beginning with MySQL 5.1.20, it is no longer possible to partition the log tables; beginning with that version, an AL-
TER TABLE ... PARTITION BY ... statement on such a table fails with an error. (Bug#27816)
Data type of partitioning key. A partitioning key must be either an integer column or an expression that resolves to an integer.
The column or expression value may also be NULL. (See Section 18.2.6, How MySQL Partitioning Handles NULL.)
The lone exception to this restriction occurs when partitioning by [LINEAR] KEY, where it is possible to use columns of other types
as partitioning keys, because MySQL's internal key-hashing functions produce the correct data type from these types. For example,
the following CREATE TABLE statement is valid:
CREATE TABLE tkc (c1 CHAR)
PARTITION BY KEY(c1)
PARTITIONS 4;
This exception does not apply to BLOB or TEXT column types.
Subqueries. A partitioning key may not be a subquery, even if that subquery resolves to an integer value or NULL.
Subpartitions. Subpartitions are limited to HASH or KEY partitioning. HASH and KEY partitions cannot be subpartitioned.
Key caches not supported. Key caches are not supported for partitioned tables. The CACHE INDEX and LOAD INDEX INTO
CACHE statements, when you attempt to use them on tables having user-defined partitioning, fail with the errors THE STORAGE EN-
GINE FOR THE TABLE DOESN'T SUPPORT ASSIGN_TO_KEYCACHE and THE STORAGE ENGINE FOR THE TABLE DOESN'T SUPPORT
PRELOAD_KEYS, respectively.
DELAYED option not supported. Use of INSERT DELAYED to insert rows into a partitioned table is not supported. Beginning
with MySQL 5.1.23, attempting to do so fails with an error. (Bug#31210)
DATA DIRECTORY and INDEX DIRECTORY options. DATA DIRECTORY and INDEX DIRECTORY are subject to the fol-
lowing restrictions when used with partitioned tables:
Beginning with MySQL 5.1.23, table-level DATA DIRECTORY and INDEX DIRECTORY options are ignored. (Bug#32091)
On Windows, the DATA DIRECTORY and INDEX DIRECTORY options are not supported for individual partitions or subparti-
tions (Bug#30459).
Repairing and rebuilding partitioned tables. The statements CHECK TABLE, OPTIMIZE TABLE, ANALYZE TABLE, and
REPAIR TABLE are supported for partitioned tables beginning with MySQL 5.1.27. (See Bug#20129.) mysqlcheck and myis-
amchk are not supported with partitioned tables.
In addition, you can use ALTER TABLE ... REBUILD PARTITION to rebuild one or more partitions of a partitioned table;
ALTER TABLE ... REORGANIZE PARTITION also causes partitions to be rebuilt. Both of these statements were added in
MySQL 5.1.5. See Section 12.1.7, ALTER TABLE Syntax, for more information about these two statements.
18.5.1. Partitioning Keys, Primary Keys, and Unique Keys
This section discusses the relationship of partitioning keys with primary keys and unique keys. The rule governing this relationship can
be expressed as follows: All columns used in the partitioning expression for a partitioned table must be part of every unique key that the
table may have.
In other words, every unique key on the table must use every column in the table's partitioning expression. (This also includes the table's
primary key, since it is by definition a unique key. This particular case is discussed later in this section.) For example, each of the fol-
lowing table creation statements is invalid:
CREATE TABLE t1 (
col1 INT NOT NULL,
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
UNIQUE KEY (col1, col2)
)
PARTITION BY HASH(col3)
PARTITIONS 4;
CREATE TABLE t2 (
col1 INT NOT NULL,
Partitioning
1884
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
UNIQUE KEY (col1),
UNIQUE KEY (col3)
)
PARTITION BY HASH(col1 + col3)
PARTITIONS 4;
In each case, the proposed table would have at least one unique key that does not include all columns used in the partitioning expres-
sion.
Each of the following statements is valid, and represents one way in which the corresponding invalid table creation statement could be
made to work:
CREATE TABLE t1 (
col1 INT NOT NULL,
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
UNIQUE KEY (col1, col2, col3)
)
PARTITION BY HASH(col3)
PARTITIONS 4;
CREATE TABLE t2 (
col1 INT NOT NULL,
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
UNIQUE KEY (col1, col3)
)
PARTITION BY HASH(col1 + col3)
PARTITIONS 4;
This example shows the error produced in such cases:
mysql> CREATE TABLE t3 (
-> col1 INT NOT NULL,
-> col2 DATE NOT NULL,
-> col3 INT NOT NULL,
-> col4 INT NOT NULL,
-> UNIQUE KEY (col1, col2),
-> UNIQUE KEY (col3)
-> )
-> PARTITION BY HASH(col1 + col3)
-> PARTITIONS 4;
ERROR 1491 (HY000): A PRIMARY KEY MUST INCLUDE ALL COLUMNS IN THE TABLE'S PARTITIONING FUNCTION
The CREATE statement fails because both col1 and col3 are included in the proposed partitioning key, but neither of these columns
is part of both of unique keys on the table. This shows one possible fix for the invalid table definition;
mysql> CREATE TABLE t3 (
-> col1 INT NOT NULL,
-> col2 DATE NOT NULL,
-> col3 INT NOT NULL,
-> col4 INT NOT NULL,
-> UNIQUE KEY (col1, col2, col3),
-> UNIQUE KEY (col3)
-> )
-> PARTITION BY HASH(col3)
-> PARTITIONS 4;
Query OK, 0 rows affected (0.05 sec)
In this case, the proposed partitioning key col3 is part of both unique keys, and the table creation statement succeeds.
Since every primary key is by definition a unique key, this restriction also includes the table's primary key, if it has one. For example,
the next two statements are invalid:
CREATE TABLE t4 (
col1 INT NOT NULL,
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
PRIMARY KEY(col1, col2)
)
PARTITION BY HASH(col3)
PARTITIONS 4;
CREATE TABLE t5 (
col1 INT NOT NULL,
Partitioning
1885
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
PRIMARY KEY(col1, col3),
UNIQUE KEY(col2)
)
PARTITION BY HASH( YEAR(col2) )
PARTITIONS 4;
In both cases, the primary key does not include all columns referenced in the partitioning expression. However, both of the next two
statements are valid:
CREATE TABLE t6 (
col1 INT NOT NULL,
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
PRIMARY KEY(col1, col2)
)
PARTITION BY HASH(col1 + YEAR(col2))
PARTITIONS 4;
CREATE TABLE t7 (
col1 INT NOT NULL,
col2 DATE NOT NULL,
col3 INT NOT NULL,
col4 INT NOT NULL,
PRIMARY KEY(col1, col2, col4),
UNIQUE KEY(col2, col1)
)
PARTITION BY HASH(col1 + YEAR(col2))
PARTITIONS 4;
If a table has no unique keys this includes having no primary key then this restriction does not apply, and you may use any
column or columns in the partitioning expression as long as the column type is compatible with the partitioning type.
For the same reason, you cannot later add a unique key to a partitioned table unless the key includes all columns used by the table's par-
titioning expression. Consider given the partitioned table defined as shown here:
mysql> CREATE TABLE t_no_pk (c1 INT, c2 INT)
-> PARTITION BY RANGE(c1) (
-> PARTITION p0 VALUES LESS THAN (10),
-> PARTITION p1 VALUES LESS THAN (20),
-> PARTITION p2 VALUES LESS THAN (30),
-> PARTITION p3 VALUES LESS THAN (40)
-> );
Query OK, 0 rows affected (0.12 sec)
It is possible to add a primary key to t_no_pk using either of these ALTER TABLE statements:
# possible PK
mysql> ALTER TABLE t_no_pk ADD PRIMARY KEY(c1);
Query OK, 0 rows affected (0.13 sec)
Records: 0 Duplicates: 0 Warnings: 0
# drop this PK
mysql> ALTER TABLE t_no_pk DROP PRIMARY KEY;
Query OK, 0 rows affected (0.10 sec)
Records: 0 Duplicates: 0 Warnings: 0
# use another possible PK
mysql> ALTER TABLE t_no_pk ADD PRIMARY KEY(c1, c2);
Query OK, 0 rows affected (0.12 sec)
Records: 0 Duplicates: 0 Warnings: 0
# drop this PK
mysql> ALTER TABLE t_no_pk DROP PRIMARY KEY;
Query OK, 0 rows affected (0.09 sec)
Records: 0 Duplicates: 0 Warnings: 0
However, the next statement fails, because c1 is part of the partitioning key, but is not part of the proposed primary key:
# fails with error 1503
mysql> ALTER TABLE t_no_pk ADD PRIMARY KEY(c2);
ERROR 1503 (HY000): A PRIMARY KEY MUST INCLUDE ALL COLUMNS IN THE TABLE'S PARTITIONING FUNCTION
Since t_no_pk has only c1 in its partitioning expression, attempting to adding a unique key on c2 alone fails. However, you can add
a unique key that uses both c1 and c2.
Partitioning
1886
These rules also apply to existing nonpartitioned tables that you wish to partition using ALTER TABLE ... PARTITION BY. Con-
sider a table np_pk defined as shown here:
mysql> CREATE TABLE np_pk (
-> id INT NOT NULL AUTO_INCREMENT,
-> name VARCHAR(50),
-> added DATE,
-> PRIMARY KEY (id)
-> );
Query OK, 0 rows affected (0.08 sec)
The following ALTER TABLE statements fails with an error, because the added column is not part of any unique key in the table:
mysql> ALTER TABLE np_pk
-> PARTITION BY HASH( TO_DAYS(added) )
-> PARTITIONS 4;
ERROR 1503 (HY000): A PRIMARY KEY MUST INCLUDE ALL COLUMNS IN THE TABLE'S PARTITIONING FUNCTION
However, this statement using the id column for the partitioning column is valid, as shown here:
mysql> ALTER TABLE np_pk
-> PARTITION BY HASH(id)
-> PARTITIONS 4;
Query OK, 0 rows affected (0.11 sec)
Records: 0 Duplicates: 0 Warnings: 0
In the case of np_pk, the only column that may be used as part of a partitioning expression is id; if you wish to partition this table us-
ing any other column or columns in the partitioning expression, you must first modify the table, either by adding the desired column or
columns to the primary key, or by dropping the primary key altogether.
We are working to remove this limitation in a future MySQL release series.
18.5.2. Partitioning Limitations Relating to Storage Engines
The following limitations apply to the use of storage engines with user-defined partitioning of tables.
MERGE storage engine. User-defined partitioning and the MERGE storage engine are not compatible. Tables using the MERGE storage
engine cannot be partitioned. Partitioned tables cannot be merged.
FEDERATED storage engine. Partitioning of FEDERATED tables is not supported. Beginning with MySQL 5.1.15, it is not possible to
create partitioned FEDERATED tables at all. We are working to remove this limitation in a future MySQL release.
CSV storage engine. Partitioned tables using the CSV storage engine are not supported. Starting with MySQL 5.1.12, it is not possible
to create partitioned CSV tables at all.
BLACKHOLE storage engine. Prior to MySQL 5.1.6, tables using the BLACKHOLE storage engine also could not be partitioned.
NDBCLUSTER storage engine (MySQL Cluster). Partitioning by KEY (or LINEAR KEY) is the only type of partitioning supported
for the NDBCLUSTER storage engine. Beginning with MySQL 5.1.12, it is not possible to create a MySQL Cluster table using any par-
titioning type other than [LINEAR] KEY, and attempting to do so fails with an error.
In addition, the maximum number of partitions that can be defined for an NDBCLUSTER table is 8 times the number of node groups in
the cluster. (See Section 17.1.2, MySQL Cluster Nodes, Node Groups, Replicas, and Partitions, for more information about node
groups in MySQL Cluster.)
Beginning with MySQL Cluster NDB 6.2.18, MySQL Cluster NDB 6.3.25, and MySQL Cluster NDB 7.0.6, CREATE TABLE and
ALTER TABLE statements that would cause a user-partitioned NDBCLUSTER table not to meet either or both of the following two re-
quirements are disallowed, and fail with an error (Bug#40709):
1. The table must have an explicit primary key.
2. All columns listed in the table's partitioning expression must be part of the primary key.
Exception. If a user-partitioned NDBCLUSTER table is created using an empty column-list (that is, using PARTITION BY KEY() or
PARTITION BY LINEAR KEY()), then no explicit primary key is required.
Partitioning
1887
Upgrading partitioned tables. When performing an upgrade, tables which are partitioned by KEY and which use any storage engine
other than NDBCLUSTER must be dumped and reloaded.
Same storage engine for all partitions. All partitions of a partitioned table must use the same storage engine and it must be the same
storage engine used by the table as a whole. In addition, if one does not specify an engine on the table level, then one must do either of
the following when creating or altering a partitioned table:
Do not specify any engine for any partition or subpartition
Specify the engine for all partitions or subpartitions
We are working to remove this limitation in a future MySQL release.
18.5.3. Partitioning Limitations Relating to Functions
This section discusses limitations in MySQL Partitioning relating specifically to functions used in partitioning expressions.
Beginning with MySQL 5.1.12, only the following MySQL functions are supported in partitioning expressions:
ABS()
CEILING() (see CEILING() and FLOOR(), immediately following this list)
DAY()
DAYOFMONTH()
DAYOFWEEK()
DAYOFYEAR()
DATEDIFF()
EXTRACT()
FLOOR() (see CEILING() and FLOOR(), immediately following this list)
HOUR()
MICROSECOND()
MINUTE()
MOD()
MONTH()
QUARTER()
SECOND()
TIME_TO_SEC()
TO_DAYS()
WEEKDAY()
YEAR()
YEARWEEK()
Note
Partitioning
1888
CEILING() and FLOOR(). Each of these functions returns an integer only if it is passed an integer argument. This
means, for example, that the following CREATE TABLE statement fails with an error, as shown here:
mysql> CREATE TABLE t (c FLOAT) PARTITION BY LIST( FLOOR(c) )(
-> PARTITION p0 VALUES IN (1,3,5),
-> PARTITION p1 VALUES IN (2,4,6)
-> );
ERROR 1490 (HY000): THE PARTITION FUNCTION RETURNS THE WRONG TYPE
See Section 11.5.2, Mathematical Functions, for more information about the return types of these functions.
Partitioning
1889
Chapter 19. Stored Programs and Views
This chapter discusses stored programs and views, which are database objects defined in terms of SQL code that is stored on the server
for later invocation.
Stored programs include these objects:
Stored routines, that is, stored procedures and functions. A stored function is used much like a built-in function. you invoke it in an
expression and it returns a value during expression evaluation. A stored procedure is invoked using the CALL statement. A proced-
ure does not have a return value but can modify its parameters for later inspection by the caller. It can also generate result sets to be
returned to the client program.
Triggers. A trigger is a named database object that is associated with a table and that is activated when a particular event occurs for
the table, such as an insert or update.
Events. An event is a task that runs according to schedule.
Views are stored queries that when invoked produce a result set. A view acts as a virtual table.
This chapter describes how to use each type of stored program and views. Additional information about SQL syntax for statements re-
lated to these objects is available in the following locations:
For each object type, there are CREATE, ALTER, and DROP statements that control which objects exist and how they are defined.
See Section 12.1, Data Definition Statements.
The CALL statement is used to invoke stored procedures. See Section 12.2.1, CALL Syntax.
Stored program definitions contain a body that may use compound statements, loops, conditionals, and declared variables. See Sec-
tion 12.8, MySQL Compound-Statement Syntax.
19.1. Defining Stored Programs
Each stored program contains a body that consists of an SQL statement. This statement may be a compound statement made up of sev-
eral statements separated by semicolon (;) characters. For example, the following stored procedure has a body made up of a BEGIN
... END block that contains a SET statement and a REPEAT loop that itself contains another SET statement:
CREATE PROCEDURE dorepeat(p1 INT)
BEGIN
SET @x = 0;
REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END
If you use the mysql client program to define a stored program that contains the semicolon characters within its definition, a problem
arises. By default, mysql itself recognizes semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause
mysql to pass the entire stored program definition to the server.
To redefine the mysql delimiter, use the delimiter command. The following example shows how to do this for the dorepeat()
procedure just shown. The delimiter is changed to // to enable the entire definition to be passed to the server as a single statement, and
then restored to ; before invoking the procedure. This allows the ; delimiter used in the procedure body to be passed through to the
server rather than being interpreted by mysql itself.
mysql> delimiter //
mysql> CREATE PROCEDURE dorepeat(p1 INT)
-> BEGIN
-> SET @x = 0;
-> REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
mysql> CALL dorepeat(1000);
Query OK, 0 rows affected (0.00 sec)
1890
mysql> SELECT @x;
+------+
| @x |
+------+
| 1001 |
+------+
1 row in set (0.00 sec)
You can redefine the delimiter to a string other than //, and the delimiter can consist of a single character or multiple characters. You
should avoid the use of the backslash (\) character because that is the escape character for MySQL.
The following is an example of a function that takes a parameter, performs an operation using an SQL function, and returns the result.
In this case, it is unnecessary to use delimiter because the function definition contains no internal ; statement delimiters:
mysql> CREATE FUNCTION hello (s CHAR(20))
mysql> RETURNS CHAR(50) DETERMINISTIC
-> RETURN CONCAT('Hello, ',s,'!');
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT hello('world');
+----------------+
| hello('world') |
+----------------+
| Hello, world! |
+----------------+
1 row in set (0.00 sec)
19.2. Using Stored Routines (Procedures and Functions)
Stored routines (procedures and functions) are supported in MySQL 5.1. A stored routine is a set of SQL statements that can be stored
in the server. Once this has been done, clients don't need to keep reissuing the individual statements but can refer to the stored routine
instead.
Stored routines require the proc table in the mysql database. This table is created during the MySQL 5.1 installation procedure. If
you are upgrading to MySQL 5.1 from an earlier version, be sure to update your grant tables to make sure that the proc table exists.
See Section 4.4.8, mysql_upgrade Check Tables for MySQL Upgrade.
MySQL Enterprise
For expert advice on using stored procedures and functions subscribe to the MySQL Enterprise Monitor. For
more information, see http://www.mysql.com/products/enterprise/advisors.html.
Stored routines can be particularly useful in certain situations:
When multiple client applications are written in different languages or work on different platforms, but need to perform the same
database operations.
When security is paramount. Banks, for example, use stored procedures and functions for all common operations. This provides a
consistent and secure environment, and routines can ensure that each operation is properly logged. In such a setup, applications and
users would have no access to the database tables directly, but can only execute specific stored routines.
Stored routines can provide improved performance because less information needs to be sent between the server and the client. The
tradeoff is that this does increase the load on the database server because more of the work is done on the server side and less is done on
the client (application) side. Consider this if many client machines (such as Web servers) are serviced by only one or a few database
servers.
Stored routines also allow you to have libraries of functions in the database server. This is a feature shared by modern application lan-
guages that allow such design internally (for example, by using classes). Using these client application language features is beneficial
for the programmer even outside the scope of database use.
MySQL follows the SQL:2003 syntax for stored routines, which is also used by IBM's DB2.
The MySQL implementation of stored routines is still in progress. All syntax described here is supported and any limitations and exten-
sions are documented where appropriate.
Additional resources
Stored Programs and Views
1891
You may find the Stored Procedures User Forum of use when working with stored procedures and functions.
For answers to some commonly asked questions regarding stored routines in MySQL, see Section A.4, MySQL 5.1 FAQ Stored
Procedures and Functions.
There are some restrictions on the use of stored routines. See Section D.1, Restrictions on Stored Routines, Triggers, and Events.
Binary logging for stored routines takes place as described in Section 19.6, Binary Logging of Stored Programs.
19.2.1. Stored Routine Syntax
A stored routine is either a procedure or a function. Stored routines are created with the CREATE PROCEDURE and CREATE FUNC-
TION statements (see Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION Syntax). A procedure is invoked using a
CALL statement (see Section 12.2.1, CALL Syntax), and can only pass back values using output variables. A function can be called
from inside a statement just like any other function (that is, by invoking the function's name), and can return a scalar value. The body of
a stored routine can use compound statements (see Section 12.8, MySQL Compound-Statement Syntax).
Stored routines can be dropped with the DROP PROCEDURE and DROP FUNCTION statements (see Section 12.1.26, DROP PRO-
CEDURE and DROP FUNCTION Syntax), and altered with the ALTER PROCEDURE and ALTER FUNCTION statements (see Sec-
tion 12.1.5, ALTER PROCEDURE Syntax).
A stored procedure or function is associated with a particular database. This has several implications:
When the routine is invoked, an implicit USE db_name is performed (and undone when the routine terminates). USE statements
within stored routines are disallowed.
You can qualify routine names with the database name. This can be used to refer to a routine that is not in the current database. For
example, to invoke a stored procedure p or function f that is associated with the test database, you can say CALL test.p() or
test.f().
When a database is dropped, all stored routines associated with it are dropped as well.
Stored functions cannot be recursive.
Recursion in stored procedures is allowed but disabled by default. To enable recursion, set the max_sp_recursion_depth server
system variable to a value greater than zero. Stored procedure recursion increases the demand on thread stack space. If you increase the
value of max_sp_recursion_depth, it may be necessary to increase thread stack size by increasing the value of thread_stack
at server startup. See Section 5.1.4, Server System Variables, for more information.
MySQL supports the very useful extension that allows the use of regular SELECT statements (that is, without using cursors or local
variables) inside a stored procedure. The result set of such a query is simply sent directly to the client. Multiple SELECT statements
generate multiple result sets, so the client must use a MySQL client library that supports multiple result sets. This means the client must
use a client library from a version of MySQL at least as recent as 4.1. The client should also specify the CLIENT_MULTI_RESULTS
option when it connects. For C programs, this can be done with the mysql_real_connect() C API function. See Sec-
tion 21.10.3.52, mysql_real_connect(), and Section 21.10.12, C API Support for Multiple Statement Execution.
MySQL Enterprise
MySQL Enterprise subscribers will find numerous articles about stored routines in the MySQL Enterprise Know-
ledge Base. Access to this collection of articles is one of the advantages of subscribing to MySQL Enterprise.
For more information, see http://www.mysql.com/products/enterprise/advisors.html.
19.2.2. Stored Routines and MySQL Privileges
The MySQL grant system takes stored routines into account as follows:
The CREATE ROUTINE privilege is needed to create stored routines.
The ALTER ROUTINE privilege is needed to alter or drop stored routines. This privilege is granted automatically to the creator of a
routine if necessary, and dropped when the routine creator drops the routine.
The EXECUTE privilege is required to execute stored routines. However, this privilege is granted automatically to the creator of a
Stored Programs and Views
1892
routine if necessary (and dropped when the creator drops the routine). Also, the default SQL SECURITY characteristic for a routine
is DEFINER, which enables users who have access to the database with which the routine is associated to execute the routine.
If the automatic_sp_privileges system variable is 0, the EXECUTE and ALTER ROUTINE privileges are not automatically
granted and dropped.
The server manipulates the mysql.proc table in response to statements that create, alter, or drop stored routines. It is not supported
that the server will notice manual manipulation of this table.
19.2.3. Stored Routine Metadata
Metadata about stored routines can be obtained as follows:
Query the ROUTINES table of the INFORMATION_SCHEMA database. See Section 20.14, The INFORMATION_SCHEMA
ROUTINES Table.
Use the SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION statements to see routine definitions. See Sec-
tion 12.5.5.11, SHOW CREATE PROCEDURE Syntax.
Use the SHOW PROCEDURE STATUS and SHOW FUNCTION STATUS statements to see routine characteristics. See Sec-
tion 12.5.5.30, SHOW PROCEDURE STATUS Syntax.
INFORMATION_SCHEMA does not have a PARAMETERS table until MySQL 6.0, so applications that need to acquire routine para-
meter information at runtime must use workarounds such as parsing the output of SHOW CREATE statements or the param_list
column of the mysql.proc table. param_list contents can be processed from within a stored routine, unlike the output from
SHOW.
19.2.4. Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
Within the body of a stored routine (procedure or function) or a trigger, the value of LAST_INSERT_ID() changes the same way as
for statements executed outside the body of these kinds of objects (see Section 11.11.3, Information Functions). The effect of a stored
routine or trigger upon the value of LAST_INSERT_ID() that is seen by following statements depends on the kind of routine:
If a stored procedure executes statements that change the value of LAST_INSERT_ID(), the changed value is seen by statements
that follow the procedure call.
For stored functions and triggers that change the value, the value is restored when the function or trigger ends, so following state-
ments do not see a changed value.
19.3. Using Triggers
A trigger is a named database object that is associated with a table, and that activates when a particular event occurs for the table. Some
uses for triggers are to perform checks of values to be inserted into a table or to perform calculations on values involved in an update.
A trigger is defined to activate when an INSERT, DELETE, or UPDATE statement executes for the associated table. A trigger can be set
to activate either before or after the triggering statement. For example, you can have a trigger activate before each row that is inserted
into a table or after each row that is updated.
Important
MySQL triggers are activated by SQL statements only. They are not activated by changes in tables made by APIs that do
not transmit SQL statements to the MySQL Server; in particular, they are not activated by updates made using the NDB
API.
To use triggers if you have upgraded to MySQL 5.1 from an older release that did not support triggers, you should upgrade your grant
tables so that they contain the trigger-related privileges. See Section 4.4.8, mysql_upgrade Check Tables for MySQL Upgrade.
The following discussion describes the syntax for creating and dropping triggers, and shows some examples of how to use them.
Stored Programs and Views
1893
Additional resources
You may find the Triggers User Forum of use when working with views.
For answers to some commonly asked questions regarding triggers in MySQL, see Section A.5, MySQL 5.1 FAQ Triggers.
There are some restrictions on the use of triggers; see Section D.1, Restrictions on Stored Routines, Triggers, and Events.
Binary logging for triggers takes place as described in Section 19.6, Binary Logging of Stored Programs.
19.3.1. Trigger Syntax
To create a trigger or drop a trigger, use the CREATE TRIGGER or DROP TRIGGER statement. The syntax for these statements is de-
scribed in Section 12.1.19, CREATE TRIGGER Syntax, and Section 12.1.30, DROP TRIGGER Syntax.
Here is a simple example that associates a trigger with a table for INSERT statements. The trigger acts as an accumulator, summing the
values inserted into one of the columns of the table.
mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
Query OK, 0 rows affected (0.03 sec)
mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account
-> FOR EACH ROW SET @sum = @sum + NEW.amount;
Query OK, 0 rows affected (0.06 sec)
The CREATE TRIGGER statement creates a trigger named ins_sum that is associated with the account table. It also includes
clauses that specify the trigger activation time, the triggering event, and what to do with the trigger activates:
The keyword BEFORE indicates the trigger action time. In this case, the trigger should activate before each row inserted into the ta-
ble. The other allowable keyword here is AFTER.
The keyword INSERT indicates the event that activates the trigger. In the example, INSERT statements cause trigger activation.
You can also create triggers for DELETE and UPDATE statements.
The statement following FOR EACH ROW defines the statement to execute each time the trigger activates, which occurs once for
each row affected by the triggering statement In the example, the triggered statement is a simple SET that accumulates the values in-
serted into the amount column. The statement refers to the column as NEW.amount which means the value of the amount
column to be inserted into the new row.
To use the trigger, set the accumulator variable to zero, execute an INSERT statement, and then see what value the variable has after-
ward:
mysql> SET @sum = 0;
mysql> INSERT INTO account VALUES(137,14.98),(141,1937.50),(97,-100.00);
mysql> SELECT @sum AS 'Total amount inserted';
+-----------------------+
| Total amount inserted |
+-----------------------+
| 1852.48 |
+-----------------------+
In this case, the value of @sum after the INSERT statement has executed is 14.98 + 1937.50 - 100, or 1852.48.
To destroy the trigger, use a DROP TRIGGER statement. You must specify the schema name if the trigger is not in the default schema:
mysql> DROP TRIGGER test.ins_sum;
Triggers for a table are also dropped if you drop the table.
Trigger names exist in the schema namespace, meaning that all triggers must have unique names within a schema. Triggers in different
schemas can have the same name.
In addition to the requirement that trigger names be unique for a schema, there are other limitations on the types of triggers you can cre-
ate. In particular, you cannot have two triggers for a table that have the same activation time and activation event. For example, you
Stored Programs and Views
1894
cannot define two BEFORE INSERT triggers or two AFTER UPDATE triggers for a table. This should rarely be a significant limita-
tion, because it is possible to define a trigger that executes multiple statements by using the BEGIN ... END compound statement
construct after FOR EACH ROW. (An example appears later in this section.)
The OLD and NEW keywords enable you to access columns in the rows affected by a trigger. (OLD and NEW are not case sensitive.) In an
INSERT trigger, only NEW.col_name can be used; there is no old row. In a DELETE trigger, only OLD.col_name can be used;
there is no new row. In an UPDATE trigger, you can use OLD.col_name to refer to the columns of a row before it is updated and
NEW.col_name to refer to the columns of the row after it is updated.
A column named with OLD is read only. You can refer to it (if you have the SELECT privilege), but not modify it. A column named
with NEW can be referred to if you have the SELECT privilege for it. In a BEFORE trigger, you can also change its value with SET
NEW.col_name = value if you have the UPDATE privilege for it. This means you can use a trigger to modify the values to be in-
serted into a new row or that are used to update a row.
In a BEFORE trigger, the NEW value for an AUTO_INCREMENT column is 0, not the automatically generated sequence number that will
be generated when the new record actually is inserted.
OLD and NEW are MySQL extensions to triggers.
By using the BEGIN ... END construct, you can define a trigger that executes multiple statements. Within the BEGIN block, you
also can use other syntax that is allowed within stored routines such as conditionals and loops. However, just as for stored routines, if
you use the mysql program to define a trigger that executes multiple statements, it is necessary to redefine the mysql statement delim-
iter so that you can use the ; statement delimiter within the trigger definition. The following example illustrates these points. It defines
an UPDATE trigger that checks the new value to be used for updating each row, and modifies the value to be within the range from 0 to
100. This must be a BEFORE trigger because the value needs to be checked before it is used to update the row:
mysql> delimiter //
mysql> CREATE TRIGGER upd_check BEFORE UPDATE ON account
-> FOR EACH ROW
-> BEGIN
-> IF NEW.amount < 0 THEN
-> SET NEW.amount = 0;
-> ELSEIF NEW.amount > 100 THEN
-> SET NEW.amount = 100;
-> END IF;
-> END;//
mysql> delimiter ;
It can be easier to define a stored procedure separately and then invoke it from the trigger using a simple CALL statement. This is also
advantageous if you want to invoke the same routine from within several triggers.
There are some limitations on what can appear in statements that a trigger executes when activated:
The trigger cannot use the CALL statement to invoke stored procedures that return data to the client or that use dynamic SQL.
(Stored procedures are allowed to return data to the trigger through OUT or INOUT parameters.)
The trigger cannot use statements that explicitly or implicitly begin or end a transaction such as START TRANSACTION, COMMIT,
or ROLLBACK.
MySQL handles errors during trigger execution as follows:
If a BEFORE trigger fails, the operation on the corresponding row is not performed.
A BEFORE trigger is activated by the attempt to insert or modify the row, regardless of whether the attempt subsequently succeeds.
An AFTER trigger is executed only if the BEFORE trigger (if any) and the row operation both execute successfully.
An error during either a BEFORE or AFTER trigger results in failure of the entire statement that caused trigger invocation.
For transactional tables, failure of a statement should cause rollback of all changes performed by the statement. Failure of a trigger
causes the statement to fail, so trigger failure also causes rollback. For nontransactional tables, such rollback cannot be done, so al-
though the statement fails, any changes performed prior to the point of the error remain in effect.
19.3.2. Trigger Metadata
Stored Programs and Views
1895
Metadata about triggers can be obtained as follows:
Query the TRIGGERS table of the INFORMATION_SCHEMA database. See Section 20.16, The INFORMATION_SCHEMA
TRIGGERS Table.
Use the SHOW TRIGGERS statement. See Section 12.5.5.40, SHOW TRIGGERS Syntax.
19.4. Using the Event Scheduler
The MySQL Event Scheduler manages the scheduling and execution of events: Tasks that run according to schedule. Event support was
added in MySQL 5.1.6. The following discussion covers the Event Scheduler and is divided into the following sections:
Section 19.4.1, Event Scheduler Overview, provides an introduction to and conceptual overview of MySQL Events.
Section 19.4.3, Event Syntax, discusses the SQL statements for creating, altering, and dropping MySQL Events.
Section 19.4.4, Event Metadata, shows how to obtain information about events and how this information is stored by the MySQL
Server.
Section 19.4.6, The Event Scheduler and MySQL Privileges, discusses the privileges required to work with events and the rami-
fications that events have with regard to privileges when executing.
Stored routines require the event table in the mysql database. This table is created during the MySQL 5.1 installation procedure. If
you are upgrading to MySQL 5.1 from an earlier version, be sure to update your grant tables to make sure that the event table exists.
See Section 4.4.8, mysql_upgrade Check Tables for MySQL Upgrade.
Additional resources
You may find the MySQL Event Scheduler User Forum of use when working with scheduled events.
There are some restrictions on the use of events; see Section D.1, Restrictions on Stored Routines, Triggers, and Events.
Binary logging for events takes place as described in Section 19.6, Binary Logging of Stored Programs.
19.4.1. Event Scheduler Overview
MySQL Events are tasks that run according to a schedule. Therefore, we sometimes refer to them as scheduled events. When you create
an event, you are creating a named database object containing one or more SQL statements to be executed at one or more regular inter-
vals, beginning and ending at a specific date and time. Conceptually, this is similar to the idea of the Unix crontab (also known as a
cron job) or the Windows Task Scheduler.
Scheduled tasks of this type are also sometimes known as temporal triggers, implying that these are objects that are triggered by the
passage of time. While this is essentially correct, we prefer to use the term events in order to avoid confusion with triggers of the type
discussed in Section 19.3, Using Triggers. Events should more specifically not be confused with temporary triggers. Whereas a trig-
ger is a database object whose statements are executed in response to a specific type of event that occurs on a given table, a (scheduled)
event is an object whose statements are executed in response to the passage of a specified time interval.
While there is no provision in the SQL Standard for event scheduling, there are precedents in other database systems, and you may no-
tice some similarities between these implementations and that found in the MySQL Server.
MySQL Events have the following major features and properties:
In MySQL 5.1.12 and later, an event is uniquely identified by its name and the schema to which it is assigned. (Previously, an event
was also unique to its definer.)
An event performs a specific action according to a schedule. This action consists of an SQL statement, which can be a compound
statement in a BEGIN ... END block if desired (see Section 12.8, MySQL Compound-Statement Syntax). An event's timing
can be either one-time or recurrent. A one-time event executes one time only. A recurrent event repeats its action at a regular inter-
Stored Programs and Views
1896
val, and the schedule for a recurring event can be assigned a specific start day and time, end day and time, both, or neither. (By de-
fault, a recurring event's schedule begins as soon as it is created, and continues indefinitely, until it is disabled or dropped.)
If a repeating event does not terminate within its scheduling interval, the result may be multiple instances of the event executing
simultaneously. If this is undesirable, you should institute a mechanism to prevent simultaneous instances. For example, you could
use the GET_LOCK() function, or row or table locking.
Users can create, modify, and drop scheduled events using SQL statements intended for these purposes. Syntactically invalid event
creation and modification statements fail with an appropriate error message. A user may include statements in an event's action
which require privileges that the user does not actually have. The event creation or modification statement succeeds but the event's
action fails. See Section 19.4.6, The Event Scheduler and MySQL Privileges for details.
Many of the properties of an event can be set or modified using SQL statements. These properties include the event's name, timing,
persistence (that is, whether it is preserved following the expiration of its schedule), status (enabled or disabled), action to be per-
formed, and the schema to which it is assigned. See Section 12.1.2, ALTER EVENT Syntax.
The default definer of an event is the user who created the event, unless the event has been altered, in which case the definer is the
user who issued the last ALTER EVENT statement affecting that event. An event can be modified by any user having the EVENT
privilege on the database for which the event is defined. (Prior to MySQL 5.1.12, only an event's definer, or a user having privileges
on the mysql.event table, could modify a given event.) See Section 19.4.6, The Event Scheduler and MySQL Privileges.
An event's action statement may include most SQL statements permitted within stored routines. For restrictions, see Section D.1,
Restrictions on Stored Routines, Triggers, and Events.
19.4.2. Event Scheduler Configuration
Events are executed by a special event scheduler thread; when we refer to the Event Scheduler, we actually refer to this thread. When
running, the event scheduler thread and its current state can be seen by users having the PROCESS privilege in the output of SHOW
PROCESSLIST, as shown in the discussion that follows.
The global event_scheduler system variable determines whether the Event Scheduler is enabled and running on the server. Begin-
ning with MySQL 5.1.12, it has one of these 3 values, which affect event scheduling as described here:
OFF: The Event Scheduler is stopped. The event scheduler thread does not run, is not shown in the output of SHOW PROCESS-
LIST, and no scheduled events are executed. OFF is the default value for event_scheduler.
When the Event Scheduler is stopped (event_scheduler is OFF), it can be started by setting the value of event_scheduler
to ON. (See next item.)
ON: The Event Scheduler is started; the event scheduler thread runs and executes all scheduled events.
When the Event Scheduler is ON, the event scheduler thread is listed in the output of SHOW PROCESSLIST as a daemon process,
and its state is represented as shown here:
mysql> SHOW PROCESSLIST\G
*************************** 1. row ***************************
Id: 1
User: root
Host: localhost
db: NULL
Command: Query
Time: 0
State: NULL
Info: show processlist
*************************** 2. row ***************************
Id: 2
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon
Time: 3
State: Waiting for next activation
Info: NULL
2 rows in set (0.00 sec)
Event scheduling can be stopped by setting the value of event_scheduler to OFF.
DISABLED: This value renders the Event Scheduler nonoperational. When the Event Scheduler is DISABLED, the event scheduler
Stored Programs and Views
1897
thread does not run (and so does not appear in the output of SHOW PROCESSLIST). In addition, the Event Scheduler state cannot
be changed at runtime.
If the Event Scheduler status has not been set to DISABLED, event_scheduler can be toggled between ON and OFF (using SET).
It is also possible to use 0 for OFF, and 1 for ON when setting this variable. Thus, any of the following 4 statements can be used in the
mysql client to turn on the Event Scheduler:
SET GLOBAL event_scheduler = ON;
SET @@global.event_scheduler = ON;
SET GLOBAL event_scheduler = 1;
SET @@global.event_scheduler = 1;
Similarly, any of these 4 statements can be used to turn off the Event Scheduler:
SET GLOBAL event_scheduler = OFF;
SET @@global.event_scheduler = OFF;
SET GLOBAL event_scheduler = 0;
SET @@global.event_scheduler = 0;
Although ON and OFF have numeric equivalents, the value displayed for event_scheduler by SELECT or SHOW VARIABLES is
always one of OFF, ON, or DISABLED. DISABLED has no numeric equivalent. For this reason, ON and OFF are usually preferred over
1 and 0 when setting this variable.
Note that attempting to set event_scheduler without specifying it as a global variable causes an error:
mysql< SET @@event_scheduler = OFF;
ERROR 1229 (HY000): VARIABLE 'EVENT_SCHEDULER' IS A GLOBAL
VARIABLE AND SHOULD BE SET WITH SET GLOBAL
Important
It is possible to set the Event Scheduler to DISABLED only at server startup. If event_scheduler is ON or OFF, you
cannot set it to DISABLED at runtime. Also, if the Event Scheduler is set to DISABLED at startup, you cannot change the
value of event_scheduler at runtime.
To disable the event scheduler, use one of the following two methods:
As a command-line option when starting the server:
--event-scheduler=DISABLED
In the server configuration file (my.cnf, or my.ini on Windows systems), include the line where it will be read by the server (for
example, in a [mysqld] section):
event_scheduler=DISABLED
To enable the Event Scheduler, restart the server without the --event-scheduler=DISABLED command-line option, or after re-
moving or commenting out the line containing event-scheduler=DISABLED in the server configuration file, as appropriate. Al-
ternatively, you can use ON (or 1) or OFF (or 0) in place of the DISABLED value when starting the server.
Note
You can issue event-manipulation statements when event_scheduler is set to DISABLED. No warnings or errors are
generated in such cases (provided that the statements are themselves valid). However, scheduled events cannot execute un-
til this variable is set to ON (or 1). Once this has been done, the event scheduler thread executes all events whose schedul-
ing conditions are satisfied.
In MySQL 5.1.11, event_scheduler behaved as follows: this variable could take one of the values 0 (or OFF), 1 (or ON), or 2. Set-
ting it to 0 turned event scheduling off, so that the event scheduler thread did not run; the event_scheduler variable could not be
set to this value while the server was running. Setting it to 1 so that the event scheduler thread ran and executed scheduled events. In
this state, the event scheduler thread appeared to be sleeping when viewed with SHOW PROCESSLIST. When event_scheduler
was set to 2 (which was the default value), the Event Scheduler was considered to be suspended; the event scheduler thread ran and
could be seen in the output of SHOW PROCESSLIST (where Suspended was displayed in the State column), but did not execute
Stored Programs and Views
1898
any scheduled events. The value of event_scheduler could be changed only between 1 (or ON) and 2 while the server was run-
ning. Setting it to 0 (or OFF) required a server restart, as did changing its value from 0 (or OFF) to 1 (or ON) or 2.
Prior to MySQL 5.1.11, event_scheduler could take one of only the 2 values 0|OFF or 1|ON, and the default value was 0|OFF. It
was also possible to start and stop the event scheduler thread while the MySQL server was running.
For more information concerning the reasons for these changes in behaviour, see Bug#17619.
Beginning with MySQL 5.1.17, starting the MySQL server with the --skip-grant-tables option causes event_scheduler
to be set to DISABLED, overriding any other value set either on the command line or in the my.cnf or my.ini file (Bug#26807).
For SQL statements used to create, alter, and drop events, see Section 19.4.3, Event Syntax.
MySQL 5.1.6 and later provides an EVENTS table in the INFORMATION_SCHEMA database. This table can be queried to obtain in-
formation about scheduled events which have been defined on the server. See Section 19.4.4, Event Metadata, and Section 20.20,
The INFORMATION_SCHEMA EVENTS Table, for more information.
For information regarding event scheduling and the MySQL privilege system, see Section 19.4.6, The Event Scheduler and MySQL
Privileges.
19.4.3. Event Syntax
MySQL 5.1.6 and later provides several SQL statements for working with scheduled events:
New events are defined using the CREATE EVENT statement. See Section 12.1.11, CREATE EVENT Syntax.
The definition of an existing event can be changed by means of the ALTER EVENT statement. See Section 12.1.2, ALTER
EVENT Syntax.
When a scheduled event is no longer wanted or needed, it can be deleted from the server by its definer using the DROP EVENT
statement. See Section 12.1.22, DROP EVENT Syntax. Whether an event persists past the end of its schedule also depends on its
ON COMPLETION clause, if it has one. See Section 12.1.11, CREATE EVENT Syntax.
An event can be dropped by any user having the EVENT privilege for the database on which the event is defined. Prior to MySQL
5.1.12, a user other than the definer required privileges on the mysql.event table. See Section 19.4.6, The Event Scheduler and
MySQL Privileges.
19.4.4. Event Metadata
Metadata about events can be obtained as follows:
Query the EVENTS table of the INFORMATION_SCHEMA database. See Section 20.20, The INFORMATION_SCHEMA EVENTS
Table.
Use the SHOW CREATE EVENT statement. See Section 12.5.5.9, SHOW CREATE EVENT Syntax.
Use the SHOW EVENTS statement. See Section 12.5.5.19, SHOW EVENTS Syntax.
19.4.5. Event Scheduler Status
The Event Scheduler writes information about event execution that terminates with an error or warning to the MySQL Server's error
log. See Section 19.4.6, The Event Scheduler and MySQL Privileges for an example. (Before MySQL 5.1.31, the Event Scheduler
also logged messages when events started execution and terminated successfully.)
Information about the state of the Event Scheduler for debugging and troubleshooting purposes can be obtained as follows:
In debugging builds of MySQL 5.1.11, you can use the SHOW SCHEDULER STATUS statement; see Section 12.5.5.34, SHOW
SCHEDULER STATUS Syntax. This statement was removed in MySQL 5.1.12. We intend to implement an SQL statement provid-
ing similar functionality in a future MySQL release.
Beginning with MySQL 5.1.12, event scheduler status information can be obtained by running mysqladmin debug (see Sec-
Stored Programs and Views
1899
tion 4.5.2, mysqladmin Client for Administering a MySQL Server); after running this command, the server's error log con-
tains output relating to the Event Scheduler, similar to what is shown here:
Events status:
LLA = Last Locked At LUA = Last Unlocked At
WOC = Waiting On Condition DL = Data Locked
Event scheduler status:
State : INITIALIZED
Thread id : 0
LLA : init_scheduler:313
LUA : init_scheduler:318
WOC : NO
Workers : 0
Executed : 0
Data locked: NO
Event queue status:
Element count : 1
Data locked : NO
Attempting lock : NO
LLA : init_queue:148
LUA : init_queue:168
WOC : NO
Next activation : 0000-00-00 00:00:00
For SELECT ... INTO var_list statements, if the query returns no rows, a warning with error code 1329 occurs (No data),
and the variable values remain unchanged. If the query returns multiple rows, error 1172 occurs (Result consisted of more
than one row). In the context of such statements that occur as part of events executed by the Event Scheduler, diagnostics messages
(not only errors, but also warnings) are written to the error log, and, on Windows, to the application event log. For frequently executed
events, it is possible for this to result in many logged messages. For either condition, you can avoid this problem by declaring a condi-
tion handler; see Section 12.8.4.2, DECLARE for Handlers. For statements that may retrieve multiple rows, another strategy is to use
LIMIT 1 to limit the result set to a single row.
19.4.6. The Event Scheduler and MySQL Privileges
To enable or disable the execution of scheduled events, it is necessary to set the value of the global event_scheduler system vari-
able. This requires the SUPER privilege.
MySQL 5.1.6 introduces a privilege governing the creation, modification, and deletion of events, the EVENT privilege. This privilege
can be bestowed using GRANT. For example, this GRANT statement confers the EVENT privilege for the schema named myschema on
the user jon@ghidora:
GRANT EVENT ON myschema.* TO jon@ghidora;
(We assume that this user account already exists, and that we wish for it to remain unchanged otherwise.)
To grant this same user the EVENT privilege on all schemas, use the following statement:
GRANT EVENT ON *.* TO jon@ghidora;
The EVENT privilege has global or schema-level scope. Therefore, trying to grant it on a single table results in an error as shown:
mysql> GRANT EVENT ON myschema.mytable TO jon@ghidora;
ERROR 1144 (42000): ILLEGAL GRANT/REVOKE COMMAND; PLEASE
CONSULT THE MANUAL TO SEE WHICH PRIVILEGES CAN BE USED
It is important to understand that an event is executed with the privileges of its definer, and that it cannot perform any actions for which
its definer does not have the requisite privileges. For example, suppose that jon@ghidora has the EVENT privilege for myschema.
Suppose also that this user has the SELECT privilege for myschema, but no other privileges for this schema. It is possible for
jon@ghidora to create a new event such as this one:
CREATE EVENT e_store_ts
ON SCHEDULE
EVERY 10 SECOND
DO
INSERT INTO myschema.mytable VALUES (UNIX_TIMESTAMP());
The user waits for a minute or so, and then performs a SELECT * FROM mytable; query, expecting to see several new rows in the
Stored Programs and Views
1900
table. Instead, the table is empty. Since the user does not have the INSERT privilege for the table in question, the event has no effect.
If you inspect the MySQL error log (hostname.err), you can see that the event is executing, but the action it is attempting to per-
form fails, as indicated by RetCode=0:
060209 22:39:44 [Note] EVEX EXECUTING event newdb.e [EXPR:10]
060209 22:39:44 [Note] EVEX EXECUTED event newdb.e [EXPR:10]. RetCode=0
060209 22:39:54 [Note] EVEX EXECUTING event newdb.e [EXPR:10]
060209 22:39:54 [Note] EVEX EXECUTED event newdb.e [EXPR:10]. RetCode=0
060209 22:40:04 [Note] EVEX EXECUTING event newdb.e [EXPR:10]
060209 22:40:04 [Note] EVEX EXECUTED event newdb.e [EXPR:10]. RetCode=0
Since this user very likely does not have access to the error log, it is possible to verify whether the event's action statement is valid by
executing it directly:
mysql> INSERT INTO myschema.mytable VALUES (UNIX_TIMESTAMP());
ERROR 1142 (42000): INSERT COMMAND DENIED TO USER
'JON'@'GHIDORA' FOR TABLE 'MYTABLE'
Inspection of the INFORMATION_SCHEMA.EVENTS table shows that e_store_ts exists and is enabled, but its LAST_EXECUTED
column is NULL:
mysql> SELECT * FROM INFORMATION_SCHEMA.EVENTS
> WHERE EVENT_NAME='e_store_ts'
> AND EVENT_SCHEMA='myschema'\G
*************************** 1. row ***************************
EVENT_CATALOG: NULL
EVENT_SCHEMA: myschema
EVENT_NAME: e_store_ts
DEFINER: jon@ghidora
EVENT_BODY: SQL
EVENT_DEFINITION: INSERT INTO myschema.mytable VALUES (UNIX_TIMESTAMP())
EVENT_TYPE: RECURRING
EXECUTE_AT: NULL
INTERVAL_VALUE: 5
INTERVAL_FIELD: SECOND
SQL_MODE: NULL
STARTS: 0000-00-00 00:00:00
ENDS: 0000-00-00 00:00:00
STATUS: ENABLED
ON_COMPLETION: NOT PRESERVE
CREATED: 2006-02-09 22:36:06
LAST_ALTERED: 2006-02-09 22:36:06
LAST_EXECUTED: NULL
EVENT_COMMENT:
1 row in set (0.00 sec)
Note
Prior to MySQL 5.1.12, there was no EVENT_DEFINITION column, and EVENT_BODY contained the SQL statement or
statements to be executed. See Section 20.20, The INFORMATION_SCHEMA EVENTS Table, for more information.
To rescind the EVENT privilege, use the REVOKE statement. In this example, the EVENT privilege on the schema myschema is re-
moved from the jon@ghidora user account:
REVOKE EVENT ON myschema.* FROM jon@ghidora;
Important
Revoking the EVENT privilege from a user does not delete or disable any events that may have been created by that user.
An event is not migrated or dropped as a result of renaming or dropping the user who created it.
For example, suppose that the user jon@ghidora has been granted the EVENT and INSERT privileges on the myschema schema.
This user then creates the following event:
CREATE EVENT e_insert
ON SCHEDULE
EVERY 7 SECOND
DO
INSERT INTO myschema.mytable;
After this event has been created, root revokes the EVENT privilege for jon@ghidora. However, e_insert continues to execute,
Stored Programs and Views
1901
inserting a new row into mytable each seven seconds. The same would be true if root had issued either of these statements:
DROP USER jon@ghidora;
RENAME USER jon@ghidora TO someotherguy@ghidora;
You can verify that this is true by examining the mysql.event table (discussed later in this section) or the INFORMA-
TION_SCHEMA.EVENTS table (see Section 20.20, The INFORMATION_SCHEMA EVENTS Table) before and after issuing a DROP
USER or RENAME USER statement.
Event definitions are stored in the mysql.event table, which was added in MySQL 5.1.6. To drop an event created by another user
account, the MySQL root user (or another user with the necessary privileges) can delete rows from this table. For example, to remove
the event e_insert shown previously, root can use the following statement:
DELETE FROM mysql.event
WHERE db = 'myschema'
AND definer = 'jon@ghidora'
AND name = 'e_insert';
It is very important to match the event name, database schema name, and user account when deleting rows from the mysql.event ta-
ble. This is because the same user can create different events of the same name in different schemas.
Note
The namespace for scheduled events changed in MySQL 5.1.12. Prior to that MySQL version, different users could create
different events having the same name in the same database; in MySQL 5.1.12 and later, that is no longer the case. When
upgrading to MySQL 5.1.12 or later from MySQL 5.1.11 or earlier, it is extremely important to make sure that no events
in the same database share the same name, prior to performing the upgrade.
Users' EVENT privileges are stored in the Event_priv columns of the mysql.user and mysql.db tables. In both cases, this
column holds one of the values 'Y' or 'N'. 'N' is the default. mysql.user.Event_priv is set to 'Y' for a given user only if that user
has the global EVENT privilege (that is, if the privilege was bestowed using GRANT EVENT ON *.*). For a schema-level EVENT
privilege, GRANT creates a row in mysql.db and sets that row's Db column to the name of the schema, the User column to the name
of the user, and the Event_priv column to 'Y'. There should never be any need to manipulate these tables directly, since the GRANT
EVENT and REVOKE EVENT statements perform the required operations on them.
MySQL 5.1.6 introduces five status variables providing counts of event-related operations (but not of statements executed by events;
see Section D.1, Restrictions on Stored Routines, Triggers, and Events). These are:
Com_create_event: The number of CREATE EVENT statements executed since the last server restart.
Com_alter_event: The number of ALTER EVENT statements executed since the last server restart.
Com_drop_event: The number of DROP EVENT statements executed since the last server restart.
Com_show_create_event: The number of SHOW CREATE EVENT statements executed since the last server restart.
Com_show_events: The number of SHOW EVENTS statements executed since the last server restart.
You can view current values for all of these at one time by running the statement SHOW STATUS LIKE '%event%';.
19.5. Using Views
Views (including updatable views) are available in MySQL Server 5.1. Views are stored queries that when invoked produce a result set.
A view acts as a virtual table.
To use views if you have upgraded to MySQL 5.1 from an older release that did not support views, you should upgrade your grant
tables so that they contain the view-related privileges. See Section 4.4.8, mysql_upgrade Check Tables for MySQL Upgrade.
The following discussion describes the syntax for creating and dropping views, and shows some examples of how to use them.
Additional resources
Stored Programs and Views
1902
You may find the Views User Forum of use when working with views.
For answers to some commonly asked questions regarding views in MySQL, see Section A.6, MySQL 5.1 FAQ Views.
There are some restrictions on the use of views; see Section D.4, Restrictions on Views.
19.5.1. View Syntax
The CREATE VIEW statement creates a new view (see Section 12.1.20, CREATE VIEW Syntax). To alter the definition of a view or
drop a view, use ALTER VIEW (see Section 12.1.9, ALTER VIEW Syntax), or DROP VIEW (see Section 12.1.31, DROP VIEW
Syntax).
A view can be created from many kinds of SELECT statements. It can refer to base tables or other views. It can use joins, UNION, and
subqueries. The SELECT need not even refer to any tables. The following example defines a view that selects two columns from anoth-
er table, as well as an expression calculated from those columns:
mysql> CREATE TABLE t (qty INT, price INT);
mysql> INSERT INTO t VALUES(3, 50), (5, 60);
mysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;
mysql> SELECT * FROM v;
+------+-------+-------+
| qty | price | value |
+------+-------+-------+
| 3 | 50 | 150 |
| 5 | 60 | 300 |
+------+-------+-------+
mysql> SELECT * FROM v WHERE qty = 5;
+------+-------+-------+
| qty | price | value |
+------+-------+-------+
| 5 | 60 | 300 |
+------+-------+-------+
19.5.2. View Processing Algorithms
The optional ALGORITHM clause for CREATE VIEW or ALTER VIEW is a MySQL extension to standard SQL. It affects how MySQL
processes the view. ALGORITHM takes three values: MERGE, TEMPTABLE, or UNDEFINED. The default algorithm is UNDEFINED if
no ALGORITHM clause is present.
For MERGE, the text of a statement that refers to the view and the view definition are merged such that parts of the view definition re-
place corresponding parts of the statement.
For TEMPTABLE, the results from the view are retrieved into a temporary table, which then is used to execute the statement.
For UNDEFINED, MySQL chooses which algorithm to use. It prefers MERGE over TEMPTABLE if possible, because MERGE is usually
more efficient and because a view cannot be updatable if a temporary table is used.
A reason to choose TEMPTABLE explicitly is that locks can be released on underlying tables after the temporary table has been created
and before it is used to finish processing the statement. This might result in quicker lock release than the MERGE algorithm so that other
clients that use the view are not blocked as long.
A view algorithm can be UNDEFINED for three reasons:
No ALGORITHM clause is present in the CREATE VIEW statement.
The CREATE VIEW statement has an explicit ALGORITHM = UNDEFINED clause.
ALGORITHM = MERGE is specified for a view that can be processed only with a temporary table. In this case, MySQL generates a
warning and sets the algorithm to UNDEFINED.
As mentioned earlier, MERGE is handled by merging corresponding parts of a view definition into the statement that refers to the view.
The following examples briefly illustrate how the MERGE algorithm works. The examples assume that there is a view v_merge that
has this definition:
CREATE ALGORITHM = MERGE VIEW v_merge (vc1, vc2) AS
SELECT c1, c2 FROM t WHERE c3 > 100;
Stored Programs and Views
1903
Example 1: Suppose that we issue this statement:
SELECT * FROM v_merge;
MySQL handles the statement as follows:
v_merge becomes t
* becomes vc1, vc2, which corresponds to c1, c2
The view WHERE clause is added
The resulting statement to be executed becomes:
SELECT c1, c2 FROM t WHERE c3 > 100;
Example 2: Suppose that we issue this statement:
SELECT * FROM v_merge WHERE vc1 < 100;
This statement is handled similarly to the previous one, except that vc1 < 100 becomes c1 < 100 and the view WHERE clause is
added to the statement WHERE clause using an AND connective (and parentheses are added to make sure the parts of the clause are ex-
ecuted with correct precedence). The resulting statement to be executed becomes:
SELECT c1, c2 FROM t WHERE (c3 > 100) AND (c1 < 100);
Effectively, the statement to be executed has a WHERE clause of this form:
WHERE (select WHERE) AND (view WHERE)
If the MERGE algorithm cannot be used, a temporary table must be used instead. MERGE cannot be used if the view contains any of the
following constructs:
Aggregate functions (SUM(), MIN(), MAX(), COUNT(), and so forth)
DISTINCT
GROUP BY
HAVING
LIMIT
UNION or UNION ALL
Subquery in the select list
Refers only to literal values (in this case, there is no underlying table)
19.5.3. Updatable and Insertable Views
Some views are updatable. That is, you can use them in statements such as UPDATE, DELETE, or INSERT to update the contents of the
underlying table. For a view to be updatable, there must be a one-to-one relationship between the rows in the view and the rows in the
underlying table. There are also certain other constructs that make a view nonupdatable. To be more specific, a view is not updatable if
it contains any of the following:
Aggregate functions (SUM(), MIN(), MAX(), COUNT(), and so forth)
Stored Programs and Views
1904
DISTINCT
GROUP BY
HAVING
UNION or UNION ALL
Subquery in the select list
Certain joins (see additional join discussion later in this section)
Nonupdatable view in the FROM clause
A subquery in the WHERE clause that refers to a table in the FROM clause
Refers only to literal values (in this case, there is no underlying table to update)
Uses ALGORITHM = TEMPTABLE (use of a temporary table always makes a view nonupdatable)
Multiple references to any column of a base table.
With respect to insertability (being updatable with INSERT statements), an updatable view is insertable if it also satisfies these addi-
tional requirements for the view columns:
There must be no duplicate view column names.
The view must contain all columns in the base table that do not have a default value.
The view columns must be simple column references and not derived columns. A derived column is one that is not a simple column
reference but is derived from an expression. These are examples of derived columns:
3.14159
col1 + 3
UPPER(col2)
col3 / col4
(subquery)
A view that has a mix of simple column references and derived columns is not insertable, but it can be updatable if you update only
those columns that are not derived. Consider this view:
CREATE VIEW v AS SELECT col1, 1 AS col2 FROM t;
This view is not insertable because col2 is derived from an expression. But it is updatable if the update does not try to update col2.
This update is allowable:
UPDATE v SET col1 = 0;
This update is not allowable because it attempts to update a derived column:
UPDATE v SET col2 = 0;
It is sometimes possible for a multiple-table view to be updatable, assuming that it can be processed with the MERGE algorithm. For this
to work, the view must use an inner join (not an outer join or a UNION). Also, only a single table in the view definition can be updated,
so the SET clause must name only columns from one of the tables in the view. Views that use UNION ALL are disallowed even though
they might be theoretically updatable, because the implementation uses temporary tables to process them.
For a multiple-table updatable view, INSERT can work if it inserts into a single table. DELETE is not supported.
INSERT DELAYED is not supported for views.
If a table contains an AUTO_INCREMENT column, inserting into an insertable view on the table that does not include the
AUTO_INCREMENT column does not change the value of LAST_INSERT_ID(), because the side effects of inserting default values
Stored Programs and Views
1905
into columns not part of the view should not be visible.
The WITH CHECK OPTION clause can be given for an updatable view to prevent inserts or updates to rows except those for which the
WHERE clause in the select_statement is true.
In a WITH CHECK OPTION clause for an updatable view, the LOCAL and CASCADED keywords determine the scope of check testing
when the view is defined in terms of another view. The LOCAL keyword restricts the CHECK OPTION only to the view being defined.
CASCADED causes the checks for underlying views to be evaluated as well. When neither keyword is given, the default is CASCADED.
Consider the definitions for the following table and set of views:
mysql> CREATE TABLE t1 (a INT);
mysql> CREATE VIEW v1 AS SELECT * FROM t1 WHERE a < 2
-> WITH CHECK OPTION;
mysql> CREATE VIEW v2 AS SELECT * FROM v1 WHERE a > 0
-> WITH LOCAL CHECK OPTION;
mysql> CREATE VIEW v3 AS SELECT * FROM v1 WHERE a > 0
-> WITH CASCADED CHECK OPTION;
Here the v2 and v3 views are defined in terms of another view, v1. v2 has a LOCAL check option, so inserts are tested only against the
v2 check. v3 has a CASCADED check option, so inserts are tested not only against its own check, but against those of underlying views.
The following statements illustrate these differences:
mysql> INSERT INTO v2 VALUES (2);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO v3 VALUES (2);
ERROR 1369 (HY000): CHECK OPTION failed 'test.v3'
MySQL sets a flag, called the view updatability flag, at CREATE VIEW time. The flag is set to YES (true) if UPDATE and DELETE
(and similar operations) are legal for the view. Otherwise, the flag is set to NO (false). The IS_UPDATABLE column in the INFORMA-
TION_SCHEMA.VIEWS table displays the status of this flag. It means that the server always knows whether a view is updatable. If the
view is not updatable, statements such UPDATE, DELETE, and INSERT are illegal and will be rejected. (Note that even if a view is up-
datable, it might not be possible to insert into it, as described elsewhere in this section.)
The updatability of views may be affected by the value of the updatable_views_with_limit system variable. See Section 5.1.4,
Server System Variables.
19.5.4. View Metadata
Metadata about views can be obtained as follows:
Query the VIEWS table of the INFORMATION_SCHEMA database. See Section 20.15, The INFORMATION_SCHEMA VIEWS
Table.
Use the SHOW CREATE VIEW statement. See Section 12.5.5.14, SHOW CREATE VIEW Syntax.
19.6. Binary Logging of Stored Programs
The binary log contains information about SQL statements that modify database contents. This information is stored in the form of
events that describe the modifications. The binary log has two important purposes:
For replication, the binary log is used on master replication servers as a record of the statements to be sent to slave servers. The mas-
ter server sends the events contained in its binary log to its slaves, which execute those events to make the same data changes that
were made on the master. See Section 16.4, Replication Implementation.
Certain data recovery operations require use of the binary log. After a backup file has been restored, the events in the binary log that
were recorded after the backup was made are re-executed. These events bring databases up to date from the point of the backup. See
Section 6.2.2, Using Backups for Recovery.
However, there are certain binary logging issues that apply with respect to stored programs (stored procedures and functions, triggers,
and events), if logging occurs at the statement level:
In some cases, it is possible that a statement will affect different sets of rows on a master and a slave.
Stored Programs and Views
1906
Replicated statements executed on a slave are processed by the slave SQL thread, which has full privileges. It is possible for a pro-
cedure to follow different execution paths on master and slave servers, so a user can write a routine containing a dangerous state-
ment that will execute only on the slave where it is processed by a thread that has full privileges.
If a stored program that modifies data is nondeterministic, it is not repeatable. This can result in different data on a master and slave,
or cause restored data to differ from the original data.
This section describes how MySQL 5.1 handles binary logging for stored programs. It states the current conditions that the implementa-
tion places on the use of stored programs, and what you can do to avoid problems. It also provides additional information about the
reasons for these conditions.
In general, the issues described here result when binary logging occurs at the SQL statement level. If you use row-based binary logging,
the log contains changes made to individual rows as a result of executing SQL statements. When routines or triggers execute, row
changes are logged, not the statements that make the changes. For stored procedures, this means that the CALL statement is not logged.
For stored functions, row changes made within the function are logged, not the function invocation. For triggers, row changes made by
the trigger are logged. On the slave side, only the row changes are seen, not the stored program invocation. For general information
about row-based logging, see Section 16.1.2, Replication Formats.
Unless noted otherwise, the remarks here assume that you have enabled binary logging by starting the server with the --log-bin op-
tion. (See Section 5.2.4, The Binary Log.) If the binary log is not enabled, replication is not possible, nor is the binary log available
for data recovery.
The current conditions on the use of stored functions in MySQL 5.1 can be summarized as follows. These conditions do not apply to
stored procedures or Event Scheduler events and they do not apply unless binary logging is enabled.
To create or alter a stored function, you must have the SUPER privilege, in addition to the CREATE ROUTINE or ALTER
ROUTINE privilege that is normally required.
When you create a stored function, you must declare either that it is deterministic or that it does not modify data. Otherwise, it may
be unsafe for data recovery or replication.
By default, for a CREATE FUNCTION statement to be accepted, at least one of DETERMINISTIC, NO SQL, or READS SQL
DATA must be specified explicitly. Otherwise an error occurs:
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL,
or READS SQL DATA in its declaration and binary logging is enabled
(you *might* want to use the less safe log_bin_trust_function_creators
variable)
This function is deterministic (and does not modify data), so it is safe:
CREATE FUNCTION f1(i INT)
RETURNS INT
DETERMINISTIC
READS SQL DATA
BEGIN
RETURN i;
END;
This function uses UUID(), which is not deterministic, so the function also is not deterministic and is not safe:
CREATE FUNCTION f2()
RETURNS CHAR(36) CHARACTER SET utf8
BEGIN
RETURN UUID();
END;
This function modifies data, so it may not be safe:
CREATE FUNCTION f3(p_id INT)
RETURNS INT
BEGIN
UPDATE t SET modtime = NOW() WHERE id = p_id;
RETURN ROW_COUNT();
END;
Assessment of the nature of a function is based on the honesty of the creator: MySQL does not check that a function declared DE-
Stored Programs and Views
1907
TERMINISTIC is free of statements that produce nondeterministic results.
Although it is possible to create a deterministic stored function without specifying DETERMINISTIC, you cannot as of MySQL
5.1.15 execute this function using statement-based binary logging. To execute such a function, you must use row-based or mixed
binary logging. Alternatively, if you explicitly specify DETERMINISTIC in the function definition, you can use any kind of log-
ging, including statement-based logging.
To relax the preceding conditions on function creation (that you must have the SUPER privilege and that a function must be de-
clared deterministic or to not modify data), set the global log_bin_trust_function_creators system variable to 1. By de-
fault, this variable has a value of 0, but you can change it like this:
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
You can also set this variable by using the --log-bin-trust-function-creators=1 option when starting the server.
If binary logging is not enabled, log_bin_trust_function_creators does not apply and SUPER is not required for func-
tion creation.
For information about built-in functions that may be unsafe for replication (and thus cause stored functions that use them to be un-
safe as well), see Section 16.3.1, Replication Features and Issues.
Triggers are similar to stored functions, so the preceding remarks regarding functions also apply to triggers with the following excep-
tion: CREATE TRIGGER does not have an optional DETERMINISTIC characteristic, so triggers are assumed to be always determin-
istic. However, this assumption might in some cases be invalid. For example, the UUID() function is nondeterministic (and does not
replicate). You should be careful about using such functions in triggers.
Triggers can update tables, so error messages similar to those for stored functions occur with CREATE TRIGGER if you do not have
the required privileges. On the slave side, the slave uses the trigger DEFINER attribute to determine which user is considered to be the
creator of the trigger.
The rest of this section provides additional detail about the logging implementation and its implications. You need not read it unless you
are interested in the background on the rationale for the current logging-related conditions on stored routine use. This discussion applies
only for statement-based logging, and not for row-based logging, with the exception of the first item: CREATE and DROP statements are
logged as statements regardless of the logging mode.
The server writes CREATE EVENT, CREATE PROCEDURE, CREATE FUNCTION, ALTER EVENT, ALTER PROCEDURE, AL-
TER FUNCTION, DROP EVENT, DROP PROCEDURE, and DROP FUNCTION statements to the binary log.
A stored function invocation is logged as a SELECT statement if the function changes data and occurs within a statement that would
not otherwise be logged. This prevents nonreplication of data changes that result from use of stored functions in nonlogged state-
ments. For example, SELECT statements are not written to the binary log, but a SELECT might invoke a stored function that makes
changes. To handle this, a SELECT func_name() statement is written to the binary log when the given function makes a change.
Suppose that the following statements are executed on the master:
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 0;
END;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
When the SELECT statement executes, the function f1() is invoked three times. Two of those invocations insert a row, and
MySQL logs a SELECT statement for each of them. That is, MySQL writes the following statements to the binary log:
SELECT f1(1);
SELECT f1(2);
The server also logs a SELECT statement for a stored function invocation when the function invokes a stored procedure that causes
an error. In this case, the server writes the SELECT statement to the log along with the expected error code. On the slave, if the
same error occurs, that is the expected result and replication continues. Otherwise, replication stops.
Stored Programs and Views
1908
Note: Before MySQL 5.1.7, you will see these SELECT func_name() statements logged as DO func_name(). The change to
SELECT was made because use of DO was found to yield insufficient control over error code checking.
Logging stored function invocations rather than the statements executed by a function has a security implication for replication,
which arises from two factors:
It is possible for a function to follow different execution paths on master and slave servers.
Statements executed on a slave are processed by the slave SQL thread which has full privileges.
The implication is that although a user must have the CREATE ROUTINE privilege to create a function, the user can write a func-
tion containing a dangerous statement that will execute only on the slave where it is processed by a thread that has full privileges.
For example, if the master and slave servers have server ID values of 1 and 2, respectively, a user on the master server could create
and invoke an unsafe function unsafe_func() as follows:
mysql> delimiter //
mysql> CREATE FUNCTION unsafe_func () RETURNS INT
-> BEGIN
-> IF @@server_id=2 THEN dangerous_statement; END IF;
-> RETURN 1;
-> END;
-> //
mysql> delimiter ;
mysql> INSERT INTO t VALUES(unsafe_func());
The CREATE FUNCTION and INSERT statements are written to the binary log, so the slave will execute them. Because the slave
SQL thread has full privileges, it will execute the dangerous statement. Thus, the function invocation has different effects on the
master and slave and is not replication-safe.
To guard against this danger for servers that have binary logging enabled, stored function creators must have the SUPER privilege,
in addition to the usual CREATE ROUTINE privilege that is required. Similarly, to use ALTER FUNCTION, you must have the
SUPER privilege in addition to the ALTER ROUTINE privilege. Without the SUPER privilege, an error will occur:
ERROR 1419 (HY000): You do not have the SUPER privilege and
binary logging is enabled (you *might* want to use the less safe
log_bin_trust_function_creators variable)
If you do not want to require function creators to have the SUPER privilege (for example, if all users with the CREATE ROUTINE
privilege on your system are experienced application developers), set the global log_bin_trust_function_creators sys-
tem variable to 1. You can also set this variable by using the --log-bin-trust-function-creators=1 option when start-
ing the server. If binary logging is not enabled, log_bin_trust_function_creators does not apply and SUPER is not re-
quired for function creation.
If a function that performs updates is nondeterministic, it is not repeatable. This can have two undesirable effects:
It will make a slave different from the master.
Restored data will be different from the original data.
To deal with these problems, MySQL enforces the following requirement: On a master server, creation and alteration of a function
is refused unless you declare the function to be deterministic or to not modify data. Two sets of function characteristics apply here:
The DETERMINISTIC and NOT DETERMINISTIC characteristics indicate whether a function always produces the same res-
ult for given inputs. The default is NOT DETERMINISTIC if neither characteristic is given. To declare that a function is de-
terministic, you must specify DETERMINISTIC explicitly.
The CONTAINS SQL, NO SQL, READS SQL DATA, and MODIFIES SQL DATA characteristics provide information about
whether the function reads or writes data. Either NO SQL or READS SQL DATA indicates that a function does not change data,
but you must specify one of these explicitly because the default is CONTAINS SQL if no characteristic is given.
By default, for a CREATE FUNCTION statement to be accepted, at least one of DETERMINISTIC, NO SQL, or READS SQL
DATA must be specified explicitly. Otherwise an error occurs:
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL,
or READS SQL DATA in its declaration and binary logging is enabled
(you *might* want to use the less safe log_bin_trust_function_creators
variable)
Stored Programs and Views
1909
If you set log_bin_trust_function_creators to 1, the requirement that functions be deterministic or not modify data is
dropped.
Stored procedure calls are logged at the statement level rather than at the CALL level. That is, the server does not log the CALL
statement, it logs those statements within the procedure that actually execute. As a result, the same changes that occur on the master
will be observed on slave servers. This prevents problems that could result from a procedure having different execution paths on dif-
ferent machines.
In general, statements executed within a stored procedure are written to the binary log using the same rules that would apply were
the statements to be executed in standalone fashion. Some special care is taken when logging procedure statements because state-
ment execution within procedures is not quite the same as in nonprocedure context:
A statement to be logged might contain references to local procedure variables. These variables do not exist outside of stored
procedure context, so a statement that refers to such a variable cannot be logged literally. Instead, each reference to a local vari-
able is replaced by this construct for logging purposes:
NAME_CONST(var_name, var_value)
var_name is the local variable name, and var_value is a constant indicating the value that the variable has at the time the
statement is logged. NAME_CONST() has a value of var_value, and a name of var_name. Thus, if you invoke this func-
tion directly, you get a result like this:
mysql> SELECT NAME_CONST('myname', 14);
+--------+
| myname |
+--------+
| 14 |
+--------+
NAME_CONST() allows a logged standalone statement to be executed on a slave with the same effect as the original statement
that was executed on the master within a stored procedure.
The use of NAME_CONST() can result in a problem for CREATE TABLE ... SELECT statements when the source column
expressions refer to local variables. Converting these references to NAME_CONST() expressions can result in column names
that are different on the master and slave servers, or names that are too long to be legal column identifiers. A workaround is to
supply aliases for columns that refer to local variables. Consider this statement when myvar has a value of 1:
CREATE TABLE t1 SELECT myvar;
That will be rewritten as follows:
CREATE TABLE t1 SELECT NAME_CONST(myvar, 1);
To ensure that the master and slave tables have the same column names, write the statement like this:
CREATE TABLE t1 SELECT myvar AS myvar;
The rewritten statement becomes:
CREATE TABLE t1 SELECT NAME_CONST(myvar, 1) AS myvar;
A statement to be logged might contain references to user-defined variables. To handle this, MySQL writes a SET statement to
the binary log to make sure that the variable exists on the slave with the same value as on the master. For example, if a statement
refers to a variable @my_var, that statement will be preceded in the binary log by the following statement, where value is the
value of @my_var on the master:
SET @my_var = value;
Procedure calls can occur within a committed or rolled-back transaction. Transactional context is accounted for so that the trans-
actional aspects of procedure execution are replicated correctly. That is, the server logs those statements within the procedure
that actually execute and modify data, and also logs BEGIN, COMMIT, and ROLLBACK statements as necessary. For example, if
a procedure updates only transactional tables and is executed within a transaction that is rolled back, those updates are not
logged. If the procedure occurs within a committed transaction, BEGIN and COMMIT statements are logged with the updates.
Stored Programs and Views
1910
For a procedure that executes within a rolled-back transaction, its statements are logged using the same rules that would apply if
the statements were executed in standalone fashion:
Updates to transactional tables are not logged.
Updates to nontransactional tables are logged because rollback does not cancel them.
Updates to a mix of transactional and nontransactional tables are logged surrounded by BEGIN and ROLLBACK so that
slaves will make the same changes and rollbacks as on the master.
A stored procedure call is not written to the binary log at the statement level if the procedure is invoked from within a stored func-
tion. In that case, the only thing logged is the statement that invokes the function (if it occurs within a statement that is logged) or a
DO statement (if it occurs within a statement that is not logged). For this reason, care should be exercised in the use of stored func-
tions that invoke a procedure, even if the procedure is otherwise safe in itself.
Stored Programs and Views
1911
Chapter 20. INFORMATION_SCHEMA Tables
INFORMATION_SCHEMA provides access to database metadata.
Metadata is data about the data, such as the name of a database or table, the data type of a column, or access privileges. Other terms that
sometimes are used for this information are data dictionary and system catalog.
INFORMATION_SCHEMA is the information database, the place that stores information about all the other databases that the MySQL
server maintains. Inside INFORMATION_SCHEMA there are several read-only tables. They are actually views, not base tables, so there
are no files associated with them.
In effect, we have a database named INFORMATION_SCHEMA, although the server does not create a database directory with that name.
It is possible to select INFORMATION_SCHEMA as the default database with a USE statement, but it is possible only to read the con-
tents of tables. You cannot insert into them, update them, or delete from them.
Here is an example of a statement that retrieves information from INFORMATION_SCHEMA:
mysql> SELECT table_name, table_type, engine
-> FROM information_schema.tables
-> WHERE table_schema = 'db5'
-> ORDER BY table_name DESC;
+------------+------------+--------+
| table_name | table_type | engine |
+------------+------------+--------+
| v56 | VIEW | NULL |
| v3 | VIEW | NULL |
| v2 | VIEW | NULL |
| v | VIEW | NULL |
| tables | BASE TABLE | MyISAM |
| t7 | BASE TABLE | MyISAM |
| t3 | BASE TABLE | MyISAM |
| t2 | BASE TABLE | MyISAM |
| t | BASE TABLE | MyISAM |
| pk | BASE TABLE | InnoDB |
| loop | BASE TABLE | MyISAM |
| kurs | BASE TABLE | MyISAM |
| k | BASE TABLE | MyISAM |
| into | BASE TABLE | MyISAM |
| goto | BASE TABLE | MyISAM |
| fk2 | BASE TABLE | InnoDB |
| fk | BASE TABLE | InnoDB |
+------------+------------+--------+
17 rows in set (0.01 sec)
Explanation: The statement requests a list of all the tables in database db5, in reverse alphabetical order, showing just three pieces of
information: the name of the table, its type, and its storage engine.
Each MySQL user has the right to access these tables, but can see only the rows in the tables that correspond to objects for which the
user has the proper access privileges. In some cases (for example, the ROUTINE_DEFINITION column in the INFORMA-
TION_SCHEMA.ROUTINES table), users who have insufficient privileges will see NULL.
The SELECT ... FROM INFORMATION_SCHEMA statement is intended as a more consistent way to provide access to the informa-
tion provided by the various SHOW statements that MySQL supports (SHOW DATABASES, SHOW TABLES, and so forth). Using SE-
LECT has these advantages, compared to SHOW:
It conforms to Codd's rules. That is, all access is done on tables.
Nobody needs to learn a new statement syntax. Because they already know how SELECT works, they only need to learn the object
names.
The implementor need not worry about adding keywords.
There are millions of possible output variations, instead of just one. This provides more flexibility for applications that have varying
requirements about what metadata they need.
Migration is easier because every other DBMS does it this way.
However, because SHOW is popular with MySQL employees and users, and because it might be confusing were it to disappear, the ad-
vantages of conventional syntax are not a sufficient reason to eliminate SHOW. In fact, along with the implementation of INFORMA-
1912
TION_SCHEMA, there are enhancements to SHOW as well. These are described in Section 20.28, Extensions to SHOW Statements.
There is no difference between the privileges required for SHOW statements and those required to select information from INFORMA-
TION_SCHEMA. In either case, you have to have some privilege on an object in order to see information about it.
The implementation for the INFORMATION_SCHEMA table structures in MySQL follows the ANSI/ISO SQL:2003 standard Part 11
Schemata. Our intent is approximate compliance with SQL:2003 core feature F021 Basic information schema.
Users of SQL Server 2000 (which also follows the standard) may notice a strong similarity. However, MySQL has omitted many
columns that are not relevant for our implementation, and added columns that are MySQL-specific. One such column is the ENGINE
column in the INFORMATION_SCHEMA.TABLES table.
Although other DBMSs use a variety of names, like syscat or system, the standard name is INFORMATION_SCHEMA.
The following sections describe each of the tables and columns that are in INFORMATION_SCHEMA. For each column, there are three
pieces of information:
INFORMATION_SCHEMA Name indicates the name for the column in the INFORMATION_SCHEMA table. This corresponds to
the standard SQL name unless the Remarks field says MySQL extension.
SHOW Name indicates the equivalent field name in the closest SHOW statement, if there is one.
Remarks provides additional information where applicable. If this field is NULL, it means that the value of the column is always
NULL. If this field says MySQL extension, the column is a MySQL extension to standard SQL.
To avoid using any name that is reserved in the standard or in DB2, SQL Server, or Oracle, we changed the names of some columns
marked MySQL extension. (For example, we changed COLLATION to TABLE_COLLATION in the TABLES table.) See the list of
reserved words near the end of this article: ht-
tp://web.archive.org/web/20070409075643rn_1/www.dbazine.com/db2/db2-disarticles/gulutzan5.
The definition for character columns (for example, TABLES.TABLE_NAME) is generally VARCHAR(N) CHARACTER SET utf8
where N is at least 64. MySQL uses the default collation for this character set (utf8_general_ci) for all searches, sorts, comparis-
ons, and other string operations on such columns. If the default collation is not correct for your needs, you can force a suitable collation
with a COLLATE clause (Section 9.1.6.1, Using COLLATE in SQL Statements).
Each section indicates what SHOW statement is equivalent to a SELECT that retrieves information from INFORMATION_SCHEMA, if
there is such a statement. For SHOW statements that display information for the current database if you omit a FROM db_name clause,
you can often select information for the current database by adding an AND TABLE_SCHEMA = CURRENT_SCHEMA() condition to
the WHERE clause of a query that retrieves information from an INFORMATION_SCHEMA table.
Note
At present, there are some missing columns and some columns out of order. We are working on this and updating the doc-
umentation as changes are made.
For answers to questions that are often asked concerning the INFORMATION_SCHEMA database, see Section A.7, MySQL 5.0 FAQ
INFORMATION_SCHEMA.
20.1. The INFORMATION_SCHEMA SCHEMATA Table
A schema is a database, so the SCHEMATA table provides information about databases.
INFORMATION_SCHEMA Name SHOW Name Remarks
CATALOG_NAME NULL
SCHEMA_NAME Database
DEFAULT_CHARACTER_SET_NAME
DEFAULT_COLLATION_NAME
SQL_PATH NULL
The following statements are equivalent:
INFORMATION_SCHEMA Tables
1913
SELECT SCHEMA_NAME AS `Database`
FROM INFORMATION_SCHEMA.SCHEMATA
[WHERE SCHEMA_NAME LIKE 'wild']
SHOW DATABASES
[LIKE 'wild']
20.2. The INFORMATION_SCHEMA TABLES Table
The TABLES table provides information about tables in databases.
INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG NULL
TABLE_SCHEMA Table_...
TABLE_NAME Table_...
TABLE_TYPE
ENGINE Engine MySQL extension
VERSION Version The version number of the table's
.frm file, MySQL extension
ROW_FORMAT Row_format MySQL extension
TABLE_ROWS Rows MySQL extension
AVG_ROW_LENGTH Avg_row_length MySQL extension
DATA_LENGTH Data_length MySQL extension
MAX_DATA_LENGTH Max_data_length MySQL extension
INDEX_LENGTH Index_length MySQL extension
DATA_FREE Data_free MySQL extension
AUTO_INCREMENT Auto_increment MySQL extension
CREATE_TIME Create_time MySQL extension
UPDATE_TIME Update_time MySQL extension
CHECK_TIME Check_time MySQL extension
TABLE_COLLATION Collation MySQL extension
CHECKSUM Checksum MySQL extension
CREATE_OPTIONS Create_options MySQL extension
TABLE_COMMENT Comment MySQL extension
Notes:
TABLE_SCHEMA and TABLE_NAME are a single field in a SHOW display, for example Table_in_db1.
TABLE_TYPE should be BASE TABLE or VIEW. Currently, the TABLES table does not list TEMPORARY tables.
For partitioned tables, beginning with MySQL 5.1.9, the ENGINE column shows the name of the storage engine used by all parti-
tions. (Previously, this column showed PARTITION for such tables.)
The TABLE_ROWS column is NULL if the table is in the INFORMATION_SCHEMA database.
For InnoDB tables, the row count is only a rough estimate used in SQL optimization. (This is also true if the InnoDB table is parti-
tioned.)
For tables using the NDBCLUSTER storage engine, beginning with MySQL 5.1.12, the DATA_LENGTH column reflects the true
amount of storage for variable-width columns. (See Bug#18413.)
Note
INFORMATION_SCHEMA Tables
1914
Because MySQL Cluster allocates storage for variable-width columns in 10-page extents of 32 kilobytes each, space usage
for such columns is reported in increments of 320 KB.
Beginning with MySQL 5.1.28, the DATA_FREE column shows the free space in bytes for InnoDB tables.
We have nothing for the table's default character set. TABLE_COLLATION is close, because collation names begin with a character
set name.
Beginning with MySQL 5.1.9, the CREATE_OPTIONS column shows partitioned if the table is partitioned.
The following statements are equivalent:
SELECT table_name FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = 'db_name'
[AND table_name LIKE 'wild']
SHOW TABLES
FROM db_name
[LIKE 'wild']
20.3. The INFORMATION_SCHEMA COLUMNS Table
The COLUMNS table provides information about columns in tables.
INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG NULL
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME Field
ORDINAL_POSITION see notes
COLUMN_DEFAULT Default
IS_NULLABLE Null
DATA_TYPE Type
CHARACTER_MAXIMUM_LENGTH Type
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION Type
NUMERIC_SCALE Type
CHARACTER_SET_NAME
COLLATION_NAME Collation
COLUMN_TYPE Type MySQL extension
COLUMN_KEY Key MySQL extension
EXTRA Extra MySQL extension
PRIVILEGES Privileges MySQL extension
COLUMN_COMMENT Comment MySQL extension
Notes:
In SHOW, the Type display includes values from several different COLUMNS columns.
ORDINAL_POSITION is necessary because you might want to say ORDER BY ORDINAL_POSITION. Unlike SHOW, SELECT
does not have automatic ordering.
CHARACTER_OCTET_LENGTH should be the same as CHARACTER_MAXIMUM_LENGTH, except for multi-byte character sets.
INFORMATION_SCHEMA Tables
1915
CHARACTER_SET_NAME can be derived from Collation. For example, if you say SHOW FULL COLUMNS FROM t, and you
see in the Collation column a value of latin1_swedish_ci, the character set is what is before the first underscore: lat-
in1.
The following statements are nearly equivalent:
SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'tbl_name'
[AND table_schema = 'db_name']
[AND column_name LIKE 'wild']
SHOW COLUMNS
FROM tbl_name
[FROM db_name]
[LIKE 'wild']
20.4. The INFORMATION_SCHEMA STATISTICS Table
The STATISTICS table provides information about table indexes.
INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG NULL
TABLE_SCHEMA = Database
TABLE_NAME Table
NON_UNIQUE Non_unique
INDEX_SCHEMA = Database
INDEX_NAME Key_name
SEQ_IN_INDEX Seq_in_index
COLUMN_NAME Column_name
COLLATION Collation
CARDINALITY Cardinality
SUB_PART Sub_part MySQL extension
PACKED Packed MySQL extension
NULLABLE Null MySQL extension
INDEX_TYPE Index_type MySQL extension
COMMENT Comment MySQL extension
Notes:
There is no standard table for indexes. The preceding list is similar to what SQL Server 2000 returns for sp_statistics, except
that we replaced the name QUALIFIER with CATALOG and we replaced the name OWNER with SCHEMA.
Clearly, the preceding table and the output from SHOW INDEX are derived from the same parent. So the correlation is already
close.
The following statements are equivalent:
SELECT * FROM INFORMATION_SCHEMA.STATISTICS
WHERE table_name = 'tbl_name'
AND table_schema = 'db_name'
SHOW INDEX
FROM tbl_name
FROM db_name
INFORMATION_SCHEMA Tables
1916
20.5. The INFORMATION_SCHEMA USER_PRIVILEGES Table
The USER_PRIVILEGES table provides information about global privileges. This information comes from the mysql.user grant ta-
ble.
INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name'
value, MySQL extension
TABLE_CATALOG NULL, MySQL extension
PRIVILEGE_TYPE MySQL extension
IS_GRANTABLE MySQL extension
Notes:
This is a nonstandard table. It takes its values from the mysql.user table.
20.6. The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table
The SCHEMA_PRIVILEGES table provides information about schema (database) privileges. This information comes from the
mysql.db grant table.
INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name'
value, MySQL extension
TABLE_CATALOG NULL, MySQL extension
TABLE_SCHEMA MySQL extension
PRIVILEGE_TYPE MySQL extension
IS_GRANTABLE MySQL extension
Notes:
This is a nonstandard table. It takes its values from the mysql.db table.
20.7. The INFORMATION_SCHEMA TABLE_PRIVILEGES Table
The TABLE_PRIVILEGES table provides information about table privileges. This information comes from the
mysql.tables_priv grant table.
INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name'
value
TABLE_CATALOG NULL
TABLE_SCHEMA
TABLE_NAME
PRIVILEGE_TYPE
IS_GRANTABLE
Notes:
INFORMATION_SCHEMA Tables
1917
PRIVILEGE_TYPE can contain one (and only one) of these values: SELECT, INSERT, UPDATE, REFERENCES, ALTER,
INDEX, DROP, CREATE VIEW.
The following statements are not equivalent:
SELECT ... FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
SHOW GRANTS ...
20.8. The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table
The COLUMN_PRIVILEGES table provides information about column privileges. This information comes from the
mysql.columns_priv grant table.
INFORMATION_SCHEMA Name SHOW Name Remarks
GRANTEE 'user_name'@'host_name'
value
TABLE_CATALOG NULL
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
PRIVILEGE_TYPE
IS_GRANTABLE
Notes:
In the output from SHOW FULL COLUMNS, the privileges are all in one field and in lowercase, for example, se-
lect,insert,update,references. In COLUMN_PRIVILEGES, there is one privilege per row, in uppercase.
PRIVILEGE_TYPE can contain one (and only one) of these values: SELECT, INSERT, UPDATE, REFERENCES.
If the user has GRANT OPTION privilege, IS_GRANTABLE should be YES. Otherwise, IS_GRANTABLE should be NO. The out-
put does not list GRANT OPTION as a separate privilege.
The following statements are not equivalent:
SELECT ... FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
SHOW GRANTS ...
20.9. The INFORMATION_SCHEMA CHARACTER_SETS Table
The CHARACTER_SETS table provides information about available character sets.
INFORMATION_SCHEMA Name SHOW Name Remarks
CHARACTER_SET_NAME Charset
DEFAULT_COLLATE_NAME Default collation
DESCRIPION Description MySQL extension
MAXLEN Maxlen MySQL extension
The following statements are equivalent:
SELECT * FROM INFORMATION_SCHEMA.CHARACTER_SETS
[WHERE name LIKE 'wild']
INFORMATION_SCHEMA Tables
1918
SHOW CHARACTER SET
[LIKE 'wild']
20.10. The INFORMATION_SCHEMA COLLATIONS Table
The COLLATIONS table provides information about collations for each character set.
INFORMATION_SCHEMA Name SHOW Name Remarks
COLLATION_NAME Collation
CHARACTER_SET_NAME Charset MySQL extension
ID Id MySQL extension
IS_DEFAULT Default MySQL extension
IS_COMPILED Compiled MySQL extension
SORTLEN Sortlen MySQL extension
The following statements are equivalent:
SELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLLATIONS
[WHERE collation_name LIKE 'wild']
SHOW COLLATION
[LIKE 'wild']
20.11. The INFORMATION_SCHEMA COLLA-
TION_CHARACTER_SET_APPLICABILITY Table
The COLLATION_CHARACTER_SET_APPLICABILITY table indicates what character set is applicable for what collation. The
columns are equivalent to the first two display fields that we get from SHOW COLLATION.
INFORMATION_SCHEMA Name SHOW Name Remarks
COLLATION_NAME Collation
CHARACTER_SET_NAME Charset
20.12. The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table
The TABLE_CONSTRAINTS table describes which tables have constraints.
INFORMATION_SCHEMA Name SHOW Name Remarks
CONSTRAINT_CATALOG NULL
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_SCHEMA
TABLE_NAME
CONSTRAINT_TYPE
Notes:
The CONSTRAINT_TYPE value can be UNIQUE, PRIMARY KEY, or FOREIGN KEY.
The UNIQUE and PRIMARY KEY information is about the same as what you get from the Key_name field in the output from
SHOW INDEX when the Non_unique field is 0.
INFORMATION_SCHEMA Tables
1919
The CONSTRAINT_TYPE column can contain one of these values: UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK. This is a
CHAR (not ENUM) column. The CHECK value is not available until we support CHECK.
20.13. The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table
The KEY_COLUMN_USAGE table describes which key columns have constraints.
INFORMATION_SCHEMA Name SHOW Name Remarks
CONSTRAINT_CATALOG NULL
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
POSITION_IN_UNIQUE_CONSTRAINT
REFERENCED_TABLE_SCHEMA
REFERENCED_TABLE_NAME
REFERENCED_COLUMN_NAME
Notes:
If the constraint is a foreign key, then this is the column of the foreign key, not the column that the foreign key references.
The value of ORDINAL_POSITION is the column's position within the constraint, not the column's position within the table.
Column positions are numbered beginning with 1.
The value of POSITION_IN_UNIQUE_CONSTRAINT is NULL for unique and primary-key constraints. For foreign-key con-
straints, it is the ordinal position in key of the table that is being referenced.
For example, suppose that there are two tables name t1 and t3 that have the following definitions:
CREATE TABLE t1
(
s1 INT,
s2 INT,
s3 INT,
PRIMARY KEY(s3)
) ENGINE=InnoDB;
CREATE TABLE t3
(
s1 INT,
s2 INT,
s3 INT,
KEY(s1),
CONSTRAINT CO FOREIGN KEY (s2) REFERENCES t1(s3)
) ENGINE=InnoDB;
For those two tables, the KEY_COLUMN_USAGE table has two rows:
One row with CONSTRAINT_NAME = 'PRIMARY', TABLE_NAME = 't1', COLUMN_NAME = 's3', ORDIN-
AL_POSITION = 1, POSITION_IN_UNIQUE_CONSTRAINT = NULL.
One row with CONSTRAINT_NAME = 'CO', TABLE_NAME = 't3', COLUMN_NAME = 's2', ORDINAL_POSITION = 1,
POSITION_IN_UNIQUE_CONSTRAINT = 1.
INFORMATION_SCHEMA Tables
1920
20.14. The INFORMATION_SCHEMA ROUTINES Table
The ROUTINES table provides information about stored routines (both procedures and functions). The ROUTINES table does not in-
clude user-defined functions (UDFs) at this time.
The column named mysql.proc name indicates the mysql.proc table column that corresponds to the INFORMA-
TION_SCHEMA.ROUTINES table column, if any.
INFORMATION_SCHEMA Name mysql.proc Name Remarks
SPECIFIC_NAME specific_name
ROUTINE_CATALOG NULL
ROUTINE_SCHEMA db
ROUTINE_NAME name
ROUTINE_TYPE type {PROCEDURE|FUNCTION}
DTD_IDENTIFIER data type descriptor
ROUTINE_BODY SQL
ROUTINE_DEFINITION body
EXTERNAL_NAME NULL
EXTERNAL_LANGUAGE language NULL
PARAMETER_STYLE SQL
IS_DETERMINISTIC is_deterministic
SQL_DATA_ACCESS sql_data_access
SQL_PATH NULL
SECURITY_TYPE security_type
CREATED created
LAST_ALTERED modified
SQL_MODE sql_mode MySQL extension
ROUTINE_COMMENT comment MySQL extension
DEFINER definer MySQL extension
CHARACTER_SET_CLIENT MySQL extension
COLLATION_CONNECTION MySQL extension
DATABASE_COLLATION MySQL extension
Notes:
MySQL calculates EXTERNAL_LANGUAGE thus:
If mysql.proc.language='SQL', EXTERNAL_LANGUAGE is NULL
Otherwise, EXTERNAL_LANGUAGE is what is in mysql.proc.language. However, we do not have external languages
yet, so it is always NULL.
CHARACTER_SET_CLIENT is the session value of the character_set_client system variable when the routine was cre-
ated. COLLATION_CONNECTION is the session value of the collation_connection system variable when the routine was
created. DATABASE_COLLATION is the collation of the database with which the routine is associated. These columns were added
in MySQL 5.1.21.
20.15. The INFORMATION_SCHEMA VIEWS Table
The VIEWS table provides information about views in databases. You must have the SHOW VIEW privilege to access this table.
INFORMATION_SCHEMA Tables
1921
INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG NULL
TABLE_SCHEMA
TABLE_NAME
VIEW_DEFINITION
CHECK_OPTION
IS_UPDATABLE
DEFINER
SECURITY_TYPE
CHARACTER_SET_CLIENT MySQL extension
COLLATION_CONNECTION MySQL extension
Notes:
The VIEW_DEFINITION column has most of what you see in the Create Table field that SHOW CREATE VIEW produces.
Skip the words before SELECT and skip the words WITH CHECK OPTION. Suppose that the original statement was:
CREATE VIEW v AS
SELECT s2,s1 FROM t
WHERE s1 > 5
ORDER BY s1
WITH CHECK OPTION;
Then the view definition looks like this:
SELECT s2,s1 FROM t WHERE s1 > 5 ORDER BY s1
The CHECK_OPTION column has a value of NONE, CASCADE, or LOCAL.
MySQL sets a flag, called the view updatability flag, at CREATE VIEW time. The flag is set to YES (true) if UPDATE and DELETE
(and similar operations) are legal for the view. Otherwise, the flag is set to NO (false). The IS_UPDATABLE column in the VIEWS
table displays the status of this flag. It means that the server always knows whether a view is updatable. If the view is not updatable,
statements such UPDATE, DELETE, and INSERT are illegal and will be rejected. (Note that even if a view is updatable, it might not
be possible to insert into it; for details, refer to Section 12.1.20, CREATE VIEW Syntax.)
The DEFINER column indicates who defined the view. SECURITY_TYPE has a value of DEFINER or INVOKER.
CHARACTER_SET_CLIENT is the session value of the character_set_client system variable when the view was created.
COLLATION_CONNECTION is the session value of the collation_connection system variable when the view was created.
These columns were added in MySQL 5.1.21.
MySQL lets you use different sql_mode settings to tell the server the type of SQL syntax to support. For example, you might use the
ANSI SQL mode to ensure MySQL correctly interprets the standard SQL concatenation operator, the double bar (||), in your queries.
If you then create a view that concatenates items, you might worry that changing the sql_mode setting to a value different from ANSI
could cause the view to become invalid. But this is not the case. No matter how you write out a view definition, MySQL always stores it
the same way, in a canonical form. Here is an example that shows how the server changes a double bar concatenation operator to a
CONCAT() function:
mysql> SET sql_mode = 'ANSI';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE VIEW test.v AS SELECT 'a' || 'b' as col1;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS
-> WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v';
+----------------------------------+
| VIEW_DEFINITION |
+----------------------------------+
| select concat('a','b') AS `col1` |
+----------------------------------+
1 row in set (0.00 sec)
INFORMATION_SCHEMA Tables
1922
The advantage of storing a view definition in canonical form is that changes made later to the value of sql_mode will not affect the
results from the view. However an additional consequence is that comments prior to SELECT are stripped from the definition by the
server.
20.16. The INFORMATION_SCHEMA TRIGGERS Table
The TRIGGERS table provides information about triggers. You must have the TRIGGER privilege to access this table (prior to MySQL
5.1.22, you must have the SUPER privilege).
INFORMATION_SCHEMA Name SHOW Name Remarks
TRIGGER_CATALOG NULL
TRIGGER_SCHEMA
TRIGGER_NAME Trigger
EVENT_MANIPULATION Event
EVENT_OBJECT_CATALOG NULL
EVENT_OBJECT_SCHEMA
EVENT_OBJECT_TABLE Table
ACTION_ORDER 0
ACTION_CONDITION NULL
ACTION_STATEMENT Statement
ACTION_ORIENTATION ROW
ACTION_TIMING Timing
ACTION_REFERENCE_OLD_TABLE NULL
ACTION_REFERENCE_NEW_TABLE NULL
ACTION_REFERENCE_OLD_ROW OLD
ACTION_REFERENCE_NEW_ROW NEW
CREATED NULL (0)
SQL_MODE MySQL extension
DEFINER MySQL extension
CHARACTER_SET_CLIENT MySQL extension
COLLATION_CONNECTION MySQL extension
DATABASE_COLLATION MySQL extension
Notes:
The TRIGGER_SCHEMA and TRIGGER_NAME columns contain the name of the database in which the trigger occurs and the trig-
ger name, respectively.
The EVENT_MANIPULATION column contains one of the values 'INSERT', 'DELETE', or 'UPDATE'.
As noted in Section 19.3, Using Triggers, every trigger is associated with exactly one table. The EVENT_OBJECT_SCHEMA and
EVENT_OBJECT_TABLE columns contain the database in which this table occurs, and the table's name.
The ACTION_ORDER statement contains the ordinal position of the trigger's action within the list of all similar triggers on the same
table. Currently, this value is always 0, because it is not possible to have more than one trigger with the same
EVENT_MANIPULATION and ACTION_TIMING on the same table.
The ACTION_STATEMENT column contains the statement to be executed when the trigger is invoked. This is the same as the text
displayed in the Statement column of the output from SHOW TRIGGERS. Note that this text uses UTF-8 encoding.
The ACTION_ORIENTATION column always contains the value 'ROW'.
INFORMATION_SCHEMA Tables
1923
The ACTION_TIMING column contains one of the two values 'BEFORE' or 'AFTER'.
The columns ACTION_REFERENCE_OLD_ROW and ACTION_REFERENCE_NEW_ROW contain the old and new column identifi-
ers, respectively. This means that ACTION_REFERENCE_OLD_ROW always contains the value 'OLD' and AC-
TION_REFERENCE_NEW_ROW always contains the value 'NEW'.
The SQL_MODE column shows the server SQL mode that was in effect at the time when the trigger was created (and thus which re-
mains in effect for this trigger whenever it is invoked, regardless of the current server SQL mode). The possible range of values for
this column is the same as that of the sql_mode system variable. See Section 5.1.8, Server SQL Modes.
The DEFINER column was added in MySQL 5.1.2. DEFINER indicates who defined the trigger.
CHARACTER_SET_CLIENT is the session value of the character_set_client system variable when the trigger was cre-
ated. COLLATION_CONNECTION is the session value of the collation_connection system variable when the trigger was
created. DATABASE_COLLATION is the collation of the database with which the trigger is associated. These columns were added
in MySQL 5.1.21.
The following columns currently always contain NULL: TRIGGER_CATALOG, EVENT_OBJECT_CATALOG, AC-
TION_CONDITION, ACTION_REFERENCE_OLD_TABLE, ACTION_REFERENCE_NEW_TABLE, and CREATED.
Example, using the ins_sum trigger defined in Section 19.3, Using Triggers:
mysql> SELECT * FROM INFORMATION_SCHEMA.TRIGGERS\G
*************************** 1. row ***************************
TRIGGER_CATALOG: NULL
TRIGGER_SCHEMA: test
TRIGGER_NAME: ins_sum
EVENT_MANIPULATION: INSERT
EVENT_OBJECT_CATALOG: NULL
EVENT_OBJECT_SCHEMA: test
EVENT_OBJECT_TABLE: account
ACTION_ORDER: 0
ACTION_CONDITION: NULL
ACTION_STATEMENT: SET @sum = @sum + NEW.amount
ACTION_ORIENTATION: ROW
ACTION_TIMING: BEFORE
ACTION_REFERENCE_OLD_TABLE: NULL
ACTION_REFERENCE_NEW_TABLE: NULL
ACTION_REFERENCE_OLD_ROW: OLD
ACTION_REFERENCE_NEW_ROW: NEW
CREATED: NULL
SQL_MODE:
DEFINER: me@localhost
See also Section 12.5.5.40, SHOW TRIGGERS Syntax.
20.17. The INFORMATION_SCHEMA PLUGINS Table
The PLUGINS table provides information about server plugins.
INFORMATION_SCHEMA Name SHOW Name Remarks
PLUGIN_NAME Name MySQL extension
PLUGIN_VERSION MySQL extension
PLUGIN_STATUS Status MySQL extension
PLUGIN_TYPE Type MySQL extension
PLUGIN_TYPE_VERSION MySQL extension
PLUGIN_LIBRARY Library MySQL extension
PLUGIN_LIBRARY_VERSION MySQL extension
PLUGIN_AUTHOR MySQL extension
PLUGIN_DESCRIPTION MySQL extension
PLUGIN_LICENSE MySQL extension
Notes:
INFORMATION_SCHEMA Tables
1924
The PLUGINS table is a nonstandard table. It was added in MySQL 5.1.5.
The PLUGIN_LICENSE column was added in MySQL 5.1.12.
See also Section 12.5.5.27, SHOW PLUGINS Syntax.
20.18. The INFORMATION_SCHEMA ENGINES Table
The PLUGINS table provides information about storage engines.
INFORMATION_SCHEMA Name SHOW Name Remarks
ENGINE Engine MySQL extension
SUPPORT Support MySQL extension
COMMENT Comment MySQL extension
TRANSACTIONS Transactions MySQL extension
XA XA MySQL extension
SAVEPOINTS Savepoints MySQL extension
Notes:
The ENGINES table is a nonstandard table. It was added in MySQL 5.1.5.
See also Section 12.5.5.17, SHOW ENGINES Syntax.
20.19. The INFORMATION_SCHEMA PARTITIONS Table
The PARTITIONS table provides information about table partitions. See Chapter 18, Partitioning, for more information about parti-
tioning tables.
INFORMATION_SCHEMA Name SHOW Name Remarks
TABLE_CATALOG MySQL extension
TABLE_SCHEMA MySQL extension
TABLE_NAME MySQL extension
PARTITION_NAME MySQL extension
SUBPARTITION_NAME MySQL extension
PARTITION_ORDINAL_POSITION MySQL extension
SUBPARTITION_ORDINAL_POSITION MySQL extension
PARTITION_METHOD MySQL extension
SUBPARTITION_METHOD MySQL extension
PARTITION_EXPRESSION MySQL extension
SUBPARTITION_EXPRESSION MySQL extension
PARTITION_DESCRIPTION MySQL extension
TABLE_ROWS MySQL extension
AVG_ROW_LENGTH MySQL extension
DATA_LENGTH MySQL extension
MAX_DATA_LENGTH MySQL extension
INDEX_LENGTH MySQL extension
DATA_FREE MySQL extension
INFORMATION_SCHEMA Tables
1925
CREATE_TIME MySQL extension
UPDATE_TIME MySQL extension
CHECK_TIME MySQL extension
CHECKSUM MySQL extension
PARTITION_COMMENT MySQL extension
NODEGROUP MySQL extension
TABLESPACE_NAME MySQL extension
Notes:
The PARTITIONS table is a nonstandard table. It was added in MySQL 5.1.6.
Each record in this table corresponds to an individual partition or subpartition of a partitioned table.
TABLE_CATALOG: This column is always NULL.
TABLE_SCHEMA: This column contains the name of the database to which the table belongs.
TABLE_NAME: This column contains the name of the table containing the partition.
PARTITION_NAME: The name of the partition.
SUBPARTITION_NAME: If the PARTITIONS table record represents a subpartition, then this column contains the name of subpar-
tition; otherwise it is NULL.
PARTITION_ORDINAL_POSITION: All partitions are indexed in the same order as they are defined, with 1 being the number as-
signed to the first partition. The indexing can change as partitions are added, dropped, and reorganized; the number shown is this
column reflects the current order, taking into account any indexing changes.
SUBPARTITION_ORDINAL_POSITION: Subpartitions within a given partition are also indexed and reindexed in the same man-
ner as partitions are indexed within a table.
PARTITION_METHOD: One of the values RANGE, LIST, HASH, LINEAR HASH, KEY, or LINEAR KEY; that is, one of the avail-
able partitioning types as discussed in Section 18.2, Partition Types.
SUBPARTITION_METHOD: One of the values HASH, LINEAR HASH, KEY, or LINEAR KEY; that is, one of the available subpar-
titioning types as discussed in Section 18.2.5, Subpartitioning.
PARTITION_EXPRESSION: This is the expression for the partitioning function used in the CREATE TABLE or ALTER TABLE
statement that created the table's current partitioning scheme.
For example, consider a partitioned table created in the test database using this statement:
CREATE TABLE tp (
c1 INT,
c2 INT,
c3 VARCHAR(25)
)
PARTITION BY HASH(c1 + c2)
PARTITIONS 4;
The PARTITION_EXPRESSION column in a PARTITIONS table record for a partition from this table displays c1 + c2, as
shown here:
mysql> SELECT DISTINCT PARTITION_EXPRESSION
> FROM INFORMATION_SCHEMA.PARTITIONS
> WHERE TABLE_NAME='tp' AND TABLE_SCHEMA='test';
+----------------------+
| PARTITION_EXPRESSION |
+----------------------+
| c1 + c2 |
+----------------------+
1 row in set (0.09 sec)
INFORMATION_SCHEMA Tables
1926
SUBPARTITION_EXPRESSION: This works in the same fashion for the subpartitioning expression that defines the subpartition-
ing for a table as PARTITION_EXPRESSION does for the partitioning expression used to define a table's partitioning.
If the table has no subpartitions, then this column is NULL.
PARTITION_DESCRIPTION: This column is used for RANGE and LIST partitions. For a RANGE partition, it contains the value
set in the partition's VALUES LESS THAN clause, which can be either an integer or MAXVALUE. For a LIST partition, this column
contains the values defined in the partition's VALUES IN clause, which is a comma-separated list of integer values.
For partitions whose PARTITION_METHOD is other than RANGE or LIST, this column is always NULL.
TABLE_ROWS: The number of table rows in the partition.
For partitioned InnoDB tables, the row count given in the TABLE_ROWS column is only an estimated value used in SQL optimiza-
tion, and may not always be exact.
AVG_ROW_LENGTH: The average length of the rows stored in this partition or subpartition, in bytes.
This is the same as DATA_LENGTH divided by TABLE_ROWS.
DATA_LENGTH: The total length of all rows stored in this partition or subpartition, in bytes that is, the total number of bytes
stored in the partition or subpartition.
MAX_DATA_LENGTH: The maximum number of bytes that can be stored in this partition or subpartition.
INDEX_LENGTH: The length of the index file for this partition or subpartition, in bytes.
DATA_FREE: The number of bytes allocated to the partition or subpartition but not used.
CREATE_TIME: The time of the partition's or subpartition's creation.
UPDATE_TIME: The time that the partition or subpartition was last modified.
CHECK_TIME: The last time that the table to which this partition or subpartition belongs was checked.
Note
Some storage engines do not update this time; for tables using these storage engines, this value is always NULL.
CHECKSUM: The checksum value, if any; otherwise, this column is NULL.
PARTITION_COMMENT: This column contains the text of any comment made for the partition.
The default value for this column is an empty string.
NODEGROUP: This is the nodegroup to which the partition belongs. This is relevant only to MySQL Cluster tables; otherwise the
value of this column is always 0.
TABLESPACE_NAME: This column contains the name of tablespace to which the partition belongs. In MySQL 5.1, the value of this
column is always DEFAULT.

Important
If any partitioned tables created in a MySQL version prior to MySQL 5.1.6 are present following an upgrade to MySQL
5.1.6 or later, it is not possible to SELECT from, SHOW, or DESCRIBE the PARTITIONS table. See Section C.1.32,
Changes in MySQL 5.1.6 (01 February 2006) before upgrading from MySQL 5.1.5 or earlier to MySQL 5.1.6 or later.
A nonpartitioned table has one record in INFORMATION_SCHEMA.PARTITIONS; however, the values of the PARTI-
TION_NAME, SUBPARTITION_NAME, PARTITION_ORDINAL_POSITION, SUBPARTITION_ORDINAL_POSITION, PAR-
TITION_METHOD, SUBPARTITION_METHOD, PARTITION_EXPRESSION, SUBPARTITION_EXPRESSION, and PARTI-
TION_DESCRIPTION columns are all NULL. (The PARTITION_COMMENT column in this case is blank.)
In MySQL 5.1, there is also only one record in the PARTITIONS table for a table using the NDBCLUSTER storage engine. The
same columns are also NULL (or empty) as for a nonpartitioned table.
INFORMATION_SCHEMA Tables
1927
20.20. The INFORMATION_SCHEMA EVENTS Table
The EVENTS table provides information about scheduled events, which are discussed in Section 19.4, Using the Event Scheduler.
INFORMATION_SCHEMA Name SHOW Name Remarks
EVENT_CATALOG NULL, MySQL extension
EVENT_SCHEMA Db MySQL extension
EVENT_NAME Name MySQL extension
DEFINER Definer MySQL extension
TIME_ZONE Time zone MySQL extension
EVENT_BODY MySQL extension
EVENT_DEFINITION MySQL extension
EVENT_TYPE Type MySQL extension
EXECUTE_AT Execute at MySQL extension
INTERVAL_VALUE Interval value MySQL extension
INTERVAL_FIELD Interval field MySQL extension
SQL_MODE MySQL extension
STARTS Starts MySQL extension
ENDS Ends MySQL extension
STATUS Status MySQL extension
ON_COMPLETION MySQL extension
CREATED MySQL extension
LAST_ALTERED MySQL extension
LAST_EXECUTED MySQL extension
EVENT_COMMENT MySQL extension
ORIGINATOR Originator MySQL extension
CHARACTER_SET_CLIENT MySQL extension
COLLATION_CONNECTION MySQL extension
DATABASE_COLLATION MySQL extension
Notes:
The EVENTS table is a nonstandard table. It was added in MySQL 5.1.6.
EVENT_CATALOG: The value of this column is always NULL.
EVENT_SCHEMA: The name of the schema (database) to which this event belongs.
EVENT_NAME: The name of the event.
DEFINER: The user who created the event. Always displayed in 'user_name'@'host_name' format.
TIME_ZONE: The time zone in effect when schedule for the event was last modified. If the event's schedule has not been modified
since the event was created, then this is the time zone that was in effect at the event's creation. The default value is SYSTEM.
This column was added in MySQL 5.1.17. See Section C.1.21, Changes in MySQL 5.1.17 (04 April 2007), for important informa-
tion if you are using the Event Scheduler and are upgrading from MySQL 5.1.16 (or earlier) to MySQL 5.1.17 (or later).
EVENT_BODY: The language used for the statements in the event's DO clause; in MySQL 5.1, this is always SQL.
This column was added in MySQL 5.1.12. It is not to be confused with the column of the same name (now named
EVENT_DEFINITION) that existed in earlier MySQL versions.
INFORMATION_SCHEMA Tables
1928
EVENT_DEFINITION: The text of the SQL statement making up the event's DO clause; in other words, the statement executed by
this event.
Note
Prior to MySQL 5.1.12, this column was named EVENT_BODY.
EVENT_TYPE: One of the two values ONE TIME or RECURRING.
EXECUTE_AT: For a one-time event, this is the DATETIME value specified in the AT clause of the CREATE EVENT statement
used to create the event, or of the last ALTER EVENT statement that modified the event. The value shown in this column reflects
the addition or subtraction of any INTERVAL value included in the event's AT clause. For example, if an event is created using ON
SCHEDULE AT CURRENT_TIMESTAMP + '1:6' DAY_HOUR, and the event was created at 2006-02-09 14:05:30, the value
shown in this column would be '2006-02-10 20:05:30'.
If the event's timing is determined by an EVERY clause instead of an AT clause (that is, if the event is recurring), the value of this
column is NULL.
INTERVAL_VALUE: For recurring events, this column contains the numeric portion of the event's EVERY clause.
For a one-time event (that is, an event whose timing is determined by an AT clause), this column's value is NULL.
INTERVAL_FIELD: For recurring events, this column contains the units portion of the EVERY clause governing the timing of the
event. Thus, this column contains a value such as 'YEAR', 'QUARTER', 'DAY', and so on.
Note
In early MySQL 5.1 releases, this value was prefixed with 'INTERVAL_', and was displayed as 'INTERVAL_YEAR', 'IN-
TERVAL_QUARTER', 'INTERVAL_DAY', and so on.
For a one-time event (that is, an event whose timing is determined by an AT clause), this column's value is NULL.
SQL_MODE: The SQL mode in effect at the time the event was created or altered.
STARTS: For a recurring event whose definition includes a STARTS clause, this column contains the corresponding DATETIME
value. As with the EXECUTE_AT column, this value resolves any expressions used.
If there is no STARTS clause affecting the timing of the event, this column is empty. (Prior to MySQL 5.1.8, it contained NULL in
such cases.)
ENDS: For a recurring event whose definition includes a ENDS clause, this column contains the corresponding DATETIME value.
As with the EXECUTE_AT column (see previous example), this value resolves any expressions used.
If there is no ENDS clause affecting the timing of the event, this column contains NULL.
STATUS: One of the three values ENABLED, DISABLED, or SLAVESIDE_DISABLED.
SLAVESIDE_DISABLED was added to the list of possible values for this column in MySQL 5.1.18. This value indicates that the
creation of the event occurred on another MySQL server acting as a replication master and was replicated to the current MySQL
server which is acting as a slave, but the event is not presently being executed on the slave. See Section 16.3.1.7, Replication of In-
voked Features, for more information.
ON_COMPLETION: One of the two values PRESERVE or NOT PRESERVE.
CREATED: The date and time when the event was created. This is a DATETIME value.
LAST_ALTERED: The date and time when the event was last modified. This is a DATETIME value. If the event has not been modi-
fied since its creation, this column holds the same value as the CREATED column.
LAST_EXECUTED: The date and time when the event last executed. A DATETIME value. If the event has never executed, this
column's value is NULL.
Before MySQL 5.1.23, LAST_EXECUTED indicates when event finished executing. As of 5.1.23, LAST_EXECUTED instead indic-
ates when the event started. As a result, the ENDS column is never less than LAST_EXECUTED.
EVENT_COMMENT: The text of a comment, if the event has one. If there is no comment, the value of this column is an empty string.
INFORMATION_SCHEMA Tables
1929
ORIGINATOR: The server ID of the MySQL server on which the event was created; used in replication. The default value is 0. This
column was added in MySQL 5.1.18.
CHARACTER_SET_CLIENT is the session value of the character_set_client system variable when the event was created.
COLLATION_CONNECTION is the session value of the collation_connection system variable when the event was created.
DATABASE_COLLATION is the collation of the database with which the event is associated. These columns were added in MySQL
5.1.21.
Example: Suppose the user jon@ghidora creates an event named e_daily, and then modifies it a few minutes later using an AL-
TER EVENT statement, as shown here:
DELIMITER |
CREATE EVENT e_daily
ON SCHEDULE
EVERY 1 DAY
COMMENT 'Saves total number of sessions then clears the table each day'
DO
BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END |
DELIMITER ;
ALTER EVENT e_daily
ENABLED;
(Note that comments can span multiple lines.)
This user can then run the following SELECT statement, and obtain the output shown:
mysql> SELECT * FROM INFORMATION_SCHEMA.EVENTS
> WHERE EVENT_NAME = 'e_daily'
> AND EVENT_SCHEMA = 'myschema'\G
*************************** 1. row ***************************
EVENT_CATALOG: NULL
EVENT_SCHEMA: test
EVENT_NAME: e_daily
DEFINER: paul@localhost
TIME_ZONE: SYSTEM
EVENT_BODY: SQL
EVENT_DEFINITION: BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END
EVENT_TYPE: RECURRING
EXECUTE_AT: NULL
INTERVAL_VALUE: 1
INTERVAL_FIELD: DAY
SQL_MODE:
STARTS: 2008-09-03 12:13:39
ENDS: NULL
STATUS: ENABLED
ON_COMPLETION: NOT PRESERVE
CREATED: 2008-09-03 12:13:39
LAST_ALTERED: 2008-09-03 12:13:39
LAST_EXECUTED: NULL
EVENT_COMMENT: Saves total number of sessions then clears the
table each day
ORIGINATOR: 1
CHARACTER_SET_CLIENT: latin1
COLLATION_CONNECTION: latin1_swedish_ci
DATABASE_COLLATION: latin1_swedish_ci
Prior to MySQL 5.1.17, the times displayed in the STARTS, ENDS, and LAST_EXECUTED columns were given in terms of Universal
Time (GMT or UTC), regardless of the server's time zone setting (Bug#16420). Beginning with MySQL 5.1.17, these times are all giv-
en in terms of local time as determined by the MySQL server's time_zone setting. (The same was true of the starts, ends, and
last_executed columns of the mysql.event table as well as the Starts and Ends columns in the output of SHOW [FULL]
EVENTS.)
The CREATED and LAST_ALTERED columns use the server time zone (as do the created and last_altered columns of the
mysql.event table).
INFORMATION_SCHEMA Tables
1930
See also Section 12.5.5.19, SHOW EVENTS Syntax.
20.21. The INFORMATION_SCHEMA FILES Table
The FILES table provides information about the files in which MySQL NDB Disk Data tables are stored.
INFORMATION_SCHEMA Name SHOW Name Remarks
FILE_ID MySQL extension
FILE_NAME MySQL extension
FILE_TYPE MySQL extension
TABLESPACE_NAME MySQL extension
TABLE_CATALOG MySQL extension
TABLE_SCHEMA MySQL extension
TABLE_NAME MySQL extension
LOGFILE_GROUP_NAME MySQL extension
LOGFILE_GROUP_NUMBER MySQL extension
ENGINE MySQL extension
FULLTEXT_KEYS MySQL extension
DELETED_ROWS MySQL extension
UPDATE_COUNT MySQL extension
FREE_EXTENTS MySQL extension
TOTAL_EXTENTS MySQL extension
EXTENT_SIZE MySQL extension
INITIAL_SIZE MySQL extension
MAXIMUM_SIZE MySQL extension
AUTOEXTEND_SIZE MySQL extension
CREATION_TIME MySQL extension
LAST_UPDATE_TIME MySQL extension
LAST_ACCESS_TIME MySQL extension
RECOVER_TIME MySQL extension
TRANSACTION_COUNTER MySQL extension
VERSION MySQL extension
ROW_FORMAT MySQL extension
TABLE_ROWS MySQL extension
AVG_ROW_LENGTH MySQL extension
DATA_LENGTH MySQL extension
MAX_DATA_LENGTH MySQL extension
INDEX_LENGTH MySQL extension
DATA_FREE MySQL extension
CREATE_TIME MySQL extension
UPDATE_TIME MySQL extension
CHECK_TIME MySQL extension
CHECKSUM MySQL extension
STATUS MySQL extension
EXTRA MySQL extension
INFORMATION_SCHEMA Tables
1931
Notes:
FILE_ID column values are auto-generated.
FILE_NAME is the name of an UNDO log file created by CREATE LOGFILE GROUP or ALTER LOGFILE GROUP, or of a data
file created by CREATE TABLESPACE or ALTER TABLESPACE.
FILE_TYPE is one of the values UNDOFILE or DATAFILE.
TABLESPACE_NAME is the name of the tablespace with which the file is associated.
Currently, the value of the TABLESPACE_CATALOG column is always NULL.
TABLE_NAME is the name of the Disk Data table with which the file is associated, if any.
The LOGFILE_GROUP_NAME column gives the name of the log file group to which the log file or data file belongs.
For an UNDO log file, the LOGFILE_GROUP_NUMBER contains the auto-generated ID number of the log file group to which the log
file belongs.
For a MySQL Cluster Disk Data log file or data file, the value of the ENGINE column is always NDB or NDBCLUSTER.
For a MySQL Cluster Disk Data log file or data file, the value of the FULLTEXT_KEYS column is always empty.
The FREE EXTENTS column displays the number of extents which have not yet been used by the file. The TOTAL EXTENTS
column show the total number of extents allocated to the file.
The difference between these two columns is the number of extents currently in use by the file:
SELECT TOTAL_EXTENTS - FREE_EXTENTS AS extents_used
FROM INFORMATION_SCHEMA.FILES
WHERE FILE_NAME = 'myfile.dat';
You can approximate the amount of disk space in use by the file by multiplying this difference by the value of the EXTENT_SIZE
column, which gives the size of an extent for the file in bytes:
SELECT (TOTAL_EXTENTS - FREE_EXTENTS) * EXTENT_SIZE AS bytes_used
FROM INFORMATION_SCHEMA.FILES
WHERE FILE_NAME = 'myfile.dat';
Similarly, you can estimate the amount of space that remains available in a given file by multiplying FREE_EXTENTS by EX-
TENT_SIZE:
SELECT FREE_EXTENTS * EXTENT_SIZE AS bytes_free
FROM INFORMATION_SCHEMA.FILES
WHERE FILE_NAME = 'myfile.dat';
Important
The byte values produced by the preceding queries are approximations only, and their precision is inversely proportional
to the value of EXTENT_SIZE. That is, the larger EXTENT_SIZE becomes, the less accurate the approximations are.
It is also important to remember that once an extent is used, it cannot be freed again without dropping the data file of which it is a
part. This means that deletes from a Disk Data table do not release disk space.
The extent size can be set in a CREATE TABLESPACE statement. See Section 12.1.18, CREATE TABLESPACE Syntax, for
more information.
The INITIAL_SIZE column shows the size in bytes of the file. This is the same value that was used in the INITIAL_SIZE
clause of the CREATE LOGFILE GROUP, ALTER LOGFILE GROUP, CREATE TABLESPACE, or ALTER TABLESPACE
statement used to create the file.
For MySQL Cluster Disk Data files, the value of the MAXIMUM_SIZE column is always the same as INITIAL_SIZE, and the
AUTOEXTEND_SIZE column is always empty.
INFORMATION_SCHEMA Tables
1932
The CREATION_TIME column shows the date and time when the file was created. The LAST_UPDATE_TIME column displays
the date and time when the file was last modified. The LAST_ACCESSED column provides the date and time when the file was last
accessed by the server.
Currently, the values of these columns are as reported by the operating system, and are not supplied by the NDB storage engine.
Where no value is provided by the operating system, these columns display 0000-00-00 00:00:00.
For MySQL Cluster Disk Data files, the value of the RECOVER_TIME and TRANSACTION_COUNTER columns is always 0.
For MySQL Cluster Disk Data files, the following columns are always NULL:
VERSION
ROW_FORMAT
TABLE_ROWS
AVG_ROW_LENGTH
DATA_LENGTH
MAX_DATA_LENGTH
INDEX_LENGTH
DATA_FREE
CREATE_TIME
UPDATE_TIME
CHECK_TIME
CHECKSUM
For MySQL Cluster Disk Data files, the value of the STATUS column is always NORMAL.
For MySQL Cluster Disk Data files, the EXTRA column shows which data node the file belongs to, as each data node has its own
copy of the file. For example, suppose you use this statement on a MySQL Cluster with four data nodes:
CREATE LOGFILE GROUP mygroup
ADD UNDOFILE 'new_undo.dat'
INITIAL_SIZE 2G
ENGINE NDB;
After running the CREATE LOGFILE GROUP statement successfully, you should see a result similar to the one shown here for
this query against the FILES table:
mysql> SELECT LOGFILE_GROUP_NAME, FILE_TYPE, EXTRA
-> FROM INFORMATION_SCHEMA.FILES
-> WHERE FILE_NAME = 'new_undo.dat';
+--------------------+-------------+----------------+
| LOGFILE_GROUP_NAME | FILE_TYPE | EXTRA |
+--------------------+-------------+----------------+
| mygroup | UNDO FILE | CLUSTER_NODE=3 |
| mygroup | UNDO FILE | CLUSTER_NODE=4 |
| mygroup | UNDO FILE | CLUSTER_NODE=5 |
| mygroup | UNDO FILE | CLUSTER_NODE=6 |
+--------------------+-------------+----------------+
4 rows in set (0.01 sec)
The FILES table is a nonstandard table. It was added in MySQL 5.1.6.
Beginning with MySQL 5.1.14, an additional row is present in the FILES table following the creation of a logfile group. This row
has NULL for the value of the FILE_NAME column. For this row, the value of the FILE_ID column is always 0, that of the
FILE_TYPE column is always UNDO FILE, and that of the STATUS column is always NORMAL. Currently, the value of the EN-
GINE column is always NDBCLUSTER.
The FREE_EXTENTS column in this row shows the total number of free extents available to all undo files belonging to a given log
INFORMATION_SCHEMA Tables
1933
file group whose name and number are shown in the LOGFILE_GROUP_NAME and LOGFILE_GROUP_NUMBER columns, re-
spectively.
Suppose there are no existing log file groups on your MySQL Cluster, and you create one using the following statement:
mysql> CREATE LOGFILE GROUP lg1
-> ADD UNDOFILE 'undofile.dat'
-> INITIAL_SIZE = 16M
-> UNDO_BUFFER_SIZE = 1M
-> ENGINE = NDB;
Query OK, 0 rows affected (3.81 sec)
You can now see this NULL row when you query the FILES table:
mysql> SELECT DISTINCT
-> FILE_NAME AS File,
-> FREE_EXTENTS AS Free,
-> TOTAL_EXTENTS AS Total,
-> EXTENT_SIZE AS Size,
-> INITIAL_SIZE AS Initial
-> FROM INFORMATION_SCHEMA.FILES;
+--------------+---------+---------+------+----------+
| File | Free | Total | Size | Initial |
+--------------+---------+---------+------+----------+
| undofile.dat | NULL | 4194304 | 4 | 16777216 |
| NULL | 4184068 | NULL | 4 | NULL |
+--------------+---------+---------+------+----------+
2 rows in set (0.01 sec)
The total number of free extents available for undo logging is always somewhat less than the sum of the TOTAL_EXTENTS column
values for all undo files in the log file group due to overhead required for maintaining the undo files. This can be seen by adding a
second undo file to the log file group, then repeating the previous query against the FILES table:
mysql> ALTER LOGFILE GROUP lg1
-> ADD UNDOFILE 'undofile02.dat'
-> INITIAL_SIZE = 4M
-> ENGINE = NDB;
Query OK, 0 rows affected (1.02 sec)
mysql> SELECT DISTINCT
-> FILE_NAME AS File,
-> FREE_EXTENTS AS Free,
-> TOTAL_EXTENTS AS Total,
-> EXTENT_SIZE AS Size,
-> INITIAL_SIZE AS Initial
-> FROM INFORMATION_SCHEMA.FILES;
+----------------+---------+---------+------+----------+
| File | Free | Total | Size | Initial |
+----------------+---------+---------+------+----------+
| undofile.dat | NULL | 4194304 | 4 | 16777216 |
| undofile02.dat | NULL | 1048576 | 4 | 4194304 |
| NULL | 5223944 | NULL | 4 | NULL |
+----------------+---------+---------+------+----------+
3 rows in set (0.01 sec)
The amount of free space in bytes which is available for undo logging by Disk Data tables using this log file group can be approxim-
ated by multiplying the number of free extents by the initial size:
mysql> SELECT
-> FREE_EXTENTS AS 'Free Extents',
-> FREE_EXTENTS * EXTENT_SIZE AS 'Free Bytes'
-> FROM INFORMATION_SCHEMA.FILES
-> WHERE LOGFILE_GROUP_NAME = 'lg1'
-> AND FILE_NAME IS NULL;
+--------------+------------+
| Free Extents | Free Bytes |
+--------------+------------+
| 5223944 | 20895776 |
+--------------+------------+
1 row in set (0.02 sec)
If you create a MySQL Cluster Disk Data table and then insert some rows into it, you can see approximately how much space re-
mains for undo logging afterwards, for example:
mysql> CREATE TABLESPACE ts1
-> ADD DATAFILE 'data1.dat'
-> USE LOGFILE GROUP lg1
-> INITIAL_SIZE 512M
INFORMATION_SCHEMA Tables
1934
-> ENGINE = NDB;
Query OK, 0 rows affected (8.71 sec)
mysql> CREATE TABLE dd (
-> c1 INT NOT NULL PRIMARY KEY,
-> c2 INT,
-> c3 DATE
-> )
-> TABLESPACE ts1 STORAGE DISK
-> ENGINE = NDB;
Query OK, 0 rows affected (2.11 sec)
mysql> INSERT INTO dd VALUES
-> (NULL, 1234567890, '2007-02-02'),
-> (NULL, 1126789005, '2007-02-03'),
-> (NULL, 1357924680, '2007-02-04'),
-> (NULL, 1642097531, '2007-02-05');
Query OK, 4 rows affected (0.01 sec)
mysql> SELECT
-> FREE_EXTENTS AS 'Free Extents',
-> FREE_EXTENTS * EXTENT_SIZE AS 'Free Bytes'
-> FROM INFORMATION_SCHEMA.FILES
-> WHERE LOGFILE_GROUP_NAME = 'lg1'
-> AND FILE_NAME IS NULL;
+--------------+------------+
| Free Extents | Free Bytes |
+--------------+------------+
| 5207565 | 20830260 |
+--------------+------------+
1 row in set (0.01 sec)
There are no SHOW commands associated with the FILES table.
For additional information, and examples of creating and dropping MySQL Cluster Disk Data objects, see Section 17.10, MySQL
Cluster Disk Data Tables.
20.22. The INFORMATION_SCHEMA PROCESSLIST Table
The PROCESSLIST table provides information about which threads are running.
INFORMATION_SCHEMA Name SHOW Name Remarks
ID Id MySQL extension
USER User MySQL extension
HOST Host MySQL extension
DB db MySQL extension
COMMAND Command MySQL extension
TIME Time MySQL extension
STATE State MySQL extension
INFO Info MySQL extension
For an extensive description of the table columns, see Section 12.5.5.31, SHOW PROCESSLIST Syntax.
Notes:
The PROCESSLIST table is a nonstandard table. It was added in MySQL 5.1.7.
Like the output from the corresponding SHOW statement, the PROCESSLIST table will only show information about your own
threads, unless you have the PROCESS privilege, in which case you will see information about other threads, too. As an anonymous
user, you cannot see any rows at all.
If an SQL statement refers to INFORMATION_SCHEMA.PROCESSLIST, then MySQL will populate the entire table once, when
statement execution begins, so there is read consistency during the statement. There is no read consistency for a multi-statement
transaction, though.
INFORMATION_SCHEMA Tables
1935
The following statements are equivalent:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
SHOW FULL PROCESSLIST
20.23. The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table
The REFERENTIAL_CONSTRAINTS table provides information about foreign keys.
INFORMATION_SCHEMA Name SHOW Name Remarks
CONSTRAINT_CATALOG NULL
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
UNIQUE_CONSTRAINT_CATALOG NULL
UNIQUE_CONSTRAINT_SCHEMA
UNIQUE_CONSTRAINT_NAME
MATCH_OPTION
UPDATE_RULE
DELETE_RULE
TABLE_NAME
REFERENCED_TABLE_NAME
Notes:
The REFERENTIAL_CONSTRAINTS table was added in MySQL 5.1.10. The REFERENCED_TABLE_NAME column was added
in MySQL 5.1.16.
TABLE_NAME has the same value as TABLE_NAME in INFORMATION_SCHEMA.TABLE_CONSTRAINTS.
CONSTRAINT_SCHEMA and CONSTRAINT_NAME identify the foreign key.
UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME, and REFERENCED_TABLE_NAME identify the referenced
key. (Note: Before MySQL 5.1.16, UNIQUE_CONSTRAINT_NAME incorrectly named the referenced table, not the constraint.)
The only valid value at this time for MATCH_OPTION is NONE.
The possible values for UPDATE_RULE or DELETE_RULE are CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO AC-
TION.
20.24. The INFORMATION_SCHEMA GLOBAL_STATUS and SES-
SION_STATUS Tables
The GLOBAL_STATUS and SESSION_STATUS tables provide information about server status variables. Their contents correspond to
the information produced by the SHOW GLOBAL STATUS and SHOW SESSION STATUS statements (see Section 12.5.5.37, SHOW
STATUS Syntax).
INFORMATION_SCHEMA Name SHOW Name Remarks
VARIABLE_NAME Variable_name
VARIABLE_VALUE Value
Notes:
INFORMATION_SCHEMA Tables
1936
The GLOBAL_STATUS and SESSION_STATUS tables were added in MySQL 5.1.12.
Beginning with MySQL 5.1.19, the VARIABLE_VALUE column for each of these tables is defined as VARCHAR(20480). Previ-
ously, this column had the data type DECIMAL(22,7), but was changed to avoid loss of data when working with status variables
whose values were strings (Bug#26994).
20.25. The INFORMATION_SCHEMA GLOBAL_VARIABLES and SES-
SION_VARIABLES Tables
The GLOBAL_VARIABLES and SESSION_VARIABLES tables provide information about server status variables. Their contents cor-
respond to the information produced by the SHOW GLOBAL VARIABLES and SHOW SESSION VARIABLES statements (see Sec-
tion 12.5.5.41, SHOW VARIABLES Syntax).
INFORMATION_SCHEMA Name SHOW Name Remarks
VARIABLE_NAME Variable_name
VARIABLE_VALUE Value
Notes:
The GLOBAL_VARIABLES and SESSION_VARIABLES tables were added in MySQL 5.1.12.
Beginning with MySQL 5.1.19, the VARIABLE_VALUE column for each of these tables is defined as VARCHAR(20480). Previ-
ously, this column had the data type LONGTEXT; this was changed in order to make these tables consistent with the GLOB-
AL_STATUS and SESSION_STATUS tables, whose definitions had been changed in that version (see Section 20.24, The IN-
FORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables).
20.26. The INFORMATION_SCHEMA PROFILING Table
The PROFILING table provides statement profiling information. Its contents correspond to the information produced by the SHOW
PROFILES and SHOW PROFILE statements (see Section 12.5.5.33, SHOW PROFILES Syntax). The table is empty unless the
profiling session variable is set to 1.
INFORMATION_SCHEMA Name SHOW Name Remarks
QUERY_ID Query_ID
SEQ
STATE Status
DURATION Duration
CPU_USER CPU_user
CPU_SYSTEM CPU_system
CONTEXT_VOLUNTARY Context_voluntary
CONTEXT_INVOLUNTARY Context_involuntary
BLOCK_OPS_IN Block_ops_in
BLOCK_OPS_OUT Block_ops_out
MESSAGES_SENT Messages_sent
MESSAGES_RECEIVED Messages_received
PAGE_FAULTS_MAJOR Page_faults_major
PAGE_FAULTS_MINOR Page_faults_minor
SWAPS Swaps
SOURCE_FUNCTION Source_function
SOURCE_FILE Source_file
INFORMATION_SCHEMA Tables
1937
SOURCE_LINE Source_line
Notes:
The PROFILING table was added in MySQL 5.1.24.
QUERY_ID is a numeric statement identifier.
SEQ is a sequence number indicating the display order for rows with the same QUERY_ID value.
STATE is the profiling state to which the row measurements apply.
DURATION indicates how long statement execution remained in the given state, in seconds.
CPU_USER and CPU_SYSTEM indicate user and system CPU use, in seconds.
CONTEXT_VOLUNTARY and CONTEXT_INVOLUNTARY indicate how many voluntary and involuntary context switches occurred.
BLOCK_OPS_IN and BLOCK_OPS_OUT indicate the number of block input and output operations.
MESSAGES_SENT and MESSAGES_RECEIVED indicate the number of communication messages sent and received.
PAGE_FAULTS_MAJOR and PAGE_FAULTS_MINOR indicate the number of major and minor page faults.
SWAPS indicates how many swaps occurred.
SOURCE_FUNCTION, SOURCE_FILE, and SOURCE_LINE provide information indicating where in the source code the profiled
state executes.
20.27. Other INFORMATION_SCHEMA Tables
We intend to implement additional INFORMATION_SCHEMA tables. In particular, we acknowledge the need for the PARAMETERS ta-
ble. (PARAMETERS is implemented in MySQL 6.0.)
20.28. Extensions to SHOW Statements
Some extensions to SHOW statements accompany the implementation of INFORMATION_SCHEMA:
SHOW can be used to get information about the structure of INFORMATION_SCHEMA itself.
Several SHOW statements accept a WHERE clause that provides more flexibility in specifying which rows to display.
INFORMATION_SCHEMA is an information database, so its name is included in the output from SHOW DATABASES. Similarly, SHOW
TABLES can be used with INFORMATION_SCHEMA to obtain a list of its tables:
mysql> SHOW TABLES FROM INFORMATION_SCHEMA;
+---------------------------------------+
| Tables_in_INFORMATION_SCHEMA |
+---------------------------------------+
| CHARACTER_SETS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| ENGINES |
| EVENTS |
| FILES |
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
INFORMATION_SCHEMA Tables
1938
| SCHEMATA |
| SCHEMA_PRIVILEGES |
| SESSION_STATUS |
| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
+---------------------------------------+
27 rows in set (0.00 sec)
SHOW COLUMNS and DESCRIBE can display information about the columns in individual INFORMATION_SCHEMA tables.
SHOW statements that accept a LIKE clause to limit the rows displayed also allow a WHERE clause that enables specification of more
general conditions that selected rows must satisfy:
SHOW CHARACTER SET
SHOW COLLATION
SHOW COLUMNS
SHOW DATABASES
SHOW FUNCTION STATUS
SHOW INDEX
SHOW OPEN TABLES
SHOW PROCEDURE STATUS
SHOW STATUS
SHOW TABLE STATUS
SHOW TABLES
SHOW TRIGGERS
SHOW VARIABLES
The WHERE clause, if present, is evaluated against the column names displayed by the SHOW statement. For example, the SHOW
CHARACTER SET statement produces these output columns:
mysql> SHOW CHARACTER SET;
+----------+-----------------------------+---------------------+--------+
| Charset | Description | Default collation | Maxlen |
+----------+-----------------------------+---------------------+--------+
| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |
| dec8 | DEC West European | dec8_swedish_ci | 1 |
| cp850 | DOS West European | cp850_general_ci | 1 |
| hp8 | HP West European | hp8_english_ci | 1 |
| koi8r | KOI8-R Relcom Russian | koi8r_general_ci | 1 |
| latin1 | cp1252 West European | latin1_swedish_ci | 1 |
| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |
...
To use a WHERE clause with SHOW CHARACTER SET, you would refer to those column names. As an example, the following state-
ment displays information about character sets for which the default collation contains the string 'japanese':
mysql> SHOW CHARACTER SET WHERE `Default collation` LIKE '%japanese%';
+---------+---------------------------+---------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------------------+---------------------+--------+
| ujis | EUC-JP Japanese | ujis_japanese_ci | 3 |
| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |
| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2 |
| eucjpms | UJIS for Windows Japanese | eucjpms_japanese_ci | 3 |
+---------+---------------------------+---------------------+--------+
This statement displays the multi-byte character sets:
mysql> SHOW CHARACTER SET WHERE Maxlen > 1;
+---------+---------------------------+---------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------------------+---------------------+--------+
| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |
| ujis | EUC-JP Japanese | ujis_japanese_ci | 3 |
| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |
| euckr | EUC-KR Korean | euckr_korean_ci | 2 |
| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2 |
| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |
| utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |
| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2 |
| eucjpms | UJIS for Windows Japanese | eucjpms_japanese_ci | 3 |
+---------+---------------------------+---------------------+--------+
INFORMATION_SCHEMA Tables
1939
Chapter 21. Connectors and APIs
MySQL Connectors provide connectivity to the MySQL server for client programs. APIs provide low-level access to the MySQL pro-
tocol and MySQL resources. Both Connectors and the APIs enable you to connect and execute MySQL statements from another lan-
guage or environment, including Java (JDBC), ODBC, Perl, Python, PHP, Ruby, and native C and embedded MySQL instances.
Note
Connector version numbers do not correlate with MySQL Server version numbers. See also Table 21.2, MySQL Con-
nector Versions and MySQL Server Versions.
A number of connectors are developed by MySQL:
Connector/ODBC provides driver support for connecting to a MySQL server using the Open Database Connectivity (ODBC) API.
Support is available for ODBC connectivity from Windows, Unix and Mac OS X platforms.
Connector/NET enables developers to create .NET applications that use data stored in a MySQL database. Connector/NET imple-
ment a fully functional ADO.NET interface and provides support for use with ADO.NET aware tools. Applications that want to use
Connector/NET can be written in any of the supported .NET languages.
The MySQL Visual Studio Plugin works with Connector/NET and Visual Studio 2005. The plugin is a MySQL DDEX Provider,
which means that you can use the schema and data manipulation tools within Visual Studio to create and edit objects within a
MySQL database.
Connector/J provides driver support for connecting to MySQL from a Java application using the standard Java Database Connectiv-
ity (JDBC) API.
Connector/MXJ is a tool that enables easy deployment and management of MySQL server and database through your Java applica-
tion.
Connector/C++ is a tool that enables easy deployment and management of MySQL server and database through your C++ applica-
tion.
Connector/C is a stand-alone replacement for the MySQL Client Library (libmysql).
Connector/OpenOffice.org is a tool that enables OpenOffice.org applications to connect to MySQL server.
There are two direct access methods for using MySQL natively within a C application:
The C API provides low-level access to the MySQL protocol through the libmysql client library; this is the primary method used
to connect to an instance of the MySQL server, and is used both by MySQL command line clients and many of the APIs also de-
tailed in this section. MySQL Connector/C can now also be used for this purpose.
libmysqld is an embedded MySQL server library that enables you to embed an instance of the MySQL server into your C applic-
ations.
If you need to access MySQL from a C application, or build an interface to MySQL for a language not supported by the Connectors or
APIs in this chapter, the C API is where you would start. A number of programmers utilities are available to help with the process, and
also covered in this section.
The remaining APIs provide an interface to MySQL from specific application langauges. These solutions are not developed or suppor-
ted by MySQL. Basic information on their usage and abilities is provided here for reference purposes only.
All the language APIs are developed using one of two methods, using libmysql or by building a native driver. The two solutions of-
fer different benefits:
Using libmysql offers complete compatibility with MySQL as it uses the same libraries as the MySQL client applications.
However, the feature set is limited to the implementation and interfaces exposed through libmysql and the performance may be
lower as data is copied between the native langiage, and the MySQL API components. MySQL Connector/C is a possible alternative
to using libmysql.
1940
Native drivers are an implementation of the MySQL network protocol entirely within the host language or environment. Native
drivers are fast, as there is less copying of data between components, and they can offer advanced functionality not available
through the standard MySQL API. Native drivers are also easier to build and deploy, as you do not need a copy of the MySQL client
libraries to build the native driver components.
A list of many of the libraries and interfaces available for MySQL are shown in the table. See Table 21.1, MySQL APIs and Inter-
faces.
Table 21.1. MySQL APIs and Interfaces
Environ-
ment
API Type Notes
Ada MySQL Bindings for GNU Ada libmysql See MySQL Bindings for GNU Ada
C Connector/C Replacement for
libmysql
See Section 21.7, MySQL Connector/C.
C++ Connector/C++ libmysql See Section 21.6, MySQL Connector/C++.
MySQL++ libmysql See Section 21.13, MySQL C++ API.
MySQL wrapped libmysql See MySQL wrapped.
Cocoa MySQL-Cocoa libmysql Compatible with the Objective-C Cocoa environ-
ment. See http://mysql-cocoa.sourceforge.net/
D MySQL for D libmysql See MySQL for D.
Eiffel Eiffel MySQL libmysql See Section 21.17, MySQL Eiffel Wrapper.
Erlang erlang-mysql-driver libmysql See erlang-mysql-driver.
Haskell Haskell MySQL Bindings Native Driver See Brian O'Sullivan's pure Haskell MySQL bind-
ings.
hsql-mysql libmysql See MySQL driver for Haskell .
Java/JDBC Connector/J Native Driver See Section 21.4, MySQL Connector/J.
Kaya MyDB libmysql See MyDB.
Lua LuaSQL libmysql See LuaSQL.
.NET/Mono Connector/NET Native Driver See Section 21.2, MySQL Connector/NET.
Objective
Caml
MySQL Bindings for OBjective Caml libmysql See MySQL Bindings for Objective Caml.
Octave Database bindings for GNU Octave libmysql See Database bindings for GNU Octave.
ODBC Connector/ODBC libmysql See Section 21.1, MySQL Connector/ODBC.
OpenOffice MySQL Connector/OpenOffice.org libmysql Direct connectivity, without using JDBC/ODBC. See
Section 21.8, MySQL Connector/OpenOffice.org.
Perl DBI/DBD::mysql libmysql See Section 21.12, MySQL Perl API.
Net::MySQL Native Driver See Net::MySQL at CPAN
PHP mysql, ext/mysql interface (deprecated) libmysql See Section 21.11.1, MySQL.
mysqli, ext/mysqli interface libmysql See Section 21.11.2, MySQL Improved Extension
(Mysqli).
PDO_MYSQL libmysql See Section 21.11.3, MySQL Functions
(PDO_MYSQL).
PDO mysqlnd Native Driver See PHP PDO mysqlnd.
Python MySQLdb libmysql See Section 21.14, MySQL Python API.
Ruby MySQL/Ruby libmysql Uses libmysql. See Section 21.15.1, The
MySQL/Ruby API.
Ruby/MySQL Native Driver See Section 21.15.2, The Ruby/MySQL API.
Scheme Myscsh libmysql See Myscsh.
SPL sql_mysql libmysql See sql_mysql for SPL.
Connectors and APIs
1941
Environ-
ment
API Type Notes
Tcl MySQLtcl libmysql See Section 21.16, MySQL Tcl API.
Table 21.2. MySQL Connector Versions and MySQL Server Versions
Connector Connector version MySQL Server version
Connector/C++ 1.0.5 (Beta) 5.1, 5.4, 6.0
Connector/OpenOffice.org 1.0 (Alpha) 5.0, 5.1, 5.4, 6.0
Connector/J 5.1 4.1, 5.0, 5.1, 5.4, 6.0
Connector/NET 1.0 4.0, 5.0
Connector/NET 5.2 4.0, 4.1, 5.0, 5.1, 5.4, 6.0
Connector/NET 5.3 4.1, 5.0, 5.1, 5.4, 6.0
Connector/ODBC 3.51 (Unicode not supported) 4.1, 5.0, 5.1, 5.4, 6.0
Connector/ODBC 5.1 4.1, 5.0, 5.1, 5.4, 6.0
21.1. MySQL Connector/ODBC
The MySQL Connector/ODBC is the name for the family of MySQL ODBC drivers (previously called MyODBC drivers) that provide
access to a MySQL database using the industry standard Open Database Connectivity (ODBC) API. This reference covers Connector/
ODBC 3.51 and Connector/ODBC 5.1. Both releases provide an ODBC compliant interface to MySQL Server.
MySQL Connector/ODBC provides both driver-manager based and native interfaces to the MySQL database, which full support for
MySQL functionality, including stored procedures, transactions and, with Connector/ODBC 5.1, full Unicode compliance.
For more information on the ODBC API standard and how to use it, refer to http://support.microsoft.com/kb/110093.
The application development part of this reference assumes a good working knowledge of C, general DBMS knowledge, and finally,
but not least, familiarity with MySQL. For more information about MySQL functionality and its syntax, refer to ht-
tp://dev.mysql.com/doc/.
Typically, you need to install Connector/ODBC only on Windows machines. For Unix and Mac OS X you can use the native MySQL
network or named pipe to communicate with your MySQL database. You may need Connector/ODBC for Unix or Mac OS X if you
have an application that requires an ODBC interface to communicate with the database. Applications that require ODBC to communic-
ate with MySQL include ColdFusion, Microsoft Office, and Filemaker Pro.
Key topics:
For help installing Connector/ODBC see Section 21.1.3, Connector/ODBC Installation.
For information on the configuration options, see Section 21.1.4.2, Connector/ODBC Connection Parameters.
For more information on connecting to a MySQL database from a Windows host using Connector/ODBC see Section 21.1.5.2,
Step-by-step Guide to Connecting to a MySQL Database through Connector/ODBC.
If you want to use Microsoft Access as an interface to a MySQL database using Connector/ODBC see Section 21.1.5.4, Using
Connector/ODBC with Microsoft Access.
General tips on using Connector/ODBC, including obtaining the last auto-increment ID see Section 21.1.7.1, Connector/ODBC
General Functionality.
For tips and common questions on using Connector/ODBC with specific application see Section 21.1.7.2, Connector/ODBC Ap-
plication Specific Tips.
For a general list of Frequently Asked Questions see Section 21.1.7.3, Connector/ODBC Errors and Resolutions (FAQ).
Additional support when using Connector/ODBC is available, see Section 21.1.8, Connector/ODBC Support.
Connectors and APIs
1942
MySQL Enterprise
MySQL Enterprise subscribers will find more information about MySQL and ODBC in the Knowledge Base art-
icles about ODBC. Access to the MySQL Knowledge Base collection of articles is one of the advantages of
subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.1.1. Connector/ODBC Versions
There are currently two version of Connector/ODBC available:
Connector/ODBC 5.1, currently in GA status, is a partial rewrite of the of the 3.51 code base and is designed to work with all ver-
sions of MySQL from 4.1. Connector/ODBC 5.1 will be a complete implementation of the ODBC Core interface,plus more Level 1
and Level 2 functionality of the ODBC specification than that currently supported by Connector/ODBC 3.51. See Section 21.1.2.1,
Connector/ODBC Roadmap.
Connector/ODBC 5.1 also includes the following changes and improvements over the 3.51 release:
Improved support on Windows 64-bit platforms.
Full Unicode support at the driver level. This includes support for the SQL_WCHAR datatype, and support for Unicode login,
password and DSN configurations. For more information,. see Microsoft Knowledgebase Article #716246.
Support for the SQL_NUMERIC_STRUCT datatype, which provides easier access to the precise definition of numeric values.
For more information, see Microsoft Knowledgebase Article #714556
Native Windows setup library. This replaces the Qt library based interface for configuring DSN information within the ODBC
Data Sources application.
Support for the ODBC descriptor, which improves the handling and metadata of columns and parameter data. For more informa-
tion, see Microsoft Knowledgebase Article #716339.
Connector/ODBC 3.51 is the current release of the 32-bit ODBC driver, also known as the MySQL ODBC 3.51 driver. Connector/
ODBC 3.51 has support for ODBC 3.5x specification level 1 (complete core API + level 2 features) in order to continue to provide
all functionality of ODBC for accessing MySQL.
The manual for versions of Connector/ODBC older than 3.51 can be located in the corresponding binary or source distribution. Please
note that versions of Connector/ODBC earlier than the 3.51 revision were not fully compliant with the ODBC specification.
Note
Development on Connector/ODBC 5.0 was stopped due to development issues. Connector/ODBC 5.1 is now the current
development release.
Note
From this section onward, the primary focus of this guide is the Connector/ODBC 3.51 and Connector/ODBC 5.1 drivers.
Note
Version numbers for MySQL products are formatted as X.X.X. However, Windows tools (Control Panel, properties dis-
play) may show the version numbers as XX.XX.XX. For example, the official MySQL formatted version number 5.0.9
may be displayed by Windows tools as 5.00.09. The two versions are the same; only the number display format is differ-
ent.
21.1.2. Connector/ODBC Introduction
ODBC (Open Database Connectivity) provides a way for client programs to access a wide range of databases or data sources. ODBC is
a standardized API that allows connections to SQL database servers. It was developed according to the specifications of the SQL Ac-
cess Group and defines a set of function calls, error codes, and data types that can be used to develop database-independent applications.
ODBC usually is used when database independence or simultaneous access to different data sources is required.
For more information about ODBC, refer to http://support.microsoft.com/kb/110093.
Connectors and APIs
1943
21.1.2.1. Connector/ODBC Roadmap
Connector/ODBC 5.1 is currently in development and will be a complete implementation of the ODBC Core interface,plus more Level
1 and Level 2 functionality of the ODBC specification than that currently supported by Connector/ODBC 3.51.
The following functionality was added or changed as part of 5.1:
Add support for SQL_NUMERIC_STRUCT: MSDN Article 714556.
Replace installer library with new implementation (from v5 tree).
Implement native Windows setup library.
Implement SQLCancel() (Bug#15601): MSDN Article 714112.
The following functionality will be added in a version after 5.1:
Implement native Mac OS X setup library.
Replace OPTIONS flags with individual DSN settings (but support OPTIONS for backwards-compatibility).
Fix support for SQLBIGINT (Bug#28887): MSDN Article 714121.
Make diagnostics support standards-compliant: MSDN Article 711021.
Add support for SQL_ATTR_METADATA_ID: MSDN Article 716447.
Implement SQLBrowseConnect(): MSDN Article 714565, MSDN Article 712446.
Implement arrays of parameters: MSDN Article 711818.
21.1.2.2. General Information About ODBC and Connector/ODBC
Open Database Connectivity (ODBC) is a widely accepted application-programming interface (API) for database access. It is based on
the Call-Level Interface (CLI) specifications from X/Open and ISO/IEC for database APIs and uses Structured Query Language (SQL)
as its database access language.
A survey of ODBC functions supported by Connector/ODBC is given at Section 21.1.6.1, Connector/ODBC API Reference. For gen-
eral information about ODBC, see http://support.microsoft.com/kb/110093.
21.1.2.2.1. Connector/ODBC Architecture
The Connector/ODBC architecture is based on five components, as shown in the following diagram:
Connectors and APIs
1944
Application:
The Application uses the ODBC API to access the data from the MySQL server. The ODBC API in turn uses the communicates
with the Driver Manager. The Application communicates with the Driver Manager using the standard ODBC calls. The Application
does not care where the data is stored, how it is stored, or even how the system is configured to access the data. It needs to know
only the Data Source Name (DSN).
A number of tasks are common to all applications, no matter how they use ODBC. These tasks are:
Selecting the MySQL server and connecting to it
Submitting SQL statements for execution
Retrieving results (if any)
Processing errors
Committing or rolling back the transaction enclosing the SQL statement
Connectors and APIs
1945
Disconnecting from the MySQL server
Because most data access work is done with SQL, the primary tasks for applications that use ODBC are submitting SQL statements
and retrieving any results generated by those statements.
Driver manager:
The Driver Manager is a library that manages communication between application and driver or drivers. It performs the following
tasks:
Resolves Data Source Names (DSN). The DSN is a configuration string that identifies a given database driver, database, data-
base host and optionally authentication information that enables an ODBC application to connect to a database using a standard-
ized reference.
Because the database connectivity information is identified by the DSN, any ODBC compliant application can connect to the
data source using the same DSN reference. This eliminates the need to separately configure each application that needs access to
a given database; instead you instruct the application to use a pre-configured DSN.
Loading and unloading of the driver required to access a specific database as defined within the DSN. For example, if you have
configured a DSN that connects to a MySQL database then the driver manager will load the Connector/ODBC driver to enable
the ODBC API to communicate with the MySQL host.
Processes ODBC function calls or passes them to the driver for processing.
Connector/ODBC Driver:
The Connector/ODBC driver is a library that implements the functions supported by the ODBC API. It processes ODBC function
calls, submits SQL requests to MySQL server, and returns results back to the application. If necessary, the driver modifies an applic-
ation's request so that the request conforms to syntax supported by MySQL.
DSN Configuration:
The ODBC configuration file stores the driver and database information required to connect to the server. It is used by the Driver
Manager to determine which driver to be loaded according to the definition in the DSN. The driver uses this to read connection
parameters based on the DSN specified. For more information, Section 21.1.4, Connector/ODBC Configuration.
MySQL Server:
The MySQL database where the information is stored. The database is used as the source of the data (during queries) and the destin-
ation for data (during inserts and updates).
21.1.2.2.2. ODBC Driver Managers
An ODBC Driver Manager is a library that manages communication between the ODBC-aware application and any drivers. Its main
functionality includes:
Resolving Data Source Names (DSN).
Driver loading and unloading.
Processing ODBC function calls or passing them to the driver.
Both Windows and Mac OS X include ODBC driver managers with the operating system. Most ODBC Driver Manager implementa-
tions also include an administration application that makes the configuration of DSN and drivers easier. Examples and information on
these managers, including Unix ODBC driver managers are listed below:
Microsoft Windows ODBC Driver Manager (odbc32.dll), http://support.microsoft.com/kb/110093.
Mac OS X includes ODBC Administrator, a GUI application that provides a simpler configuration mechanism for the Unix
iODBC Driver Manager. You can configure DSN and driver information either through ODBC Administrator or through the iOD-
BC configuration files. This also means that you can test ODBC Administrator configurations using the iodbctest command. ht-
Connectors and APIs
1946
tp://www.apple.com.
unixODBC Driver Manager for Unix (libodbc.so). See http://www.unixodbc.org, for more information. The unixODBC
Driver Manager includes the Connector/ODBC driver 3.51 in the installation package, starting with version unixODBC 2.1.2.
iODBC ODBC Driver Manager for Unix (libiodbc.so), see http://www.iodbc.org, for more information.
21.1.3. Connector/ODBC Installation
You can install the Connector/ODBC drivers using two different methods, a binary installation and a source installation. The binary in-
stallation is the easiest and most straightforward method of installation. Using the source installation methods should only be necessary
on platforms where a binary installation package is not available, or in situations where you want to customize or modify the installation
process or Connector/ODBC drivers before installation.
Where to Get Connector/ODBC
Sun Microsystems, Inc distributes its MySQL products under the General Public License (GPL). You can get a copy of the latest ver-
sion of Connector/ODBC binaries and sources from our Web site at http://dev.mysql.com/downloads/.
For more information about Connector/ODBC, visit http://www.mysql.com/products/myodbc/.
For more information about licensing, visit http://www.mysql.com/company/legal/licensing/.
Supported Platforms
Connector/ODBC can be used on all major platforms supported by MySQL. You can install it on:
Windows 95, 98, Me, NT, 2000, XP, and 2003
All Unix-like Operating Systems, including: AIX, Amiga, BSDI, DEC, FreeBSD, HP-UX 10/11, Linux, NetBSD, OpenBSD, OS/2,
SGI Irix, Solaris, SunOS, SCO OpenServer, SCO UnixWare, Tru64 Unix
Mac OS X and Mac OS X Server
Using a binary distribution offers the most straightforward method for installing Connector/ODBC. If you want more control over the
driver, the installation location and or to customize elements of the driver you will need to build and install from the source.
If a binary distribution is not available for a particular platform build the driver from the original source code. You can contribute the
binaries you create to MySQL by sending a mail message to <[email protected]>, so that it becomes available for other
users.
Note
On all non-Windows platforms except Mac OS X, the driver is built against unixODBC and is expecting a 2-byte SQLW-
CHAR, not 4 bytes as iODBC is using. For this reason, the binaries are only compatible with unixODBC and you will need
to recompile the driver against iODBC if you wish to use them together. For further information see Section 21.1.2.2.2,
ODBC Driver Managers.
For further instructions:
Platform Binary Source
Windows Installation Instructions Build Instructions
Unix/Linux Installation Instructions Build Instructions
Mac OS X Installation Instructions
21.1.3.1. Installing Connector/ODBC from a Binary Distribution on Windows
Before installing the Connector/ODBC drivers on Windows you should ensure that your Microsoft Data Access Components (MDAC)
are up to date. You can obtain the latest version from the Microsoft Data Access and Storage Web site.
Connectors and APIs
1947
There are three available distribution types to use when installing for Windows. The contents in each case are identical, it is only the in-
stallation method which is different.
Zipped installer consists of a Zipped package containing a standalone installation application. To install from this package, you must
unzip the installer, and then run the installation application. See Section 21.1.3.1.1, Installing the Windows Connector/ODBC
Driver using an installer to complete the installation.
MSI installer, an installation file that can be used with the installer included in Windows 2000, Windows XP and Windows Server
2003. See Section 21.1.3.1.1, Installing the Windows Connector/ODBC Driver using an installer to complete the installation.
Zipped DLL package, containing the DLL files that need must be manually installed. See Section 21.1.3.1.2, Installing the Win-
dows Connector/ODBC Driver using the Zipped DLL package to complete the installation.
Note
An OLEDB/ODBC driver for Windows 64-bit is available from Microsoft Downloads.
21.1.3.1.1. Installing the Windows Connector/ODBC Driver using an installer
The installer packages offer a very simple method for installing the Connector/ODBC drivers. If you have downloaded the zipped in-
staller then you must extract the installer application. The basic installation process is identical for both installers.
You should follow these steps to complete the installation:
1. Double click on the standalone installer that you extracted, or the MSI file you downloaded.
2. The MySQL Connector/ODBC 3.51 - Setup Wizard will start. Click the NEXT button to begin the installation process.
Connectors and APIs
1948
3. You will need to choose the installation type. The Typical installation provides the standard files you will need to connect to a
MySQL database using ODBC. The Complete option installs all the available files, including debug and utility components. It is
recommended you choose one of these two options to complete the installation. If choose one of these methods, click NEXT and
then proceed to step 5.
You may also choose a Custom installation, which enables you to select the individual components that you want to install. You
have chosen this method, click NEXT and then proceed to step 4.
Connectors and APIs
1949
4. If you have chosen a custom installation, use the pop-ups to select which components to install and then click NEXT to install the
necessary files.
Connectors and APIs
1950
5. Once the files have copied to your machine, the installation is complete. Click FINISH to exit the installer.
Connectors and APIs
1951
Now the installation is complete, you can continue to configure your ODBC connections using Section 21.1.4, Connector/ODBC Con-
figuration.
21.1.3.1.2. Installing the Windows Connector/ODBC Driver using the Zipped DLL package
If you have downloaded the Zipped DLL package then you must install the individual files required for Connector/ODBC operation
manually. Once you have unzipped the installation files, you can either perform this operation by hand, executing each statement indi-
vidually, or you can use the included Batch file to perform an installation to the default locations.
To install using the Batch file:
1. Unzip the Connector/ODBC Zipped DLL package.
2. Open a Command Prompt.
3. Change to the directory created when you unzipped the Connector/ODBC Zipped DLL package.
4. Run Install.bat:
C:\> Install.bat
This will copy the necessary files into the default location, and then register the Connector/ODBC driver with the Windows ODBC
manager.
Connectors and APIs
1952
If you want to copy the files to an alternative location - for example, to run or test different versions of the Connector/ODBC driver on
the same machine, then you must copy the files by hand. It is however not recommended to install these files in a nonstandard location.
To copy the files by hand to the default installation location use the following steps:
1. Unzip the Connector/ODBC Zipped DLL package.
2. Open a Command Prompt.
3. Change to the directory created when you unzipped the Connector/ODBC Zipped DLL package.
4. Copy the library files to a suitable directory. The default is to copy them into the default Windows system directory
\Windows\System32:
C:\> copy lib\myodbc3S.dll \Windows\System32
C:\> copy lib\myodbc3S.lib \Windows\System32
C:\> copy lib\myodbc3.dll \Windows\System32
C:\> copy lib\myodbc3.lib \Windows\System32
5. Copy the Connector/ODBC tools. These must be placed into a directory that is in the system PATH. The default is to install these
into the Windows system directory \Windows\System32:
C:\> copy bin\myodbc3i.exe \Windows\System32
C:\> copy bin\myodbc3m.exe \Windows\System32
C:\> copy bin\myodbc3c.exe \Windows\System32
6. Optionally copy the help files. For these files to be accessible through the help system, they must be installed in the Windows sys-
tem directory:
C:\> copy doc\*.hlp \Windows\System32
7. Finally, you must register the Connector/ODBC driver with the ODBC manager:
C:\> myodbc3i -a -d -t"MySQL ODBC 3.51 Driver;\
DRIVER=myodbc3.dll;SETUP=myodbc3S.dll"
You must change the references to the DLL files and command location in the above statement if you have not installed these files
into the default location.
21.1.3.2. Installing Connector/ODBC from a Binary Distribution on Unix
There are two methods available for installing Connector/ODBC on Unix from a binary distribution. For most Unix environments you
will need to use the tarball distribution. For Linux systems, there is also an RPM distribution available.
Note
To install Connector/ODBC 5.1 on Unix you require unixODBC 2.2.12 or later to be installed.
21.1.3.2.1. Installing Connector/ODBC from a Binary Tarball Distribution
To install the driver from a tarball distribution (.tar.gz file), download the latest version of the driver for your operating system and
follow these steps that demonstrate the process using the Linux version of the tarball:
shell> su root
shell> gunzip mysql-connector-odbc-3.51.11-i686-pc-linux.tar.gz
shell> tar xvf mysql-connector-odbc-3.51.11-i686-pc-linux.tar
shell> cd mysql-connector-odbc-3.51.11-i686-pc-linux
Read the installation instructions in the INSTALL file and execute these commands.
Then proceed on to Section 21.1.4.5, Configuring a Connector/ODBC DSN on Unix, to configure the DSN for Connector/ODBC. For
more information, refer to the INSTALL file that comes with your distribution.
21.1.3.2.2. Installing Connector/ODBC from an RPM Distribution
Connectors and APIs
1953
To install or upgrade Connector/ODBC from an RPM distribution on Linux, simply download the RPM distribution of the latest version
of Connector/ODBC and follow the instructions below. Use su root to become root, then install the RPM file.
If you are installing for the first time:
shell> su root
shell> rpm -ivh mysql-connector-odbc-3.51.12.i386.rpm
If the driver exists, upgrade it like this:
shell> su root
shell> rpm -Uvh mysql-connector-odbc-3.51.12.i386.rpm
If there is any dependency error for MySQL client library, libmysqlclient, simply ignore it by supplying the --nodeps option,
and then make sure the MySQL client shared library is in the path or set through LD_LIBRARY_PATH.
This installs the driver libraries and related documents to /usr/local/lib and /usr/share/doc/MyODBC, respectively. Pro-
ceed onto Section 21.1.4.5, Configuring a Connector/ODBC DSN on Unix.
To uninstall the driver, become root and execute an rpm command:
shell> su root
shell> rpm -e mysql-connector-odbc
21.1.3.3. Installing Connector/ODBC from a Binary Distribution on Mac OS X
Mac OS X is based on the FreeBSD operating system, and you can normally use the MySQL network port for connecting to MySQL
servers on other hosts. Installing the Connector/ODBC driver enables you to connect to MySQL databases on any platform through the
ODBC interface. You should only need to install the Connector/ODBC driver when your application requires an ODBC interface. Ap-
plications that require or can use ODBC (and therefore the Connector/ODBC driver) include ColdFusion, Filemaker Pro, 4th Dimension
and many other applications.
Mac OS X includes its own ODBC manager, based on the iODBC manager. Mac OS X includes an administration tool that provides
easier administration of ODBC drivers and configuration, updating the underlying iODBC configuration files.
The method for installing Connector/ODBC on Mac OS X depends on the version on Connector/ODBC you are using. For Connector/
ODBC 3.51.14 and later, the package is provided as a compressed tar archive that you must manually install. For Connector/ODBC
3.51.13 and earlier the software was provided on a compressed disk image (.dmg) file and included an installer.
In either case, the driver is designed to work with the iODBC driver manager included with Mac OS X.
To install Connector/ODBC 3.51.14 and later:
1. Download the installation file. Note that versions are available for both PowerPC and Intel platforms.
2. Extract the archive:
shell> tar zxf mysql-connector-odbc-3.51.16-osx10.4-x86-32bit.tar.gz
3. The directory created will contain two subdirectories, lib and bin. You need to copy these to a suitable location such as /
usr/local:
shell> cp bin/* /usr/local/bin
shell> cp lib/* /usr/local/lib
4. Finally, you must register the driver with iODBC using the myodbc3i tool you just installed:
shell> myodbc3i -a -d -t"MySQL ODBC 3.51 Driver;Driver=/usr/local/lib/libmyodbc3.so;Setup=/usr/local/lib/libmyodbc3S.so"
You can verify the installed drivers either by using the ODBC Administrator application or the myodbc3i utility:
shell> myodbc3i -q -d
Connectors and APIs
1954
To install Connector/ODBC 3.51.13 and earlier, follow these steps:
1. Download the file to your computer and double-click on the downloaded image file.
2. Within the disk image you will find an installer package (with the .pkg extension). Double click on this file to start the Mac OS X
installer.
3. You will be presented with the installer welcome message. Click the CONTINUE button to begin the installation process.
4. Please take the time to read the Important Information as it contains guidance on how to complete the installation process. Once
you have read the notice and collected the necessary information, click CONTINUE.
Connectors and APIs
1955
5. Connector/ODBC drivers are made available under the GNU General Public License. Please read the license if you are not familiar
with it before continuing installation. Click CONTINUE to approve the license (you will be asked to confirm that decision) and con-
tinue the installation.
Connectors and APIs
1956
6. Choose a location to install the Connector/ODBC drivers and the ODBC Administrator application. You must install the files onto
a drive with an operating system and you may be limited in the choices available. Select the drive you want to use, and then click
CONTINUE.
Connectors and APIs
1957
7. The installer will automatically select the files that need to be installed on your machine. Click INSTALL to continue. The installer
will copy the necessary files to your machine. A progress bar will be shown indicating the installation progress.
Connectors and APIs
1958
8. When installation has been completed you will get a window like the one shown below. Click CLOSE to close and quit the installer.
Connectors and APIs
1959
21.1.3.4. Installing Connector/ODBC from a Source Distribution on Windows
You should only need to install Connector/ODBC from source on Windows if you want to change or modify the source or installation.
If you are unsure whether to install from source, please use the binary installation detailed in Section 21.1.3.1, Installing Connector/
ODBC from a Binary Distribution on Windows.
Installing Connector/ODBC from source on Windows requires a number of different tools and packages:
MDAC, Microsoft Data Access SDK from http://support.microsoft.com/kb/110093.
Suitable C compiler, such as Microsoft Visual C++ or the C compiler included with Microsoft Visual Studio.
Compatible make tool. Microsoft's nmake is used in the examples in this section.
MySQL client libraries and include files from MySQL 4.0.0 or higher. (Preferably MySQL 4.0.16 or higher). This is required be-
cause Connector/ODBC uses new calls and structures that exist only starting from this version of the library. To get the client librar-
ies and include files, visit http://dev.mysql.com/downloads/.
21.1.3.4.1. Building Connector/ODBC 3.51
Connector/ODBC source distributions include Makefiles that require the nmake or other make utility. In the distribution, you can
find Makefile for building the release version and Makefile_debug for building debugging versions of the driver libraries and
DLLs.
To build the driver, use this procedure:
Connectors and APIs
1960
1. Download and extract the sources to a folder, then change directory into that folder. The following command assumes the folder is
named myodbc3-src:
C:\> cd myodbc3-src
2. Edit Makefile to specify the correct path for the MySQL client libraries and header files. Then use the following commands to
build and install the release version:
C:\> nmake -f Makefile
C:\> nmake -f Makefile install
nmake -f Makefile builds the release version of the driver and places the binaries in subdirectory called Release.
nmake -f Makefile install installs (copies) the driver DLLs and libraries (myodbc3.dll, myodbc3.lib) to your
system directory.
3. To build the debug version, use Makefile_Debug rather than Makefile, as shown below:
C:\> nmake -f Makefile_debug
C:\> nmake -f Makefile_debug install
4. You can clean and rebuild the driver by using:
C:\> nmake -f Makefile clean
C:\> nmake -f Makefile install
Note
Make sure to specify the correct MySQL client libraries and header files path in the Makefiles (set the
MYSQL_LIB_PATH and MYSQL_INCLUDE_PATH variables). The default header file path is assumed to be
C:\mysql\include. The default library path is assumed to be C:\mysql\lib\opt for release DLLs and
C:\mysql\lib\debug for debug versions.
For the complete usage of nmake, visit ht-
tp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vcce4/html/evgrfRunningNMAKE.asp.
If you are using the Subversion tree for compiling, all Windows-specific Makefiles are named as
Win_Makefile*.
21.1.3.4.2. Testing
After the driver libraries are copied/installed to the system directory, you can test whether the libraries are properly built by using the
samples provided in the samples subdirectory:
C:\> cd samples
C:\> nmake -f Makefile all
21.1.3.5. Installing Connector/ODBC from a Source Distribution on Unix
You need the following tools to build MySQL from source on Unix:
A working ANSI C++ compiler. gcc 2.95.2 or later, SGI C++, and SunPro C++ are some of the compilers that are known to work.
A good make program. GNU make is always recommended and is sometimes required.
MySQL client libraries and include files from MySQL 4.0.0 or higher. (Preferably MySQL 4.0.16 or higher). This is required be-
cause Connector/ODBC uses new calls and structures that exist only starting from this version of the library. To get the client librar-
ies and include files, visit http://dev.mysql.com/downloads/.
If you have built your own MySQL server and/or client libraries from source then you must have used the -
Connectors and APIs
1961
-enable-thread-safe-client option to configure when the libraries were built.
You should also ensure that the libmysqlclient library were built and installed as a shared library.
A compatible ODBC manager must be installed. Connector/ODBC is known to work with the iODBC and unixODBC managers.
See Section 21.1.2.2.2, ODBC Driver Managers, for more information.
If you are using a character set that isn't compiled into the MySQL client library then you need to install the MySQL character
definitions from the charsets directory into SHAREDIR (by default, /usr/local/mysql/share/mysql/charsets).
These should be in place if you have installed the MySQL server on the same machine. See Section 9.1, Character Set Support,
for more information on character set support.
Once you have all the required files, unpack the source files to a separate directory, you then have to run configure and build the lib-
rary using make.
21.1.3.5.1. Typical configure Options
The configure script gives you a great deal of control over how you configure your Connector/ODBC build. Typically you do this
using options on the configure command line. You can also affect configure using certain environment variables. For a list of
options and environment variables supported by configure, run this command:
shell> ./configure --help
Some of the more commonly used configure options are described here:
1. To compile Connector/ODBC, you need to supply the MySQL client include and library files path using the -
-with-mysql-path=DIR option, where DIR is the directory where MySQL is installed.
MySQL compile options can be determined by running DIR/bin/mysql_config.
2. Supply the standard header and library files path for your ODBC Driver Manager (iODBC or unixODBC).
If you are using iODBC and iODBC is not installed in its default location (/usr/local), you might have to use the -
-with-iodbc=DIR option, where DIR is the directory where iODBC is installed.
If the iODBC headers do not reside in DIR/include, you can use the --with-iodbc-includes=INCDIR option to
specify their location.
The applies to libraries. If they are not in DIR/lib, you can use the --with-iodbc-libs=LIBDIR option.
If you are using unixODBC, use the --with-unixODBC=DIR option (case sensitive) to make configure look for
unixODBC instead of iODBC by default, DIR is the directory where unixODBC is installed.
If the unixODBC headers and libraries aren't located in DIR/include and DIR/lib, use the -
-with-unixODBC-includes=INCDIR and --with-unixODBC-libs=LIBDIR options.
3. You might want to specify an installation prefix other than /usr/local. For example, to install the Connector/ODBC drivers in
/usr/local/odbc/lib, use the --prefix=/usr/local/odbc option.
The final configuration command looks something like this:
shell> ./configure --prefix=/usr/local \
--with-iodbc=/usr/local \
--with-mysql-path=/usr/local/mysql
21.1.3.5.2. Additional configure Options
There are a number of other options that you need, or want, to set when configuring the Connector/ODBC driver before it is built.
To link the driver with MySQL thread safe client libraries libmysqlclient_r.so or libmysqlclient_r.a, you must spe-
cify the following configure option:
Connectors and APIs
1962
--enable-thread-safe
and can be disabled (default) using
--disable-thread-safe
This option enables the building of the driver thread-safe library libmyodbc3_r.so from by linking with MySQL thread-safe
client library libmysqlclient_r.so (The extensions are OS dependent).
If the compilation with the thread-safe option fails, it may be because the correct thread-libraries on the system could not be located.
You should set the value of LIBS to point to the correct thread library for your system.
LIBS="-lpthread" ./configure ..
You can enable or disable the shared and static versions of Connector/ODBC using these options:
--enable-shared[=yes/no]
--disable-shared
--enable-static[=yes/no]
--disable-static
By default, all the binary distributions are built as nondebugging versions (configured with --without-debug).
To enable debugging information, build the driver from source distribution and use the --with-debug option when you run
configure.
This option is available only for source trees that have been obtained from the Subversion repository. This option does not apply to
the packaged source distributions.
By default, the driver is built with the --without-docs option. If you would like the documentation to be built, then execute
configure with:
--with-docs
21.1.3.5.3. Building and Compilation
To build the driver libraries, you have to just execute make.
shell> make
If any errors occur, correct them and continue the build process. If you aren't able to build, then send a detailed email to
<[email protected]> for further assistance.
21.1.3.5.4. Building Shared Libraries
On most platforms, MySQL does not build or support .so (shared) client libraries by default. This is based on our experience of prob-
lems when building shared libraries.
In cases like this, you have to download the MySQL distribution and configure it with these options:
--without-server --enable-shared
To build shared driver libraries, you must specify the --enable-shared option for configure. By default, configure does not
enable this option.
If you have configured with the --disable-shared option, you can build the .so file from the static libraries using the following
commands:
shell> cd mysql-connector-odbc-3.51.01
shell> make
shell> cd driver
shell> CC=/usr/bin/gcc \
$CC -bundle -flat_namespace -undefined error \
Connectors and APIs
1963
-o .libs/libmyodbc3-3.51.01.so \
catalog.o connect.o cursor.o dll.o error.o execute.o \
handle.o info.o misc.o myodbc3.o options.o prepare.o \
results.o transact.o utility.o \
-L/usr/local/mysql/lib/mysql/ \
-L/usr/local/iodbc/lib/ \
-lz -lc -lmysqlclient -liodbcinst
Make sure to change -liodbcinst to -lodbcinst if you are using unixODBC instead of iODBC, and configure the library paths
accordingly.
This builds and places the libmyodbc3-3.51.01.so file in the .libs directory. Copy this file to the Connector/ODBC library in-
stallation directory (/usr/local/lib (or the lib directory under the installation directory that you supplied with the --prefix).
shell> cd .libs
shell> cp libmyodbc3-3.51.01.so /usr/local/lib
shell> cd /usr/local/lib
shell> ln -s libmyodbc3-3.51.01.so libmyodbc3.so
To build the thread-safe driver library:
shell> CC=/usr/bin/gcc \
$CC -bundle -flat_namespace -undefined error
-o .libs/libmyodbc3_r-3.51.01.so
catalog.o connect.o cursor.o dll.o error.o execute.o
handle.o info.o misc.o myodbc3.o options.o prepare.o
results.o transact.o utility.o
-L/usr/local/mysql/lib/mysql/
-L/usr/local/iodbc/lib/
-lz -lc -lmysqlclient_r -liodbcinst
21.1.3.5.5. Installing Driver Libraries
To install the driver libraries, execute the following command:
shell> make install
That command installs one of the following sets of libraries:
For Connector/ODBC 3.51:
libmyodbc3.so
libmyodbc3-3.51.01.so, where 3.51.01 is the version of the driver
libmyodbc3.a
For thread-safe Connector/ODBC 3.51:
libmyodbc3_r.so
libmyodbc3-3_r.51.01.so
libmyodbc3_r.a
For more information on build process, refer to the INSTALL file that comes with the source distribution. Note that if you are trying to
use the make from Sun, you may end up with errors. On the other hand, GNU gmake should work fine on all platforms.
21.1.3.5.6. Testing Connector/ODBC on Unix
To run the basic samples provided in the distribution with the libraries that you built, use the following command:
shell> make test
Before running the tests, create the DSN 'myodbc3' in odbc.ini and set the environment variable ODBCINI to the correct
Connectors and APIs
1964
odbc.ini file; and MySQL server is running. You can find a sample odbc.ini with the driver distribution.
You can even modify the samples/run-samples script to pass the desired DSN, UID, and PASSWORD values as the command-
line arguments to each sample.
21.1.3.5.7. Building Connector/ODBC from Source on Mac OS X
To build the driver on Mac OS X (Darwin), make use of the following configure example:
shell> ./configure --prefix=/usr/local
--with-unixODBC=/usr/local
--with-mysql-path=/usr/local/mysql
--disable-shared
--enable-gui=no
--host=powerpc-apple
The command assumes that the unixODBC and MySQL are installed in the default locations. If not, configure accordingly.
On Mac OS X, --enable-shared builds .dylib files by default. You can build .so files like this:
shell> make
shell> cd driver
shell> CC=/usr/bin/gcc \
$CC -bundle -flat_namespace -undefined error
-o .libs/libmyodbc3-3.51.01.so *.o
-L/usr/local/mysql/lib/
-L/usr/local/iodbc/lib
-liodbcinst -lmysqlclient -lz -lc
To build the thread-safe driver library:
shell> CC=/usr/bin/gcc \
$CC -bundle -flat_namespace -undefined error
-o .libs/libmyodbc3-3.51.01.so *.o
-L/usr/local/mysql/lib/
-L/usr/local/iodbc/lib
-liodbcinst -lmysqlclienti_r -lz -lc -lpthread
Make sure to change the -liodbcinst to -lodbcinst in case of using unixODBC instead of iODBC and configure the libraries
path accordingly.
In Apple's version of GCC, both cc and gcc are actually symbolic links to gcc3.
Copy this library to the $prefix/lib directory and symlink to libmyodbc3.so.
You can cross-check the output shared-library properties using this command:
shell> otool -LD .libs/libmyodbc3-3.51.01.so
21.1.3.5.8. Building Connector/ODBC from Source on HP-UX
To build the driver on HP-UX 10.x or 11.x, make use of the following configure example:
If using cc:
shell> CC="cc" \
CFLAGS="+z" \
LDFLAGS="-Wl,+b:-Wl,+s" \
./configure --prefix=/usr/local
--with-unixodbc=/usr/local
--with-mysql-path=/usr/local/mysql/lib/mysql
--enable-shared
--enable-thread-safe
If using gcc:
shell> CC="gcc" \
LDFLAGS="-Wl,+b:-Wl,+s" \
./configure --prefix=/usr/local
--with-unixodbc=/usr/local
--with-mysql-path=/usr/local/mysql
--enable-shared
--enable-thread-safe
Connectors and APIs
1965
Once the driver is built, cross-check its attributes using chatr .libs/libmyodbc3.sl to determine whether you need to have set
the MySQL client library path using the SHLIB_PATH environment variable. For static versions, ignore all shared-library options and
run configure with the --disable-shared option.
21.1.3.5.9. Building Connector/ODBC from Source on AIX
To build the driver on AIX, make use of the following configure example:
shell> ./configure --prefix=/usr/local
--with-unixodbc=/usr/local
--with-mysql-path=/usr/local/mysql
--disable-shared
--enable-thread-safe
Note
For more information about how to build and set up the static and shared libraries across the different platforms refer to '
Using static and shared libraries across platforms'.
21.1.3.6. Installing Connector/ODBC from the Development Source Tree
Caution
You should read this section only if you are interested in helping us test our new code. If you just want to get MySQL
Connector/ODBC up and running on your system, you should use a standard release distribution.
To be able to access the Connector/ODBC source tree, you must have Subversion installed. Subversion is freely available from ht-
tp://subversion.tigris.org/.
To build from the source trees, you need the following tools:
autoconf 2.52 (or newer)
automake 1.4 (or newer)
libtool 1.4 (or newer)
m4
The most recent development source tree is available from our public Subversion trees at ht-
tp://dev.mysql.com/tech-resources/sources.html.
To checkout out the Connector/ODBC sources, change to the directory where you want the copy of the Connector/ODBC tree to be
stored, then use the following command:
shell> svn co http://svn.mysql.com/svnpublic/connector-odbc3
You should now have a copy of the entire Connector/ODBC source tree in the directory connector-odbc3. To build from this
source tree on Unix or Linux follow these steps:
shell> cd connector-odbc3
shell> aclocal
shell> autoheader
shell> autoconf
shell> automake;
shell> ./configure # Add your favorite options here
shell> make
For more information on how to build, refer to the INSTALL file located in the same directory. For more information on options to
configure, see Section 21.1.3.5.1, Typical configure Options
When the build is done, run make install to install the Connector/ODBC 3.51 driver on your system.
If you have gotten to the make stage and the distribution does not compile, please report it to <[email protected]>.
Connectors and APIs
1966
On Windows, make use of Windows Makefiles WIN-Makefile and WIN-Makefile_debug in building the driver. For more in-
formation, see Section 21.1.3.4, Installing Connector/ODBC from a Source Distribution on Windows.
After the initial checkout operation to get the source tree, you should run svn update periodically update your source according to
the latest version.
21.1.4. Connector/ODBC Configuration
Before you connect to a MySQL database using the Connector/ODBC driver you must configure an ODBC Data Source Name. The
DSN associates the various configuration parameters required to communicate with a database to a specific name. You use the DSN in
an application to communicate with the database, rather than specifying individual parameters within the application itself. DSN in-
formation can be user specific, system specific, or provided in a special file. ODBC data source names are configured in different ways,
depending on your platform and ODBC driver.
21.1.4.1. Data Source Names
A Data Source Name associates the configuration parameters for communicating with a specific database. Generally a DSN consists of
the following parameters:
Name
Host Name
Database Name
Login
Password
In addition, different ODBC drivers, including Connector/ODBC, may accept additional driver-specific options and parameters.
There are three types of DSN:
A System DSN is a global DSN definition that is available to any user and application on a particular system. A System DSN can
normally only be configured by a systems administrator, or by a user who has specific permissions that let them create System
DSNs.
A User DSN is specific to an individual user, and can be used to store database connectivity information that the user regularly uses.
A File DSN uses a simple file to define the DSN configuration. File DSNs can be shared between users and machines and are there-
fore more practical when installing or deploying DSN information as part of an application across many machines.
DSN information is stored in different locations depending on your platform and environment.
21.1.4.2. Connector/ODBC Connection Parameters
You can specify the parameters in the following tables for Connector/ODBC when configuring a DSN. Users on Windows can use the
Options and Advanced panels when configuring a DSN to set these parameters; see the table for information on which options relate to
which fields and checkboxes. On Unix and Mac OS X, use the parameter name and value as the keyword/value pair in the DSN config-
uration. Alternatively, you can set these parameters within the InConnectionString argument in the SQLDriverConnect()
call.
Parameter Default Value Comment
user ODBC The user name used to connect to MySQL.
uid ODBC Synonymous with user. Added in 3.51.16.
server localhost The host name of the MySQL server.
database The default database.
option 0 Options that specify how Connector/ODBC should work. See below.
Connectors and APIs
1967
Parameter Default Value Comment
port 3306 The TCP/IP port to use if server is not localhost.
initstmt Initial statement. A statement to execute when connecting to MySQL. In version 3.51
the parameter is called stmt. Note, the driver supports the initial statement being ex-
ecuted only at the time of the initial connection.
password The password for the user account on server.
pwd Synonymous with password. Added in 3.51.16.
socket The Unix socket file or Windows named pipe to connect to if server is
localhost.
sslca The path to a file with a list of trust SSL CAs. Added in 3.51.16.
sslcapath The path to a directory that contains trusted SSL CA certificates in PEM format. Added
in 3.51.16.
sslcert The name of the SSL certificate file to use for establishing a secure connection. Added
in 3.51.16.
sslcipher A list of allowable ciphers to use for SSL encryption. The cipher list has the same
format as the openssl ciphers command Added in 3.51.16.
sslkey The name of the SSL key file to use for establishing a secure connection. Added in
3.51.16.
charset The character set to use for the connection. Added in 3.51.17.
sslverify If set to 1, the SSL certificate will be verified when used with the MySQL connection.
If not set, then the default behaviour is to ignore SSL certificate verification.
readtimeout The timeout in seconds for attempts to read from the server. Each attempt uses this
timeout value and there are retries if necessary, so the total effective timeout value is
three times the option value. You can set the value so that a lost connection can be de-
tected earlier than the TCP/IP Close_Wait_Timeout value of 10 minutes. This op-
tion works only for TCP/IP connections, and only for Windows prior to MySQL
5.1.12. Corresponds to the MYSQL_OPT_READ_TIMEOUT option of the MySQL Cli-
ent Library. This option was added in Connector/ODBC 3.51.27.
writetimeout The timeout in seconds for attempts to write to the server. Each attempt uses this
timeout value and there are net_retry_count retries if necessary, so the total ef-
fective timeout value is net_retry_count times the option value. This option
works only for TCP/IP connections, and only for Windows prior to MySQL 5.1.12.
Corresponds to the MYSQL_OPT_WRITE_TIMEOUT option of the MySQL Client
Library. This option was added in Connector/ODBC 3.51.27.
Note
The SSL configuration parameters can also be automatically loaded from a my.ini or my.cnf file.
The option argument is used to tell Connector/ODBC that the client isn't 100% ODBC compliant. On Windows, you normally select
options by toggling the checkboxes in the connection screen, but you can also select them in the option argument. The following op-
tions are listed in the order in which they appear in the Connector/ODBC connect screen.
Value Flagname GUI Option Description
1 FLAG_FIELD_LENGTH Do not Optimize Column
Width
The client cannot handle that Connector/ODBC returns the real
width of a column. This option was removed in 3.51.18.
2 FLAG_FOUND_ROWS Return Matching Rows The client cannot handle that MySQL returns the true value of af-
fected rows. If this flag is set, MySQL returns found rows in-
stead. You must have MySQL 3.21.14 or newer to get this to
work.
4 FLAG_DEBUG Trace Driver Calls To
myodbc.log
Make a debug log in C:\myodbc.log on Windows, or /
tmp/myodbc.log on Unix variants. This option was removed
in Connector/ODBC 3.51.18.
8 FLAG_BIG_PACKETS Allow Big Results Do not set any packet limit for results and bind parameters.
Without this option, parameter binding will be truncated to 255
Connectors and APIs
1968
characters.
16 FLAG_NO_PROMPT Do not Prompt Upon
Connect
Do not prompt for questions even if driver would like to prompt.
32 FLAG_DYNAMIC_CURS
OR
Enable Dynamic Cursor Enable or disable the dynamic cursor support.
64 FLAG_NO_SCHEMA Ignore # in Table Name Ignore use of database name in
db_name.tbl_name.col_name.
128 FLAG_NO_DEFAULT_C
URSOR
User Manager Cursors Force use of ODBC manager cursors (experimental).
256 FLAG_NO_LOCALE Do not Use Set Locale Disable the use of extended fetch (experimental).
512 FLAG_PAD_SPACE Pad Char To Full Length Pad CHAR columns to full column length.
1024 FLAG_FULL_COLUMN_
NAMES
Return Table Names for
SQLDescribeCol
SQLDescribeCol() returns fully qualified column names.
2048 FLAG_COMPRESSED_P
ROTO
Use Compressed Protocol Use the compressed client/server protocol.
4096 FLAG_IGNORE_SPACE Ignore Space After Func-
tion Names
Tell server to ignore space after function name and before (
(needed by PowerBuilder). This makes all function names
keywords.
8192 FLAG_NAMED_PIPE Force Use of Named
Pipes
Connect with named pipes to a mysqld server running on NT.
16384 FLAG_NO_BIGINT Change BIGINT
Columns to Int
Change BIGINT columns to INT columns (some applications
cannot handle BIGINT).
32768 FLAG_NO_CATALOG No Catalog Forces results from the catalog functions, such as SQLTables, to
always return NULL and the driver to report that catalogs are not
supported.
65536 FLAG_USE_MYCNF Read Options From
my.cnf
Read parameters from the [client] and [odbc] groups from
my.cnf.
131072 FLAG_SAFE Safe Add some extra safety checks.
262144 FLAG_NO_TRANSACTI
ONS
Disable transactions Disable transactions.
524288 FLAG_LOG_QUERY Save queries to myod-
bc.sql
Enable query logging to c:\myodbc.sql(/
tmp/myodbc.sql) file. (Enabled only in debug mode.)
1048576 FLAG_NO_CACHE Do not Cache Result
(forward only cursors)
Do not cache the results locally in the driver, instead read from
server (mysql_use_result()). This works only for forward-
only cursors. This option is very important in dealing with large
tables when you do not want the driver to cache the entire result
set.
2097152 FLAG_FORWARD_CURS
OR
Force Use Of Forward
Only Cursors
Force the use of Forward-only cursor type. In case of applica-
tions setting the default static/dynamic cursor type, and one wants
the driver to use noncache result sets, then this option ensures the
forward-only cursor behavior.
4194304 FLAG_AUTO_RECONNE
CT
Enable auto-reconnect. Enables auto-reconnection functionality. You should not use this
option with transactions, since a auto reconnection during a incom-
plete transaction may cause corruption. Note that an auto-
reconnected connection will not inherit the same settings and en-
vironment as the original. This option was added in Connector/
ODBC 3.51.13.
8388608 FLAG_AUTO_IS_NULL Flag Auto Is Null
When FLAG_AUTO_IS_NULL is set, the driver does not change
the default value of sql_auto_is_null, leaving it at 1, so you
get the MySQL default, not the SQL standard behavior.
When FLAG_AUTO_IS_NULL is not set, the driver changes the
default value of SQL_AUTO_IS_NULL to 0 after connecting, so
you get the SQL standard, not the MySQL default behaviour.
Connectors and APIs
1969
Thus, omitting the flag disables the compatibility option and forces
SQL standard behaviour.
See IS NULL. This option was added in Connector/ODBC
3.51.13.
16777216 FLAG_ZERO_DATE_TO
_MIN
Flag Zero Date to Min Translates zero dates (XXXX-00-00) into the minimum date val-
ues supported by ODBC, XXXX-01-01. This resolves an issue
where some statements will not work because the date returned
and the minimum ODBC date value are incompatible. This option
was added in Connector/ODBC 3.51.17.
33554432 FLAG_MIN_DATE_TO_
ZERO
Flag Min Date to Zero Translates the minimum ODBC date value (XXXX-01-01) to the
zero date format supported by MySQL (XXXX-00-00). This re-
solves an issue where some statements will not work because the
date returned and the minimum ODBC date value are incompat-
ible. This option was added in Connector/ODBC 3.51.17.
67108864 FLAG_MULTI_STATEM
ENTS
Allow multiple state-
ments
Enables support for batched statements. This option was added in
Connector/ODBC 3.51.18.
134217728 FLAG_COLUMN_SIZE_
S32
Limit column size to
32-bit value
Limits the column size to a signed 32-bit value to prevent prob-
lems with larger column sizes in applications that do not support
them. This option is automatically enabled when working with
ADO applications. This option was added in Connector/ODBC
3.51.22.
268435456 FLAG_NO_BINARY_RE
SULT
Always handle binary
function results as char-
acter data
When set this option disables charset 63 for columns with an
empty org_table. This option was added in Connector/ODBC
3.51.26.
To select multiple options, add together their values. For example, setting option to 12 (4+8) gives you debugging without packet
limits.
The following table shows some recommended option values for various configurations.
Configuration Option Value
Microsoft Access, Visual Basic 3
Driver trace generation (Debug mode) 4
Microsoft Access (with improved DELETE queries) 35
Large tables with too many rows 2049
Sybase PowerBuilder 135168
Query log generation (Debug mode) 524288
Generate driver trace as well as query log (Debug mode) 524292
Large tables with no-cache results 3145731
21.1.4.3. Configuring a Connector/ODBC DSN on Windows
The ODBC Data Source Administrator within Windows enables you to create DSNs, check driver installation and configure
ODBC systems such as tracing (used for debugging) and connection pooling.
Different editions and versions of Windows store the ODBC Data Source Administrator in different locations depending on
the version of Windows that you are using.
To open the ODBC Data Source Administrator in Windows Server 2003:
Tip
Because it is possible to create DSN using either the 32-bit or 64-bit driver, but using the same DNS identifier, it is advis-
able to include the driver being used within the DSN identifier. This will help you to identify the DSN when using it from
Connectors and APIs
1970
applications such as Excel that are only compatible with the 32-bit driver. For example, you might add Us-
ing32bitCODBC to the DSN identifier for the 32-bit interface and Using64bitCODBC for those using the 64-bit Con-
nector/ODBC driver.
1. On the Start menu, choose Administrative Tools, and then click Data Sources (ODBC).
To open the ODBC Data Source Administrator in Windows 2000 Server or Windows 2000 Professional:
1. On the Start menu, choose Settings, and then click Control Panel.
2. In Control Panel, click Administrative Tools.
3. In Administrative Tools, click Data Sources (ODBC).
To open the ODBC Data Source Administrator on Windows XP:
1. On the Start menu, click Control Panel.
2. In the Control Panel when in Category View click Performance and Maintenance and then click Adminis-
trative Tools.. If you are viewing the Control Panel in Classic View, click Administrative Tools.
3. In Administrative Tools, click Data Sources (ODBC).
Irrespective of your Windows version, you should be presented the ODBC Data Source Administrator window:
Connectors and APIs
1971
Within Windows XP, you can add the Administrative Tools folder to your START menu to make it easier to locate the ODBC
Data Source Administrator. To do this:
1. Right click on the START menu.
2. Select Properties.
3. Click CUSTOMIZE....
4. Select the ADVANCED tab.
5. Within Start menu items, within the System Administrative Tools section, select Display on the All
Programs menu.
Within both Windows Server 2003 and Windows XP you may want to permanently add the ODBC Data Source Administrat-
or to your START menu. To do this, locate the Data Sources (ODBC) icon using the methods shown, then right-click on the icon
and then choose PIN TO START MENU.
The interfaces for the 3.51 and 5.1 versions of the Connector/ODBC driver are different, although the fields and information that you
need to enter remain the same.
To configure a DSN using Connector/ODBC 3.51.x or Connector/ODBC 5.1.0, see Section 21.1.4.3.1, Configuring a Connector/
ODBC 3.51 DSN on Windows.
Connectors and APIs
1972
To configure a DSN using Connector/ODBC 5.1.1 or later, see Section 21.1.4.3.2, Configuring a Connector/ODBC 5.1 DSN on Win-
dows.
21.1.4.3.1. Configuring a Connector/ODBC 3.51 DSN on Windows
To add and configure a new Connector/ODBC data source on Windows, use the ODBC Data Source Administrator:
1. Open the ODBC Data Source Administrator.
2. To create a System DSN (which will be available to all users) , select the System DSN tab. To create a User DSN, which will be
unique only to the current user, click the ADD... button.
3. You will need to select the ODBC driver for this DSN.
Select MySQL ODBC 3.51 Driver, then click FINISH.
4. You now need to configure the specific fields for the DSN you are creating through the Add Data Source Name dialog.
Connectors and APIs
1973
In the DATA SOURCE NAME box, enter the name of the data source you want to access. It can be any valid name that you choose.
5. In the DESCRIPTION box, enter some text to help identify the connection.
6. In the SERVER field, enter the name of the MySQL server host that you want to access. By default, it is localhost.
7. In the USER field, enter the user name to use for this connection.
8. In the PASSWORD field, enter the corresponding password for this connection.
9. The DATABASE pop-up should automatically populate with the list of databases that the user has permissions to access.
10. Click OK to save the DSN.
A completed DSN configuration may look like this:
Connectors and APIs
1974
You can verify the connection using the parameters you have entered by clicking the TEST button. If the connection could be made suc-
cessfully, you will be notified with a Success; connection was made! dialog.
If the connection failed, you can obtain more information on the test and why it may have failed by clicking the DIAGNOSTICS... button
to show additional error messages.
You can configure a number of options for a specific DSN by using either the CONNECT OPTIONS or ADVANCED tabs in the DSN con-
figuration dialog.
Connectors and APIs
1975
The three options you can configure are:
PORT sets the TCP/IP port number to use when communicating with MySQL. Communication with MySQL uses port 3306 by de-
fault. If your server is configured to use a different TCP/IP port, you must specify that port number here.
SOCKET sets the name or location of a specific socket or Windows pipe to use when communicating with MySQL.
INITIAL STATEMENT defines an SQL statement that will be executed when the connection to MySQL is opened. You can use this to
set MySQL options for your connection, such as disabling autocommit.
CHARACTER SET is a pop-up list from which you can select the default character set to be used with this connection. The Character
Set option was added in 3.5.17.
The ADVANCED tab enables you to configure Connector/ODBC connection parameters. Refer to Section 21.1.4.2, Connector/ODBC
Connection Parameters, for information about the meaning of these options.
Connectors and APIs
1976
21.1.4.3.2. Configuring a Connector/ODBC 5.1 DSN on Windows
The DSN configuration when using Connector/ODBC 5.1.1 and later has a slightly different layout. Also, due to the native Unicode
support within Connector/ODBC 5.1, you no longer need to specify the initial character set to be used with your connection.
To configure a DSN using the Connector/ODBC 5.1.1 or later driver:
1. Open the ODBC Data Source Administrator.
2. To create a System DSN (which will be available to all users) , select the SYSTEM DSN tab. To create a User DSN, which will be
unique only to the current user, click the ADD... button.
3. You will need to select the ODBC driver for this DSN.
Connectors and APIs
1977
Select MySQL ODBC 5.1 Driver, then click FINISH.
4. You now need to configure the specific fields for the DSN you are creating through the Connection Parameters dialog.
Connectors and APIs
1978
In the DATA SOURCE NAME box, enter the name of the data source you want to access. It can be any valid name that you choose.
5. In the DESCRIPTION box, enter some text to help identify the connection.
6. In the SERVER field, enter the name of the MySQL server host that you want to access. By default, it is localhost.
7. In the USER field, enter the user name to use for this connection.
8. In the PASSWORD field, enter the corresponding password for this connection.
9. The DATABASE pop-up should automatically populate with the list of databases that the user has permissions to access.
10. To communicate over a different TCP/IP port than the default (3306), change the value of the PORT.
11. Click OK to save the DSN.
You can verify the connection using the parameters you have entered by clicking the TEST button. If the connection could be made suc-
cessfully, you will be notified with a Success; connection was made! dialog.
You can configure a number of options for a specific DSN by using the DETAILS button.
Connectors and APIs
1979
Connectors and APIs
1980
The DETAILS button opens a tabbed display which allows you to set additional options:
FLAGS 1, FLAGS 2, and FLAGS 3 enable you to select the additional flags for the DSN connection. For more information on these
flags, see Section 21.1.4.2, Connector/ODBC Connection Parameters.
DEBUG allows you to enable ODBC debugging to record the queries you execute through the DSN to the myodbc.sql file. For
more information, see Section 21.1.4.8, Getting an ODBC Trace File.
SSL SETTINGS configures the additional options required for using the Secure Sockets Layer (SSL) when communicating with
MySQL server. Note that you must have enabled SSL and configured the MySQL server with suitable certificates to communicate
over SSL.
The ADVANCED tab enables you to configure Connector/ODBC connection parameters. Refer to Section 21.1.4.2, Connector/ODBC
Connection Parameters, for information about the meaning of these options.
21.1.4.3.3. Errors and Debugging
This section answers Connector/ODBC connection-related questions.
While configuring a Connector/ODBC DSN, a Could Not Load Translator or Setup Library error occurs
For more information, refer to MS KnowledgeBase Article(Q260558). Also, make sure you have the latest valid ctl3d32.dll in
your system directory.
On Windows, the default myodbc3.dll is compiled for optimal performance. If you want to debug Connector/ODBC 3.51 (for
example, to enable tracing), you should instead use myodbc3d.dll. To install this file, copy myodbc3d.dll over the installed
myodbc3.dll file. Make sure to revert back to the release version of the driver DLL once you are done with the debugging be-
cause the debug version may cause performance issues. Note that the myodbc3d.dll isn't included in Connector/ODBC 3.51.07
through 3.51.11. If you are using one of these versions, you should copy that DLL from a previous version (for example, 3.51.06).
21.1.4.4. Configuring a Connector/ODBC DSN on Mac OS X
To configure a DSN on Mac OS X you can either use the myodbc3i utility, edit the odbc.ini file within the Library/ODBC dir-
Connectors and APIs
1981
ectory of the user or the should use the ODBC Administrator. If you have Mac OS X 10.2 or earlier, refer to Section 21.1.4.5,
Configuring a Connector/ODBC DSN on Unix. Select whether you want to create a User DSN or a System DSN. If you want to add a
System DSN, you may need to authenticate with the system. You must click the padlock and enter a user and password with adminis-
trator privileges.
For correct operation of ODBC Administrator, you should ensure that the /Library/ODBC/odbc.ini file used to set up ODBC
connectivity and DSNs are writable by the admin group. If this file is not writable by this group then the ODBC Administrator may
fail, or may appear to have worked but not generated the correct entry.
Warning
There are known issues with the OS X ODBC Administrator and Connector/ODBC that may prevent you from creating a
DSN using this method. In this case you should use the command-line or edit the odbc.ini file directly. Note that exist-
ing DSNs or those that you create via the myodbc3i or myodbc-installertool can still be checked and edited using
ODBC Administrator.
To create a DSN using the myodbc3i utility, you need only specify the DSN type and the DSN connection string. For example:
shell> myodbc3i -a -s -t"DSN=mydb;DRIVER=MySQL ODBC 3.51 Driver;SERVER=mysql;USER=username;PASSWORD=pass"
To use ODBC Administrator:
1. Open the ODBC Administrator from the Utilities folder in the Applications folder.
2. On the User DSN or System DSN panel, click ADD.
3. Select the Connector/ODBC driver and click OK.
4. You will be presented with the Data Source Name dialog. Enter The Data Source Name and an optional Description
for the DSN.
Connectors and APIs
1982
5. Click ADD to add a new keyword/value pair to the panel. You should configure at least four pairs to specify the server, user-
name, password and database connection parameters. See Section 21.1.4.2, Connector/ODBC Connection Parameters.
6. Click OK to add the DSN to the list of configured data source names.
A completed DSN configuration may look like this:
Connectors and APIs
1983
You can configure additional ODBC options to your DSN by adding further keyword/value pairs and setting the corresponding values.
See Section 21.1.4.2, Connector/ODBC Connection Parameters.
21.1.4.5. Configuring a Connector/ODBC DSN on Unix
On Unix, you configure DSN entries directly in the odbc.ini file. Here is a typical odbc.ini file that configures myodbc3 as the
DSN name for Connector/ODBC 3.51:
;
; odbc.ini configuration for Connector/ODBC and Connector/ODBC 3.51 drivers
;
[ODBC Data Sources]
myodbc3 = MyODBC 3.51 Driver DSN
[myodbc3]
Driver = /usr/local/lib/libmyodbc3.so
Description = Connector/ODBC 3.51 Driver DSN
SERVER = localhost
PORT =
USER = root
Password =
Database = test
OPTION = 3
SOCKET =
[Default]
Driver = /usr/local/lib/libmyodbc3.so
Description = Connector/ODBC 3.51 Driver DSN
SERVER = localhost
PORT =
USER = root
Password =
Database = test
OPTION = 3
SOCKET =
Refer to the Section 21.1.4.2, Connector/ODBC Connection Parameters, for the list of connection parameters that can be supplied.
Note
If you are using unixODBC, you can use the following tools to set up the DSN:
Connectors and APIs
1984
ODBCConfig GUI tool(HOWTO: ODBCConfig)
odbcinst
In some cases when using unixODBC, you might get this error:
Data source name not found and no default driver specified
If this happens, make sure the ODBCINI and ODBCSYSINI environment variables are pointing to the right odbc.ini file. For ex-
ample, if your odbc.ini file is located in /usr/local/etc, set the environment variables like this:
export ODBCINI=/usr/local/etc/odbc.ini
export ODBCSYSINI=/usr/local/etc
21.1.4.6. Connecting Without a Predefined DSN
You can connect to the MySQL server using SQLDriverConnect, by specifying the DRIVER name field. Here are the connection strings
for Connector/ODBC using DSN-Less connections:
For Connector/ODBC 3.51:
ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};\
SERVER=localhost;\
DATABASE=test;\
USER=venu;\
PASSWORD=venu;\
OPTION=3;"
If your programming language converts backslash followed by whitespace to a space, it is preferable to specify the connection string as
a single long string, or to use a concatenation of multiple strings that does not add spaces in between. For example:
ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};"
"SERVER=localhost;"
"DATABASE=test;"
"USER=venu;"
"PASSWORD=venu;"
"OPTION=3;"
Note. Note that on Mac OS X you may need to specify the full path to the Connector/ODBC driver library.
Refer to the Section 21.1.4.2, Connector/ODBC Connection Parameters, for the list of connection parameters that can be supplied.
21.1.4.7. ODBC Connection Pooling
Connection pooling enables the ODBC driver to re-use existing connections to a given database from a pool of connections, instead of
opening a new connection each time the database is accessed. By enabling connection pooling you can improve the overall performance
of your application by lowering the time taken to open a connection to a database in the connection pool.
For more information about connection pooling: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q169470.
21.1.4.8. Getting an ODBC Trace File
If you encounter difficulties or problems with Connector/ODBC, you should start by making a log file from the ODBC Manager and
Connector/ODBC. This is called tracing, and is enabled through the ODBC Manager. The procedure for this differs for Windows, Mac
OS X and Unix.
21.1.4.8.1. Enabling ODBC Tracing on Windows
To enable the trace option on Windows:
1. The Tracing tab of the ODBC Data Source Administrator dialog box enables you to configure the way ODBC function calls are
traced.
Connectors and APIs
1985
2. When you activate tracing from the Tracing tab, the Driver Manager logs all ODBC function calls for all subsequently run
applications.
3. ODBC function calls from applications running before tracing is activated are not logged. ODBC function calls are recorded in a
log file you specify.
4. Tracing ceases only after you click Stop Tracing Now. Remember that while tracing is on, the log file continues to increase in
size and that tracing affects the performance of all your ODBC applications.
21.1.4.8.2. Enabling ODBC Tracing on Mac OS X
To enable the trace option on Mac OS X 10.3 or later you should use the Tracing tab within ODBC Administrator .
1. Open the ODBC Administrator.
2. Select the Tracing tab.
Connectors and APIs
1986
3. Select the Enable Tracing checkbox.
4. Enter the location where you want to save the Tracing log. If you want to append information to an existing log file, click the
CHOOSE... button.
21.1.4.8.3. Enabling ODBC Tracing on Unix
To enable the trace option on Mac OS X 10.2 (or earlier) or Unix you must add the trace option to the ODBC configuration:
1. On Unix, you need to explicitly set the Trace option in the ODBC.INI file.
Set the tracing ON or OFF by using TraceFile and Trace parameters in odbc.ini as shown below:
TraceFile = /tmp/odbc.trace
Trace = 1
TraceFile specifies the name and full path of the trace file and Trace is set to ON or OFF. You can also use 1 or YES for ON
and 0 or NO for OFF. If you are using ODBCConfig from unixODBC, then follow the instructions for tracing unixODBC calls at
HOWTO-ODBCConfig.
21.1.4.8.4. Enabling a Connector/ODBC Log
To generate a Connector/ODBC log, do the following:
1. Within Windows, enable the Trace Connector/ODBC option flag in the Connector/ODBC connect/configure screen. The log
is written to file C:\myodbc.log. If the trace option is not remembered when you are going back to the above screen, it means
Connectors and APIs
1987
that you are not using the myodbcd.dll driver, see Section 21.1.4.3.3, Errors and Debugging.
On Mac OS X, Unix, or if you are using DSN-Less connection, then you need to supply OPTION=4 in the connection string or set
the corresponding keyword/value pair in the DSN.
2. Start your application and try to get it to fail. Then check the Connector/ODBC trace file to find out what could be wrong.
If you need help determining what is wrong, see Section 21.1.8.1, Connector/ODBC Community Support.
21.1.5. Connector/ODBC Examples
Once you have configured a DSN to provide access to a database, how you access and use that connection is dependent on the applica-
tion or programming language. As ODBC is a standardized interface, any application or language that supports ODBC can use the DSN
and connect to the configured database.
21.1.5.1. Basic Connector/ODBC Application Steps
Interacting with a MySQL server from an applications using the Connector/ODBC typically involves the following operations:
Configure the Connector/ODBC DSN
Connect to MySQL server
Initialization operations
Execute SQL statements
Retrieve results
Perform Transactions
Disconnect from the server
Most applications use some variation of these steps. The basic application steps are shown in the following diagram:
Connectors and APIs
1988
21.1.5.2. Step-by-step Guide to Connecting to a MySQL Database through Connector/ODBC
Connectors and APIs
1989
A typical installation situation where you would install Connector/ODBC is when you want to access a database on a Linux or Unix
host from a Windows machine.
As an example of the process required to set up access between two machines, the steps below take you through the basic steps. These
instructions assume that you want to connect to system ALPHA from system BETA with a user name and password of myuser and
mypassword.
On system ALPHA (the MySQL server) follow these steps:
1. Start the MySQL server.
2. Use GRANT to set up an account with a user name of myuser that can connect from system BETA using a password of myuser
to the database test:
GRANT ALL ON test.* to 'myuser'@'BETA' IDENTIFIED BY 'mypassword';
For more information about MySQL privileges, refer to Section 5.5, MySQL User Account Management.
On system BETA (the Connector/ODBC client), follow these steps:
1. Configure a Connector/ODBC DSN using parameters that match the server, database and authentication information that you have
just configured on system ALPHA.
Parameter Value Comment
DSN remote_test A name to identify the connection.
SERVER ALPHA The address of the remote server.
DATABASE test The name of the default database.
USER myuser The user name configured for access to this database.
PASSWORD mypassword The password for myuser.
2. Using an ODBC-capable application, such as Microsoft Office, connect to the MySQL server using the DSN you have just created.
If the connection fails, use tracing to examine the connection process. See Section 21.1.4.8, Getting an ODBC Trace File, for
more information.
21.1.5.3. Connector/ODBC and Third-Party ODBC Tools
Once you have configured your Connector/ODBC DSN, you can access your MySQL database through any application that supports
the ODBC interface, including programming languages and third-party applications. This section contains guides and help on using
Connector/ODBC with various ODBC-compatible tools and applications, including Microsoft Word, Microsoft Excel and Adobe/
Macromedia ColdFusion.
Connector/ODBC has been tested with the following applications.
Publisher Application Notes
Adobe ColdFusion Formerly Macromedia ColdFusion
Borland C++ Builder
Builder 4
Delphi
Business Objects Crystal Reports
Claris Filemaker Pro
Corel Paradox
Computer Associates Visual Objects Also known as CAVO
AllFusion ERwin Data Modeler
Connectors and APIs
1990
Gupta Team Developer Previously known as Centura Team Developer; Gupta SQL/
Windows
Gensym G2-ODBC Bridge
Inline iHTML
Lotus Notes Versions 4.5 and 4.6
Microsoft Access
Excel
Visio Enterprise
Visual C++
Visual Basic
ODBC.NET Using C#, Visual Basic, C++
FoxPro
Visual Interdev
OpenOffice.org OpenOffice.org
Perl DBD::ODBC
Pervasive Software DataJunction
Sambar Technologies Sambar Server
SPSS SPSS
SoftVelocity Clarion
SQLExpress SQLExpress for Xbase++
Sun StarOffice
SunSystems Vision
Sybase PowerBuilder
PowerDesigner
theKompany.com Data Architect
If you know of any other applications that work with Connector/ODBC, please send mail to <[email protected]> about
them.
21.1.5.4. Using Connector/ODBC with Microsoft Access
You can use MySQL database with Microsoft Access using Connector/ODBC. The MySQL database can be used as an import source,
an export source, or as a linked table for direct use within an Access application, so you can use Access as the front-end interface to a
MySQL database.
21.1.5.4.1. Exporting Access Data to MySQL
To export a table of data from an Access database to MySQL, follow these instructions:
1. When you open an Access database or an Access project, a Database window appears. It displays shortcuts for creating new data-
base objects and opening existing objects.
Connectors and APIs
1991
2. Click the name of the table or query you want to export, and then in the File menu, select Export.
3. In the Export Object Type Object name To dialog box, in the Save As Type box, select ODBC Databases ()
as shown here:
4. In the Export dialog box, enter a name for the file (or use the suggested name), and then select OK.
5. The Select Data Source dialog box is displayed; it lists the defined data sources for any ODBC drivers installed on your computer.
Click either the File Data Source or Machine Data Source tab, and then double-click the Connector/ODBC or Connector/ODBC
3.51 data source that you want to export to. To define a new data source for Connector/ODBC, please Section 21.1.4.3,
Configuring a Connector/ODBC DSN on Windows.
Note
Ensure that the information that you are exporting to the MySQL table is valid for the corresponding MySQL data types.
Connectors and APIs
1992
Values that are outside of the supported range of the MySQL data type but valid within Access may trigger an overflow
error during the export.
Microsoft Access connects to the MySQL Server through this data source and exports new tables and or data.
21.1.5.4.2. Importing MySQL Data to Access
To import a table or tables from MySQL to Access, follow these instructions:
1. Open a database, or switch to the Database window for the open database.
2. To import tables, on the File menu, point to Get External Data, and then click Import.
3. In the Import dialog box, in the Files Of Type box, select ODBC DATABASES (). The Select Data Source dialog box lists the
defined data sources THE SELECT DATA SOURCE dialog box is displayed; it lists the defined data source names.
4. If the ODBC data source that you selected requires you to log on, enter your login ID and password (additional information might
also be required), and then click OK.
5. Microsoft Access connects to the MySQL server through ODBC data source and displays the list of tables that you can im-
port.
6. Click each table that you want to import, and then click OK.
21.1.5.4.3. Using Microsoft Access as a Front-end to MySQL
You can use Microsoft Access as a front end to a MySQL database by linking tables within your Microsoft Access database to tables
that exist within your MySQL database. When a query is requested on a table within Access, ODBC is used to execute the queries on
the MySQL database instead.
To create a linked table:
1. Open the Access database that you want to link to MySQL.
2. From the FILE, choose GET EXTERNAL DATA->LINK TABLES.
Connectors and APIs
1993
3. From the browser, choose ODBC DATABASES () from the FILES OF TYPE pop-up.
4. In the SELECT DATA SOURCE window, choose an existing DSN, either from a FILE DATA SOURCE or MACHINE DATA
SOURCE.You can also create a new DSN using the NEW... button. For more information on creating a DSN see Section 21.1.4.3,
Configuring a Connector/ODBC DSN on Windows.
Connectors and APIs
1994
5. In the LINK TABLES dialog, select one or more tables from the MySQL database. A link will be created to each table that you se-
lect from this list.
Connectors and APIs
1995
6. If Microsoft Access is unable to determine the unique record identifier for a table automatically then it may ask you to confirm the
column, or combination of columns, to be used to uniquely identify each row from the source table. Select the columns you want to
use and click OK.
Once the process has been completed, you can now build interfaces and queries to the linked tables just as you would for any Access
database.
Use the following procedure to view or to refresh links when the structure or location of a linked table has changed. The Linked Table
Manager lists the paths to all currently linked tables.
To view or refresh links:
Connectors and APIs
1996
1. Open the database that contains links to MySQL tables.
2. On the Tools menu, point to Add-ins (Database Utilities in Access 2000 or newer), and then click Linked Table
Manager.
3. Select the check box for the tables whose links you want to refresh.
4. Click OK to refresh the links.
Microsoft Access confirms a successful refresh or, if the table wasn't found, displays the Select New Location of <table name>
dialog box in which you can specify its the table's new location. If several selected tables have moved to the new location that you spe-
cify, the Linked Table Manager searches that location for all selected tables, and updates all links in one step.
To change the path for a set of linked tables:
1. Open the database that contains links to tables.
2. On the Tools menu, point to Add-ins (Database Utilities in Access 2000 or newer), and then click Linked Table
Manager.
3. Select the Always Prompt For A New Location check box.
4. Select the check box for the tables whose links you want to change, and then click OK.
5. In the Select New Location of <table name> dialog box, specify the new location, click Open, and then click OK.
21.1.5.5. Using Connector/ODBC with Microsoft Word or Excel
You can use Microsoft Word and Microsoft Excel to access information from a MySQL database using Connector/ODBC. Within Mi-
crosoft Word, this facility is most useful when importing data for mailmerge, or for tables and data to be included in reports. Within Mi-
crosoft Excel, you can execute queries on your MySQL server and import the data directly into an Excel Worksheet, presenting the data
as a series of rows and columns.
With both applications, data is accessed and imported into the application using Microsoft Query , which enables you to execute a query
though an ODBC source. You use Microsoft Query to build the SQL statement to be executed, selecting the tables, fields, selection cri-
teria and sort order. For example, to insert information from a table in the World test database into an Excel spreadsheet, using the DSN
samples shown in Section 21.1.4, Connector/ODBC Configuration:
1. Create a new Worksheet.
2. From the Data menu, choose Import External Data, and then select New Database Query.
3. Microsoft Query will start. First, you need to choose the data source, by selecting an existing Data Source Name.
Connectors and APIs
1997
4. Within the Query Wizard, you must choose the columns that you want to import. The list of tables available to the user con-
figured through the DSN is shown on the left, the columns that will be added to your query are shown on the right. The columns
you choose are equivalent to those in the first section of a SELECT query. Click NEXT to continue.
5. You can filter rows from the query (the equivalent of a WHERE clause) using the Filter Data dialog. Click NEXT to continue.
Connectors and APIs
1998
6. Select an (optional) sort order for the data. This is equivalent to using a ORDER BY clause in your SQL query. You can select up
to three fields for sorting the information returned by the query. Click NEXT to continue.
7. Select the destination for your query. You can select to return the data Microsoft Excel, where you can choose a worksheet and cell
Connectors and APIs
1999
where the data will be inserted; you can continue to view the query and results within Microsoft Query, where you can edit the
SQL query and further filter and sort the information returned; or you can create an OLAP Cube from the query, which can then be
used directly within Microsoft Excel. Click FINISH.
The same process can be used to import data into a Word document, where the data will be inserted as a table. This can be used for mail
merge purposes (where the field data is read from a Word table), or where you want to include data and reports within a report or other
document.
21.1.5.6. Using Connector/ODBC with Crystal Reports
Crystal Reports can use an ODBC DSN to connect to a database from which you to extract data and information for reporting purposes.
Note
There is a known issue with certain versions of Crystal Reports where the application is unable to open and browse tables
and fields through an ODBC connection. Before using Crystal Reports with MySQL, please ensure that you have update to
the latest version, including any outstanding service packs and hotfixes. For more information on this issue, see the Busi-
ness) Objects Knowledgebase for more information.
For example, to create a simple crosstab report within Crystal Reports XI, you should follow these steps:
1. Create a DSN using the Data Sources (ODBC) tool. You can either specify a complete database, including user name and
password, or you can build a basic DSN and use Crystal Reports to set the user name and password.
For the purposes of this example, a DSN that provides a connection to an instance of the MySQL Sakila sample database has been
created.
2. Open Crystal Reports and create a new project, or an open an existing reporting project into which you want to insert data from
your MySQL data source.
3. Start the Cross-Tab Report Wizard, either by clicking on the option on the Start Page. Expand the CREATE NEW CONNECTION
folder, then expand the ODBC (RDO) folder to obtain a list of ODBC data sources.
Connectors and APIs
2000
You will be asked to select a data source.
4. When you first expand the ODBC (RDO) folder you will be presented the Data Source Selection screen. From here you can select
either a pre-configured DSN, open a file-based DSN or enter and manual connection string. For this example, the SAKILA DSN
will be used.
If the DSN contains a user name/password combination, or you want to use different authentication credentials, click NEXT to enter
the user name and password that you want to use. Otherwise, click FINISH to continue the data source selection wizard.
Connectors and APIs
2001
5. You will be returned the Cross-Tab Report Creation Wizard. You now need to select the database and tables that you want to in-
clude in your report. For our example, we will expand the selected Sakila database. Click the city table and use the > button to
add the table to the report. Then repeat the action with the country table. Alternatively you can select multiple tables and add
them to the report.
Finally, you can select the parent SAKILA resource and add of the tables to the report.
Once you have selected the tables you want to include, click NEXT to continue.
Connectors and APIs
2002
6. Crystal Reports will now read the table definitions and automatically identify the links between the tables. The identification of
links between tables enables Crystal Reports to automatically lookup and summarize information based on all the tables in the
database according to your query. If Crystal Reports is unable to perform the linking itself, you can manually create the links
between fields in the tables you have selected.
Click NEXT to continue the process.
Connectors and APIs
2003
7. You can now select the columns and rows that you wish to include within the Cross-Tab report. Drag and drop or use the > buttons
to add fields to each area of the report. In the example shown, we will report on cities, organized by country, incorporating a count
of the number of cities within each country. If you want to browse the data, select a field and click the BROWSE DATA... button.
Click NEXT to create a graph of the results. Since we are not creating a graph from this data, click FINISH to generate the report.
Connectors and APIs
2004
8. The finished report will be shown, a sample of the output from the Sakila sample database is shown below.
Connectors and APIs
2005
Once the ODBC connection has been opened within Crystal Reports, you can browse and add any fields within the available tables into
your reports.
21.1.5.7. Connector/ODBC Programming
With a suitable ODBC Manager and the Connector/ODBC driver installed, any programming language or environment that can support
ODBC should be able to connect to a MySQL database through Connector/ODBC.
This includes, but is certainly not limited to, Microsoft support languages (including Visual Basic, C# and interfaces such as
ODBC.NET), Perl (through the DBI module, and the DBD::ODBC driver).
Connectors and APIs
2006
21.1.5.7.1. Using Connector/ODBC with Visual Basic Using ADO, DAO and RDO
This section contains simple examples of the use of MySQL ODBC 3.51 Driver with ADO, DAO and RDO.
21.1.5.7.1.1. ADO: rs.addNew, rs.delete, and rs.update
The following ADO (ActiveX Data Objects) example creates a table my_ado and demonstrates the use of rs.addNew, rs.delete,
and rs.update.
Private Sub myodbc_ado_Click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim sql As String
'connect to MySQL server using MySQL ODBC 3.51 Driver
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_
& " DATABASE=test;"_
& "UID=venu;PWD=venu; OPTION=3"
conn.Open
'create table
conn.Execute "DROP TABLE IF EXISTS my_ado"
conn.Execute "CREATE TABLE my_ado(id int not null primary key, name varchar(20)," _
& "txt text, dt date, tm time, ts timestamp)"
'direct insert
conn.Execute "INSERT INTO my_ado(id,name,txt) values(1,100,'venu')"
conn.Execute "INSERT INTO my_ado(id,name,txt) values(2,200,'MySQL')"
conn.Execute "INSERT INTO my_ado(id,name,txt) values(3,300,'Delete')"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseServer
'fetch the initial table ..
rs.Open "SELECT * FROM my_ado", conn
Debug.Print rs.RecordCount
rs.MoveFirst
Debug.Print String(50, "-") & "Initial my_ado Result Set " & String(50, "-")
For Each fld In rs.Fields
Debug.Print fld.Name,
Next
Debug.Print
Do Until rs.EOF
For Each fld In rs.Fields
Debug.Print fld.Value,
Next
rs.MoveNext
Debug.Print
Loop
rs.Close
'rs insert
rs.Open "select * from my_ado", conn, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!Name = "Monty"
rs!txt = "Insert row"
rs.Update
rs.Close
'rs update
rs.Open "SELECT * FROM my_ado"
rs!Name = "update"
rs!txt = "updated-row"
rs.Update
rs.Close
'rs update second time..
rs.Open "SELECT * FROM my_ado"
rs!Name = "update"
rs!txt = "updated-second-time"
rs.Update
rs.Close
'rs delete
rs.Open "SELECT * FROM my_ado"
rs.MoveNext
rs.MoveNext
rs.Delete
rs.Close
Connectors and APIs
2007
'fetch the updated table ..
rs.Open "SELECT * FROM my_ado", conn
Debug.Print rs.RecordCount
rs.MoveFirst
Debug.Print String(50, "-") & "Updated my_ado Result Set " & String(50, "-")
For Each fld In rs.Fields
Debug.Print fld.Name,
Next
Debug.Print
Do Until rs.EOF
For Each fld In rs.Fields
Debug.Print fld.Value,
Next
rs.MoveNext
Debug.Print
Loop
rs.Close
conn.Close
End Sub
21.1.5.7.1.2. DAO: rs.addNew, rs.update, and Scrolling
The following DAO (Data Access Objects) example creates a table my_dao and demonstrates the use of rs.addNew, rs.update,
and result set scrolling.
Private Sub myodbc_dao_Click()
Dim ws As Workspace
Dim conn As Connection
Dim queryDef As queryDef
Dim str As String
'connect to MySQL using MySQL ODBC 3.51 Driver
Set ws = DBEngine.CreateWorkspace("", "venu", "venu", dbUseODBC)
str = "odbc;DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_
& " DATABASE=test;"_
& "UID=venu;PWD=venu; OPTION=3"
Set conn = ws.OpenConnection("test", dbDriverNoPrompt, False, str)
'Create table my_dao
Set queryDef = conn.CreateQueryDef("", "drop table if exists my_dao")
queryDef.Execute
Set queryDef = conn.CreateQueryDef("", "create table my_dao(Id INT AUTO_INCREMENT PRIMARY KEY, " _
& "Ts TIMESTAMP(14) NOT NULL, Name varchar(20), Id2 INT)")
queryDef.Execute
'Insert new records using rs.addNew
Set rs = conn.OpenRecordset("my_dao")
Dim i As Integer
For i = 10 To 15
rs.AddNew
rs!Name = "insert record" & i
rs!Id2 = i
rs.Update
Next i
rs.Close
'rs update..
Set rs = conn.OpenRecordset("my_dao")
rs.Edit
rs!Name = "updated-string"
rs.Update
rs.Close
'fetch the table back...
Set rs = conn.OpenRecordset("my_dao", dbOpenDynamic)
str = "Results:"
rs.MoveFirst
While Not rs.EOF
str = " " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print "DATA:" & str
rs.MoveNext
Wend
'rs Scrolling
rs.MoveFirst
str = " FIRST ROW: " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print str
rs.MoveLast
str = " LAST ROW: " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print str
Connectors and APIs
2008
rs.MovePrevious
str = " LAST-1 ROW: " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print str
'free all resources
rs.Close
queryDef.Close
conn.Close
ws.Close
End Sub
21.1.5.7.1.3. RDO: rs.addNew and rs.update
The following RDO (Remote Data Objects) example creates a table my_rdo and demonstrates the use of rs.addNew and
rs.update.
Dim rs As rdoResultset
Dim cn As New rdoConnection
Dim cl As rdoColumn
Dim SQL As String
'cn.Connect = "DSN=test;"
cn.Connect = "DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_
& " DATABASE=test;"_
& "UID=venu;PWD=venu; OPTION=3"
cn.CursorDriver = rdUseOdbc
cn.EstablishConnection rdDriverPrompt
'drop table my_rdo
SQL = "drop table if exists my_rdo"
cn.Execute SQL, rdExecDirect
'create table my_rdo
SQL = "create table my_rdo(id int, name varchar(20))"
cn.Execute SQL, rdExecDirect
'insert - direct
SQL = "insert into my_rdo values (100,'venu')"
cn.Execute SQL, rdExecDirect
SQL = "insert into my_rdo values (200,'MySQL')"
cn.Execute SQL, rdExecDirect
'rs insert
SQL = "select * from my_rdo"
Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
rs.AddNew
rs!id = 300
rs!Name = "Insert1"
rs.Update
rs.Close
'rs insert
SQL = "select * from my_rdo"
Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
rs.AddNew
rs!id = 400
rs!Name = "Insert 2"
rs.Update
rs.Close
'rs update
SQL = "select * from my_rdo"
Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
rs.Edit
rs!id = 999
rs!Name = "updated"
rs.Update
rs.Close
'fetch back...
SQL = "select * from my_rdo"
Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
Do Until rs.EOF
For Each cl In rs.rdoColumns
Debug.Print cl.Value,
Next
rs.MoveNext
Debug.Print
Loop
Debug.Print "Row count="; rs.RowCount
Connectors and APIs
2009
'close
rs.Close
cn.Close
End Sub
21.1.5.7.2. Using Connector/ODBC with .NET
This section contains simple examples that demonstrate the use of Connector/ODBC drivers with ODBC.NET.
21.1.5.7.2.1. Using Connector/ODBC with ODBC.NET and C# (C sharp)
The following sample creates a table my_odbc_net and demonstrates its use in C#.
/**
* @sample : mycon.cs
* @purpose : Demo sample for ODBC.NET using Connector/ODBC
* @author : Venu, <[email protected]>
*
* (C) Copyright MySQL AB, 1995-2006
*
**/
/* build command
*
* csc /t:exe
* /out:mycon.exe mycon.cs
* /r:Microsoft.Data.Odbc.dll
*/
using Console = System.Console;
using Microsoft.Data.Odbc;
namespace myodbc3
{
class mycon
{
static void Main(string[] args)
{
try
{
//Connection string for Connector/ODBC 3.51
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=localhost;" +
"DATABASE=test;" +
"UID=venu;" +
"PASSWORD=venu;" +
"OPTION=3";
//Connect to MySQL using Connector/ODBC
OdbcConnection MyConnection = new OdbcConnection(MyConString);
MyConnection.Open();
Console.WriteLine("\n !!! success, connected successfully !!!\n");
//Display connection information
Console.WriteLine("Connection Information:");
Console.WriteLine("\tConnection String:" +
MyConnection.ConnectionString);
Console.WriteLine("\tConnection Timeout:" +
MyConnection.ConnectionTimeout);
Console.WriteLine("\tDatabase:" +
MyConnection.Database);
Console.WriteLine("\tDataSource:" +
MyConnection.DataSource);
Console.WriteLine("\tDriver:" +
MyConnection.Driver);
Console.WriteLine("\tServerVersion:" +
MyConnection.ServerVersion);
//Create a sample table
OdbcCommand MyCommand =
new OdbcCommand("DROP TABLE IF EXISTS my_odbc_net",
MyConnection);
MyCommand.ExecuteNonQuery();
MyCommand.CommandText =
"CREATE TABLE my_odbc_net(id int, name varchar(20), idb bigint)";
MyCommand.ExecuteNonQuery();
//Insert
MyCommand.CommandText =
"INSERT INTO my_odbc_net VALUES(10,'venu', 300)";
Console.WriteLine("INSERT, Total rows affected:" +
MyCommand.ExecuteNonQuery());;
Connectors and APIs
2010
//Insert
MyCommand.CommandText =
"INSERT INTO my_odbc_net VALUES(20,'mysql',400)";
Console.WriteLine("INSERT, Total rows affected:" +
MyCommand.ExecuteNonQuery());
//Insert
MyCommand.CommandText =
"INSERT INTO my_odbc_net VALUES(20,'mysql',500)";
Console.WriteLine("INSERT, Total rows affected:" +
MyCommand.ExecuteNonQuery());
//Update
MyCommand.CommandText =
"UPDATE my_odbc_net SET id=999 WHERE id=20";
Console.WriteLine("Update, Total rows affected:" +
MyCommand.ExecuteNonQuery());
//COUNT(*)
MyCommand.CommandText =
"SELECT COUNT(*) as TRows FROM my_odbc_net";
Console.WriteLine("Total Rows:" +
MyCommand.ExecuteScalar());
//Fetch
MyCommand.CommandText = "SELECT * FROM my_odbc_net";
OdbcDataReader MyDataReader;
MyDataReader = MyCommand.ExecuteReader();
while (MyDataReader.Read())
{
if(string.Compare(MyConnection.Driver,"myodbc3.dll") == 0) {
//Supported only by Connector/ODBC 3.51
Console.WriteLine("Data:" + MyDataReader.GetInt32(0) + " " +
MyDataReader.GetString(1) + " " +
MyDataReader.GetInt64(2));
}
else {
//BIGINTs not supported by Connector/ODBC
Console.WriteLine("Data:" + MyDataReader.GetInt32(0) + " " +
MyDataReader.GetString(1) + " " +
MyDataReader.GetInt32(2));
}
}
//Close all resources
MyDataReader.Close();
MyConnection.Close();
}
catch (OdbcException MyOdbcException) //Catch any ODBC exception ..
{
for (int i=0; i < MyOdbcException.Errors.Count; i++)
{
Console.Write("ERROR #" + i + "\n" +
"Message: " +
MyOdbcException.Errors[i].Message + "\n" +
"Native: " +
MyOdbcException.Errors[i].NativeError.ToString() + "\n" +
"Source: " +
MyOdbcException.Errors[i].Source + "\n" +
"SQL: " +
MyOdbcException.Errors[i].SQLState + "\n");
}
}
}
}
}
21.1.5.7.2.2. Using Connector/ODBC with ODBC.NET and Visual Basic
The following sample creates a table my_vb_net and demonstrates the use in VB.
' @sample : myvb.vb
' @purpose : Demo sample for ODBC.NET using Connector/ODBC
' @author : Venu, <[email protected]>
'
' (C) Copyright MySQL AB, 1995-2006
'
'
'
' build command
'
' vbc /target:exe
' /out:myvb.exe
' /r:Microsoft.Data.Odbc.dll
' /r:System.dll
' /r:System.Data.dll
Connectors and APIs
2011
'
Imports Microsoft.Data.Odbc
Imports System
Module myvb
Sub Main()
Try
'Connector/ODBC 3.51 connection string
Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;" & _
"DATABASE=test;" & _
"UID=venu;" & _
"PASSWORD=venu;" & _
"OPTION=3;"
'Connection
Dim MyConnection As New OdbcConnection(MyConString)
MyConnection.Open()
Console.WriteLine("Connection State::" & MyConnection.State.ToString)
'Drop
Console.WriteLine("Dropping table")
Dim MyCommand As New OdbcCommand()
MyCommand.Connection = MyConnection
MyCommand.CommandText = "DROP TABLE IF EXISTS my_vb_net"
MyCommand.ExecuteNonQuery()
'Create
Console.WriteLine("Creating....")
MyCommand.CommandText = "CREATE TABLE my_vb_net(id int, name varchar(30))"
MyCommand.ExecuteNonQuery()
'Insert
MyCommand.CommandText = "INSERT INTO my_vb_net VALUES(10,'venu')"
Console.WriteLine("INSERT, Total rows affected:" & _
MyCommand.ExecuteNonQuery())
'Insert
MyCommand.CommandText = "INSERT INTO my_vb_net VALUES(20,'mysql')"
Console.WriteLine("INSERT, Total rows affected:" & _
MyCommand.ExecuteNonQuery())
'Insert
MyCommand.CommandText = "INSERT INTO my_vb_net VALUES(20,'mysql')"
Console.WriteLine("INSERT, Total rows affected:" & _
MyCommand.ExecuteNonQuery())
'Insert
MyCommand.CommandText = "INSERT INTO my_vb_net(id) VALUES(30)"
Console.WriteLine("INSERT, Total rows affected:" & _
MyCommand.ExecuteNonQuery())
'Update
MyCommand.CommandText = "UPDATE my_vb_net SET id=999 WHERE id=20"
Console.WriteLine("Update, Total rows affected:" & _
MyCommand.ExecuteNonQuery())
'COUNT(*)
MyCommand.CommandText = "SELECT COUNT(*) as TRows FROM my_vb_net"
Console.WriteLine("Total Rows:" & MyCommand.ExecuteScalar())
'Select
Console.WriteLine("Select * FROM my_vb_net")
MyCommand.CommandText = "SELECT * FROM my_vb_net"
Dim MyDataReader As OdbcDataReader
MyDataReader = MyCommand.ExecuteReader
While MyDataReader.Read
If MyDataReader("name") Is DBNull.Value Then
Console.WriteLine("id = " & _
CStr(MyDataReader("id")) & " name = " & _
"NULL")
Else
Console.WriteLine("id = " & _
CStr(MyDataReader("id")) & " name = " & _
CStr(MyDataReader("name")))
End If
End While
'Catch ODBC Exception
Catch MyOdbcException As OdbcException
Dim i As Integer
Console.WriteLine(MyOdbcException.ToString)
'Catch program exception
Catch MyException As Exception
Console.WriteLine(MyException.ToString)
End Try
End Sub
Connectors and APIs
2012
21.1.6. Connector/ODBC Reference
This section provides reference material for the Connector/ODBC API, showing supported functions and methods, supported MySQL
column types and the corresponding native type in Connector/ODBC, and the error codes returned by Connector/ODBC when a fault
occurs.
21.1.6.1. Connector/ODBC API Reference
This section summarizes ODBC routines, categorized by functionality.
For the complete ODBC API reference, please refer to the ODBC Programmer's Reference at ht-
tp://msdn.microsoft.com/en-us/library/ms714177.aspx.
An application can call SQLGetInfo function to obtain conformance information about Connector/ODBC. To obtain information
about support for a specific function in the driver, an application can call SQLGetFunctions.
Note
For backward compatibility, the Connector/ODBC 3.51 driver supports all deprecated functions.
The following tables list Connector/ODBC API calls grouped by task:
Connecting to a data source
Function name C/ODBC 3.51 Standard Purpose
SQLAllocHandle Yes ISO 92 Obtains an environment, connection, statement, or descriptor
handle.
SQLConnect Yes ISO 92 Connects to a specific driver by data source name, user ID, and
password.
SQLDriverConnect Yes ODBC Connects to a specific driver by connection string or requests that
the Driver Manager and driver display connection dialog boxes for
the user.
SQLAllocEnv Yes Deprecated Obtains an environment handle allocated from driver.
SQLAllocConnect Yes Deprecated Obtains a connection handle
Obtaining information about a driver and data source
Function name C/ODBC 3.51 Standard Purpose
SQLDataSources No ISO 92 Returns the list of available data sources, handled by the Driver
Manager
SQLDrivers No ODBC Returns the list of installed drivers and their attributes, handles by
Driver Manager
SQLGetInfo Yes ISO 92 Returns information about a specific driver and data source.
SQLGetFunctions Yes ISO 92 Returns supported driver functions.
SQLGetTypeInfo Yes ISO 92 Returns information about supported data types.
Setting and retrieving driver attributes
Function name C/ODBC 3.51 Standard Purpose
SQLSetConnectAttr Yes ISO 92 Sets a connection attribute.
SQLGetConnectAttr Yes ISO 92 Returns the value of a connection attribute.
SQLSetConnectOption Yes Deprecated Sets a connection option
SQLGetConnectOption Yes Deprecated Returns the value of a connection option
SQLSetEnvAttr Yes ISO 92 Sets an environment attribute.
SQLGetEnvAttr Yes ISO 92 Returns the value of an environment attribute.
Connectors and APIs
2013
SQLSetStmtAttr Yes ISO 92 Sets a statement attribute.
SQLGetStmtAttr Yes ISO 92 Returns the value of a statement attribute.
SQLSetStmtOption Yes Deprecated Sets a statement option
SQLGetStmtOption Yes Deprecated Returns the value of a statement option
Preparing SQL requests
Function name C/ODBC 3.51 Standard Purpose
SQLAllocStmt Yes Deprecated Allocates a statement handle
SQLPrepare Yes ISO 92 Prepares an SQL statement for later execution.
SQLBindParameter Yes ODBC Assigns storage for a parameter in an SQL statement.
SQLGetCursorName Yes ISO 92 Returns the cursor name associated with a statement handle.
SQLSetCursorName Yes ISO 92 Specifies a cursor name.
SQLSetScrollOptions Yes ODBC Sets options that control cursor behavior.
Submitting requests
Function name C/ODBC 3.51 Standard Purpose
SQLExecute Yes ISO 92 Executes a prepared statement.
SQLExecDirect Yes ISO 92 Executes a statement
SQLNativeSql Yes ODBC Returns the text of an SQL statement as translated by the driver.
SQLDescribeParam Yes ODBC Returns the description for a specific parameter in a statement.
SQLNumParams Yes ISO 92 Returns the number of parameters in a statement.
SQLParamData Yes ISO 92 Used in conjunction with SQLPutData to supply parameter data
at execution time. (Useful for long data values.)
SQLPutData Yes ISO 92 Sends part or all of a data value for a parameter. (Useful for long
data values.)
Retrieving results and information about results
Function name C/ODBC 3.51 Standard Purpose
SQLRowCount Yes ISO 92 Returns the number of rows affected by an insert, update, or delete
request.
SQLNumResultCols Yes ISO 92 Returns the number of columns in the result set.
SQLDescribeCol Yes ISO 92 Describes a column in the result set.
SQLColAttribute Yes ISO 92 Describes attributes of a column in the result set.
SQLColAttributes Yes Deprecated Describes attributes of a column in the result set.
SQLFetch Yes ISO 92 Returns multiple result rows.
SQLFetchScroll Yes ISO 92 Returns scrollable result rows.
SQLExtendedFetch Yes Deprecated Returns scrollable result rows.
SQLSetPos Yes ODBC Positions a cursor within a fetched block of data and allows an ap-
plication to refresh data in the rowset or to update or delete data in
the result set.
SQLBulkOperations Yes ODBC Performs bulk insertions and bulk bookmark operations, including
update, delete, and fetch by bookmark.
Retrieving error or diagnostic information
Connectors and APIs
2014
Function name C/ODBC 3.51 Standard Purpose
SQLError Yes Deprecated Returns additional error or status information
SQLGetDiagField Yes ISO 92 Returns additional diagnostic information (a single field of the dia-
gnostic data structure).
SQLGetDiagRec Yes ISO 92 Returns additional diagnostic information (multiple fields of the
diagnostic data structure).
Obtaining information about the data source's system tables (catalog functions) item
Function name C/ODBC 3.51 Standard Purpose
SQLColumnPrivileges Yes ODBC Returns a list of columns and associated privileges for one or more
tables.
SQLColumns Yes X/Open Returns the list of column names in specified tables.
SQLForeignKeys Yes ODBC Returns a list of column names that make up foreign keys, if they
exist for a specified table.
SQLPrimaryKeys Yes ODBC Returns the list of column names that make up the primary key for
a table.
SQLSpecialColumns Yes X/Open Returns information about the optimal set of columns that
uniquely identifies a row in a specified table, or the columns that
are automatically updated when any value in the row is updated by
a transaction.
SQLStatistics Yes ISO 92 Returns statistics about a single table and the list of indexes associ-
ated with the table.
SQLTablePrivileges Yes ODBC Returns a list of tables and the privileges associated with each ta-
ble.
SQLTables Yes X/Open Returns the list of table names stored in a specific data source.
Performing transactions
Function name C/ODBC 3.51 Standard Purpose
SQLTransact Yes Deprecated Commits or rolls back a transaction
SQLEndTran Yes ISO 92 Commits or rolls back a transaction.
Terminating a statement
Function name C/ODBC 3.51 Standard Purpose
SQLFreeStmt Yes ISO 92 Ends statement processing, discards pending results, and, option-
ally, frees all resources associated with the statement handle.
SQLCloseCursor Yes ISO 92 Closes a cursor that has been opened on a statement handle.
SQLCancel Yes ISO 92 Cancels an SQL statement.
Terminating a connection
Function name C/ODBC 3.51 Standard Purpose
SQLDisconnect Yes ISO 92 Closes the connection.
SQLFreeHandle Yes ISO 92 Releases an environment, connection, statement, or descriptor
handle.
SQLFreeConnect Yes Deprecated Releases connection handle
SQLFreeEnv Yes Deprecated Releases an environment handle
Connectors and APIs
2015
21.1.6.2. Connector/ODBC Data Types
The following table illustrates how driver maps the server data types to default SQL and C data types.
Native Value SQL Type C Type
bigint unsigned SQL_BIGINT SQL_C_UBIGINT
bigint SQL_BIGINT SQL_C_SBIGINT
bit SQL_BIT SQL_C_BIT
bit SQL_CHAR SQL_C_CHAR
blob SQL_LONGVARBINARY SQL_C_BINARY
bool SQL_CHAR SQL_C_CHAR
char SQL_CHAR SQL_C_CHAR
date SQL_DATE SQL_C_DATE
datetime SQL_TIMESTAMP SQL_C_TIMESTAMP
decimal SQL_DECIMAL SQL_C_CHAR
double precision SQL_DOUBLE SQL_C_DOUBLE
double SQL_FLOAT SQL_C_DOUBLE
enum SQL_VARCHAR SQL_C_CHAR
float SQL_REAL SQL_C_FLOAT
int unsigned SQL_INTEGER SQL_C_ULONG
int SQL_INTEGER SQL_C_SLONG
integer unsigned SQL_INTEGER SQL_C_ULONG
integer SQL_INTEGER SQL_C_SLONG
long varbinary SQL_LONGVARBINARY SQL_C_BINARY
long varchar SQL_LONGVARCHAR SQL_C_CHAR
longblob SQL_LONGVARBINARY SQL_C_BINARY
longtext SQL_LONGVARCHAR SQL_C_CHAR
mediumblob SQL_LONGVARBINARY SQL_C_BINARY
mediumint unsigned SQL_INTEGER SQL_C_ULONG
mediumint SQL_INTEGER SQL_C_SLONG
mediumtext SQL_LONGVARCHAR SQL_C_CHAR
numeric SQL_NUMERIC SQL_C_CHAR
real SQL_FLOAT SQL_C_DOUBLE
set SQL_VARCHAR SQL_C_CHAR
smallint unsigned SQL_SMALLINT SQL_C_USHORT
smallint SQL_SMALLINT SQL_C_SSHORT
text SQL_LONGVARCHAR SQL_C_CHAR
time SQL_TIME SQL_C_TIME
timestamp SQL_TIMESTAMP SQL_C_TIMESTAMP
tinyblob SQL_LONGVARBINARY SQL_C_BINARY
tinyint unsigned SQL_TINYINT SQL_C_UTINYINT
tinyint SQL_TINYINT SQL_C_STINYINT
tinytext SQL_LONGVARCHAR SQL_C_CHAR
varchar SQL_VARCHAR SQL_C_CHAR
year SQL_SMALLINT SQL_C_SHORT
Connectors and APIs
2016
21.1.6.3. Connector/ODBC Error Codes
The following tables lists the error codes returned by the driver apart from the server errors.
Native
Code
SQLSTATE 2 SQLSTATE 3 Error Message
500 01000 01000 General warning
501 01004 01004 String data, right truncated
502 01S02 01S02 Option value changed
503 01S03 01S03 No rows updated/deleted
504 01S04 01S04 More than one row updated/deleted
505 01S06 01S06 Attempt to fetch before the result set returned the first row set
506 07001 07002 SQLBindParameter not used for all parameters
507 07005 07005 Prepared statement not a cursor-specification
508 07009 07009 Invalid descriptor index
509 08002 08002 Connection name in use
510 08003 08003 Connection does not exist
511 24000 24000 Invalid cursor state
512 25000 25000 Invalid transaction state
513 25S01 25S01 Transaction state unknown
514 34000 34000 Invalid cursor name
515 S1000 HY000 General driver defined error
516 S1001 HY001 Memory allocation error
517 S1002 HY002 Invalid column number
518 S1003 HY003 Invalid application buffer type
519 S1004 HY004 Invalid SQL data type
520 S1009 HY009 Invalid use of null pointer
521 S1010 HY010 Function sequence error
522 S1011 HY011 Attribute can not be set now
523 S1012 HY012 Invalid transaction operation code
524 S1013 HY013 Memory management error
525 S1015 HY015 No cursor name available
526 S1024 HY024 Invalid attribute value
527 S1090 HY090 Invalid string or buffer length
528 S1091 HY091 Invalid descriptor field identifier
529 S1092 HY092 Invalid attribute/option identifier
530 S1093 HY093 Invalid parameter number
531 S1095 HY095 Function type out of range
532 S1106 HY106 Fetch type out of range
533 S1117 HY117 Row value out of range
534 S1109 HY109 Invalid cursor position
535 S1C00 HYC00 Optional feature not implemented
0 21S01 21S01 Column count does not match value count
0 23000 23000 Integrity constraint violation
0 42000 42000 Syntax error or access violation
0 42S02 42S02 Base table or view not found
Connectors and APIs
2017
0 42S12 42S12 Index not found
0 42S21 42S21 Column already exists
0 42S22 42S22 Column not found
0 08S01 08S01 Communication link failure
21.1.7. Connector/ODBC Notes and Tips
Here are some common notes and tips for using Connector/ODBC within different environments, applications and tools. The notes
provided here are based on the experiences of Connector/ODBC developers and users.
21.1.7.1. Connector/ODBC General Functionality
This section provides help with common queries and areas of functionality in MySQL and how to use them with Connector/ODBC.
21.1.7.1.1. Obtaining Auto-Increment Values
Obtaining the value of column that uses AUTO_INCREMENT after an INSERT statement can be achieved in a number of different
ways. To obtain the value immediately after an INSERT, use a SELECT query with the LAST_INSERT_ID() function.
For example, using Connector/ODBC you would execute two separate statements, the INSERT statement and the SELECT query to ob-
tain the auto-increment value.
INSERT INTO tbl (auto,text) VALUES(NULL,'text');
SELECT LAST_INSERT_ID();
If you do not require the value within your application, but do require the value as part of another INSERT, the entire process can be
handled by executing the following statements:
INSERT INTO tbl (auto,text) VALUES(NULL,'text');
INSERT INTO tbl2 (id,text) VALUES(LAST_INSERT_ID(),'text');
Certain ODBC applications (including Delphi and Access) may have trouble obtaining the auto-increment value using the previous ex-
amples. In this case, try the following statement as an alternative:
SELECT * FROM tbl WHERE auto IS NULL;
See Section 21.10.10.3, How to Get the Unique ID for the Last Inserted Row.
21.1.7.1.2. Dynamic Cursor Support
Support for the dynamic cursor is provided in Connector/ODBC 3.51, but dynamic cursors are not enabled by default. You can en-
able this function within Windows by selecting the Enable Dynamic Cursor checkbox within the ODBC Data Source Adminis-
trator.
On other platforms, you can enable the dynamic cursor by adding 32 to the OPTION value when creating the DSN.
21.1.7.1.3. Connector/ODBC Performance
The Connector/ODBC driver has been optimized to provide very fast performance. If you experience problems with the performance of
Connector/ODBC, or notice a large amount of disk activity for simple queries, there are a number of aspects you should check:
Ensure that ODBC Tracing is not enabled. With tracing enabled, a lot of information is recorded in the tracing file by the ODBC
Manager. You can check, and disable, tracing within Windows using the TRACING panel of the ODBC Data Source Administrator.
Within Mac OS X, check the TRACING panel of ODBC Administrator. See Section 21.1.4.8, Getting an ODBC Trace File.
Make sure you are using the standard version of the driver, and not the debug version. The debug version includes additional checks
and reporting measures.
Disable the Connector/ODBC driver trace and query logs. These options are enabled for each DSN, so make sure to examine only
the DSN that you are using in your application. Within Windows, you can disable the Connector/ODBC and query logs by modify-
Connectors and APIs
2018
ing the DSN configuration. Within Mac OS X and Unix, ensure that the driver trace (option value 4) and query logging (option
value 524288) are not enabled.
21.1.7.1.4. Setting ODBC Query Timeout in Windows
For more information on how to set the query timeout on Microsoft Windows when executing queries through an ODBC connection,
read the Microsoft knowledgebase document at http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B153756.
21.1.7.2. Connector/ODBC Application Specific Tips
Most programs should work with Connector/ODBC, but for each of those listed here, there are specific notes and tips to improve or en-
hance the way you work with Connector/ODBC and these applications.
With all applications you should ensure that you are using the latest Connector/ODBC drivers, ODBC Manager and any supporting lib-
raries and interfaces used by your application. For example, on Windows, using the latest version of Microsoft Data Access Compon-
ents (MDAC) will improve the compatibility with ODBC in general, and with the Connector/ODBC driver.
21.1.7.2.1. Using Connector/ODBC with Microsoft Applications
The majority of Microsoft applications have been tested with Connector/ODBC, including Microsoft Office, Microsoft Access and the
various programming languages supported within ASP and Microsoft Visual Studio.
21.1.7.2.1.1. Microsoft Access
To improve the integration between Microsoft Access and MySQL through Connector/ODBC:
For all versions of Access, you should enable the Connector/ODBC Return matching rows option. For Access 2.0, you
should additionally enable the Simulate ODBC 1.0 option.
You should have a TIMESTAMP column in all tables that you want to be able to update. For maximum portability, do not use a
length specification in the column declaration (which is unsupported within MySQL in versions earlier than 4.1).
You should have a primary key in each MySQL table you want to use with Access. If not, new or updated rows may show up as
#DELETED#.
Use only DOUBLE float fields. Access fails when comparing with single-precision floats. The symptom usually is that new or up-
dated rows may show up as #DELETED# or that you cannot find or update rows.
If you are using Connector/ODBC to link to a table that has a BIGINT column, the results are displayed as #DELETED#. The work
around solution is:
Have one more dummy column with TIMESTAMP as the data type.
Select the Change BIGINT columns to INT option in the connection dialog in ODBC DSN Administrator.
Delete the table link from Access and re-create it.
Old records may still display as #DELETED#, but newly added/updated records are displayed properly.
If you still get the error Another user has changed your data after adding a TIMESTAMP column, the following trick
may help you:
Do not use a table data sheet view. Instead, create a form with the fields you want, and use that form data sheet view. You
should set the DefaultValue property for the TIMESTAMP column to NOW(). It may be a good idea to hide the TIMESTAMP
column from view so your users are not confused.
In some cases, Access may generate SQL statements that MySQL cannot understand. You can fix this by selecting
"Query|SQLSpecific|Pass-Through" from the Access menu.
On Windows NT, Access reports BLOB columns as OLE OBJECTS. If you want to have MEMO columns instead, you should change
BLOB columns to TEXT with ALTER TABLE.
Access cannot always handle the MySQL DATE column properly. If you have a problem with these, change the columns to DATE-
Connectors and APIs
2019
TIME.
If you have in Access a column defined as BYTE, Access tries to export this as TINYINT instead of TINYINT UNSIGNED. This
gives you problems if you have values larger than 127 in the column.
If you have very large (long) tables in Access, it might take a very long time to open them. Or you might run low on virtual memory
and eventually get an ODBC Query Failed error and the table cannot open. To deal with this, select the following options:
Return Matching Rows (2)
Allow BIG Results (8).
These add up to a value of 10 (OPTION=10).
Some external articles and tips that may be useful when using Access, ODBC and Connector/ODBC:
Read How to Trap ODBC Login Error Messages in Access
Optimizing Access ODBC Applications
Optimizing for Client/Server Performance
Tips for Converting Applications to Using ODBCDirect
Tips for Optimizing Queries on Attached SQL Tables
For a list of tools that can be used with Access and ODBC data sources, refer to converters section for list of available tools.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about using ODBC with Access in Knowledge Base
articles such as Use MySQL-Specific Syntax with Microsoft Access. To subscribe to MySQL Enterprise see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.1.7.2.1.2. Microsoft Excel and Column Types
If you have problems importing data into Microsoft Excel, particularly numerical, date, and time values, this is probably because of a
bug in Excel, where the column type of the source data is used to determine the data type when that data is inserted into a cell within the
worksheet. The result is that Excel incorrectly identifies the content and this affects both the display format and the data when it is used
within calculations.
To address this issue, use the CONCAT() function in your queries. The use of CONCAT() forces Excel to treat the value as a string,
which Excel will then parse and usually correctly identify the embedded information.
However, even with this option, some data may be incorrectly formatted, even though the source data remains unchanged. Use the
Format Cells option within Excel to change the format of the displayed information.
21.1.7.2.1.3. Microsoft Visual Basic
To be able to update a table, you must define a primary key for the table.
Visual Basic with ADO cannot handle big integers. This means that some queries like SHOW PROCESSLIST do not work properly.
The fix is to use OPTION=16384 in the ODBC connect string or to select the Change BIGINT columns to INT option in the
Connector/ODBC connect screen. You may also want to select the Return matching rows option.
MySQL Enterprise
MySQL Enterprise subscribers can find a discussion about using VBA in the Knowledge Base article, MySQL-
Specific Syntax with VBA. To subscribe to MySQL Enterprise see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.1.7.2.1.4. Microsoft Visual InterDev
If you have a BIGINT in your result, you may get the error [Microsoft][ODBC Driver Manager] Driver does not
support this parameter. Try selecting the Change BIGINT columns to INT option in the Connector/ODBC connect
Connectors and APIs
2020
screen.
21.1.7.2.1.5. Visual Objects
You should select the Don't optimize column widths option.
21.1.7.2.1.6. Microsoft ADO
When you are coding with the ADO API and Connector/ODBC, you need to pay attention to some default properties that aren't suppor-
ted by the MySQL server. For example, using the CursorLocation Property as adUseServer returns a result of 1 for the
RecordCount Property. To have the right value, you need to set this property to adUseClient, as shown in the VB code here:
Dim myconn As New ADODB.Connection
Dim myrs As New Recordset
Dim mySQL As String
Dim myrows As Long
myconn.Open "DSN=MyODBCsample"
mySQL = "SELECT * from user"
myrs.Source = mySQL
Set myrs.ActiveConnection = myconn
myrs.CursorLocation = adUseClient
myrs.Open
myrows = myrs.RecordCount
myrs.Close
myconn.Close
Another workaround is to use a SELECT COUNT(*) statement for a similar query to get the correct row count.
To find the number of rows affected by a specific SQL statement in ADO, use the RecordsAffected property in the ADO execute
method. For more information on the usage of execute method, refer to ht-
tp://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcnnexecute.asp.
For information, see ActiveX Data Objects(ADO) Frequently Asked Questions.
21.1.7.2.1.7. Using Connector/ODBC with Active Server Pages (ASP)
You should select the Return matching rows option in the DSN.
For more information about how to access MySQL via ASP using Connector/ODBC, refer to the following articles:
Using MyODBC To Access Your MySQL Database Via ASP
ASP and MySQL at DWAM.NT
A Frequently Asked Questions list for ASP can be found at ht-
tp://support.microsoft.com/default.aspx?scid=/Support/ActiveServer/faq/data/adofaq.asp.
21.1.7.2.1.8. Using Connector/ODBC with Visual Basic (ADO, DAO and RDO) and ASP
Some articles that may help with Visual Basic and ASP:
MySQL BLOB columns and Visual Basic 6 by Mike Hillyer (<[email protected]>).
How to map Visual basic data type to MySQL types by Mike Hillyer (<[email protected]>).
21.1.7.2.2. Using Connector/ODBC with Borland Applications
With all Borland applications where the Borland Database Engine (BDE) is used, follow these steps to improve compatibility:
Update to BDE 3.2 or newer.
Enable the Don't optimize column widths option in the DSN.
Connectors and APIs
2021
Enabled the Return matching rows option in the DSN.
21.1.7.2.2.1. Using Connector/ODBC with Borland Builder 4
When you start a query, you can use the Active property or the Open method. Note that Active starts by automatically issuing a
SELECT * FROM ... query. That may not be a good thing if your tables are large.
21.1.7.2.2.2. Using Connector/ODBC with Delphi
Also, here is some potentially useful Delphi code that sets up both an ODBC entry and a BDE entry for Connector/ODBC. The BDE
entry requires a BDE Alias Editor that is free at a Delphi Super Page near you. (Thanks to Bryan Brunton
<[email protected]> for this):
fReg:= TRegistry.Create;
fReg.OpenKey('\Software\ODBC\ODBC.INI\DocumentsFab', True);
fReg.WriteString('Database', 'Documents');
fReg.WriteString('Description', ' ');
fReg.WriteString('Driver', 'C:\WINNT\System32\myodbc.dll');
fReg.WriteString('Flag', '1');
fReg.WriteString('Password', '');
fReg.WriteString('Port', ' ');
fReg.WriteString('Server', 'xmark');
fReg.WriteString('User', 'winuser');
fReg.OpenKey('\Software\ODBC\ODBC.INI\ODBC Data Sources', True);
fReg.WriteString('DocumentsFab', 'MySQL');
fReg.CloseKey;
fReg.Free;
Memo1.Lines.Add('DATABASE NAME=');
Memo1.Lines.Add('USER NAME=');
Memo1.Lines.Add('ODBC DSN=DocumentsFab');
Memo1.Lines.Add('OPEN MODE=READ/WRITE');
Memo1.Lines.Add('BATCH COUNT=200');
Memo1.Lines.Add('LANGDRIVER=');
Memo1.Lines.Add('MAX ROWS=-1');
Memo1.Lines.Add('SCHEMA CACHE DIR=');
Memo1.Lines.Add('SCHEMA CACHE SIZE=8');
Memo1.Lines.Add('SCHEMA CACHE TIME=-1');
Memo1.Lines.Add('SQLPASSTHRU MODE=SHARED AUTOCOMMIT');
Memo1.Lines.Add('SQLQRYMODE=');
Memo1.Lines.Add('ENABLE SCHEMA CACHE=FALSE');
Memo1.Lines.Add('ENABLE BCD=FALSE');
Memo1.Lines.Add('ROWSET SIZE=20');
Memo1.Lines.Add('BLOBS TO CACHE=64');
Memo1.Lines.Add('BLOB SIZE=32');
AliasEditor.Add('DocumentsFab','MySQL',Memo1.Lines);
21.1.7.2.2.3. Using Connector/ODBC with C++ Builder
Tested with BDE 3.0. The only known problem is that when the table schema changes, query fields are not updated. BDE, however,
does not seem to recognize primary keys, only the index named PRIMARY, although this has not been a problem.
21.1.7.2.3. Using Connector/ODBC with ColdFusion
The following information is taken from the ColdFusion documentation:
Use the following information to configure ColdFusion Server for Linux to use the unixODBC driver with Connector/ODBC for
MySQL data sources. You can download Connector/ODBC at http://dev.mysql.com/downloads/connector/odbc/.
ColdFusion version 4.5.1 allows you to us the ColdFusion Administrator to add the MySQL data source. However, the driver is not in-
cluded with ColdFusion version 4.5.1. Before the MySQL driver appears in the ODBC data sources drop-down list, you must build and
copy the Connector/ODBC driver to /opt/coldfusion/lib/libmyodbc.so.
The Contrib directory contains the program mydsn-xxx.zip which allows you to build and remove the DSN registry file for the
Connector/ODBC driver on ColdFusion applications.
For more information and guides on using ColdFusion and Connector/ODBC, see the following external sites:
Troubleshooting Data Sources and Database Connectivity for Unix Platforms.
Connectors and APIs
2022
21.1.7.2.4. Using Connector/ODBC with OpenOffice.org
Open Office (http://www.openoffice.org) How-to: MySQL + OpenOffice. How-to: OpenOffice + MyODBC + unixODBC.
21.1.7.2.5. Using Connector/ODBC with Sambar Server
Sambar Server (http://www.sambarserver.info) How-to: MyODBC + SambarServer + MySQL.
21.1.7.2.6. Using Connector/ODBC with Pervasive Software DataJunction
You have to change it to output VARCHAR rather than ENUM, as it exports the latter in a manner that causes MySQL problems.
21.1.7.2.7. Using Connector/ODBC with SunSystems Vision
You should select the Return matching rows option.
21.1.7.3. Connector/ODBC Errors and Resolutions (FAQ)
The following section details some common errors and their suggested fix or alternative solution. If you are still experiencing problems,
use the Connector/ODBC mailing list; see Section 21.1.8.1, Connector/ODBC Community Support.
Many problems can be resolved by upgrading your Connector/ODBC drivers to the latest available release. On Windows, you should
also make sure that you have the latest versions of the Microsoft Data Access Components (MDAC) installed.
Questions
21.1.7.3.1: I have installed Connector/ODBC on Windows XP x64 Edition or Windows Server 2003 R2 x64. The installation com-
pleted successfully, but the Connector/ODBC driver does not appear in ODBC Data Source Administrator.
21.1.7.3.2: When connecting or using the TEST button in ODBC Data Source Administrator I get error 10061 (Cannot
connect to server)
21.1.7.3.3: The following error is reported when using transactions: Transactions are not enabled
21.1.7.3.4: Access reports records as #DELETED# when inserting or updating records in linked tables.
21.1.7.3.5: How do I handle Write Conflicts or Row Location errors?
21.1.7.3.6: Exporting data from Access 97 to MySQL reports a Syntax Error.
21.1.7.3.7: Exporting data from Microsoft DTS to MySQL reports a Syntax Error.
21.1.7.3.8: Using ODBC.NET with Connector/ODBC, while fetching empty string (0 length), it starts giving the SQL_NO_DATA
exception.
21.1.7.3.9: Using SELECT COUNT(*) FROM tbl_name within Visual Basic and ASP returns an error.
21.1.7.3.10: Using the AppendChunk() or GetChunk() ADO methods, the Multiple-step operation generated
errors. Check each status value error is returned.
21.1.7.3.11: Access Returns Another user had modified the record that you have modified while editing
records on a Linked Table.
21.1.7.3.12: When linking an application directly to the Connector/ODBC library under Unix/Linux, the application crashes.
21.1.7.3.13: Applications in the Microsoft Office suite are unable to update tables that have DATE or TIMESTAMP columns.
21.1.7.3.14: When connecting Connector/ODBC 5.x (Beta) to a MySQL 4.x server, the error 1044 Access denied for
user 'xxx'@'%' to database 'information_schema' is returned.
21.1.7.3.15: When calling SQLTables, the error S1T00 is returned, but I cannot find this in the list of error numbers for Connect-
or/ODBC.
21.1.7.3.16: When linking to tables in Access 2000 and generating links to tables programmatically, rather than through the table de-
Connectors and APIs
2023
signer interface, you may get errors about tables not existing.
21.1.7.3.17: When I try to use batched statements, the excution of the batched statements fails.
21.1.7.3.18: When connecting to a MySQL server using ADODB and Excel, occasionally the application fails to communicate with
the server and the error Got an error reading communication packets appears in the error log.
21.1.7.3.19: When using some applications to access a MySQL server using C/ODBC and outer joins, an error is reported regarding
the Outer Join Escape Sequence.
21.1.7.3.20: I can correctly store extended characters in the database (Hebrew/CJK) using C/ODBC 5.1, but when I retrieve the data,
the text is not formatted correctly and I get garbled characters.
21.1.7.3.21: I have a duplicate MySQL Connector/ODBC entry within my INSTALLED PROGRAMS list, but I cannot delete one of
them.
21.1.7.3.22: When submitting queries with parameter binding using UPDATE, my field values are being truncated to 255 characters.
21.1.7.3.23: Is it possible to disable data-at-execution using a flag?
Questions and Answers
21.1.7.3.1: I have installed Connector/ODBC on Windows XP x64 Edition or Windows Server 2003 R2 x64. The installation
completed successfully, but the Connector/ODBC driver does not appear in ODBC Data Source Administrator.
This is not a bug, but is related to the way Windows x64 editions operate with the ODBC driver. On Windows x64 editions, the Con-
nector/ODBC driver is installed in the %SystemRoot%\SysWOW64 folder. However, the default ODBC Data Source Admin-
istrator that is available through the Administrative Tools or Control Panel in Windows x64 Editions is located in the
%SystemRoot%\system32 folder, and only searches this folder for ODBC drivers.
On Windows x64 editions, you should use the ODBC administration tool located at %SystemRoot%\SysWOW64\odbcad32.exe,
this will correctly locate the installed Connector/ODBC drivers and enable you to create a Connector/ODBC DSN.
This issue was originally reported as Bug#20301.
21.1.7.3.2: When connecting or using the TEST button in ODBC Data Source Administrator I get error 10061 (Cannot
connect to server)
This error can be raised by a number of different issues, including server problems, network problems, and firewall and port blocking
problems. For more information, see Section B.1.2.2, Can't connect to [local] MySQL server.
21.1.7.3.3: The following error is reported when using transactions: Transactions are not enabled
This error indicates that you are trying to use transactions with a MySQL table that does not support transactions. Transactions are sup-
ported within MySQL when using the InnoDB database engine. In versions of MySQL before Mysql 5.1 you may also use the BDB en-
gine.
You should check the following before continuing:
Verify that your MySQL server supports a transactional database engine. Use SHOW ENGINES to obtain a list of the available en-
gine types.
Verify that the tables you are updating use a transaction database engine.
Ensure that you have not enabled the disable transactions option in your DSN.
21.1.7.3.4: Access reports records as #DELETED# when inserting or updating records in linked tables.
If the inserted or updated records are shown as #DELETED# in the access, then:
If you are using Access 2000, you should get and install the newest (version 2.6 or higher) Microsoft MDAC (Microsoft Data
Access Components) from http://support.microsoft.com/kb/110093. This fixes a bug in Access that when you export data to
Connectors and APIs
2024
MySQL, the table and column names aren't specified.
You should also get and apply the Microsoft Jet 4.0 Service Pack 5 (SP5) which can be found at ht-
tp://support.microsoft.com/default.aspx?scid=kb;EN-US;q239114. This fixes some cases where columns are marked as
#DELETED# in Access.
For all versions of Access, you should enable the Connector/ODBC Return matching rows option. For Access 2.0, you
should additionally enable the Simulate ODBC 1.0 option.
You should have a timestamp in all tables that you want to be able to update.
You should have a primary key in the table. If not, new or updated rows may show up as #DELETED#.
Use only DOUBLE float fields. Access fails when comparing with single-precision floats. The symptom usually is that new or up-
dated rows may show up as #DELETED# or that you cannot find or update rows.
If you are using Connector/ODBC to link to a table that has a BIGINT column, the results are displayed as #DELETED. The work
around solution is:
Have one more dummy column with TIMESTAMP as the data type.
Select the Change BIGINT columns to INT option in the connection dialog in ODBC DSN Administrator.
Delete the table link from Access and re-create it.
Old records still display as #DELETED#, but newly added/updated records are displayed properly.
21.1.7.3.5: How do I handle Write Conflicts or Row Location errors?
If you see the following errors, select the Return Matching Rows option in the DSN configuration dialog, or specify OPTION=2,
as the connection parameter:
Write Conflict. Another user has changed your data.
Row cannot be located for updating. Some values may have been changed
since it was last read.
21.1.7.3.6: Exporting data from Access 97 to MySQL reports a Syntax Error.
This error is specific to Access 97 and versions of Connector/ODBC earlier than 3.51.02. Update to the latest version of the Connector/
ODBC driver to resolve this problem.
21.1.7.3.7: Exporting data from Microsoft DTS to MySQL reports a Syntax Error.
This error occurs only with MySQL tables using the TEXT or VARCHAR data types. You can fix this error by upgrading your Connect-
or/ODBC driver to version 3.51.02 or higher.
21.1.7.3.8: Using ODBC.NET with Connector/ODBC, while fetching empty string (0 length), it starts giving the
SQL_NO_DATA exception.
You can get the patch that addresses this problem from http://support.microsoft.com/default.aspx?scid=kb;EN-US;q319243.
21.1.7.3.9: Using SELECT COUNT(*) FROM tbl_name within Visual Basic and ASP returns an error.
This error occurs because the COUNT(*) expression is returning a BIGINT, and ADO cannot make sense of a number this big. Select
the Change BIGINT columns to INT option (option value 16384).
21.1.7.3.10: Using the AppendChunk() or GetChunk() ADO methods, the Multiple-step operation generated
errors. Check each status value error is returned.
The GetChunk() and AppendChunk() methods from ADO doesn't work as expected when the cursor location is specified as ad-
UseServer. On the other hand, you can overcome this error by using adUseClient.
A simple example can be found from http://www.dwam.net/iishelp/ado/docs/adomth02_4.htm
21.1.7.3.11: Access Returns Another user had modified the record that you have modified while editing re-
Connectors and APIs
2025
cords on a Linked Table.
In most cases, this can be solved by doing one of the following things:
Add a primary key for the table if one doesn't exist.
Add a timestamp column if one doesn't exist.
Only use double-precision float fields. Some programs may fail when they compare single-precision floats.
If these strategies do not help, you should start by making a log file from the ODBC manager (the log you get when requesting logs
from ODBCADMIN) and a Connector/ODBC log to help you figure out why things go wrong. For instructions, see Section 21.1.4.8,
Getting an ODBC Trace File.
21.1.7.3.12: When linking an application directly to the Connector/ODBC library under Unix/Linux, the application crashes.
Connector/ODBC 3.51 under Unix/Linux is not compatible with direct application linking. You must use a driver manager, such as
iODBC or unixODBC to connect to an ODBC source.
21.1.7.3.13: Applications in the Microsoft Office suite are unable to update tables that have DATE or TIMESTAMP columns.
This is a known issue with Connector/ODBC. You must ensure that the field has a default value (rather than NULL and that the default
value is nonzero (that is, the default value is not 0000-00-00 00:00:00).
21.1.7.3.14: When connecting Connector/ODBC 5.x (Beta) to a MySQL 4.x server, the error 1044 Access denied for
user 'xxx'@'%' to database 'information_schema' is returned.
Connector/ODBC 5.x is designed to work with MySQL 5.0 or later, taking advantage of the INFORMATION_SCHEMA database to de-
termine data definition information. Support for MySQL 4.1 is planned for the final release.
21.1.7.3.15: When calling SQLTables, the error S1T00 is returned, but I cannot find this in the list of error numbers for Con-
nector/ODBC.
The S1T00 error indicates that a general timeout has occurred within the ODBC system and is not a MySQL error. Typically it indic-
ates that the connection you are using is stale, the server is too busy to accept your request or that the server has gone away.
21.1.7.3.16: When linking to tables in Access 2000 and generating links to tables programmatically, rather than through the ta-
ble designer interface, you may get errors about tables not existing.
There is a known issue with a specific version of the msjet40.dll that exhibits this issue. The version affected is 4.0.9025.0. Revert-
ing to an older version will enable you to create the links. If you have recently updated your version, check your WINDOWS directory for
the older version of the file and copy it to the drivers directory.
21.1.7.3.17: When I try to use batched statements, the excution of the batched statements fails.
Batched statement support was added in 3.51.18. Support for batched statements is not enabled by default. You must enable option
FLAG_MULTI_STATEMENTS, value 67108864, or select the ALLOW MULTIPLE STATEMENTS flag within a GUI configuration.
21.1.7.3.18: When connecting to a MySQL server using ADODB and Excel, occasionally the application fails to communicate
with the server and the error Got an error reading communication packets appears in the error log.
This error may be related to Keyboard Logger 1.1 from PanteraSoft.com, which is known to interfere with the network communication
between MySQL Connector/ODBC and MySQL.
21.1.7.3.19: When using some applications to access a MySQL server using C/ODBC and outer joins, an error is reported re-
garding the Outer Join Escape Sequence.
This is a known issue with MySQL Connector/ODBC which is not correctly parsing the "Outer Join Escape Sequence", as per the specs
at Microsoft ODBC Specs. Currently, Connector/ODBC will return value > 0 when asked for SQL_OJ_CAPABILITIES even though
no parsing takes place in the driver to handle the outer join escape sequence.
21.1.7.3.20: I can correctly store extended characters in the database (Hebrew/CJK) using C/ODBC 5.1, but when I retrieve the
data, the text is not formatted correctly and I get garbled characters.
When using ASP and UTF8 characters you should add the following to your ASP files to ensure that the data returned is correctly en-
Connectors and APIs
2026
coded:
Response.CodePage = 65001
Response.CharSet = "utf-8"
21.1.7.3.21: I have a duplicate MySQL Connector/ODBC entry within my INSTALLED PROGRAMS list, but I cannot delete one of
them.
This problem can occur when you upgrade an existing Connector/ODBC installation, rather than removing and then installing the up-
dated version.
Warning
To fix the problem you should use any working uninstallers to remove existing installations and then may have to edit the
contents of the registry. Make sure you have a backup of your registry information before attempting any editing of the re-
gistry contents.
21.1.7.3.22: When submitting queries with parameter binding using UPDATE, my field values are being truncated to 255 charac-
ters.
You should ensure that the FLAG_BIG_PACKETS option is set for your connection. This removes the 255 character limitation on
bound parameters.
21.1.7.3.23: Is it possible to disable data-at-execution using a flag?
If you do not wish to use data-at-execution, simply remove the corresponding calls. For example:
SQLLEN ylen = SQL_LEN_DATA_AT_EXEC(10);
SQLBindCol(hstmt,2,SQL_C_BINARY, buf, 10, &ylen);
Would become:
SQLBindCol(hstmt,2,SQL_C_BINARY, buf, 10, NULL);
Note that in the call to SQLBindCol(), &ylen has been replaced by NULL.
For further information please refer to the MSDN documentation for SQLBindCol().
21.1.8. Connector/ODBC Support
There are many different places where you can get support for using Connector/ODBC. You should always try the Connector/ODBC
Mailing List or Connector/ODBC Forum. See Section 21.1.8.1, Connector/ODBC Community Support, for help before reporting a
specific bug or issue to MySQL.
21.1.8.1. Connector/ODBC Community Support
Sun Microsystems, Inc. provides assistance to the user community by means of its mailing lists. For Connector/ODBC-related issues,
you can get help from experienced users by using the <[email protected]> mailing list. Archives are available online at
http://lists.mysql.com/myodbc.
For information about subscribing to MySQL mailing lists or to browse list archives, visit http://lists.mysql.com/. See Section 1.5.1,
MySQL Mailing Lists.
Community support from experienced users is also available through the ODBC Forum. You may also find help from other users in the
other MySQL Forums, located at http://forums.mysql.com. See Section 1.5.2, MySQL Community Support at the MySQL Forums.
21.1.8.2. How to Report Connector/ODBC Problems or Bugs
If you encounter difficulties or problems with Connector/ODBC, you should start by making a log file from the ODBC Manager (the
log you get when requesting logs from ODBC ADMIN) and Connector/ODBC. The procedure for doing this is described in Sec-
tion 21.1.4.8, Getting an ODBC Trace File.
Check the Connector/ODBC trace file to find out what could be wrong. You should be able to determine what statements were issued
by searching for the string >mysql_real_query in the myodbc.log file.
Connectors and APIs
2027
You should also try issuing the statements from the mysql client program or from admndemo. This helps you determine whether the
error is in Connector/ODBC or MySQL.
If you find out something is wrong, please only send the relevant rows (maximum 40 rows) to the myodbc mailing list. See Sec-
tion 1.5.1, MySQL Mailing Lists. Please never send the whole Connector/ODBC or ODBC log file!
You should ideally include the following information with the email:
Operating system and version
Connector/ODBC version
ODBC Driver Manager type and version
MySQL server version
ODBC trace from Driver Manager
Connector/ODBC log file from Connector/ODBC driver
Simple reproducible sample
Remember that the more information you can supply to us, the more likely it is that we can fix the problem!
Also, before posting the bug, check the MyODBC mailing list archive at http://lists.mysql.com/myodbc.
If you are unable to find out what is wrong, the last option is to create an archive in tar or Zip format that contains a Connector/ODBC
trace file, the ODBC log file, and a README file that explains the problem. You can send this to ftp://ftp.mysql.com/pub/mysql/upload/.
Only MySQL engineers have access to the files you upload, and we are very discreet with the data.
If you can create a program that also demonstrates the problem, please include it in the archive as well.
If the program works with another SQL server, you should include an ODBC log file where you perform exactly the same SQL state-
ments so that we can compare the results between the two systems.
Remember that the more information you can supply to us, the more likely it is that we can fix the problem.
21.1.8.3. How to Submit a Connector/ODBC Patch
You can send a patch or suggest a better solution for any existing code or problems by sending a mail message to
<[email protected]>.
21.1.8.4. Connector/ODBC Change History
The Connector/ODBC Change History (Changelog) is located with the main Changelog for MySQL. See Section C.3, MySQL Con-
nector/ODBC (MyODBC) Change History.
21.1.8.5. Credits
These are the developers that have worked on the Connector/ODBC and Connector/ODBC 3.51 Drivers from MySQL AB.
Michael (Monty) Widenius
Venu Anuganti
Peter Harvey
21.2. MySQL Connector/NET
Connector/NET enables developers to easily create .NET applications that require secure, high-performance data connectivity with
MySQL. It implements the required ADO.NET interfaces and integrates into ADO.NET aware tools. Developers can build applications
Connectors and APIs
2028
using their choice of .NET languages. Connector/NET is a fully managed ADO.NET driver written in 100% pure C#.
Connector/NET includes full support for:
MySQL 6.0 features
MySQL 5.1 features
MySQL 5.0 features (such as stored procedures)
MySQL 4.1 features (server-side prepared statements, Unicode, and shared memory access, and so forth)
Large-packet support for sending and receiving rows and BLOBs up to 2 gigabytes in size.
Protocol compression which allows for compressing the data stream between the client and server.
Support for connecting using TCP/IP sockets, named pipes, or shared memory on Windows.
Support for connecting using TCP/IP sockets or Unix sockets on Unix.
Support for the Open Source Mono framework developed by Novell.
Fully managed, does not utilize the MySQL client library.
This document is intended as a user's guide to Connector/NET and includes a full syntax reference. Syntax information is also included
within the Documentation.chm file included with the Connector/NET distribution.
If you are using MySQL 5.0 or later, and Visual Studio as your development environment, you may want also want to use the MySQL
Visual Studio Plugin. The plugin acts as a DDEX (Data Designer Extensibility) provider, enabling you to use the data design tools with-
in Visual Studio to manipulate the schema and objects within a MySQL database. For more information, see Section 21.2.3, Visual
Studio User Guide.
Note
Connector/NET 5.1.2 and later include the Visual Studio Plugin by default.
Key topics:
For connection string properties when using the MySqlConnection class, see Section 21.2.4.5, Connector/NET Connection
String Options Reference.
21.2.1. Connector/NET Versions
There are several versions of Connector/NET available:
Connector/NET 1.0 includes support for MySQL 4.0, and MySQL 5.0 features, and full compatibility with the ADO.NET driver in-
terface.
Connector/NET 5.0 includes support for MySQL 4.0, MySQL 4.1, MySQL 5.0 and MySQL 5.1 features. Connector/NET 5.0 also
includes full support for the ADO.Net 2.0 interfaces and subclasses, includes support for the usage advisor and performance monitor
(PerfMon) hooks.
Connector/NET 5.1 includes support for MySQL 4.0, MySQL 5.0, MySQL 5.1 and MySQL 6.0 (Falcon Preview) features. Con-
nector/NET 5.1 also includes support for a new membership/role provider, Compact Framework 2.0, a new stored procedure parser
and improvements to GetSchema. Connector/NET 5.1 also includes the Visual Studio Plugin as a standard installable component.
Connector/NET 5.2 includes support for MySQL 4.0, MySQL 5.0, MySQL 5.1 and MySQL 6.0 (Falcon Preview) features. Con-
nector/NET 5.2 also includes support for a new membership/role provider, Compact Framework 2.0, a new stored procedure parser
and improvements to GetSchema. Connector/NET 5.2 also includes the Visual Studio Plugin as a standard installable component.
Connector/NET 6.0 includes support for MySQL 4.0, MySQL 5.0, MySQL 5.1 and MySQL 6.0. Connector/NET 6.0 is currently
Connectors and APIs
2029
available as an Alpha release.
The latest source code for Connector/NET can be downloaded from the MySQL public Subversion server. For further details see Sec-
tion 21.2.2.3, Installing Connector/NET from the source code.
The following table shows the .NET Framework version required, and MySQL Server version supported by Connector/NET:
Connector/NET version ADO.NET version supported .NET Framework version re-
quired
MySQL Server version sup-
ported
1.0 1.x 1.x 4.0, 5.0
5.0 1.x+ 1.x+ 4.0, 5.0
5.1 1.x+ 1.x+ 4.0, 5.0, 5.1, 6.0
5.2 1.x+ 1.x+ 4.0, 5.0, 5.1, 6.0
6.0 2.x+ 2.x+ 4.0, 5.0, 5.1, 6.0
Note
Version numbers for MySQL products are formatted as X.X.X. However, Windows tools (Control Panel, properties dis-
play) may show the version numbers as XX.XX.XX. For example, the official MySQL formatted version number 5.0.9
may be displayed by Windows tools as 5.00.09. The two versions are the same; only the number display format is differ-
ent.
21.2.2. Connector/NET Installation
Connector/NET runs on any platform that supports the .NET framework. The .NET framework is primarily supported on recent ver-
sions of Microsoft Windows, and is supported on Linux through the Open Source Mono framework (see
http://www.mono-project.com).
Connector/NET is available for download from http://dev.mysql.com/downloads/connector/net/5.2.html.
21.2.2.1. Installing Connector/NET on Windows
On Windows, installation is supported either through a binary installation process or by downloading a Zip file with the Connector/NET
components.
Before installing, you should ensure that your system is up to date, including installing the latest version of the .NET Framework.
21.2.2.1.1. Installing Connector/NET using the Installer
Using the installer is the most straightforward method of installing Connector/NET on Windows and the installed components include
the source code, test code and full reference documentation.
Connector/NET is installed through the use of a Windows Installer (.msi) installation package, which can be used to install Connector/
NET on all Windows operating systems. The MSI package in contained within a ZIP archive named
mysql-connector-net-version.zip, where version indicates the Connector/NET version.
To install Connector/NET:
1. Double click on the MSI installer file extracted from the Zip you downloaded. Click NEXT to start the installation.
Connectors and APIs
2030
2. You must choose the type of installation that you want to perform.
Connectors and APIs
2031
For most situations, the Typical installation will be suitable. Click the TYPICAL button and proceed to Step 5. A Complete installa-
tion installs all the available files. To conduct a Complete installation, click the COMPLETE button and proceed to step 5. If you
want to customize your installation, including choosing the components to install and some installation options, click the CUSTOM
button and proceed to Step 3.
The Connector/NET installer will register the connector within the Global Assembly Cache (GAC) - this will make the Connector/
NET component available to all applications, not just those where you explicitly reference the Connector/NET component. The in-
staller will also create the necessary links in the Start menu to the documentation and release notes.
3. If you have chosen a custom installation, you can select the individual components that you want to install, including the core in-
terface component, supporting documentation (a CHM file) samples and examples and the source code. Select the items, and their
installation level, and then click NEXT to continue the installation.
Note
For Connector/NET 1.0.8 or lower and Connector 5.0.4 and lower the installer will attempt to install binaries for both 1.x
and 2.x of the .NET Framework. If you only have one version of the framework installed, the connector installation may
fail. If this happens, you can choose the framework version to be installed through the custom installation step.
Connectors and APIs
2032
4. You will be given a final opportunity to confirm the installation. Click INSTALL to copy and install the files onto your machine.
Connectors and APIs
2033
5. Once the installation has been completed, click FINISH to exit the installer.
Connectors and APIs
2034
Unless you choose otherwise, Connector/NET is installed in C:\Program Files\MySQL\MySQL Connector Net X.X.X,
where X.X.X is replaced with the version of Connector/NET you are installing. New installations do not overwrite existing versions of
Connector/NET.
Depending on your installation type, the installed components will include some or all of the following components:
bin - Connector/NET MySQL libraries for different versions of the .NET environment.
docs - contains a CHM of the Connector/NET documentation.
samples - sample code and applications that use the Connector/NET component.
src - the source code for the Connector/NET component.
You may also use the /quiet or /q command-line option with the msiexec tool to install the Connector/NET package automatically
(using the default options) with no notification to the user. Using this method the user cannot select options. Additionally, no prompts,
messages or dialog boxes will be displayed.
C:\> msiexec /package conector-net.msi /quiet
To provide a progress bar to the user during automatic installation, use the /passive option.
21.2.2.1.2. Installing Connector/NET using the Zip packages
Connectors and APIs
2035
If you are having problems running the installer, you can download a Zip file without an installer as an alternative. That file is called
mysql-connector-net-version-noinstall.zip. Once downloaded, you can extract the files to a location of your choice.
The file contains the following directories:
bin - Connector/NET MySQL libraries for different versions of the .NET environment.
Docs - contains a CHM of the Connector/NET documentation.
Samples - sample code and applications that use the Connector/NET component.
Connector/NET 6.0.x has a different directory structure:
Assemblies - contains a collection of DLLs that make up the connector functionality.
Documentation - contains the Connector/NET documentation as a CHM file.
Samples - sample code and applications that use the Connector/NET component.
There is also another Zip file available for download called mysql-connector-net-version-src.zip. This file contains the
source code distribution.
The file contains the following directories:
Documentation - This folder contains the source files to build the documentation into the compiled HTML (CHM) format.
Installer - This folder contains the source files to build the Connector/NET installer program.
MySql.Data - This folder contains the source files for the core data provider.
MySql.VisualStudio - This folder contains the source files for the Microsoft Visual Studio extensions.
MySql.Web - This folder contains the source files for the web providers. This includes code for the membership provider, role pro-
vider and profile provider. These are used in ASP.NET web sites.
Samples - This folder contains the source files for several example applications.
Tests - Ths folder contains a spreadsheet listing test cases.
VisualStudio - Contains resources used by the Visual Studio plug in.
Finally, you need to ensure that MySql.Data.dll is accessible to your program at build time (and run time). If using Microsoft
Visual Studio you will need to add MySql.Data as a Reference to your project.
21.2.2.2. Installing Connector/NET on Unix with Mono
There is no installer available for installing the Connector/NET component on your Unix installation. Before installing, please ensure
that you have a working Mono project installation. You can test whether your system has Mono installed by typing:
shell> mono --version
The version of the Mono JIT compiler will be displayed.
To compile C# source code you will also need to make sure a Mono C# compiler, is installed. Note that there are two Mono C# com-
pilers available, mcs, which accesses the 1.0-profile libraries, and gmcs, which acesses the 2.0-profile libraries.
To install Connector/NET on Unix/Mono:
1. Download the mysql-connector-net-version-noinstall.zip and extract the contents to a directory of your choice,
Connectors and APIs
2036
for example: ~/connector-net/.
2. In the directory where you unzipped the connector to, change into the bin directory. Ensure the file MySql.Data.dll is
present.
3. You must register the Connector/NET component, MySql.Data, in the Global Assembly Cache (GAC). In the current directory
enter the gacutil command:
root-shell> gacutil /i MySql.Data.dll
This will register MySql.Data into the GAC. You can check this by listing the contents of /usr/lib/mono/gac, where you
will find MySql.Data if the registration has been successful.
You are now ready to compile your application. You must ensure that when you compile your application you include the Connector/
NET component using the -r: command-line option. For example:
shell> gmcs -r:System.dll -r:System.Data.dll -r:MySql.Data.dll HelloWorld.cs
Note, the assemblies that need to be referenced will depend on the requirements of the application, but applications using Connector/
NET will need to provide -r:MySql.Data as a minimum.
You can further check your installation by running the compiled program, for example:
shell> mono HelloWorld.exe
21.2.2.3. Installing Connector/NET from the source code
Caution
You should read this section only if you are interested in helping us test our new code. If you just want to get Connector/
NET up and running on your system, you should use a standard release distribution.
Obtaining the source code
To be able to access the Connector/NET source tree, you must have Subversion installed. Subversion is freely available from ht-
tp://subversion.tigris.org/.
The most recent development source tree is available from our public Subversion trees at ht-
tp://dev.mysql.com/tech-resources/sources.html.
To checkout out the Connector/NET sources, change to the directory where you want the copy of the Connector/NET tree to be stored,
then use the following command:
shell> svn co http://svn.mysql.com/svnpublic/connector-net
Source packages are also available on the downloads page.
Building the source code on Windows
The following procedure can be used to build the connector on Microsoft Windows.
Obtain the source code, either from the Subversion server, or through one of the prepared source code packages.
Navigate to the root of the source code tree.
A Microsoft Visual Studio 2005 solution file is available to build the connector, this is called MySQL-VS2005.sln. Click on this
file to load the solution into Visual Studio.
Select BUILD, BUILD SOLUTION from the main menu to build the solution.
Building the source code on Unix
Connectors and APIs
2037
Support for building Connector/NET on Mono/Unix is currently not available.
21.2.3. Visual Studio User Guide
21.2.3.1. Making a connection
Once the connector is installed, you can use it to create, modify, and delete connections to MySQL databases. To create a connection
with a MySQL database, perform the following steps:
Start Visual Studio, and open the Server Explorer window (VIEW, SERVER EXPLORER option in the main Visual Studio menu, or
Ctrl+W, L hot keys).
Right-click on the Data Connections node, and choose the ADD CONNECTION... menu item.
Add Connection dialog opens. Press the CHANGE button to choose MySQL Database as a data source.
Figure 21.1. Add Connection Context Menu
Change Data Source dialog opens. Choose MySQL Database in the list of data sources (or the <other> option, if MySQL Data-
base is absent), and then choose .NET Framework Data Provider for MySQL in the combo box of data providers.
Figure 21.2. Choose Data Source
Connectors and APIs
2038
Input the connection settings: the server host name (for example, localhost if the MySQL server is installed on the local machine),
the user name, the password, and the default schema name. Note that you must specify the default schema name to open the connec-
tion.
Figure 21.3. Add Connection Dialog
Connectors and APIs
2039
You can also set the port to connect with the MySQL server by pressing the ADVANCED button. To test connection with the MySQL
server, set the server host name, the user name, and the password, and press the TEST CONNECTION button. If the test succeeds, the
success confirmation dialog opens.
After you set all settings and test the connection, press OK. The newly created connection is displayed in Server Explorer. Now you
can work with the MySQL server through standard Server Explorer GUI.
Figure 21.4. New Data Connection
Connectors and APIs
2040
After the connection is successfully established, all settings are saved for future use. When you start Visual Studio for the next time, just
open the connection node in Server Explorer to establish a connection to the MySQL server again.
To modify and delete a connection, use the Server Explorer context menu for the corresponding node. You can modify any of the set-
tings just by overwriting the existing values with new ones. Note that the connection may be modified or deleted only if no active editor
for its objects is opened: otherwise you may loose your data.
21.2.3.2. Editing Tables
Connector/Net contains a table editor, which enables the visual creation and modification of tables.
The Table Designer can be accessed through a mouse action on table-type node of Server Explorer. To create a new table, right-click on
the TABLES node (under the connection node) and choose the CREATE TABLE command from the context menu.
To modify an existing table, double-click on the node of the table you wish to modify, or right-click on this node and choose the
DESIGN item from the context menu. Either of the commands opens the Table Designer.
The table editor is implemented in the manner of the well-known Query Browser Table Editor, but with minor differences.
Figure 21.5. Editing New Table
Connectors and APIs
2041
Table Designer consists of the following parts:
Columns Editor - a data grid on top of the Table Designer. Use the Columns grid for column creation, modification, and deletion.
Indexes tab - a tab on bottom of the Table Designer. Use the Indexes tab for indexes management.
Foreign Keys tab - a tab on bottom of the Table Designer. Use the Foreign Keys tab for foreign keys management.
Column Details tab - a tab on bottom of the Table Designer. Use the Column Details tab to set advanced column options.
Properties window - a standard Visual Studio Properties window, where the properties of the edited table are displayed. Use the
Properties window to set the table properties.
Each of these areas is discussed in more detail in subsequent sections.
To save changes you have made in the Table Designer, use either SAVE or SAVE ALL button of the Visual Studio main toolbar, or just
press Ctrl+S. If you have not already named the table you will be prompted to do so.
Figure 21.6. Choose Table Name
Connectors and APIs
2042
Once created you can view the table in the Server Explorer.
Figure 21.7. Newly Created Table
The Table Designer main menu allows you to set a Primary Key column, edit Relationships such as Foreign Keys, and create Indexes.
Figure 21.8. Table Designer Main Menu
Connectors and APIs
2043
21.2.3.2.1. Column Editor
You can use the Column Editor to set or change the name, data type, default value, and other properties of a table column. To set the fo-
cus to a needed cell of a grid, use the mouse click. Also you can move through the grid using Tab and Shift+Tab keys.
To set or change the name, data type, default value and comment of a column, activate the appropriate cell and type the desired value.
To set or unset flag-type column properties (NOT NULL, auto incremented, flags), check or uncheck the corresponding check boxes.
Note that the set of column flags depends on its data type.
To reorder columns, index columns or foreign key columns in the Column Editor, select the whole column you wish to reorder by click-
ing on the selector column on the left of the column grid. Then move the column by using Ctrl+Up (to move the column up) or
Ctrl+Down (to move the column down) keys.
To delete a column, select it by clicking on the selector column on the left of the column grid, then press the Delete button on a key-
board.
21.2.3.2.2. Editing Indexes
Indexes management is performed via the INDEXES/KEYS dialog.
To add an index, select TABLE DESIGNER, INDEXES/KEYS... from the main menu, and click ADD to add a new index. You can then set
the index name, index kind, index type, and a set of index columns.
Figure 21.9. Indexes Dialog
Connectors and APIs
2044
To remove an index, select it in the list box on the left, and click the DELETE button.
To change index settings, select the needed index in the list box on the left. The detailed information about the index is displayed in the
panel on the right hand side. Change the desired values.
21.2.3.2.3. Editing Foreign Keys
Foreign Keys management is performed via the FOREIGN KEY RELATIONSHIPS dialog.
To add a foreign key, select TABLE DESIGNER, RELATIONSHIPS... from the main menu. This displays the FOREIGN KEY RELATIONSHIP
dialog. Click ADD. You can then set the foreign key name, referenced table name, foreign key columns, and actions upon update and
delete.
To remove a foreign key, select it in the list box on the left, and click the DELETE button.
To change foreign key settings, select the required foreign key in the list box on the left. The detailed information about the foreign key
is displayed in the right hand panel. Change the desired values.
Figure 21.10. Foreign Key Relationships Dialog
21.2.3.2.4. Column Properties
The COLUMN PROPERTIES tab can be used to set column options. In addition to the general column properties presented in the Column
Editor, in the COLUMN PROPERTIES tab you can set additional properties such as Character Set, Collation and Precision.
21.2.3.2.5. Table Properties
To bring up Table Properties select the table and right click to activate the context menu. Select PROPERTIES. The TABLE PROPERTIES
dockable window will be displayed.
Connectors and APIs
2045
Figure 21.11. Table Properties Menu Item
The following table properties can be set:
Auto Increment
Average Row Length
Character Set
Collation
Comment
Data Directory
Index Directory
Maximum Rows
Minimum Rows
Name
Row Format
Schema
Storage Engine
The property Schema is read only.
Connectors and APIs
2046
Figure 21.12. Table Properties
21.2.3.3. Editing Views
To create a new view, right click the Views node under the connection node in Server Explorer. From the node's context menu, choose
the CREATE VIEW command. This command opens the SQL Editor.
Figure 21.13. Editing View SQL
You can then enter the SQL for your view.
Figure 21.14. View SQL Added
Connectors and APIs
2047
To modify an existing view, double click on a node of the view you wish to modify, or right click on this node and choose the ALTER
VIEW command from a context menu. Either of the commands opens the SQL Editor.
All other view properties can be set in the Properties window. These properties are:
Catalog
Check Option
Definer
Definition
Definer
Is Updateable
Name
Schema
Security Type
Some of these properties can have arbitrary text values, others accept values from a predefined set. In the latter case you set the desired
value with an embedded combobox.
The properties Is Updatable and Schema are readonly.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S.
Figure 21.15. View SQL Saved
Connectors and APIs
2048
21.2.3.4. Editing Stored Procedures and Functions
To create a new stored procedure, right-click on the STORED PROCEDURES node under the connection node in Server Explorer. From
the node's context menu, choose the CREATE ROUTINE command. This command opens the SQL Editor.
Figure 21.16. Edit Stored Procedure SQL
To create a new stored function, right-click on the FUNCTIONS node under the connection node in Server Explorer. From the node's
context menu, choose the CREATE ROUTINE command.
To modify an existing stored routine (procedure or function), double-click on the node of the routine you wish to modify, or right-click
on this node and choose the ALTER ROUTINE command from the context menu. Either of the commands opens the SQL Editor.
To create or alter the routine definition using SQL Editor, type this definition in the SQL Editor using standard SQL. All other routine
properties can be set in the Properties window. These properties are:
Body
Catalog
Comment
Creation Time
Data Access
Definer
Definition
External Name
External Language
Is Deterministic
Last Modified
Name
Parameter Style
Returns
Schema
Security Type
Specific Name
Connectors and APIs
2049
SQL Mode
SQL Path
Type
Some of these properties can have arbitrary text values, others accept values from a predefined set. In the latter case set the desired
value using the embedded combo box.
You can also set all the options directly in the SQL Editor, using the standard CREATE PROCEDURE or CREATE FUNCTION state-
ment. However, it is recommended to use the Properties window instead.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S.
Figure 21.17. Stored Procedure SQL Saved
21.2.3.5. Editing Triggers
To create a new trigger, right-click on the node of the table, for which you wish to add a trigger. From the node's context menu, choose
the CREATE TRIGGER command. This command opens the SQL Editor.
To modify an existing trigger, double-click on the node of the trigger you wish to modify, or right-click on this node and choose the
ALTER TRIGGER command from the context menu. Either of the commands opens the SQL Editor.
To create or alter the trigger definition using SQL Editor, type the trigger statement in the SQL Editor using standard SQL.
Note
You should enter only the trigger statement, that is, the part of the CREATE TRIGGER query that is placed after the FOR
EACH ROW clause.
All other trigger properties are set in the Properties window. These properties are:
Definer
Event Manipulation
Name
Timing
Some of these properties can have arbitrary text values, others accept values from a predefined set. In the latter case set the desired
value using the embedded combo box.
The properties Event Table, Schema, and Server in the Properties window are read only.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. Before
changes are saved, you will be asked to confirm the execution of the corresponding SQL query in a confirmation dialog.
Connectors and APIs
2050
21.2.3.6. Editing User Defined Functions (UDF)
To create a new User Defined Function (UDF), right-click on the UDFS node under the connection node in Server Explorer. From the
node's context menu, choose the CREATE UDF command. This command opens the UDF Editor.
To modify an existing UDF, double-click on the node of the UDF you wish to modify, or right-click on this node and choose the ALTER
UDF command from the context menu. Either of the commands opens the UDF Editor.
The UDF editor allows you to set the following properties:
Name
So-name (DLL name)
Return type
Is Aggregate
There are text fields for both names, a combo box for the return type, and a check box to indicate if the UDF is aggregate. All these op-
tions are also accessible via the Properties window.
The property Server in the Properties window is read only.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. Before
changes are saved, you will be asked to confirm the execution of the corresponding SQL query in a confirmation dialog.
21.2.3.7. Cloning Database Objects
Tables, views, stored procedures, and functions can be cloned using the appropriate Clone command from the context menu: CLONE
TABLE, CLONE VIEW, CLONE ROUTINE. The clone commands open the corresponding editor for a new object: the TABLE EDITOR for
cloning a table, and the SQL EDITOR for cloning a view or a routine.
The editor is filled with values of the original object. You can modify these values in a usual manner.
To save the cloned object, use either Save or Save All buttons of the Visual Studio main toolbar, or just press Ctrl+S. Before changes
are saved, you will be asked to confirm the execution of the corresponding SQL query in a confirmation dialog.
21.2.3.8. Dropping Database Objects
Tables, views, stored routines, triggers, and UDFs can be dropped with the appropriate Drop command selected from its context menu:
DROP TABLE, DROP VIEW, DROP ROUTINE, DROP TRIGGER, DROP UDF.
You will be asked to confirm the execution of the corresponding drop query in a confirmation dialog.
Dropping of multiple objects is not supported.
21.2.3.9. Using the ADO.NET Entity Framework
Connector/NET 6.0 introduced support for the ADO.NET Entity Framework. ADO.NET Entity Framework was included with .NET
Framework 3.5 Service Pack 1, and Visual Studio 2008 Service Pack 1. ADO.NET Entity Framework was released on 11th August
2008.
ADO.NET Entity Framework provides an Object Relational Mapping (ORM) service, mapping the relational database schema to ob-
jects. The ADO.NET Entity Framework defines several layers, these can be summarized as:
Logical - this layer defines the relational data and is defined by the Store Schema Definition Language (SSDL).
Conceptual - this layer defines the .NET classes and is defined by the Conceptual Schema Definition Language (CSDL)
Mapping - this layer defines the mapping from .NET classes to relational tables and associations, and is defined by Mapping Spe-
cification Language (MSL).
Connectors and APIs
2051
Connector/NET integrates with Visual Studio 2008 to provide a range of helpful tools to assist the developer.
A full treatment of ADO.NET Entity Framework is beyond the scope of this manual. You are encouraged to review the Microsoft
ADO.NET Entity Framework documentation.
21.2.3.9.1. Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source
In this tutorial you will learn how to create a Windows Forms Data Source from an Entity in an Entity Data Model. This tutorial as-
sumes that you have installed the World example database, which can be downloaded from the MySQL Documentation page. You can
also find details on how to install the database on the same page. It will also be convenient for you to create a connection to the World
database after it is installed. For instructions on how to do this see Section 21.2.3.1, Making a connection.
Creating a new Windows Forms application
The first step is to create a new Windows Forms application.
1. In Visual Studio, select FILE, NEW, PROJECT from the main menu.
2. Choose the WINDOWS FORMS APPLICATION installed template. Click OK. The solution is created.
Adding an Entity Data Model
You will now add an Entity Data Model to your solution.
1. In the Solution Explorer, right click on your application and select ADD, NEW ITEM.... From VISUAL STUDIO INSTALLED TEM-
PLATES select ADO.NET ENTITY DATA MODEL. Click ADD.
Figure 21.18. Add Entity Data Model
2. You will now see the Entity Data Model Wizard. You will use the wizard to generate the Entity Data Model from the world ex-
Connectors and APIs
2052
ample database. Select the icon GENERATE FROM DATABASE. Click NEXT.
Figure 21.19. Entity Data Model Wizard Screen 1
3. You can now select the connection you made earlier to the World database. If you have not already done so, you can create the
new connection at this time by clicking on NEW CONNECTION.... For further instructions on creating a connection to a database see
Section 21.2.3.1, Making a connection.
Figure 21.20. Entity Data Model Wizard Screen 2
Connectors and APIs
2053
4. Make a note of the entity connection settings to be used in App.Config, as these will be used later to write the necessary control
code.
5. Click NEXT.
6. The Entity Data Model Wizard connects to the database. You are then presented with a tree structure of the database. From this
you can select the object you would like to include in your model. If you had created Views and Stored Routines these will be dis-
played along with any tables. In this example you just need to select the tables. Click FINISH to create the model and exit the wiz-
ard.
Figure 21.21. Entity Data Model Wizard Screen 3
Connectors and APIs
2054
7. Visual Studio will generate the model and then display it.
Figure 21.22. Entity Data Model Diagram
Connectors and APIs
2055
8. From the Visual Studio main menu select BUILD, BUILD SOLUTION, to ensure that everything compiles correctly so far.
Adding a new Data Source
You will now add a new Data Source to your project and see how it can be used to read and write to the database.
1. From the Visual Studio main menu select DATA, ADD NEW DATA SOURCE.... You will be presented with the Data Source Config-
uration Wizard.
Figure 21.23. Entity Data Source Configuration Wizard Screen 1
Connectors and APIs
2056
2. Select the OBJECT icon. Click NEXT.
3. You will now select the Object you wish to bind to. Expand the tree. In this tutorial you will select the city table. Once the city ta-
ble has been selected click NEXT.
Figure 21.24. Entity Data Source Configuration Wizard Screen 2
Connectors and APIs
2057
4. The wizard will confirm that the city object is to be added. Click FINISH.
Figure 21.25. Entity Data Source Configuration Wizard Screen 3
Connectors and APIs
2058
5. The city object will be display in the Data Sources panel. If the Data Sources panel is not displayed, select DATA, SHOW DATA
SOURCES from the Visual Studio main menu. The docked panel will then be displayed.
Figure 21.26. Data Sources
Connectors and APIs
2059
Using the Data Source in a Windows Form
You will now learn how to use the Data Source in a Windows Form.
Connectors and APIs
2060
1. In the Data Sources panel select the Data Source you just created and drag and drop it onto the Form Designer. By default the Data
Source object will be added as a Data Grid View control. Note that the Data Grid View control is bound to the cityBinding-
Source and the Navigator control is bound to cityBindingNavigator.
Figure 21.27. Data Form Designer
2. Save and rebuild the solution before continuing.
Adding Code to Populate the Data Grid View
You are now ready to add code to ensure that the Data Grid View control will be populated with data from the City database table.
1. Double click the form to access its code.
2. Add code to instatiate the Entity Data Model's EntityContainer object and retrieve data from the database to populate the control.
Figure 21.28. Adding Code to the Form
Connectors and APIs
2061
3. Save and rebuild the solution.
4. Run the solution. Ensure the grid is populated and you can navigate the database.
Figure 21.29. The Populated Grid Control
Connectors and APIs
2062
Adding Code to Save Changes to the Database
You will now add code to enable you to save changes to the database.
The Binding source component ensures that changes made in the Data Grid View control are also made to the Entity classes bound to it.
However, that data needs to be saved back from the entities to the database itself. This can be achieved by the enabling of the Save but-
ton in the Navigator control, and the addition of some code.
1. In the Form Designer click on the Save icon in the Form toolbar and ensure that its Enabled property is set to True.
Figure 21.30. Save Button Enabled
Connectors and APIs
2063
2. Double click the Save icon in the Form toolbar to display its code.
3. You now need to add code to ensure that data is saved to the database when the save button is click in the application.
Figure 21.31. Adding Save Code to the Form
Connectors and APIs
2064
4. Once the code has been added, save the solution and rebuild it. Run the application and verify that changes made in the grid are
saved.
21.2.3.9.2. Tutorial: Databinding in ASP.NET using LINQ on Entities
In this tutorial you create an ASP.NET web page that binds LINQ queries to entities using the Entity Framework mapping.
If you have not already done so, you should install the World example database prior to attempting this tutorial. Instructions on where to
obtain the database and instructions on how to install it where given in the tutorial Section 21.2.3.9.1, Tutorial: Using an Entity Frame-
work Entity as a Windows Forms Data Source.
Creating an ASP.NET web site
In this part of the tutorial you will create an ASP.NET web site. The web site will use the World database. The main web page will fea-
ture a drop down list from which you can select a country, data about that country's cities will then be displayed in a grid view control.
1. From the Visual Studio main menu select FILE, NEW, WEB SITE....
2. From the Visual Studio installed templates select ASP.NET WEB SITE. Click OK. You will be presented with the Source view of
your web page by default.
3. Click the Design view tab situated underneath the Source view panel.
Figure 21.32. The Design Tab
Connectors and APIs
2065
4. In the Design view panel, enter some text to decorate the blank web page.
5. Click on Toolbox. From the list of controls select DROPDOWNLIST. Drag and drop the control to a location beneath the text on
your web page.
Figure 21.33. Drop Down List
Connectors and APIs
2066
6. From the DROPDOWNLIST control's context menu, ensure that the ENABLE AUTOPOSTBACK check box is enabled. This will en-
sure the control's event handler is called when an item is selected. The user's choice will in turn be used to populate the GRIDVIEW
control.
Figure 21.34. Enable AutoPostBack
7. From the Toolbox select the GRIDVIEW control.
Figure 21.35. Grid View Control
Drag and drop the Grid Vew control to a location just below the Drop Down List you already placed.
Figure 21.36. Placed Grid Vew Control
Connectors and APIs
2067
8. At this point it is recommended that you save your solution, and build the solution to ensure that there are no errors.
9. If you run the solution you will see that the text and drop down list are displayed, but the list is empty. Also, the grid view does not
appear at all. Adding this functionality is described in the following sections.
At this stage you have a web site that will build, but further functionality is required. The next step will be to use the Entity Framework
to create a mapping from the World database into entities that you can control programmatically.
Creating an ADO.NET Entity Data Model
In this stage of the tutorial you will add an ADO.NET Entity Data Model to your project, using the World database at the storage level.
The procedure for doing this is described in the tutorial Section 21.2.3.9.1, Tutorial: Using an Entity Framework Entity as a Windows
Forms Data Source, and so will not be repeated here.
Populating a Drop Data List Box with using the results of a entity LINQ query
In this part of the tutorial you will write code to populate the DropDownList control. When the web page loads the data to populate the
list will be achieved by using the results of a LINQ query on the model created previously.
1. In the Design view panel, double click on any blank area. This brings up the Page_Load method.
2. Modify the relevant section of code according to the following listing:
...
public partial class _Default : System.Web.UI.Page
{
worldModel.worldEntities we;
protected void Page_Load(object sender, EventArgs e)
{
we = new worldModel.worldEntities();
if (!IsPostBack)
{
var countryQuery = from c in we.country
orderby c.Name
Connectors and APIs
2068
select new { c.Code, c.Name };
DropDownList1.DataValueField = "Code";
DropDownList1.DataTextField = "Name";
DropDownList1.DataSource = countryQuery;
DataBind();
}
}
...
Note that the list control only needs to be populated when the page first loads. The conditional code ensures that if the page is sub-
sequently reloaded, the list control is not repopulated, which would cause the user selection to be lost.
3. Save the solution, build it and run it. You should see the list control has been populated. You can select an item, but as yet the grid
view control does not apear.
At this point you have a working Drop Down List control, populated by a LINQ query on your entity data model.
Populating a Grid View control using an entity LINQ query
In the last part of this tutorial you will populate the Grid View Control using a LINQ query on your entity data model.
1. In the Design view double click on the DROPDOWNLIST control. This causes its SelectedIndexChanged code to be dis-
played. This method is called when a user selects an item in the list control and thus fires an AutoPostBack event.
2. Modify the relevant section of code accordingly to the following listing:
...
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
var cityQuery = from c in we.city
where c.CountryCode == DropDownList1.SelectedValue
orderby c.Name
select new { c.Name, c.Population, c.CountryCode };
GridView1.DataSource = cityQuery;
DataBind();
}
...
The grid view control is populated from the result of the LINQ query on the entity data model.
3. As a check compare your code to that shown in the following screenshot:
Figure 21.37. Source Code
Connectors and APIs
2069
4. Save, build and run the solution. As you select a country you will see its cities are displayed in the grid view control.
Figure 21.38. The Working Web Site
Connectors and APIs
2070
In this tutorial you have seen how to create an ASP.NET web site, you have also seen how you can access a MySQL database via LINQ
queries on an entity data model.
21.2.4. Connector/NET Programming
Connector/NET comprises several classes that are used to connect to the database, execute queries and statements, and manage query
results.
The following are the major classes of Connector/NET:
MySqlCommand: Represents an SQL statement to execute against a MySQL database.
MySqlCommandBuilder: Automatically generates single-table commands used to reconcile changes made to a DataSet with the
associated MySQL database.
MySqlConnection: Represents an open connection to a MySQL Server database.
MySqlDataAdapter: Represents a set of data commands and a database connection that are used to fill a data set and update a
MySQL database.
Connectors and APIs
2071
MySqlDataReader: Provides a means of reading a forward-only stream of rows from a MySQL database.
MySqlException: The exception that is thrown when MySQL returns an error.
MySqlHelper: Helper class that makes it easier to work with the provider.
MySqlTransaction: Represents an SQL transaction to be made in a MySQL database.
In the following sections you will learn about some common use cases for Connector/NET, including BLOB handling, date handling,
and using Connector/NET with common tools such as Crystal Reports.
21.2.4.1. Tutorial: An Introduction to Connector/NET Programming
This section provides a gentle introduction to programming with Connector/NET. The example code is written in C#, and is designed to
work on both Microsoft .NET Framework and Mono.
This tutorial is designed to get you up and running with Connector/NET as quickly as possible, it does not go into detail on any particu-
lar topic. However, the following sections of this manual describe each of the topics introduced in this tutorial in more detail. In this tu-
torial you are encouraged to type in and run the code, modifying it as required for your setup.
This tutorial assumes you have MySQL and Connector/NET already installed. It also assumes that you have installed the World ex-
ample database, which can be downloaded from the MySQL Documentation page. You can also find details on how to install the data-
base on the same page.
Note
Before compiling the example code make sure that you have added References to your project as required. The References
required are System, System.Data and MySql.Data.
21.2.4.1.1. The MySqlConnection Object
For your Connector/NET application to connect to a MySQL database it needs to establish a connection. This is achieved through the
use of a MySqlConnection object.
The MySqlConnection constructor takes a connection string as one of its parameters. The connection string provides necessary informa-
tion to make the connection to the MySQL database. The connection string is discussed more fully in Section 21.2.4.2, Connecting to
MySQL Using Connector/NET. A reference containing a list of supported connection string options can also be found in Sec-
tion 21.2.4.5, Connector/NET Connection String Options Reference.
The following code shows how to create a connection object.
using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
public class Tutorial1
{
public static void Main()
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
// Perform databse operations
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Done.");
}
}
When the MySqlConnection constructor is invoked it returns a connection object, which is used for subsequent database operations.
The first operation in this example is to open the connection. This needs to be done before further operations take place. Before the ap-
Connectors and APIs
2072
plication exits the connection to the database needs to be closed by calling Close on the connection object.
Sometimes an attempt to perform an Open on a connection object can fail, this will generate an exception that can be handled via stand-
ard exception handling code.
In this section you have learned how to create a connection to a MySQL database, and open and close the corresponding connection ob-
ject.
21.2.4.1.2. The MySqlCommand Object
Once a connection has been established with the MySQL database, the next step is do carry out the desired database operations. This
can be achieved through the use of the MySqlCommand object.
You will see how to create a MySqlCommand object. Once it has been created there are three main methods of interest that you can
call:
ExecuteReader - used to query the database. Results are usually returned in a MySqlDataReader object, created by Ex-
ecuteReader.
ExecuteNonQuery - used to insert and delete data.
ExecuteScalar - used to return a single value.
Once a MySqlCommand object has been created, you will call one of the above methods on it to carry out a database operation, such as
perform a query. The results are usually returned into a MySqlDataReader object, and then processed, for example the results might
be displayed. The following code demonstrates how this could be done.
using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
public class Tutorial2
{
public static void Main()
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent='Oceania'";
MySqlCommand cmd = new MySqlCommand(sql, conn);
MySqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Console.WriteLine(rdr[0]+" -- "+rdr[1]);
}
rdr.Close();
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Done.");
}
}
When a connection has been created and opened, the code then creates a MySqlCommand object. Note that the SQL query to be ex-
ecuted is passed to the MySqlCommand constructor. The ExecuteReader method is then used to generate a MySqlReader object.
The MySqlReader object contains the results generated by the SQL executed on the command object. Once the results have been ob-
tained in a MySqlReader object, the results can be processed. In this case the information is simply printed out as part of a while
loop. Finally, the MySqlReader object is displosed of by running its Close method on it.
In the next example you will see how to use the ExecuteNonQuery method.
The procedure for performing an ExecuteNonQuery method call is simpler, as there is no need to create an object to store results.
Connectors and APIs
2073
This is because ExecuteNonQuery is only used for inserting, updating and deleting data. The following example illustrates a simple
update to the Country table:
using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
public class Tutorial3
{
public static void Main()
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
string sql = "INSERT INTO Country (Name, HeadOfState, Continent) VALUES ('Disneyland','Mickey Mouse', 'North America')";
MySqlCommand cmd = new MySqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Done.");
}
}
The query is constructed, the command object created and the ExecuteNonQuery method called on the command object. You can
access your MySQL database with the MySQL Client program and verify that the update was carried out correctly.
Finally, you will see how the ExecuteScalar method can be used to return a single value. Again, this is straightforward, as a
MySqlDataReader object is not required to store results, a simple variable will do. The following code illustrates how to use Ex-
ecuteScalar:
using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
public class Tutorial4
{
public static void Main()
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
string sql = "SELECT COUNT(*) FROM Country";
MySqlCommand cmd = new MySqlCommand(sql, conn);
object result = cmd.ExecuteScalar();
if (result != null)
{
int r = Convert.ToInt32(result);
Console.WriteLine("Number of countries in the World database is: " + r);
}
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Done.");
}
}
This example uses a simple query to count the rows in the Country table. The result is obtained by calling ExecuteScaler on the
command object.
21.2.4.1.3. Working with Decoupled Data
Connectors and APIs
2074
Previously, when using MySqlDataReader, the connection to the database was continually maintained, unless explicitly closed. It is also
possible to work in a manner where a connection is only established when needed. For example, in this mode, a connection could be es-
tablished in order to read a chunk of data, the data could then be modified by the application as required. A connection could then be
reestablished only if and when the application needs to write data back to the database. This decouples the working data set from the
database.
This decouple mode of working with data is supported by Connector/NET. There are several parts involved in allowing this method to
work:
Data Set - The Data Set is the area in which data is loaded in order to read or modify it. A DataSet object is instantiated, which
can store multiple tables of data.
Data Adapter - The Data Adapter is the interface between the Data Set and the database itself. The Data Adapter is responsible for
efficiently managing connections to the database, opening and closing them as required. The Data Adapter is created by instantiating
an object of the MySqlDataAdapter class. The MySqlDataAdapter object has two main methods: Fill which reads data
into the Data Set, and Update, which writes data from the Data Set to the database.
Command Builder - The Command Builder is a support object. The Command Builder works in conjunction with the Data Ad-
apter. When a MySqlDataAdapter object is created it is typically given an initial SELECT statement. From this SELECT state-
ment the Command Builder can work out the corresponding INSERT, UPDATE and DELETE statements that would be required
should the database need to be updated. To create the Command Builder an object of the class MySqlCommandBuilder is cre-
ated.
Each of these classes will now be discussed in more detail.
Instantiating a DataSet object
A DataSet object can be created simply, as shown in the following example code snippet:
DataSet dsCountry;
...
dsCountry = new DataSet();
Although this creates the DataSet object it has not yet filled it with data. For that a Data Adapter is required.
Instantiating a MySqlDataAdapter object
The MySqlDataAdapter can be created as illustrated by the following example:
MySqlDataAdapter daCountry;
...
string sql = "SELECT Code, Name, HeadOfState FROM Country WHERE Continent='North America'";
daCountry = new MySqlDataAdapter (sql, conn);
Note, the MySqlDataAdapter is given the SQL specifying the data you wish to work with.
Instantiating a MySqlCommandBuilder object
Once the MySqlDataAdapter has been created, it is necessary to generate the additional statements required for inserting, updating
and deleting data. There are several ways to do this, but in this tutorial you will see how this can most easily be done with MySqlCom-
mandBuilder. The following code snippet ilustrates how this is done:
MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);
Note that the MySqlDataAdapter object is passed as a parameter to the command builder.
Filling the Data Set
In order to do anything useful with the data from your datbase, you need to load it into a Data Set. This is one of the jobs of the
MySqlDataAdapter object, and is carried out with its Fill method. The following example code illustrates this:
DataSet dsCountry;
...
dsCountry = new DataSet();
...
daCountry.Fill(dsCountry, "Country");
Connectors and APIs
2075
Note the Fill method is a MySqlDataAdapter method, the Data Adapter knows how to establish a connec tion with the database
and retrieve the required data, and then populates the Data Set when the Fill method is called. The second parameter Country is the
table in the Data Set to update.
Updating the Data Set
The data in the Data Set can now be manipulated by the application as required. At some point, changes to data will need to be written
back to the database. This is achieved through a MySqlDataAdapter method, the Update method.
daCountry.Update(dsCountry, "Country");
Again, the Data Set and the table within the Data Set to update are specified.
Working Example
The interactions between the DataSet, MySqlDataAdapter and MySqlCommandBuilder classes can be a little confusing, so
their operation can perhaps be best illustrated by working code.
In this example, data from the World database is read into a Data Grid View control. Here, the data can be viewed and changed before
clicking an update button. The update button then activates code to write changes back to the database. The code uses the principles ex-
plained above. The application was built using the Microsoft Visual Studio in order to place and create the user interface controls, but
the main code that uses the key classes descibed above is shown below, and is portable.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
MySqlDataAdapter daCountry;
DataSet dsCountry;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
label2.Text = "Connecting to MySQL...";
string sql = "SELECT Code, Name, HeadOfState FROM Country WHERE Continent='North America'";
daCountry = new MySqlDataAdapter (sql, conn);
MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);
dsCountry = new DataSet();
daCountry.Fill(dsCountry, "Country");
dataGridView1.DataSource = dsCountry;
dataGridView1.DataMember = "Country";
}
catch (Exception ex)
{
label2.Text = ex.ToString();
}
}
private void button1_Click(object sender, EventArgs e)
{
daCountry.Update(dsCountry, "Country");
label2.Text = "MySQL Database Updated!";
}
}
}
Connectors and APIs
2076
The application running is shown below:
Figure 21.39. World Database Application
21.2.4.1.4. Working with Parameters
This part of the tutorial shows you how to use parameters in your Connector/NET application.
Although it is possible to build SQL query strings directly from user input, this is not advisable as it does not prevent from erroneous or
malicious information being entered. It is safer to use parameters as they will be processed as field data only. For example, imagine the
following query was contructed from user input:
string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent = "+user_continent;
If the string user_continent came from a Text Box control, there would potentially be no control over the string enetred by the
user. The user could enter a string that generates a run time error, or in the worst case actually harms the system. When using paramet-
ers it is not possible to do this because a parameter is only ever treated as a field parameter, rather than an arbitrary piece of SQL code.
Connectors and APIs
2077
The same query written user a parameter for user input would be:
string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent = @Continent";
Note that the parameter is preceded by an '@' symbol to indicate it is to be treated as a parameter.
As well as marking the position of the parameter in the query string, it is necessary to create a parameter object that can be passed to the
Command object. In Connector/NET the class MySqlParameter is used for this purpose. The use of MySqlParameter is best il-
lustrated by a small code snippet:
MySqlParameter param = new MySqlParameter();
param.ParameterName = "@Continent";
param.Value = "North America";
cmd.Parameters.Add(param);
In this example the string "North America" is supplied as the parameter value statically, but in a more practical example it would come
from a user input control. Once the parameter has its name and value set it needs to be added to the Command object using the Add
method.
A further example illustrates this:
using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
public class Tutorial5
{
public static void Main()
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent=@Continent";
MySqlCommand cmd = new MySqlCommand(sql, conn);
Console.WriteLine("Enter a continent e.g. 'North America', 'Europe': ");
string user_input = Console.ReadLine();
MySqlParameter param = new MySqlParameter();
param.ParameterName = "@Continent";
param.Value = user_input;
cmd.Parameters.Add(param);
MySqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Console.WriteLine(rdr["Name"]+" --- "+rdr["HeadOfState"]);
}
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Done.");
}
}
In this part of the tutorial you have see how to use parameters to make your code more secure.
21.2.4.1.5. Working with Stored Procedures
In this section you will see how to work with Stored Procedures. This section assumes you have a basic understanding of what a Stored
Procedure is, and how to create one.
For the purposes of this tutorial, you will create a simple Stored Procedure to see how it can be called from Connector/NET. In the
MySQL Client program, connect to the World database and enter the following Stored Procedure:
DELIMITER //
Connectors and APIs
2078
CREATE PROCEDURE country_hos
(IN con CHAR(20))
BEGIN
SELECT Name, HeadOfState FROM Country
WHERE Continent = con;
END //
DELIMITER ;
Test the Stored Procedure wors as expec ted by typing the following into the MySQL Client program:
CALL country_hos('Europe');
Note that The Stored Routine takes a single parameter, which is the continent you wish to restrict your search to.
Having confirmed that the Stored Procedure is present and correct you can now move on to seeing how it can be accessed from Con-
nector/NET.
Calling a Stored Procedure from your Connector/NET application is similar to techniques you have seen earlier in this tutorial. A
MySqlCommand object is created, but rather than taking a SQL query as a parameter it takes the name of the Stored Procedure to call.
The MySqlCommand object also needs to be set to the type of Stored Procedure. This is illustrated by the following code snippet:
string rtn = "country_hos";
MySqlCommand cmd = new MySqlCommand(rtn, conn);
cmd.CommandType = CommandType.StoredProcedure;
In this case you also need to pass a parameter to the Stored Procedure. This can be achieved using the techniques seen in the previous
section on parameters, Section 21.2.4.1.4, Working with Parameters. This is shown in the following code snippet:
MySqlParameter param = new MySqlParameter();
param.ParameterName = "@con";
param.Value = "Europe";
cmd.Parameters.Add(param);
The value of the parameter @con could more realistically have come from a user input control, but for simplicity it is set as a static
string in this example.
At this point everything is set up and all that now needs to be done is to call the routine. This can be achieved using techniques also
learned in earlier sections, but in this case the ExecuteReader method of the MySqlCommand object is used.
Complete working code for the Stored Procedure example is shown below:
using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
public class Tutorial6
{
public static void Main()
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
string rtn = "country_hos";
MySqlCommand cmd = new MySqlCommand(rtn, conn);
cmd.CommandType = CommandType.StoredProcedure;
MySqlParameter param = new MySqlParameter();
param.ParameterName = "@con";
param.Value = "Europe";
cmd.Parameters.Add(param);
MySqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Console.WriteLine(rdr[0] + " --- " + rdr[1]);
}
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Connectors and APIs
2079
Console.WriteLine("Done.");
}
}
In this section you have seen how to call a Stored Procedure from Connector/NET. For the moment, this concludes our introductory tu-
torial on programming with Connector/NET.
21.2.4.2. Connecting to MySQL Using Connector/NET
Introduction
All interaction between a .NET application and the MySQL server is routed through a MySqlConnection object. Before your applic-
ation can interact with the server, a MySqlConnection object must be instanced, configured, and opened.
Even when using the MySqlHelper class, a MySqlConnection object is created by the helper class.
In this section, we will describe how to connect to MySQL using the MySqlConnection object.
21.2.4.3. Creating a Connection String
The MySqlConnection object is configured using a connection string. A connection string contains sever key/value pairs, separated
by semicolons. Each key/value pair is joined with an equals sign.
The following is a sample connection string:
Server=127.0.0.1;Uid=root;Pwd=12345;Database=test;
In this example, the MySqlConnection object is configured to connect to a MySQL server at 127.0.0.1, with a user name of
root and a password of 12345. The default database for all statements will be the test database.
The following options are available:
Note
Using the '@' symbol for parameters is now the preferred approach although the old pattern of using '?' is still supported.
Please be aware however that using '@' can cause conflicts when user variables are also used. To help with this situation
please see the documentation on the Allow User Variables connection string option, which can be found here: Sec-
tion 21.2.4.3, Creating a Connection String. The Old Syntax connection string option has now been deprecated.
21.2.4.3.1. Opening a Connection
Once you have created a connection string it can be used to open a connection to the MySQL server.
The following code is used to create a MySqlConnection object, assign the connection string, and open the connection.
Visual Basic Example
Dim conn As New MySql.Data.MySqlClient.MySqlConnection
Dim myConnectionString as String
myConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test;"
Try
conn.ConnectionString = myConnectionString
conn.Open()
Catch ex As MySql.Data.MySqlClient.MySqlException
MessageBox.Show(ex.Message)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;
Connectors and APIs
2080
myConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = myConnectionString;
conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}
You can also pass the connection string to the constructor of the MySqlConnection class:
Visual Basic Example
Dim myConnectionString as String
myConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test;"
Try
Dim conn As New MySql.Data.MySqlClient.MySqlConnection(myConnectionString)
conn.Open()
Catch ex As MySql.Data.MySqlClient.MySqlException
MessageBox.Show(ex.Message)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;
myConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}
Once the connection is open it can be used by the other Connector/NET classes to communicate with the MySQL server.
21.2.4.3.2. Handling Connection Errors
Because connecting to an external server is unpredictable, it is important to add error handling to your .NET application. When there is
an error connecting, the MySqlConnection class will return a MySqlException object. This object has two properties that are of
interest when handling errors:
Message: A message that describes the current exception.
Number: The MySQL error number.
When handling errors, you can your application's response based on the error number. The two most common error numbers when con-
necting are as follows:
0: Cannot connect to server.
1045: Invalid user name and/or password.
Connectors and APIs
2081
The following code shows how to adapt the application's response based on the actual error:
Visual Basic Example
Dim myConnectionString as String
myConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test;"
Try
Dim conn As New MySql.Data.MySqlClient.MySqlConnection(myConnectionString)
conn.Open()
Catch ex As MySql.Data.MySqlClient.MySqlException
Select Case ex.Number
Case 0
MessageBox.Show("Cannot connect to server. Contact administrator")
Case 1045
MessageBox.Show("Invalid username/password, please try again")
End Select
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;
myConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
switch (ex.Number)
{
case 0:
MessageBox.Show("Cannot connect to server. Contact administrator");
case 1045:
MessageBox.Show("Invalid username/password, please try again");
}
}
Important
Note that if you are using multilanguage databases you must specify the character set in the connection string. If you do
not specify the character set, the connection defaults to the latin1 charset. You can specify the character set as part of
the connection string, for example:
MySqlConnection myConnection = new MySqlConnection("server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;Charset=latin1;");
21.2.4.4. Using Connector/NET with Connection Pooling
The Connector/NET supports connection pooling. This is enabled by default, but can be turned off via connection string options. See
Section 21.2.4.3, Creating a Connection String for further information.
Connection pooling works by keeping the native connection to the server live when the client disposes of a MySqlConnection. Sub-
sequently, if a new MySqlConnection object is opened, it will be created from the connection pool, rather than creating a new native
connection. This improves performance.
To work as designed, it is best to let the connection pooling system manage all connections. You should not create a globally accessible
instance of MySqlConnection and then manually open and close it. This interferes with the way the pooling works and can lead to
unpredictable results or even exceptions.
One approach that simplifies things is to avoid manually creating a MySqlConnection object. Instead use the overloaded methods
that take a connection string as an argument. Using this approach, Connector/NET will automatically create, open, close and destroy
connections, using the connection pooling system for best performance.
Connectors and APIs
2082
Typed Datasets and the MembershipProvider and RoleProvider classes use this approach. Most classes that have methods that
take a MySqlConnection as an argument, also have methods that take a connection string as an argument. This includes
MySqlDataAdapter.
Instead of manually creating MySqlCommand objects, you can use the static methods of the MySqlHelper class. These take a con-
nection string as an argument, and they fully support connection pooling.
21.2.4.5. Connector/NET Connection String Options Reference
Name Default Description
Allow Batch true When true, multiple SQL statements can be sent with one command exe-
cution. -Note- Starting with MySQL 4.1.1, batch statements should be
separated by the server-defined separator character. Commands sent to
earlier versions of MySQL should be separated with ';'.
Allow User Variables false Setting this to true indicates that the provider expects user variables in
the SQL. This option was added in Connector/NET version 5.2.2.
Allow Zero Datetime false True to have MySqlDataReader.GetValue() return a MySqlDateTime for
date or datetime columns that have illegal values. False will cause a
System.DateTime object to be returned for legal values and an ex-
ception will be thrown for illegal values.
AutoEnlist true
BlobAsUTF8ExcludePattern null
BlobAsUTF8IncludePattern null
CharSet, Character Set Specifies the character set that should be used to encode all queries sent
to the server. Resultsets are still returned in the character set of the data
returned.
Connect Timeout, Connection
Timeout
15 The length of time (in seconds) to wait for a connection to the server be-
fore terminating the attempt and generating an error.
Connection Reset false
Convert Zero Datetime false True to have MySqlDataReader.GetValue() and
MySqlDataReader.GetDateTime() return DateTime.MinValue
for date or datetime columns that have illegal values.
Default Command Timeout Sets the default value of the command timeout to be used. This does not
supercede the individual command timeout property on an individual
command object. If you set the command timeout property, that will be
used. This option was added in Connector/NET 5.1.4
Encrypt, UseSSL false For Connector/NET 5.0.3 and later, when true, SSL encryption is used
for all data sent between the client and server if the server has a certific-
ate installed. Recognized values are true, false, yes, and no. In ver-
sions before 5.0.3, this option had no effect.
FunctionsReturnString false This will cause the connector to return binary/varbinary values as strings,
if they do not have a tablename in the metadata.
Host, Server, Data Source, Data-
Source, Address, Addr, Network Ad-
dress
localhost The name or network address of the instance of MySQL to which to con-
nect. Multiple hosts can be specified separated by &. This can be useful
where multiple MySQL servers are configured for replication and you are
not concerned about the precise server you are connecting to. No attempt
is made by the provider to synchronize writes to the database so care
should be taken when using this option. In Unix environment with Mono,
this can be a fully qualified path to MySQL socket file name. With this
configuration, the Unix socket will be used instead of TCP/IP socket.
Currently only a single socket name can be given so accessing MySQL in
a replicated environment using Unix sockets is not currently supported.
Ignore Prepare true When true, instructs the provider to ignore any calls to MySqlCom-
mand.Prepare(). This option is provided to prevent issues with cor-
ruption of the statements when use with server side prepared statements.
If you want to use server-side prepare statements, set this option to false.
This option was added in Connector/NET 5.0.3 and Connector/NET
Connectors and APIs
2083
1.0.9.
Initial Catalog, Database mysql The name of the database to use intially
InteractiveSession false
Logging false When true, various pieces of information is output to any configured
TraceListeners.
Old Syntax, OldSyntax false This option was deprecated in Connector/NET 5.2.2. All code should
now be written using the '@' symbol as the parameter marker.
Password, pwd The password for the MySQL account being used.
Persist Security Info false When set to false or no (strongly recommended), security-sensitive in-
formation, such as the password, is not returned as part of the connection
if the connection is open or has ever been in an open state. Resetting the
connection string resets all connection string values including the pass-
word. Recognized values are true, false, yes, and no.
Pipe Name, Pipe mysql When set to the name of a named pipe, the MySqlConnection will at-
tempt to connect to MySQL on that named pipe.This settings only applies
to the Windows platform.
Port 3306 The port MySQL is using to listen for connections. This value is ignored
if Unix socket is used.
Procedure Cache Size 25 Sets the size of the stored procedure cache. By default, Connector/NET
will store the metadata (input/output datatypes) about the last 25 stored
procedures used. To disable the stored procedure cache, set the value to
zero (0). This option was added in Connector/NET 5.0.2 and Connector/
NET 1.0.9.
Protocol socket Specifies the type of connection to make to the server. Values can be:
socket or tcp for a socket connection, pipe for a named pipe connec-
tion, unix for a Unix socket connection, memory to use MySQL shared
memory.
Respect Binary Flags true Setting this option to false means that Connector/NET will ignore a
column's binary flags as set by the server. This option was added in Con-
nector/NET version 5.1.3.
Shared Memory Name MYSQL The name of the shared memory object to use for communication if the
connection protocol is set to memory.
TreatBlobsAsUTF8 false
Treat Tiny As Boolean true Setting this value to false indicates that TINYINT(1) will be treated
as an INT. See also Section 10.1.1, Overview of Numeric Types for a
further explanation of the TINYINT and BOOL data types.
Use Affected Rows false When true the connection will report changed rows instead of found
rows. This option was added in Connector/NET version 5.2.6.
Use Procedure Bodies true Setting this option to false indicates that the user connecting to the
database does not have the SELECT privileges for the mysql.proc
(stored procedures) table. When to set to false, Connector/NET will
not rely on this information being available when the procedure is called.
Because Connector/NET will be unable to determine this information,
you should explicitly set the types of the all the parameters before the call
and the parameters should be added to the command in the exact same or-
der as they appear in the procedure definition. This option was added in
Connector/NET 5.0.4 and Connector/NET 1.0.10.
User Id, Username, Uid, User name The MySQL login account being used.
Use Compression false
Setting this option to true enables compression of packets exchanged
between the client and the server. This exchange is defined by the
MySQL client-server protocol.
Compression is used if both client and server support ZLIB compression,
and the client has requested compression using this option.
A compressed packet header is: packet length (3 bytes), packet number (1
Connectors and APIs
2084
byte), and Uncompressed Packet Length (3 bytes). The Uncompressed
Packet Length is the number of bytes in the original, uncompressed pack-
et. If this is zero then the data in this packet has not been compressed.
When the compression protocol is in use, either the client or the server
may compress packets. However, compression will not occur if the com-
pressed length is greater than the original length. Thus, some packets will
contain compressed data while other packets will not.
Use Usage Advisor false
Use Performance Monitor false
The following table lists the valid names for connection pooling values within the ConnectionString. For more information about
connection pooling, see Connection Pooling for the MySQL Data Provider.
Name Default Description
Cache Server Configuration,
CacheServerConfiguration,
CacheServerConfig
false Specifies whether server variables should be updated when a pooled con-
nection is returned. Turning this one will yeild faster opens but will also
not catch any server changes made by other connections.
Connection Lifetime 0 When a connection is returned to the pool, its creation time is compared
with the current time, and the connection is destroyed if that time span (in
seconds) exceeds the value specified by Connection Lifetime.
This is useful in clustered configurations to force load balancing between
a running server and a server just brought online. A value of zero (0)
causes pooled connections to have the maximum connection timeout.
Max Pool Size 100 The maximum number of connections allowed in the pool.
Min Pool Size 0 The minimum number of connections allowed in the pool.
Pooling true When true, the MySqlConnection object is drawn from the appro-
priate pool, or if necessary, is created and added to the appropriate pool.
Recognized values are true, false, yes, and no.
Reset Pooled Connections, Reset-
Connections, ResetPooledConnec-
tions
true Specifies whether a ping and a reset should be sent to the server before a
pooled connection is returned. Not resetting will yield faster connection
opens but also will not clear out session items such as temp tables.
21.2.4.6. Using the Connector/NET with Prepared Statements
Introduction
As of MySQL 4.1, it is possible to use prepared statements with Connector/NET. Use of prepared statements can provide significant
performance improvements on queries that are executed more than once.
Prepared execution is faster than direct execution for statements executed more than once, primarily because the query is parsed only
once. In the case of direct execution, the query is parsed every time it is executed. Prepared execution also can provide a reduction of
network traffic because for each execution of the prepared statement, it is necessary only to send the data for the parameters.
Another advantage of prepared statements is that it uses a binary protocol that makes data transfer between client and server more effi-
cient.
21.2.4.6.1. Preparing Statements in Connector/NET
To prepare a statement, create a command object and set the .CommandText property to your query.
After entering your statement, call the .Prepare method of the MySqlCommand object. After the statement is prepared, add para-
meters for each of the dynamic elements in the query.
After you enter your query and enter parameters, execute the statement using the .ExecuteNonQuery(), .ExecuteScalar(),
or .ExecuteReader methods.
For subsequent executions, you need only modify the values of the parameters and call the execute method again, there is no need to set
Connectors and APIs
2085
the .CommandText property or redefine the parameters.
Visual Basic Example
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
conn.ConnectionString = strConnection
Try
conn.Open()
cmd.Connection = conn
cmd.CommandText = "INSERT INTO myTable VALUES(NULL, @number, @text)"
cmd.Prepare()
cmd.Parameters.Add("@number", 1)
cmd.Parameters.Add("@text", "One")
For i = 1 To 1000
cmd.Parameters["@number"].Value = i
cmd.Parameters["@text"].Value = "A string value"
cmd.ExecuteNonQuery()
Next
Catch ex As MySqlException
MessageBox.Show("Error " & ex.Number & " has occurred: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
conn.ConnectionString = strConnection;
try
{
conn.Open();
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO myTable VALUES(NULL, @number, @text)";
cmd.Prepare();
cmd.Parameters.Add("@number", 1);
cmd.Parameters.Add("@text", "One");
for (int i=1; i <= 1000; i++)
{
cmd.Parameters["@number"].Value = i;
cmd.Parameters["@text"].Value = "A string value";
cmd.ExecuteNonQuery();
}
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
21.2.4.7. Accessing Stored Procedures with Connector/NET
Introduction
With the release of MySQL version 5 the MySQL server now supports stored procedures with the SQL 2003 stored procedure syntax.
A stored procedure is a set of SQL statements that can be stored in the server. Once this has been done, clients do not need to keep reis-
suing the individual statements but can refer to the stored procedure instead.
Stored procedures can be particularly useful in situations such as the following:
When multiple client applications are written in different languages or work on different platforms, but need to perform the same
database operations.
Connectors and APIs
2086
When security is paramount. Banks, for example, use stored procedures for all common operations. This provides a consistent and
secure environment, and procedures can ensure that each operation is properly logged. In such a setup, applications and users would
not get any access to the database tables directly, but can only execute specific stored procedures.
Connector/NET supports the calling of stored procedures through the MySqlCommand object. Data can be passed in and our of a
MySQL stored procedure through use of the MySqlCommand.Parameters collection.
Note
When you call a stored procedure, the command object makes an additional SELECT call to determine the parameters of
the stored procedure. You must ensure that the user calling the procedure has the SELECT privilege on the mysql.proc
table to enable them to verify the parameters. Failure to do this will result in an error when calling the procedure.
This section will not provide in-depth information on creating Stored Procedures. For such information, please refer to ht-
tp://dev.mysql.com/doc/mysql/en/stored-routines.html.
A sample application demonstrating how to use stored procedures with Connector/NET can be found in the Samples directory of your
Connector/NET installation.
21.2.4.7.1. Creating Stored Procedures from Connector/NET
Stored procedures in MySQL can be created using a variety of tools. First, stored procedures can be created using the mysql com-
mand-line client. Second, stored procedures can be created using the MySQL Query Browser GUI client. Finally, stored procedures
can be created using the .ExecuteNonQuery method of the MySqlCommand object:
Visual Basic Example
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test"
Try
conn.Open()
cmd.Connection = conn
cmd.CommandText = "CREATE PROCEDURE add_emp(" _
& "IN fname VARCHAR(20), IN lname VARCHAR(20), IN bday DATETIME, OUT empno INT) " _
& "BEGIN INSERT INTO emp(first_name, last_name, birthdate) " _
& "VALUES(fname, lname, DATE(bday)); SET empno = LAST_INSERT_ID(); END"
cmd.ExecuteNonQuery()
Catch ex As MySqlException
MessageBox.Show("Error " & ex.Number & " has occurred: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
conn.Open();
cmd.Connection = conn;
cmd.CommandText = "CREATE PROCEDURE add_emp(" +
"IN fname VARCHAR(20), IN lname VARCHAR(20), IN bday DATETIME, OUT empno INT) " +
"BEGIN INSERT INTO emp(first_name, last_name, birthdate) " +
"VALUES(fname, lname, DATE(bday)); SET empno = LAST_INSERT_ID(); END";
cmd.ExecuteNonQuery();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Connectors and APIs
2087
}
It should be noted that, unlike the command-line and GUI clients, you are not required to specify a special delimiter when creating
stored procedures in Connector/NET.
21.2.4.7.2. Calling a Stored Procedure from Connector/NET
To call a stored procedure using Connector/NET, create a MySqlCommand object and pass the stored procedure name as the
.CommandText property. Set the .CommandType property to CommandType.StoredProcedure.
After the stored procedure is named, create one MySqlCommand parameter for every parameter in the stored procedure. IN parameters
are defined with the parameter name and the object containing the value, OUT parameters are defined with the parameter name and the
datatype that is expected to be returned. All parameters need the parameter direction defined.
After defining parameters, call the stored procedure by using the MySqlCommand.ExecuteNonQuery() method:
Visual Basic Example
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test"
Try
conn.Open()
cmd.Connection = conn
cmd.CommandText = "add_emp"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@lname", 'Jones')
cmd.Parameters["@lname"].Direction = ParameterDirection.Input
cmd.Parameters.Add("@fname", 'Tom')
cmd.Parameters["@fname"].Direction = ParameterDirection.Input
cmd.Parameters.Add("@bday", #12/13/1977 2:17:36 PM#)
cmd.Parameters["@bday"].Direction = ParameterDirection.Input
cmd.Parameters.Add("@empno", MySqlDbType.Int32)
cmd.Parameters["@empno"].Direction = ParameterDirection.Output
cmd.ExecuteNonQuery()
MessageBox.Show(cmd.Parameters["@empno"].Value)
Catch ex As MySqlException
MessageBox.Show("Error " & ex.Number & " has occurred: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
conn.Open();
cmd.Connection = conn;
cmd.CommandText = "add_emp";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@lname", "Jones");
cmd.Parameters["@lname"].Direction = ParameterDirection.Input;
cmd.Parameters.Add("@fname", "Tom");
cmd.Parameters["@fname"].Direction = ParameterDirection.Input;
cmd.Parameters.Add("@bday", DateTime.Parse("12/13/1977 2:17:36 PM"));
cmd.Parameters["@bday"].Direction = ParameterDirection.Input;
Connectors and APIs
2088
cmd.Parameters.Add("@empno", MySqlDbType.Int32);
cmd.Parameters["@empno"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
MessageBox.Show(cmd.Parameters["@empno"].Value);
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Once the stored procedure is called, the values of output parameters can be retrieved by using the .Value property of the MySqlCon-
nector.Parameters collection.
21.2.4.8. Handling BLOB Data With Connector/NET
Introduction
One common use for MySQL is the storage of binary data in BLOB columns. MySQL supports four different BLOB datatypes:
TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB.
Data stored in a BLOB column can be accessed using Connector/NET and manipulated using client-side code. There are no special re-
quirements for using Connector/NET with BLOB data.
Simple code examples will be presented within this section, and a full sample application can be found in the Samples directory of the
Connector/NET installation.
21.2.4.8.1. Preparing the MySQL Server
The first step is using MySQL with BLOB data is to configure the server. Let's start by creating a table to be accessed. In my file tables,
I usually have four columns: an AUTO_INCREMENT column of appropriate size (UNSIGNED SMALLINT) to serve as a primary key
to identify the file, a VARCHAR column that stores the file name, an UNSIGNED MEDIUMINT column that stores the size of the file,
and a MEDIUMBLOB column that stores the file itself. For this example, I will use the following table definition:
CREATE TABLE file(
file_id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
file_name VARCHAR(64) NOT NULL,
file_size MEDIUMINT UNSIGNED NOT NULL,
file MEDIUMBLOB NOT NULL);
After creating a table, you may need to modify the max_allowed_packet system variable. This variable determines how large of a pack-
et (that is, a single row) can be sent to the MySQL server. By default, the server will only accept a maximum size of 1MB from our cli-
ent application. If you do not intend to exceed 1MB, this should be fine. If you do intend to exceed 1MB in your file transfers, this num-
ber has to be increased.
The max_allowed_packet option can be modified using MySQL Administrator's Startup Variables screen. Adjust the Maximum al-
lowed option in the Memory section of the Networking tab to an appropriate setting. After adjusting the value, click the APPLY
CHANGES button and restart the server using the Service Control screen of MySQL Administrator. You can also adjust this value
directly in the my.cnf file (add a line that reads max_allowed_packet=xxM), or use the SET max_allowed_packet=xxM; syntax from
within MySQL.
Try to be conservative when setting max_allowed_packet, as transfers of BLOB data can take some time to complete. Try to set a value
that will be adequate for your intended use and increase the value if necessary.
21.2.4.8.2. Writing a File to the Database
To write a file to a database we need to convert the file to a byte array, then use the byte array as a parameter to an INSERT query.
The following code opens a file using a FileStream object, reads it into a byte array, and inserts it into the file table:
Visual Basic Example
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim SQL As String
Dim FileSize As UInt32
Connectors and APIs
2089
Dim rawData() As Byte
Dim fs As FileStream
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test"
Try
fs = New FileStream("c:\image.png", FileMode.Open, FileAccess.Read)
FileSize = fs.Length
rawData = New Byte(FileSize) {}
fs.Read(rawData, 0, FileSize)
fs.Close()
conn.Open()
SQL = "INSERT INTO file VALUES(NULL, @FileName, @FileSize, @File)"
cmd.Connection = conn
cmd.CommandText = SQL
cmd.Parameters.Add("@FileName", strFileName)
cmd.Parameters.Add("@FileSize", FileSize)
cmd.Parameters.Add("@File", rawData)
cmd.ExecuteNonQuery()
MessageBox.Show("File Inserted into database successfully!", _
"Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
conn.Close()
Catch ex As Exception
MessageBox.Show("There was an error: " & ex.Message, "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
string SQL;
UInt32 FileSize;
byte[] rawData;
FileStream fs;
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
fs = new FileStream(@"c:\image.png", FileMode.Open, FileAccess.Read);
FileSize = fs.Length;
rawData = new byte[FileSize];
fs.Read(rawData, 0, FileSize);
fs.Close();
conn.Open();
SQL = "INSERT INTO file VALUES(NULL, @FileName, @FileSize, @File)";
cmd.Connection = conn;
cmd.CommandText = SQL;
cmd.Parameters.Add("@FileName", strFileName);
cmd.Parameters.Add("@FileSize", FileSize);
cmd.Parameters.Add("@File", rawData);
cmd.ExecuteNonQuery();
MessageBox.Show("File Inserted into database successfully!",
"Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
conn.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Connectors and APIs
2090
The Read method of the FileStream object is used to load the file into a byte array which is sized according to the Length prop-
erty of the FileStream object.
After assigning the byte array as a parameter of the MySqlCommand object, the ExecuteNonQuery method is called and the BLOB
is inserted into the file table.
21.2.4.8.3. Reading a BLOB from the Database to a File on Disk
Once a file is loaded into the file table, we can use the MySqlDataReader class to retrieve it.
The following code retrieves a row from the file table, then loads the data into a FileStream object to be written to disk:
Visual Basic Example
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myData As MySqlDataReader
Dim SQL As String
Dim rawData() As Byte
Dim FileSize As UInt32
Dim fs As FileStream
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test"
SQL = "SELECT file_name, file_size, file FROM file"
Try
conn.Open()
cmd.Connection = conn
cmd.CommandText = SQL
myData = cmd.ExecuteReader
If Not myData.HasRows Then Throw New Exception("There are no BLOBs to save")
myData.Read()
FileSize = myData.GetUInt32(myData.GetOrdinal("file_size"))
rawData = New Byte(FileSize) {}
myData.GetBytes(myData.GetOrdinal("file"), 0, rawData, 0, FileSize)
fs = New FileStream("C:\newfile.png", FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(rawData, 0, FileSize)
fs.Close()
MessageBox.Show("File successfully written to disk!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
myData.Close()
conn.Close()
Catch ex As Exception
MessageBox.Show("There was an error: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataReader myData;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
string SQL;
UInt32 FileSize;
byte[] rawData;
FileStream fs;
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
SQL = "SELECT file_name, file_size, file FROM file";
try
{
conn.Open();
Connectors and APIs
2091
cmd.Connection = conn;
cmd.CommandText = SQL;
myData = cmd.ExecuteReader();
if (! myData.HasRows)
throw new Exception("There are no BLOBs to save");
myData.Read();
FileSize = myData.GetUInt32(myData.GetOrdinal("file_size"));
rawData = new byte[FileSize];
myData.GetBytes(myData.GetOrdinal("file"), 0, rawData, 0, FileSize);
fs = new FileStream(@"C:\newfile.png", FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(rawData, 0, FileSize);
fs.Close();
MessageBox.Show("File successfully written to disk!",
"Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
myData.Close();
conn.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
After connecting, the contents of the file table are loaded into a MySqlDataReader object. The GetBytes method of the
MySqlDataReader is used to load the BLOB into a byte array, which is then written to disk using a FileStream object.
The GetOrdinal method of the MySqlDataReader can be used to determine the integer index of a named column. Use of the Get-
Ordinal method prevents errors if the column order of the SELECT query is changed.
21.2.4.9. Using Connector/NET with Crystal Reports
Introduction
Crystal Reports is a common tool used by Windows application developers to perform reporting and document generation. In this sec-
tion we will show how to use Crystal Reports XI with MySQL and Connector/NET.
21.2.4.9.1. Creating a Data Source
When creating a report in Crystal Reports there are two options for accessing the MySQL data while designing your report.
The first option is to use Connector/ODBC as an ADO data source when designing your report. You will be able to browse your data-
base and choose tables and fields using drag and drop to build your report. The disadvantage of this approach is that additional work
must be performed within your application to produce a data set that matches the one expected by your report.
The second option is to create a data set in VB.NET and save it as XML. This XML file can then be used to design a report. This works
quite well when displaying the report in your application, but is less versatile at design time because you must choose all relevant
columns when creating the data set. If you forget a column you must re-create the data set before the column can be added to the report.
The following code can be used to create a data set from a query and write it to disk:
Visual Basic Example
Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=world"
Try
conn.Open()
cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " _
& "country.name, country.population, country.continent " _
& "FROM country, city ORDER BY country.continent, country.name"
cmd.Connection = conn
Connectors and APIs
2092
myAdapter.SelectCommand = cmd
myAdapter.Fill(myData)
myData.WriteXml("C:\dataset.xml", XmlWriteMode.WriteSchema)
Catch ex As Exception
MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
DataSet myData = new DataSet();
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
myAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " +
"country.name, country.population, country.continent " +
"FROM country, city ORDER BY country.continent, country.name";
cmd.Connection = conn;
myAdapter.SelectCommand = cmd;
myAdapter.Fill(myData);
myData.WriteXml(@"C:\dataset.xml", XmlWriteMode.WriteSchema);
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message, "Report could not be created",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
The resulting XML file can be used as an ADO.NET XML datasource when designing your report.
If you choose to design your reports using Connector/ODBC, it can be downloaded from dev.mysql.com.
21.2.4.9.2. Creating the Report
For most purposes the Standard Report wizard should help with the initial creation of a report. To start the wizard, open Crystal Reports
and choose the New > Standard Report option from the File menu.
The wizard will first prompt you for a data source. If you are using Connector/ODBC as your data source, use the OLEDB provider for
ODBC option from the OLE DB (ADO) tree instead of the ODBC (RDO) tree when choosing a data source. If using a saved data set,
choose the ADO.NET (XML) option and browse to your saved data set.
The remainder of the report creation process is done automatically by the wizard.
After the report is created, choose the Report Options... entry of the File menu. Un-check the Save Data With Report option. This pre-
vents saved data from interfering with the loading of data within our application.
21.2.4.9.3. Displaying the Report
To display a report we first populate a data set with the data needed for the report, then load the report and bind it to the data set. Finally
we pass the report to the crViewer control for display to the user.
The following references are needed in a project that displays a report:
CrytalDecisions.CrystalReports.Engine
CrystalDecisions.ReportSource
CrystalDecisions.Shared
Connectors and APIs
2093
CrystalDecisions.Windows.Forms
The following code assumes that you created your report using a data set saved using the code shown in Section 21.2.4.9.1, Creating a
Data Source, and have a crViewer control on your form named myViewer.
Visual Basic Example
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data
Imports MySql.Data.MySqlClient
Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
conn.ConnectionString = _
"server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=test"
Try
conn.Open()
cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " _
& "country.name, country.population, country.continent " _
& "FROM country, city ORDER BY country.continent, country.name"
cmd.Connection = conn
myAdapter.SelectCommand = cmd
myAdapter.Fill(myData)
myReport.Load(".\world_report.rpt")
myReport.SetDataSource(myData)
myViewer.ReportSource = myReport
Catch ex As Exception
MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using MySql.Data.MySqlClient;
ReportDocument myReport = new ReportDocument();
DataSet myData = new DataSet();
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
myAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " +
"country.name, country.population, country.continent " +
"FROM country, city ORDER BY country.continent, country.name";
cmd.Connection = conn;
myAdapter.SelectCommand = cmd;
myAdapter.Fill(myData);
myReport.Load(@".\world_report.rpt");
myReport.SetDataSource(myData);
myViewer.ReportSource = myReport;
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message, "Report could not be created",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
A new data set it generated using the same query used to generate the previously saved data set. Once the data set is filled, a ReportDoc-
ument is used to load the report file and bind it to the data set. The ReportDocument is the passed as the ReportSource of the crViewer.
Connectors and APIs
2094
This same approach is taken when a report is created from a single table using Connector/ODBC. The data set replaces the table used in
the report and the report is displayed properly.
When a report is created from multiple tables using Connector/ODBC, a data set with multiple tables must be created in our application.
This allows each table in the report data source to be replaced with a report in the data set.
We populate a data set with multiple tables by providing multiple SELECT statements in our MySqlCommand object. These SELECT
statements are based on the SQL query shown in Crystal Reports in the Database menu's Show SQL Query option. Assume the follow-
ing query:
SELECT `country`.`Name`, `country`.`Continent`, `country`.`Population`, `city`.`Name`, `city`.`Population`
FROM `world`.`country` `country` LEFT OUTER JOIN `world`.`city` `city` ON `country`.`Code`=`city`.`CountryCode`
ORDER BY `country`.`Continent`, `country`.`Name`, `city`.`Name`
This query is converted to two SELECT queries and displayed with the following code:
Visual Basic Example
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data
Imports MySql.Data.MySqlClient
Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
conn.ConnectionString = "server=127.0.0.1;" _
& "uid=root;" _
& "pwd=12345;" _
& "database=world"
Try
conn.Open()
cmd.CommandText = "SELECT name, population, countrycode FROM city ORDER BY countrycode, name; " _
& "SELECT name, population, code, continent FROM country ORDER BY continent, name"
cmd.Connection = conn
myAdapter.SelectCommand = cmd
myAdapter.Fill(myData)
myReport.Load(".\world_report.rpt")
myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
myReport.Database.Tables(1).SetDataSource(myData.Tables(1))
myViewer.ReportSource = myReport
Catch ex As Exception
MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
C# Example
using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using MySql.Data.MySqlClient;
ReportDocument myReport = new ReportDocument();
DataSet myData = new DataSet();
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
myAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();
conn.ConnectionString = "server=127.0.0.1;uid=root;" +
"pwd=12345;database=test;";
try
{
cmd.CommandText = "SELECT name, population, countrycode FROM city ORDER " +
"BY countrycode, name; SELECT name, population, code, continent FROM " +
"country ORDER BY continent, name";
cmd.Connection = conn;
myAdapter.SelectCommand = cmd;
myAdapter.Fill(myData);
myReport.Load(@".\world_report.rpt");
myReport.Database.Tables(0).SetDataSource(myData.Tables(0));
Connectors and APIs
2095
myReport.Database.Tables(1).SetDataSource(myData.Tables(1));
myViewer.ReportSource = myReport;
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message, "Report could not be created",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
It is important to order the SELECT queries in alphabetical order, as this is the order the report will expect its source tables to be in. One
SetDataSource statement is needed for each table in the report.
This approach can cause performance problems because Crystal Reports must bind the tables together on the client-side, which will be
slower than using a pre-saved data set.
21.2.4.10. Handling Date and Time Information in Connector/NET
Introduction
MySQL and the .NET languages handle date and time information differently, with MySQL allowing dates that cannot be represented
by a .NET data type, such as '0000-00-00 00:00:00'. These differences can cause problems if not properly handled.
In this section we will demonstrate how to properly handle date and time information when using Connector/NET.
21.2.4.10.1. Problems when Using Invalid Dates
The differences in date handling can cause problems for developers who use invalid dates. Invalid MySQL dates cannot be loaded into
native .NET DateTime objects, including NULL dates.
Because of this issue, .NET DataSet objects cannot be populated by the Fill method of the MySqlDataAdapter class as invalid
dates will cause a System.ArgumentOutOfRangeException exception to occur.
21.2.4.10.2. Restricting Invalid Dates
The best solution to the date problem is to restrict users from entering invalid dates. This can be done on either the client or the server
side.
Restricting invalid dates on the client side is as simple as always using the .NET DateTime class to handle dates. The DateTime
class will only allow valid dates, ensuring that the values in your database are also valid. The disadvantage of this is that it is not useful
in a mixed environment where .NET and non .NET code are used to manipulate the database, as each application must perform its own
date validation.
Users of MySQL 5.0.2 and higher can use the new traditional SQL mode to restrict invalid date values. For information on using
the traditional SQL mode, see Section 5.1.8, Server SQL Modes.
21.2.4.10.3. Handling Invalid Dates
Although it is strongly recommended that you avoid the use of invalid dates within your .NET application, it is possible to use invalid
dates by means of the MySqlDateTime datatype.
The MySqlDateTime datatype supports the same date values that are supported by the MySQL server. The default behavior of Con-
nector/NET is to return a .NET DateTime object for valid date values, and return an error for invalid dates. This default can be modified
to cause Connector/NET to return MySqlDateTime objects for invalid dates.
To instruct Connector/NET to return a MySqlDateTime object for invalid dates, add the following line to your connection string:
Allow Zero Datetime=True
Please note that the use of the MySqlDateTime class can still be problematic. The following are some known issues:
1. Data binding for invalid dates can still cause errors (zero dates like 0000-00-00 do not seem to have this problem).
2. The ToString method return a date formatted in the standard MySQL format (for example, 2005-02-23 08:50:25). This
differs from the ToString behavior of the .NET DateTime class.
Connectors and APIs
2096
3. The MySqlDateTime class supports NULL dates, while the .NET DateTime class does not. This can cause errors when trying to
convert a MySQLDateTime to a DateTime if you do not check for NULL first.
Because of the known issues, the best recommendation is still to use only valid dates in your application.
21.2.4.10.4. Handling NULL Dates
The .NET DateTime datatype cannot handle NULL values. As such, when assigning values from a query to a DateTime variable,
you must first check whether the value is in fact NULL.
When using a MySqlDataReader, use the .IsDBNull method to check whether a value is NULL before making the assignment:
Visual Basic Example
If Not myReader.IsDBNull(myReader.GetOrdinal("mytime")) Then
myTime = myReader.GetDateTime(myReader.GetOrdinal("mytime"))
Else
myTime = DateTime.MinValue
End If
C# Example
if (! myReader.IsDBNull(myReader.GetOrdinal("mytime")))
myTime = myReader.GetDateTime(myReader.GetOrdinal("mytime"));
else
myTime = DateTime.MinValue;
NULL values will work in a data set and can be bound to form controls without special handling.
21.2.4.11. ASP.NET Provider Model
MySQL Connector/Net provides support for the ASP.NET 2.0 provider model. This model allows application developers to focus on
the business logic of there application instead of having to recreate such boilerplate items as membership and roles support. Currently,
only membership and role providers are supplied although session state and profile providers will be provided in upcoming releases.
Installing The Providers
The installation of Connector/Net 5.1 or later will install the providers and register them in your machines .NET configuration file. The
providers are implemented in the file mysql.web.dll and this file can be found in your Connector/Net installation folder. There is
no need to run any type of SQL script to setup the database as the providers create and maintain the proper schema automatically.
Using The Providers
The easiest way to start using the providers is to use the ASP.NET configuration tool that is available on the Solution Explorer toolbar
when you have a website project loaded.
In the web pages that open you will be able to select the MySQL membership and roles provider by indicating that you want to pick a
custom provider for each area.
When the provider is installed, it creates a dummy connection string named LocalMySqlServer. This has to be done so that the pro-
vider will work in the ASP.NET configuration tool. However, you will want to override this connection string in your web.config file.
You do this by first removing the dummy connection string and then adding in the proper one. Here is an example:
<connectionStrings>
<remove name="LocalMySqlServer"/>
<add name="LocalMySqlServer" connectionString="server=xxx;uid=xxx;pwd=xxx"/>
</connectionStrings>
Distribution
To use the providers on a production server you will need to distribute the MySql.Data and the MySql.Web assemblies and either
register them in the remote systems Global Assembly Cache or keep them in your applications bin folder.
21.2.4.12. Binary/Nonbinary Issues
Connectors and APIs
2097
There are certain situations where MySQL will return incorrect metadata about one or more columns. More specifically, the server will
sometimes report that a column is binary when it is not and vice versa. In these situations, it becomes practically impossible for the con-
nector to be able to correctly identify the correct metadat.
Some examples of situations that may return incorrect metadata are:
Execution of SHOW PROCESSLIST. Some of the columns will be returned as binary even though they only hold string data.
When a temp table is used to process a resultset, some columns may be returned with incorrect binary flags.
Some server functions such DATE_FORMAT will incorrectly return the column as binary.
With the availability of BINARY and VARBINARY data types it is important that we respect the metadata returned by the sever.
However, we are aware that some existing applications may break with this change so we are creating a connection string option to en-
able or disable it. By default, Connector/Net 5.1 will respect the binary flags returned by the server. This will mean that you may need
to make small changes to your application to accomodate this change.
In the event that the changes required to your application would be too large, you can add 'respect binary flags=false' to your connection
string. This will cause the connector to use the prior behavior. In a nutshell, that behavior was that any column that is marked as string,
regardless of binary flags, will be returned as string. Only columns that are specifically marked as a BLOB will be returned as BLOB.
21.2.4.13. Character Sets
Treating Binary Blobs As UTF8
MySQL doesn't currently support 4 byte UTF8 sequences. This makes it difficult to represent some multi-byte languages such as Japan-
ese. To try and alleviate this, Connector/Net now supports a mode where binary blobs can be treated as strings.
To do this, you set the 'Treat Blobs As UTF8' connection string keyword to yes. This is all that needs to be done to enable conversion of
all binary blobs to UTF8 strings. If you wish to convert only some of your blob columns, then you can make use of the 'BlobAs-
UTF8IncludePattern' and 'BlobAsUTF8ExcludePattern' keywords. These should be set to the regular expression pattern that matches the
column names you wish to include or exlude respectively.
One thing to note is that the regular expression patterns can both match a single column. When this happens, the include pattern is ap-
plied before the exclude pattern. The result, in this case, would be that the column would be excluded. You should also be aware that
this mode does not apply to columns of type BINARY or VARBINARY and also do not apply to nonbinary BLOB columns.
Currently this mode only applies to reading strings out of MySQL. To insert 4-byte UTF8 strings into blob columns you will need to use
the .NET Encoding.GetBytes function to convert your string to a series of bytes. You can then set this byte array as a parameter
for a BLOB column.
21.2.4.14. Working with medium trust
.NET applications operate under a given trust level. Normal desktop applications operate under full trust while web applications that are
hosted in shared environments are normally run under the medium trust level. Some hosting providers host shared applications in their
own app pools and allow the application to run under full trust, but this seems to be the exception rather than the rule.
Connector/Net versions prior to 5.0.8 and 5.1.3 were not compatible with medium trust hosting. Starting with these versions, Connector/
Net can be used under medium trust hosting that has been modified to allow the use of sockets for communication. By default, medium
trust does not include SocketPermission. Connector/Net uses sockets to talk with the MySQL server so it is required that a new
trust level be created that is an exact clone of medium trust but that has SocketPermission added.
21.2.5. Connector/NET Reference
This section of the manual contains a complete reference to the Connector/NET ADO.NET component, automatically generated from
the embedded documentation.
21.2.5.1. MySql.Data.MySqlClient
Namespace hierarchy
Classes
Connectors and APIs
2098
Class Description
MySqlCommand
MySqlCommandBuilder
MySqlConnection
MySqlDataAdapter
MySqlDataReader Provides a means of reading a forward-only stream of rows from a
MySQL database. This class cannot be inherited.
MySqlError Collection of error codes that can be returned by the server
MySqlException The exception that is thrown when MySQL returns an error. This
class cannot be inherited.
MySqlHelper Helper class that makes it easier to work with the provider.
MySqlInfoMessageEventArgs Provides data for the InfoMessage event. This class cannot be in-
herited.
MySqlParameter Represents a parameter to a MySqlCommand , and optionally, its
mapping to DataSetcolumns. This class cannot be inherited.
MySqlParameterCollection Represents a collection of parameters relevant to a MySqlCom-
mand as well as their respective mappings to columns in a Data-
Set. This class cannot be inherited.
MySqlRowUpdatedEventArgs Provides data for the RowUpdated event. This class cannot be in-
herited.
MySqlRowUpdatingEventArgs Provides data for the RowUpdating event. This class cannot be in-
herited.
MySqlTransaction
Delegates
Delegate Description
MySqlInfoMessageEventHandler Represents the method that will handle the InfoMessage event of a
MySqlConnection.
MySqlRowUpdatedEventHandler Represents the method that will handle the RowUpdatedevent of a
MySqlDataAdapter .
MySqlRowUpdatingEventHandler Represents the method that will handle the RowUpdatingevent of a
MySqlDataAdapter .
Enumerations
Enumeration Description
MySqlDbType Specifies MySQL specific data type of a field, property, for use in
a MySqlParameter .
MySqlErrorCode
21.2.5.1.1. MySql.Data.MySqlClientHierarchy
See Also
MySql.Data.MySqlClient Namespace
21.2.5.1.2. MySqlCommand Class
For a list of all members of this type, see MySqlCommand Members .
Syntax: Visual Basic
Connectors and APIs
2099
NotInheritable Public Class MySqlCommand_
Inherits Component_
Implements IDbCommand, ICloneable
Syntax: C#
public sealed class MySqlCommand : Component, IDbCommand, ICloneable
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlCommand Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1. MySqlCommand Members
MySqlCommand overview
Public Instance Constructors
MySqlCommand Overloaded. Initializes a new instance of the MySqlCommand
class.
Public Instance Properties
CommandText
CommandTimeout
CommandType
Connection
Container(inherited from Component) Gets the IContainerthat contains the Component.
IsPrepared
Parameters
Site(inherited from Component) Gets or sets the ISiteof the Component.
Transaction
UpdatedRowSource
Public Instance Methods
Cancel Attempts to cancel the execution of a MySqlCommand. This oper-
ation is not supported.
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
CreateParameter Creates a new instance of a MySqlParameter object.
Dispose(inherited from Component) Releases all resources used by the Component.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
Connectors and APIs
2100
ExecuteNonQuery
ExecuteReader Overloaded.
ExecuteScalar
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetType(inherited from Object) Gets the Typeof the current instance.
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
Prepare
ToString(inherited from Component) Returns a Stringcontaining the name of the Component, if any.
This method should not be overridden.
Public Instance Events
Disposed(inherited from Component) Adds an event handler to listen to the Disposedevent on the com-
ponent.
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1. MySqlCommand Constructor
Initializes a new instance of the MySqlCommand class.
Overload List
Initializes a new instance of the MySqlCommand class.
public MySqlCommand();
public MySqlCommand(string);
public MySqlCommand(string,MySqlConnection);
public MySqlCommand(string,MySqlConnection,MySqlTransaction);
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.1. MySqlCommand Constructor ()
Initializes a new instance of the MySqlCommand class.
Syntax: Visual Basic
Overloads Public Sub New()
Syntax: C#
public MySqlCommand();
See Also
Connectors and APIs
2101
MySqlCommand Class , MySql.Data.MySqlClient Namespace , MySqlCommand Constructor Overload List
21.2.5.1.2.1.1.2. MySqlCommand Constructor (String)
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal cmdText As String _
)
Syntax: C#
public MySqlCommand(
stringcmdText
);
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace , MySqlCommand Constructor Overload List
21.2.5.1.2.1.1.3. MySqlCommand Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal cmdText As String, _
ByVal connection As MySqlConnection _
)
Syntax: C#
public MySqlCommand(
stringcmdText,
MySqlConnectionconnection
);
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace , MySqlCommand Constructor Overload List
21.2.5.1.2.1.1.3.1. MySqlConnection Class
For a list of all members of this type, see MySqlConnection Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlConnection_
Inherits Component_
Implements IDbConnection, ICloneable
Syntax: C#
public sealed class MySqlConnection : Component, IDbConnection, ICloneable
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
Connectors and APIs
2102
MySqlConnection Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1. MySqlConnection Members
MySqlConnection overview
Public Instance Constructors
MySqlConnection Overloaded. Initializes a new instance of the MySqlConnection
class.
Public Instance Properties
ConnectionString
ConnectionTimeout
Container(inherited from Component) Gets the IContainerthat contains the Component.
Database
DataSource Gets the name of the MySQL server to which to connect.
ServerThread Returns the id of the server thread this connection is executing on
ServerVersion
Site(inherited from Component) Gets or sets the ISiteof the Component.
State
UseCompression Indicates if this connection should use compression when commu-
nicating with the server.
Public Instance Methods
BeginTransaction Overloaded.
ChangeDatabase
Close
CreateCommand
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
Dispose(inherited from Component) Releases all resources used by the Component.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetType(inherited from Object) Gets the Typeof the current instance.
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
Open
Ping Ping
ToString(inherited from Component) Returns a Stringcontaining the name of the Component, if any.
This method should not be overridden.
Public Instance Events
Connectors and APIs
2103
Disposed(inherited from Component) Adds an event handler to listen to the Disposedevent on the com-
ponent.
InfoMessage
StateChange
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.1. MySqlConnection Constructor
Initializes a new instance of the MySqlConnection class.
Overload List
Initializes a new instance of the MySqlConnection class.
public MySqlConnection();
public MySqlConnection(string);
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.1.1. MySqlConnection Constructor
Initializes a new instance of the MySqlConnection class.
Syntax: Visual Basic
Overloads Public Sub New()
Syntax: C#
public MySqlConnection();
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace , MySqlConnection Constructor Overload List
21.2.5.1.2.1.1.3.1.1.1.2. MySqlConnection Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal connectionString As String _
)
Syntax: C#
public MySqlConnection(
stringconnectionString
);
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace , MySqlConnection Constructor Overload List
21.2.5.1.2.1.1.3.1.1.2. ConnectionString Property
Connectors and APIs
2104
Syntax: Visual Basic
NotOverridable Public Property ConnectionString As String _
_
Implements IDbConnection.ConnectionString
Syntax: C#
public string ConnectionString {get; set;}
Implements
IDbConnection.ConnectionString
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.3. ConnectionTimeout Property
Syntax: Visual Basic
NotOverridable Public ReadOnly Property ConnectionTimeout As Integer _
_
Implements IDbConnection.ConnectionTimeout
Syntax: C#
public int ConnectionTimeout {get;}
Implements
IDbConnection.ConnectionTimeout
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.4. Database Property
Syntax: Visual Basic
NotOverridable Public ReadOnly Property Database As String _
_
Implements IDbConnection.Database
Syntax: C#
public string Database {get;}
Implements
IDbConnection.Database
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.5. DataSource Property
Gets the name of the MySQL server to which to connect.
Syntax: Visual Basic
Public ReadOnly Property DataSource As String
Connectors and APIs
2105
Syntax: C#
public string DataSource {get;}
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.6. ServerThread Property
Returns the id of the server thread this connection is executing on
Syntax: Visual Basic
Public ReadOnly Property ServerThread As Integer
Syntax: C#
public int ServerThread {get;}
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.7. ServerVersion Property
Syntax: Visual Basic
Public ReadOnly Property ServerVersion As String
Syntax: C#
public string ServerVersion {get;}
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.8. State Property
Syntax: Visual Basic
NotOverridable Public ReadOnly Property State As ConnectionState _
_
Implements IDbConnection.State
Syntax: C#
public System.Data.ConnectionState State {get;}
Implements
IDbConnection.State
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.9. UseCompression Property
Indicates if this connection should use compression when communicating with the server.
Syntax: Visual Basic
Connectors and APIs
2106
Public ReadOnly Property UseCompression As Boolean
Syntax: C#
public bool UseCompression {get;}
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10. BeginTransaction Method
Overload List
public MySqlTransaction BeginTransaction();
public MySqlTransaction BeginTransaction(IsolationLevel);
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10.1. MySqlConnection.BeginTransaction Method
Syntax: Visual Basic
Overloads Public Function BeginTransaction() As MySqlTransaction
Syntax: C#
public MySqlTransaction BeginTransaction();
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace , MySqlConnection.BeginTransaction Overload List
21.2.5.1.2.1.1.3.1.1.10.1.1. MySqlTransaction Class
For a list of all members of this type, see MySqlTransaction Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlTransaction_
Implements IDbTransaction, IDisposable
Syntax: C#
public sealed class MySqlTransaction : IDbTransaction, IDisposable
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
Connectors and APIs
2107
MySqlTransaction Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10.1.1.1. MySqlTransaction Members
MySqlTransaction overview
Public Instance Properties
Connection Gets the MySqlConnection object associated with the transaction,
or a null reference (Nothing in Visual Basic) if the transaction is
no longer valid.
IsolationLevel Specifies the IsolationLevelfor this transaction.
Public Instance Methods
Commit
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
Rollback
ToString(inherited from Object) Returns a Stringthat represents the current Object.
See Also
MySqlTransaction Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10.1.1.1.1. Connection Property
Gets the MySqlConnection object associated with the transaction, or a null reference (Nothing in Visual Basic) if the transaction is no
longer valid.
Syntax: Visual Basic
Public ReadOnly Property Connection As MySqlConnection
Syntax: C#
public MySqlConnection Connection {get;}
Property Value
The MySqlConnection object associated with this transaction.
Remarks
A single application may have multiple database connections, each with zero or more transactions. This property enables you to determ-
ine the connection object associated with a particular transaction created by BeginTransaction .
See Also
MySqlTransaction Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10.1.1.1.2. IsolationLevel Property
Specifies the IsolationLevelfor this transaction.
Connectors and APIs
2108
Syntax: Visual Basic
NotOverridable Public ReadOnly Property IsolationLevel As IsolationLevel _
_
Implements IDbTransaction.IsolationLevel
Syntax: C#
public System.Data.IsolationLevel IsolationLevel {get;}
Property Value
The IsolationLevel for this transaction. The default is ReadCommitted.
Implements
IDbTransaction.IsolationLevel
Remarks
Parallel transactions are not supported. Therefore, the IsolationLevel applies to the entire transaction.
See Also
MySqlTransaction Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10.1.1.1.3. MySqlTransaction.Commit Method
Syntax: Visual Basic
NotOverridable Public Sub Commit() _
_
Implements IDbTransaction.Commit
Syntax: C#
public void Commit();
Implements
IDbTransaction.Commit
See Also
MySqlTransaction Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.10.1.1.1.4. MySqlTransaction.Rollback Method
Syntax: Visual Basic
NotOverridable Public Sub Rollback() _
_
Implements IDbTransaction.Rollback
Syntax: C#
public void Rollback();
Implements
IDbTransaction.Rollback
See Also
MySqlTransaction Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2109
21.2.5.1.2.1.1.3.1.1.10.2. MySqlConnection.BeginTransaction Method
Syntax: Visual Basic
Overloads Public Function BeginTransaction( _
ByVal iso As IsolationLevel _
) As MySqlTransaction
Syntax: C#
public MySqlTransaction BeginTransaction(
IsolationLeveliso
);
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace , MySqlConnection.BeginTransaction Overload List
21.2.5.1.2.1.1.3.1.1.11. MySqlConnection.ChangeDatabase Method
Syntax: Visual Basic
NotOverridable Public Sub ChangeDatabase( _
ByVal databaseName As String _
) _
_
Implements IDbConnection.ChangeDatabase
Syntax: C#
public void ChangeDatabase(
stringdatabaseName
);
Implements
IDbConnection.ChangeDatabase
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.12. MySqlConnection.Close Method
Syntax: Visual Basic
NotOverridable Public Sub Close() _
_
Implements IDbConnection.Close
Syntax: C#
public void Close();
Implements
IDbConnection.Close
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.13. MySqlConnection.CreateCommand Method
Syntax: Visual Basic
Public Function CreateCommand() As MySqlCommand
Connectors and APIs
2110
Syntax: C#
public MySqlCommand CreateCommand();
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.14. MySqlConnection.Open Method
Syntax: Visual Basic
NotOverridable Public Sub Open() _
_
Implements IDbConnection.Open
Syntax: C#
public void Open();
Implements
IDbConnection.Open
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.15. MySqlConnection.Ping Method
Ping
Syntax: Visual Basic
Public Function Ping() As Boolean
Syntax: C#
public bool Ping();
Return Value
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16. MySqlConnection.InfoMessage Event
Syntax: Visual Basic
Public Event InfoMessage As MySqlInfoMessageEventHandler
Syntax: C#
public event MySqlInfoMessageEventHandler InfoMessage;
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1. MySqlInfoMessageEventHandler Delegate
Represents the method that will handle the InfoMessage event of a MySqlConnection .
Connectors and APIs
2111
Syntax: Visual Basic
Public Delegate Sub MySqlInfoMessageEventHandler( _
ByVal sender As Object, _
ByVal args As MySqlInfoMessageEventArgs _
)
Syntax: C#
public delegate void MySqlInfoMessageEventHandler(
objectsender,
MySqlInfoMessageEventArgsargs
);
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1. MySqlInfoMessageEventArgs Class
Provides data for the InfoMessage event. This class cannot be inherited.
For a list of all members of this type, see MySqlInfoMessageEventArgs Members .
Syntax: Visual Basic
Public Class MySqlInfoMessageEventArgs_
Inherits EventArgs
Syntax: C#
public class MySqlInfoMessageEventArgs : EventArgs
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlInfoMessageEventArgs Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1. MySqlInfoMessageEventArgs Members
MySqlInfoMessageEventArgs overview
Public Instance Constructors
MySqlInfoMessageEventArgs Constructor Initializes a new instance of the MySqlInfoMessageEventArgs
class.
Public Instance Fields
Connectors and APIs
2112
errors
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
Protected Instance Methods
Finalize(inherited from Object) Allows an Objectto attempt to free resources and perform other
cleanup operations before the Objectis reclaimed by garbage col-
lection.
MemberwiseClone(inherited from Object) Creates a shallow copy of the current Object.
See Also
MySqlInfoMessageEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.1. MySqlInfoMessageEventArgs Constructor
Initializes a new instance of the MySqlInfoMessageEventArgs class.
Syntax: Visual Basic
Public Sub New()
Syntax: C#
public MySqlInfoMessageEventArgs();
See Also
MySqlInfoMessageEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2. MySqlInfoMessageEventArgs.errors Field
Syntax: Visual Basic
Public errors As MySqlError()
Syntax: C#
public MySqlError[] errors;
See Also
MySqlInfoMessageEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2.1. MySqlError Class
Collection of error codes that can be returned by the server
For a list of all members of this type, see MySqlError Members .
Connectors and APIs
2113
Syntax: Visual Basic
Public Class MySqlError
Syntax: C#
public class MySqlError
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlError Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2.1.1. MySqlError Members
MySqlError overview
Public Instance Constructors
MySqlError Constructor
Public Instance Properties
Code Error code
Level Error level
Message Error message
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
Protected Instance Methods
Finalize(inherited from Object) Allows an Objectto attempt to free resources and perform other
cleanup operations before the Objectis reclaimed by garbage col-
lection.
MemberwiseClone(inherited from Object) Creates a shallow copy of the current Object.
See Also
MySqlError Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2114
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2.1.1.1. MySqlError Constructor
Syntax: Visual Basic
Public Sub New( _
ByVal level As String, _
ByVal code As Integer, _
ByVal message As String _
)
Syntax: C#
public MySqlError(
stringlevel,
intcode,
stringmessage
);
Parameters
level:
code:
message:
See Also
MySqlError Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2.1.1.2. Code Property
Error code
Syntax: Visual Basic
Public ReadOnly Property Code As Integer
Syntax: C#
public int Code {get;}
See Also
MySqlError Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2.1.1.3. Level Property
Error level
Syntax: Visual Basic
Public ReadOnly Property Level As String
Syntax: C#
public string Level {get;}
See Also
MySqlError Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.16.1.1.1.2.1.1.4. Message Property
Connectors and APIs
2115
Error message
Syntax: Visual Basic
Public ReadOnly Property Message As String
Syntax: C#
public string Message {get;}
See Also
MySqlError Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.3.1.1.17. MySqlConnection.StateChange Event
Syntax: Visual Basic
Public Event StateChange As StateChangeEventHandler
Syntax: C#
public event StateChangeEventHandler StateChange;
See Also
MySqlConnection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.1.4. MySqlCommand Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal cmdText As String, _
ByVal connection As MySqlConnection, _
ByVal transaction As MySqlTransaction _
)
Syntax: C#
public MySqlCommand(
stringcmdText,
MySqlConnectionconnection,
MySqlTransactiontransaction
);
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace , MySqlCommand Constructor Overload List
21.2.5.1.2.1.2. CommandText Property
Syntax: Visual Basic
NotOverridable Public Property CommandText As String _
_
Implements IDbCommand.CommandText
Syntax: C#
public string CommandText {get; set;}
Implements
IDbCommand.CommandText
Connectors and APIs
2116
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.3. CommandTimeout Property
Syntax: Visual Basic
NotOverridable Public Property CommandTimeout As Integer _
_
Implements IDbCommand.CommandTimeout
Syntax: C#
public int CommandTimeout {get; set;}
Implements
IDbCommand.CommandTimeout
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.4. CommandType Property
Syntax: Visual Basic
NotOverridable Public Property CommandType As CommandType _
_
Implements IDbCommand.CommandType
Syntax: C#
public System.Data.CommandType CommandType {get; set;}
Implements
IDbCommand.CommandType
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.5. Connection Property
Syntax: Visual Basic
Public Property Connection As MySqlConnection
Syntax: C#
public MySqlConnection Connection {get; set;}
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.6. IsPrepared Property
Syntax: Visual Basic
Public ReadOnly Property IsPrepared As Boolean
Connectors and APIs
2117
Syntax: C#
public bool IsPrepared {get;}
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7. Parameters Property
Syntax: Visual Basic
Public ReadOnly Property Parameters As MySqlParameterCollection
Syntax: C#
public MySqlParameterCollection Parameters {get;}
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1. MySqlParameterCollection Class
Represents a collection of parameters relevant to a MySqlCommand as well as their respective mappings to columns in a DataSet. This
class cannot be inherited.
For a list of all members of this type, see MySqlParameterCollection Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlParameterCollection_
Inherits MarshalByRefObject_
Implements IDataParameterCollection, IList, ICollection, IEnumerable
Syntax: C#
public sealed class MySqlParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlParameterCollection Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1. MySqlParameterCollection Members
MySqlParameterCollection overview
Public Instance Constructors
MySqlParameterCollection Constructor Initializes a new instance of the MySqlParameterCollection class.
Public Instance Properties
Connectors and APIs
2118
Count Gets the number of MySqlParameter objects in the collection.
Item Overloaded. Gets the MySqlParameter with a specified attribute.
In C#, this property is the indexer for the MySqlParameterCollec-
tion class.
Public Instance Methods
Add Overloaded. Adds the specified MySqlParameter object to the
MySqlParameterCollection .
Clear Removes all items from the collection.
Contains Overloaded. Gets a value indicating whether a MySqlParameter
exists in the collection.
CopyTo Copies MySqlParameter objects from the MySqlParameterCollec-
tion to the specified array.
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetType(inherited from Object) Gets the Typeof the current instance.
IndexOf Overloaded. Gets the location of a MySqlParameter in the collec-
tion.
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
Insert Inserts a MySqlParameter into the collection at the specified index.
Remove Removes the specified MySqlParameter from the collection.
RemoveAt Overloaded. Removes the specified MySqlParameter from the col-
lection.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.1. MySqlParameterCollection Constructor
Initializes a new instance of the MySqlParameterCollection class.
Syntax: Visual Basic
Public Sub New()
Syntax: C#
public MySqlParameterCollection();
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2119
21.2.5.1.2.1.7.1.1.2. Count Property
Gets the number of MySqlParameter objects in the collection.
Syntax: Visual Basic
NotOverridable Public ReadOnly Property Count As Integer _
_
Implements ICollection.Count
Syntax: C#
public int Count {get;}
Implements
ICollection.Count
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3. Item Property
Gets the MySqlParameter with a specified attribute. In C#, this property is the indexer for the MySqlParameterCollection class.
Overload List
Gets the MySqlParameter at the specified index.
public MySqlParameter this[int] {get; set;}
Gets the MySqlParameter with the specified name.
public MySqlParameter this[string] {get; set;}
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1. MySqlParameter Class
Represents a parameter to a MySqlCommand , and optionally, its mapping to DataSetcolumns. This class cannot be inherited.
For a list of all members of this type, see MySqlParameter Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlParameter_
Inherits MarshalByRefObject_
Implements IDataParameter, IDbDataParameter, ICloneable
Syntax: C#
public sealed class MySqlParameter : MarshalByRefObject, IDataParameter, IDbDataParameter, ICloneable
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Connectors and APIs
2120
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlParameter Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1. MySqlParameter Members
MySqlParameter overview
Public Instance Constructors
MySqlParameter Overloaded. Initializes a new instance of the MySqlParameter
class.
Public Instance Properties
DbType Gets or sets the DbTypeof the parameter.
Direction Gets or sets a value indicating whether the parameter is input-only,
output-only, bidirectional, or a stored procedure return value para-
meter. As of MySQL version 4.1 and earlier, input-only is the only
valid choice.
IsNullable Gets or sets a value indicating whether the parameter accepts null
values.
IsUnsigned
MySqlDbType Gets or sets the MySqlDbType of the parameter.
ParameterName Gets or sets the name of the MySqlParameter.
Precision Gets or sets the maximum number of digits used to represent the
Value property.
Scale Gets or sets the number of decimal places to which Value is re-
solved.
Size Gets or sets the maximum size, in bytes, of the data within the
column.
SourceColumn Gets or sets the name of the source column that is mapped to the
DataSetand used for loading or returning the Value .
SourceVersion Gets or sets the DataRowVersionto use when loading Value .
Value Gets or sets the value of the parameter.
Public Instance Methods
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetType(inherited from Object) Gets the Typeof the current instance.
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
Connectors and APIs
2121
ToString Overridden. Gets a string containing the ParameterName .
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.1. MySqlParameter Constructor
Initializes a new instance of the MySqlParameter class.
Overload List
Initializes a new instance of the MySqlParameter class.
public MySqlParameter();
Initializes a new instance of the MySqlParameter class with the parameter name and the data type.
public MySqlParameter(string,MySqlDbType);
Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType , and the size.
public MySqlParameter(string,MySqlDbType,int);
Initializes a new instance of the MySqlParameter class with the parameter name, the type of the parameter, the size of the parameter, a
ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a DataRowVersionto use, and the
value of the parameter.
public MySqlParameter(string,MySqlDbType,int,ParameterDirection,bool,byte,byte,string,DataRowVersion,object);
Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType , the size, and the source column
name.
public MySqlParameter(string,MySqlDbType,int,string);
Initializes a new instance of the MySqlParameter class with the parameter name and a value of the new MySqlParameter.
public MySqlParameter(string,object);
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.1.1. MySqlParameter Constructor ()
Initializes a new instance of the MySqlParameter class.
Syntax: Visual Basic
Overloads Public Sub New()
Syntax: C#
public MySqlParameter();
Connectors and APIs
2122
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace , MySqlParameter Constructor Overload List
21.2.5.1.2.1.7.1.1.3.1.1.1.2. MySqlParameter Constructor
Initializes a new instance of the MySqlParameter class with the parameter name and the data type.
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType _
)
Syntax: C#
public MySqlParameter(
stringparameterName,
MySqlDbTypedbType
);
Parameters
parameterName: The name of the parameter to map.
dbType: One of the MySqlDbType values.
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace , MySqlParameter Constructor Overload List
21.2.5.1.2.1.7.1.1.3.1.1.1.2.1. MySqlDbType Enumeration
Specifies MySQL specific data type of a field, property, for use in a MySqlParameter .
Syntax: Visual Basic
Public Enum MySqlDbType
Syntax: C#
public enum MySqlDbType
Members
Member Name Description
Newdate Obsolete. Use Datetime or Date type.
Timestamp A timestamp. The range is '1970-01-01 00:00:01' to sometime in
the year 2038.
Time
The range is '-838:59:59' to '838:59:59'
Date Date The supported range is '1000-01-01' to '9999-12-31'
Datetime The supported range is '1000-01-01 00:00:00' to '9999-12-31
23:59:59'
Year A year in 2- or 4-digit format (default is 4-digit). The allowable
values are 1901 to 2155, 0000 in the 4-digit year format, and
1970-2069 if you use the 2-digit format (70-69).
TinyBlob A BLOB column with a maximum length of 255 (2^8 - 1) charac-
ters
Connectors and APIs
2123
Blob A BLOB column with a maximum length of 65535 (2^16 - 1)
characters
MediumBlob A BLOB column with a maximum length of 16777215 (2^24 - 1)
characters
LongBlob A BLOB column with a maximum length of 4294967295 or 4G
(2^32 - 1) characters
Int16
A 16-bit signed integer. The signed range is -32768 to 32767. The
unsigned range is 0 to 65535
Int24 Specifies a 24 (3 byte) signed or unsigned value
Int32
A 32-bit signed integer
Int64
A 64-bit signed integer
Byte
The signed range is -128 to 127. The unsigned range is 0 to 255.
Float
A small (single-precision) floating-point number. Allowable val-
ues are -3.402823466E+38 to -1.175494351E-38, 0, and
1.175494351E-38 to 3.402823466E+38.
Double
A normal-size (double-precision) floating-point number. Allow-
able values are -1.7976931348623157E+308 to -
2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to
1.7976931348623157E+308.
UByte An 8-bit unsigned value
UInt16 A 16-bit unsigned value
UInt24 A 24-bit unsigned value
UInt32 A 32-bit unsigned value
UInt64 A 64-bit unsigned value
Decimal
A fixed precision and scale numeric value between -1038 -1 and
10 38 -1
NewDecimal New Decimal
Set A set. A string object that can have zero or more values, each of
which must be chosen from the list of values 'value1', 'value2', ...
A SET can have a maximum of 64 members.
String Obsolete Use VarChar type
VarChar A variable-length string containing 0 to 255 characters
VarString A variable-length string containing 0 to 65535 characters
Enum An enumeration. A string object that can have only one value,
chosen from the list of values 'value1', 'value2', ..., NULL or the
special "" error value. An ENUM can have a maximum of 65535
distinct values.
Geometry
Bit Bit-field data type
TinyText A nonbinary string column supporting a maximum length of 255
(2^8 - 1) characters
Text A nonbinary string column supporting a maximum length of
65535 (2^16 - 1) characters
MediumText A nonbinary string column supporting a maximum length of
16777215 (2^24 - 1) characters
LongText A nonbinary string column supporting a maximum length of
Connectors and APIs
2124
4294967295 (2^32 - 1) characters
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.1.3. MySqlParameter Constructor (String, MySqlDbType, Int32)
Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType , and the size.
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType, _
ByVal size As Integer _
)
Syntax: C#
public MySqlParameter(
stringparameterName,
MySqlDbTypedbType,
intsize
);
Parameters
parameterName: The name of the parameter to map.
dbType: One of the MySqlDbType values.
size: The length of the parameter.
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace , MySqlParameter Constructor Overload List
21.2.5.1.2.1.7.1.1.3.1.1.1.4. MySqlParameter Constructor
Initializes a new instance of the MySqlParameter class with the parameter name, the type of the parameter, the size of the parameter, a
ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a DataRowVersionto use, and the
value of the parameter.
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType, _
ByVal size As Integer, _
ByVal direction As ParameterDirection, _
ByVal isNullable As Boolean, _
ByVal precision As Byte, _
ByVal scale As Byte, _
ByVal sourceColumn As String, _
ByVal sourceVersion As DataRowVersion, _
ByVal value As Object _
)
Syntax: C#
Connectors and APIs
2125
public MySqlParameter(
stringparameterName,
MySqlDbTypedbType,
intsize,
ParameterDirectiondirection,
boolisNullable,
byteprecision,
bytescale,
stringsourceColumn,
DataRowVersionsourceVersion,
objectvalue
);
Parameters
parameterName: The name of the parameter to map.
dbType: One of the MySqlDbType values.
size: The length of the parameter.
direction: One of the ParameterDirectionvalues.
isNullable: true if the value of the field can be null, otherwise false.
precision: The total number of digits to the left and right of the decimal point to which Value is resolved.
scale: The total number of decimal places to which Value is resolved.
sourceColumn: The name of the source column.
sourceVersion: One of the DataRowVersionvalues.
value: An Objectthat is the value of the MySqlParameter .
Exceptions
Exception Type Condition
ArgumentException
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace , MySqlParameter Constructor Overload List
21.2.5.1.2.1.7.1.1.3.1.1.1.4.1. Value Property
Gets or sets the value of the parameter.
Syntax: Visual Basic
NotOverridable Public Property Value As Object _
_
Implements IDataParameter.Value
Syntax: C#
public object Value {get; set;}
Implements
IDataParameter.Value
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2126
21.2.5.1.2.1.7.1.1.3.1.1.1.5. MySqlParameter Constructor
Initializes a new instance of the MySqlParameter class with the parameter name, the MySqlDbType , the size, and the source column
name.
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType, _
ByVal size As Integer, _
ByVal sourceColumn As String _
)
Syntax: C#
public MySqlParameter(
stringparameterName,
MySqlDbTypedbType,
intsize,
stringsourceColumn
);
Parameters
parameterName: The name of the parameter to map.
dbType: One of the MySqlDbType values.
size: The length of the parameter.
sourceColumn: The name of the source column.
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace , MySqlParameter Constructor Overload List
21.2.5.1.2.1.7.1.1.3.1.1.1.6. MySqlParameter Constructor
Initializes a new instance of the MySqlParameter class with the parameter name and a value of the new MySqlParameter.
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal parameterName As String, _
ByVal value As Object _
)
Syntax: C#
public MySqlParameter(
stringparameterName,
objectvalue
);
Parameters
parameterName: The name of the parameter to map.
value: An Objectthat is the value of the MySqlParameter .
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace , MySqlParameter Constructor Overload List
Connectors and APIs
2127
21.2.5.1.2.1.7.1.1.3.1.1.2. DbType Property
Gets or sets the DbTypeof the parameter.
Syntax: Visual Basic
NotOverridable Public Property DbType As DbType _
_
Implements IDataParameter.DbType
Syntax: C#
public System.Data.DbType DbType {get; set;}
Implements
IDataParameter.DbType
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.3. Direction Property
Gets or sets a value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value para-
meter. As of MySQL version 4.1 and earlier, input-only is the only valid choice.
Syntax: Visual Basic
NotOverridable Public Property Direction As ParameterDirection _
_
Implements IDataParameter.Direction
Syntax: C#
public System.Data.ParameterDirection Direction {get; set;}
Implements
IDataParameter.Direction
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.4. IsNullable Property
Gets or sets a value indicating whether the parameter accepts null values.
Syntax: Visual Basic
NotOverridable Public Property IsNullable As Boolean _
_
Implements IDataParameter.IsNullable
Syntax: C#
public bool IsNullable {get; set;}
Implements
IDataParameter.IsNullable
See Also
Connectors and APIs
2128
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.5. IsUnsigned Property
Syntax: Visual Basic
Public Property IsUnsigned As Boolean
Syntax: C#
public bool IsUnsigned {get; set;}
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.6. MySqlDbType Property
Gets or sets the MySqlDbType of the parameter.
Syntax: Visual Basic
Public Property MySqlDbType As MySqlDbType
Syntax: C#
public MySqlDbType MySqlDbType {get; set;}
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.7. ParameterName Property
Gets or sets the name of the MySqlParameter.
Syntax: Visual Basic
NotOverridable Public Property ParameterName As String _
_
Implements IDataParameter.ParameterName
Syntax: C#
public string ParameterName {get; set;}
Implements
IDataParameter.ParameterName
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.8. Precision Property
Gets or sets the maximum number of digits used to represent the Value property.
Syntax: Visual Basic
NotOverridable Public Property Precision As Byte _
_
Implements IDbDataParameter.Precision
Connectors and APIs
2129
Syntax: C#
public byte Precision {get; set;}
Implements
IDbDataParameter.Precision
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.9. Scale Property
Gets or sets the number of decimal places to which Value is resolved.
Syntax: Visual Basic
NotOverridable Public Property Scale As Byte _
_
Implements IDbDataParameter.Scale
Syntax: C#
public byte Scale {get; set;}
Implements
IDbDataParameter.Scale
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.10. Size Property
Gets or sets the maximum size, in bytes, of the data within the column.
Syntax: Visual Basic
NotOverridable Public Property Size As Integer _
_
Implements IDbDataParameter.Size
Syntax: C#
public int Size {get; set;}
Implements
IDbDataParameter.Size
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.11. SourceColumn Property
Gets or sets the name of the source column that is mapped to the DataSetand used for loading or returning the Value .
Syntax: Visual Basic
NotOverridable Public Property SourceColumn As String _
_
Implements IDataParameter.SourceColumn
Connectors and APIs
2130
Syntax: C#
public string SourceColumn {get; set;}
Implements
IDataParameter.SourceColumn
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.12. SourceVersion Property
Gets or sets the DataRowVersionto use when loading Value .
Syntax: Visual Basic
NotOverridable Public Property SourceVersion As DataRowVersion _
_
Implements IDataParameter.SourceVersion
Syntax: C#
public System.Data.DataRowVersion SourceVersion {get; set;}
Implements
IDataParameter.SourceVersion
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.1.1.13. MySqlParameter.ToString Method
Overridden. Gets a string containing the ParameterName .
Syntax: Visual Basic
Overrides Public Function ToString() As String
Syntax: C#
public override string ToString();
Return Value
See Also
MySqlParameter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.3.2. Item Property (Int32)
Gets the MySqlParameter at the specified index.
Syntax: Visual Basic
Overloads Public Default Property Item( _
ByVal index As Integer _
) As MySqlParameter
Syntax: C#
public MySqlParameter this[
Connectors and APIs
2131
intindex
] {get; set;}
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Item Overload List
21.2.5.1.2.1.7.1.1.3.3. Item Property (String)
Gets the MySqlParameter with the specified name.
Syntax: Visual Basic
Overloads Public Default Property Item( _
ByVal name As String _
) As MySqlParameter
Syntax: C#
public MySqlParameter this[
stringname
] {get; set;}
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Item Overload List
21.2.5.1.2.1.7.1.1.4. Add Method
Adds the specified MySqlParameter object to the MySqlParameterCollection .
Overload List
Adds the specified MySqlParameter object to the MySqlParameterCollection .
public MySqlParameter Add(MySqlParameter);
Adds the specified MySqlParameter object to the MySqlParameterCollection .
public int Add(object);
Adds a MySqlParameter to the MySqlParameterCollection given the parameter name and the data type.
public MySqlParameter Add(string,MySqlDbType);
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, and the column length.
public MySqlParameter Add(string,MySqlDbType,int);
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, the column length, and the source
column name.
public MySqlParameter Add(string,MySqlDbType,int,string);
Adds a MySqlParameter to the MySqlParameterCollection given the specified parameter name and value.
Connectors and APIs
2132
public MySqlParameter Add(string,object);
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.4.1. MySqlParameterCollection.Add Method
Adds the specified MySqlParameter object to the MySqlParameterCollection .
Syntax: Visual Basic
Overloads Public Function Add( _
ByVal value As MySqlParameter _
) As MySqlParameter
Syntax: C#
public MySqlParameter Add(
MySqlParametervalue
);
Parameters
value: The MySqlParameter to add to the collection.
Return Value
The newly added MySqlParameter object.
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Add Overload List
21.2.5.1.2.1.7.1.1.4.2. MySqlParameterCollection.Add Method
Adds the specified MySqlParameter object to the MySqlParameterCollection .
Syntax: Visual Basic
NotOverridable Overloads Public Function Add( _
ByVal value As Object _
) As Integer _
_
Implements IList.Add
Syntax: C#
public int Add(
objectvalue
);
Parameters
value: The MySqlParameter to add to the collection.
Return Value
The index of the new MySqlParameter object.
Implements
Connectors and APIs
2133
IList.Add
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Add Overload List
21.2.5.1.2.1.7.1.1.4.3. MySqlParameterCollection.Add Method
Adds a MySqlParameter to the MySqlParameterCollection given the parameter name and the data type.
Syntax: Visual Basic
Overloads Public Function Add( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType _
) As MySqlParameter
Syntax: C#
public MySqlParameter Add(
stringparameterName,
MySqlDbTypedbType
);
Parameters
parameterName: The name of the parameter.
dbType: One of the MySqlDbType values.
Return Value
The newly added MySqlParameter object.
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Add Overload List
21.2.5.1.2.1.7.1.1.4.4. MySqlParameterCollection.Add Method
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, and the column length.
Syntax: Visual Basic
Overloads Public Function Add( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType, _
ByVal size As Integer _
) As MySqlParameter
Syntax: C#
public MySqlParameter Add(
stringparameterName,
MySqlDbTypedbType,
intsize
);
Parameters
parameterName: The name of the parameter.
dbType: One of the MySqlDbType values.
size: The length of the column.
Connectors and APIs
2134
Return Value
The newly added MySqlParameter object.
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Add Overload List
21.2.5.1.2.1.7.1.1.4.5. MySqlParameterCollection.Add Method
Adds a MySqlParameter to the MySqlParameterCollection with the parameter name, the data type, the column length, and the source
column name.
Syntax: Visual Basic
Overloads Public Function Add( _
ByVal parameterName As String, _
ByVal dbType As MySqlDbType, _
ByVal size As Integer, _
ByVal sourceColumn As String _
) As MySqlParameter
Syntax: C#
public MySqlParameter Add(
stringparameterName,
MySqlDbTypedbType,
intsize,
stringsourceColumn
);
Parameters
parameterName: The name of the parameter.
dbType: One of the MySqlDbType values.
size: The length of the column.
sourceColumn: The name of the source column.
Return Value
The newly added MySqlParameter object.
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Add Overload List
21.2.5.1.2.1.7.1.1.4.6. MySqlParameterCollection.Add Method
Adds a MySqlParameter to the MySqlParameterCollection given the specified parameter name and value.
Syntax: Visual Basic
Overloads Public Function Add( _
ByVal parameterName As String, _
ByVal value As Object _
) As MySqlParameter
Syntax: C#
public MySqlParameter Add(
stringparameterName,
objectvalue
);
Connectors and APIs
2135
Parameters
parameterName: The name of the parameter.
value: The Value of the MySqlParameter to add to the collection.
Return Value
The newly added MySqlParameter object.
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Add Overload List
21.2.5.1.2.1.7.1.1.5. MySqlParameterCollection.Clear Method
Removes all items from the collection.
Syntax: Visual Basic
NotOverridable Public Sub Clear() _
_
Implements IList.Clear
Syntax: C#
public void Clear();
Implements
IList.Clear
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.6. Contains Method
Gets a value indicating whether a MySqlParameter exists in the collection.
Overload List
Gets a value indicating whether a MySqlParameter exists in the collection.
public bool Contains(object);
Gets a value indicating whether a MySqlParameter with the specified parameter name exists in the collection.
public bool Contains(string);
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.6.1. MySqlParameterCollection.Contains Method
Gets a value indicating whether a MySqlParameter exists in the collection.
Syntax: Visual Basic
NotOverridable Overloads Public Function Contains( _
Connectors and APIs
2136
ByVal value As Object _
) As Boolean _
_
Implements IList.Contains
Syntax: C#
public bool Contains(
objectvalue
);
Parameters
value: The value of the MySqlParameter object to find.
Return Value
true if the collection contains the MySqlParameter object; otherwise, false.
Implements
IList.Contains
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Contains Overload List
21.2.5.1.2.1.7.1.1.6.2. MySqlParameterCollection.Contains Method
Gets a value indicating whether a MySqlParameter with the specified parameter name exists in the collection.
Syntax: Visual Basic
NotOverridable Overloads Public Function Contains( _
ByVal name As String _
) As Boolean _
_
Implements IDataParameterCollection.Contains
Syntax: C#
public bool Contains(
stringname
);
Parameters
name: The name of the MySqlParameter object to find.
Return Value
true if the collection contains the parameter; otherwise, false.
Implements
IDataParameterCollection.Contains
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.Contains Overload List
21.2.5.1.2.1.7.1.1.7. MySqlParameterCollection.CopyTo Method
Copies MySqlParameter objects from the MySqlParameterCollection to the specified array.
Connectors and APIs
2137
Syntax: Visual Basic
NotOverridable Public Sub CopyTo( _
ByVal array As Array, _
ByVal index As Integer _
) _
_
Implements ICollection.CopyTo
Syntax: C#
public void CopyTo(
Arrayarray,
intindex
);
Parameters
array:
index:
Implements
ICollection.CopyTo
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.8. IndexOf Method
Gets the location of a MySqlParameter in the collection.
Overload List
Gets the location of a MySqlParameter in the collection.
public int IndexOf(object);
Gets the location of the MySqlParameter in the collection with a specific parameter name.
public int IndexOf(string);
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.8.1. MySqlParameterCollection.IndexOf Method
Gets the location of a MySqlParameter in the collection.
Syntax: Visual Basic
NotOverridable Overloads Public Function IndexOf( _
ByVal value As Object _
) As Integer _
_
Implements IList.IndexOf
Syntax: C#
public int IndexOf(
Connectors and APIs
2138
objectvalue
);
Parameters
value: The MySqlParameter object to locate.
Return Value
The zero-based location of the MySqlParameter in the collection.
Implements
IList.IndexOf
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.IndexOf Overload List
21.2.5.1.2.1.7.1.1.8.2. MySqlParameterCollection.IndexOf Method
Gets the location of the MySqlParameter in the collection with a specific parameter name.
Syntax: Visual Basic
NotOverridable Overloads Public Function IndexOf( _
ByVal parameterName As String _
) As Integer _
_
Implements IDataParameterCollection.IndexOf
Syntax: C#
public int IndexOf(
stringparameterName
);
Parameters
parameterName: The name of the MySqlParameter object to retrieve.
Return Value
The zero-based location of the MySqlParameter in the collection.
Implements
IDataParameterCollection.IndexOf
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.IndexOf Overload List
21.2.5.1.2.1.7.1.1.9. MySqlParameterCollection.Insert Method
Inserts a MySqlParameter into the collection at the specified index.
Syntax: Visual Basic
NotOverridable Public Sub Insert( _
ByVal index As Integer, _
ByVal value As Object _
) _
_
Implements IList.Insert
Connectors and APIs
2139
Syntax: C#
public void Insert(
intindex,
objectvalue
);
Parameters
index:
value:
Implements
IList.Insert
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.10. MySqlParameterCollection.Remove Method
Removes the specified MySqlParameter from the collection.
Syntax: Visual Basic
NotOverridable Public Sub Remove( _
ByVal value As Object _
) _
_
Implements IList.Remove
Syntax: C#
public void Remove(
objectvalue
);
Parameters
value:
Implements
IList.Remove
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.11. RemoveAt Method
Removes the specified MySqlParameter from the collection.
Overload List
Removes the specified MySqlParameter from the collection using a specific index.
public void RemoveAt(int);
Removes the specified MySqlParameter from the collection using the parameter name.
Connectors and APIs
2140
public void RemoveAt(string);
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.7.1.1.11.1. MySqlParameterCollection.RemoveAt Method
Removes the specified MySqlParameter from the collection using a specific index.
Syntax: Visual Basic
NotOverridable Overloads Public Sub RemoveAt( _
ByVal index As Integer _
) _
_
Implements IList.RemoveAt
Syntax: C#
public void RemoveAt(
intindex
);
Parameters
index: The zero-based index of the parameter.
Implements
IList.RemoveAt
See Also
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.RemoveAt Overload List
21.2.5.1.2.1.7.1.1.11.2. MySqlParameterCollection.RemoveAt Method
Removes the specified MySqlParameter from the collection using the parameter name.
Syntax: Visual Basic
NotOverridable Overloads Public Sub RemoveAt( _
ByVal name As String _
) _
_
Implements IDataParameterCollection.RemoveAt
Syntax: C#
public void RemoveAt(
stringname
);
Parameters
name: The name of the MySqlParameter object to retrieve.
Implements
IDataParameterCollection.RemoveAt
See Also
Connectors and APIs
2141
MySqlParameterCollection Class , MySql.Data.MySqlClient Namespace , MySqlParameterCollection.RemoveAt Overload List
21.2.5.1.2.1.8. Transaction Property
Syntax: Visual Basic
Public Property Transaction As MySqlTransaction
Syntax: C#
public MySqlTransaction Transaction {get; set;}
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.9. UpdatedRowSource Property
Syntax: Visual Basic
NotOverridable Public Property UpdatedRowSource As UpdateRowSource _
_
Implements IDbCommand.UpdatedRowSource
Syntax: C#
public System.Data.UpdateRowSource UpdatedRowSource {get; set;}
Implements
IDbCommand.UpdatedRowSource
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.10. MySqlCommand.Cancel Method
Attempts to cancel the execution of a MySqlCommand. This operation is not supported.
Syntax: Visual Basic
NotOverridable Public Sub Cancel() _
_
Implements IDbCommand.Cancel
Syntax: C#
public void Cancel();
Implements
IDbCommand.Cancel
Remarks
Cancelling an executing command is currently not supported on any version of MySQL.
Exceptions
Exception Type Condition
NotSupportedException This operation is not supported.
Connectors and APIs
2142
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.11. MySqlCommand.CreateParameter Method
Creates a new instance of a MySqlParameter object.
Syntax: Visual Basic
Public Function CreateParameter() As MySqlParameter
Syntax: C#
public MySqlParameter CreateParameter();
Return Value
A MySqlParameter object.
Remarks
This method is a strongly-typed version of CreateParameter.
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.12. MySqlCommand.ExecuteNonQuery Method
Syntax: Visual Basic
NotOverridable Public Function ExecuteNonQuery() As Integer _
_
Implements IDbCommand.ExecuteNonQuery
Syntax: C#
public int ExecuteNonQuery();
Implements
IDbCommand.ExecuteNonQuery
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13. ExecuteReader Method
Overload List
public MySqlDataReader ExecuteReader();
public MySqlDataReader ExecuteReader(CommandBehavior);
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1. MySqlCommand.ExecuteReader Method
Syntax: Visual Basic
Connectors and APIs
2143
Overloads Public Function ExecuteReader() As MySqlDataReader
Syntax: C#
public MySqlDataReader ExecuteReader();
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace , MySqlCommand.ExecuteReader Overload List
21.2.5.1.2.1.13.1.1. MySqlDataReader Class
Provides a means of reading a forward-only stream of rows from a MySQL database. This class cannot be inherited.
For a list of all members of this type, see MySqlDataReader Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlDataReader_
Inherits MarshalByRefObject_
Implements IEnumerable, IDataReader, IDisposable, IDataRecord
Syntax: C#
public sealed class MySqlDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlDataReader Members , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1. MySqlDataReader Members
MySqlDataReader overview
Public Instance Properties
Depth Gets a value indicating the depth of nesting for the current row.
This method is not supported currently and always returns 0.
FieldCount Gets the number of columns in the current row.
HasRows Gets a value indicating whether the MySqlDataReader contains
one or more rows.
IsClosed Gets a value indicating whether the data reader is closed.
Item Overloaded. Overloaded. Gets the value of a column in its native
format. In C#, this property is the indexer for the MySqlDataRead-
er class.
RecordsAffected Gets the number of rows changed, inserted, or deleted by execu-
tion of the SQL statement.
Public Instance Methods
Connectors and APIs
2144
Close Closes the MySqlDataReader object.
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetBoolean Gets the value of the specified column as a Boolean.
GetByte Gets the value of the specified column as a byte.
GetBytes Reads a stream of bytes from the specified column offset into the
buffer an array starting at the given buffer offset.
GetChar Gets the value of the specified column as a single character.
GetChars Reads a stream of characters from the specified column offset into
the buffer as an array starting at the given buffer offset.
GetDataTypeName Gets the name of the source data type.
GetDateTime
GetDecimal
GetDouble
GetFieldType Gets the Type that is the data type of the object.
GetFloat
GetGuid
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetInt16
GetInt32
GetInt64
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetMySqlDateTime
GetName Gets the name of the specified column.
GetOrdinal Gets the column ordinal, given the name of the column.
GetSchemaTable Returns a DataTable that describes the column metadata of the
MySqlDataReader.
GetString
GetTimeSpan
GetType(inherited from Object) Gets the Typeof the current instance.
GetUInt16
GetUInt32
GetUInt64
GetValue Gets the value of the specified column in its native format.
GetValues Gets all attribute columns in the collection for the current row.
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
IsDBNull Gets a value indicating whether the column contains non-existent
or missing values.
NextResult Advances the data reader to the next result, when reading the res-
ults of batch SQL statements.
Read Advances the MySqlDataReader to the next record.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
Connectors and APIs
2145
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.1. Depth Property
Gets a value indicating the depth of nesting for the current row. This method is not supported currently and always returns 0.
Syntax: Visual Basic
NotOverridable Public ReadOnly Property Depth As Integer _
_
Implements IDataReader.Depth
Syntax: C#
public int Depth {get;}
Implements
IDataReader.Depth
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.2. FieldCount Property
Gets the number of columns in the current row.
Syntax: Visual Basic
NotOverridable Public ReadOnly Property FieldCount As Integer _
_
Implements IDataRecord.FieldCount
Syntax: C#
public int FieldCount {get;}
Implements
IDataRecord.FieldCount
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.3. HasRows Property
Gets a value indicating whether the MySqlDataReader contains one or more rows.
Syntax: Visual Basic
Public ReadOnly Property HasRows As Boolean
Syntax: C#
public bool HasRows {get;}
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2146
21.2.5.1.2.1.13.1.1.1.4. IsClosed Property
Gets a value indicating whether the data reader is closed.
Syntax: Visual Basic
NotOverridable Public ReadOnly Property IsClosed As Boolean _
_
Implements IDataReader.IsClosed
Syntax: C#
public bool IsClosed {get;}
Implements
IDataReader.IsClosed
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.5. Item Property
Overloaded. Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class.
Overload List
Overloaded. Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class.
public object this[int] {get;}
Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class.
public object this[string] {get;}
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.5.1. Item Property (Int32)
Overloaded. Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class.
Syntax: Visual Basic
NotOverridable Overloads Public Default ReadOnly Property Item( _
ByVal i As Integer _
) _
_
Implements IDataRecord.Item As Object _
_
Implements IDataRecord.Item
Syntax: C#
public object this[
inti
] {get;}
Implements
IDataRecord.Item
Connectors and APIs
2147
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace , MySqlDataReader.Item Overload List
21.2.5.1.2.1.13.1.1.1.5.2. Item Property (String)
Gets the value of a column in its native format. In C#, this property is the indexer for the MySqlDataReader class.
Syntax: Visual Basic
NotOverridable Overloads Public Default ReadOnly Property Item( _
ByVal name As String _
) _
_
Implements IDataRecord.Item As Object _
_
Implements IDataRecord.Item
Syntax: C#
public object this[
stringname
] {get;}
Implements
IDataRecord.Item
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace , MySqlDataReader.Item Overload List
21.2.5.1.2.1.13.1.1.1.6. RecordsAffected Property
Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
Syntax: Visual Basic
NotOverridable Public ReadOnly Property RecordsAffected As Integer _
_
Implements IDataReader.RecordsAffected
Syntax: C#
public int RecordsAffected {get;}
Implements
IDataReader.RecordsAffected
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.7. MySqlDataReader.Close Method
Closes the MySqlDataReader object.
Syntax: Visual Basic
NotOverridable Public Sub Close() _
_
Implements IDataReader.Close
Syntax: C#
public void Close();
Connectors and APIs
2148
Implements
IDataReader.Close
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.8. MySqlDataReader.GetBoolean Method
Gets the value of the specified column as a Boolean.
Syntax: Visual Basic
NotOverridable Public Function GetBoolean( _
ByVal i As Integer _
) As Boolean _
_
Implements IDataRecord.GetBoolean
Syntax: C#
public bool GetBoolean(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.GetBoolean
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.9. MySqlDataReader.GetByte Method
Gets the value of the specified column as a byte.
Syntax: Visual Basic
NotOverridable Public Function GetByte( _
ByVal i As Integer _
) As Byte _
_
Implements IDataRecord.GetByte
Syntax: C#
public byte GetByte(
inti
);
Parameters
i:
Return Value
Connectors and APIs
2149
Implements
IDataRecord.GetByte
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.10. MySqlDataReader.GetBytes Method
Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset.
Syntax: Visual Basic
NotOverridable Public Function GetBytes( _
ByVal i As Integer, _
ByVal dataIndex As Long, _
ByVal buffer As Byte(), _
ByVal bufferIndex As Integer, _
ByVal length As Integer _
) As Long _
_
Implements IDataRecord.GetBytes
Syntax: C#
public long GetBytes(
inti,
longdataIndex,
byte[]buffer,
intbufferIndex,
intlength
);
Parameters
i: The zero-based column ordinal.
dataIndex: The index within the field from which to begin the read operation.
buffer: The buffer into which to read the stream of bytes.
bufferIndex: The index for buffer to begin the read operation.
length: The maximum length to copy into the buffer.
Return Value
The actual number of bytes read.
Implements
IDataRecord.GetBytes
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.11. MySqlDataReader.GetChar Method
Gets the value of the specified column as a single character.
Syntax: Visual Basic
NotOverridable Public Function GetChar( _
ByVal i As Integer _
) As Char _
_
Implements IDataRecord.GetChar
Connectors and APIs
2150
Syntax: C#
public char GetChar(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.GetChar
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.12. MySqlDataReader.GetChars Method
Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset.
Syntax: Visual Basic
NotOverridable Public Function GetChars( _
ByVal i As Integer, _
ByVal fieldOffset As Long, _
ByVal buffer As Char(), _
ByVal bufferoffset As Integer, _
ByVal length As Integer _
) As Long _
_
Implements IDataRecord.GetChars
Syntax: C#
public long GetChars(
inti,
longfieldOffset,
char[]buffer,
intbufferoffset,
intlength
);
Parameters
i:
fieldOffset:
buffer:
bufferoffset:
length:
Return Value
Implements
IDataRecord.GetChars
See Also
Connectors and APIs
2151
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.13. MySqlDataReader.GetDataTypeName Method
Gets the name of the source data type.
Syntax: Visual Basic
NotOverridable Public Function GetDataTypeName( _
ByVal i As Integer _
) As String _
_
Implements IDataRecord.GetDataTypeName
Syntax: C#
public string GetDataTypeName(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.GetDataTypeName
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.14. MySqlDataReader.GetDateTime Method
Syntax: Visual Basic
NotOverridable Public Function GetDateTime( _
ByVal index As Integer _
) As Date _
_
Implements IDataRecord.GetDateTime
Syntax: C#
public DateTime GetDateTime(
intindex
);
Implements
IDataRecord.GetDateTime
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.15. MySqlDataReader.GetDecimal Method
Syntax: Visual Basic
NotOverridable Public Function GetDecimal( _
ByVal index As Integer _
) As Decimal _
_
Implements IDataRecord.GetDecimal
Connectors and APIs
2152
Syntax: C#
public decimal GetDecimal(
intindex
);
Implements
IDataRecord.GetDecimal
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.16. MySqlDataReader.GetDouble Method
Syntax: Visual Basic
NotOverridable Public Function GetDouble( _
ByVal index As Integer _
) As Double _
_
Implements IDataRecord.GetDouble
Syntax: C#
public double GetDouble(
intindex
);
Implements
IDataRecord.GetDouble
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.17. MySqlDataReader.GetFieldType Method
Gets the Type that is the data type of the object.
Syntax: Visual Basic
NotOverridable Public Function GetFieldType( _
ByVal i As Integer _
) As Type _
_
Implements IDataRecord.GetFieldType
Syntax: C#
public Type GetFieldType(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.GetFieldType
Connectors and APIs
2153
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.18. MySqlDataReader.GetFloat Method
Syntax: Visual Basic
NotOverridable Public Function GetFloat( _
ByVal index As Integer _
) As Single _
_
Implements IDataRecord.GetFloat
Syntax: C#
public float GetFloat(
intindex
);
Implements
IDataRecord.GetFloat
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.19. MySqlDataReader.GetGuid Method
Syntax: Visual Basic
NotOverridable Public Function GetGuid( _
ByVal index As Integer _
) As Guid _
_
Implements IDataRecord.GetGuid
Syntax: C#
public Guid GetGuid(
intindex
);
Implements
IDataRecord.GetGuid
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.20. MySqlDataReader.GetInt16 Method
Syntax: Visual Basic
NotOverridable Public Function GetInt16( _
ByVal index As Integer _
) As Short _
_
Implements IDataRecord.GetInt16
Syntax: C#
public short GetInt16(
intindex
);
Connectors and APIs
2154
Implements
IDataRecord.GetInt16
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.21. MySqlDataReader.GetInt32 Method
Syntax: Visual Basic
NotOverridable Public Function GetInt32( _
ByVal index As Integer _
) As Integer _
_
Implements IDataRecord.GetInt32
Syntax: C#
public int GetInt32(
intindex
);
Implements
IDataRecord.GetInt32
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.22. MySqlDataReader.GetInt64 Method
Syntax: Visual Basic
NotOverridable Public Function GetInt64( _
ByVal index As Integer _
) As Long _
_
Implements IDataRecord.GetInt64
Syntax: C#
public long GetInt64(
intindex
);
Implements
IDataRecord.GetInt64
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.23. MySqlDataReader.GetMySqlDateTime Method
Syntax: Visual Basic
Public Function GetMySqlDateTime( _
ByVal index As Integer _
) As MySqlDateTime
Syntax: C#
public MySqlDateTime GetMySqlDateTime(
intindex
);
Connectors and APIs
2155
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.24. MySqlDataReader.GetName Method
Gets the name of the specified column.
Syntax: Visual Basic
NotOverridable Public Function GetName( _
ByVal i As Integer _
) As String _
_
Implements IDataRecord.GetName
Syntax: C#
public string GetName(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.GetName
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.25. MySqlDataReader.GetOrdinal Method
Gets the column ordinal, given the name of the column.
Syntax: Visual Basic
NotOverridable Public Function GetOrdinal( _
ByVal name As String _
) As Integer _
_
Implements IDataRecord.GetOrdinal
Syntax: C#
public int GetOrdinal(
stringname
);
Parameters
name:
Return Value
Implements
IDataRecord.GetOrdinal
Connectors and APIs
2156
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.26. MySqlDataReader.GetSchemaTable Method
Returns a DataTable that describes the column metadata of the MySqlDataReader.
Syntax: Visual Basic
NotOverridable Public Function GetSchemaTable() As DataTable _
_
Implements IDataReader.GetSchemaTable
Syntax: C#
public DataTable GetSchemaTable();
Return Value
Implements
IDataReader.GetSchemaTable
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.27. MySqlDataReader.GetString Method
Syntax: Visual Basic
NotOverridable Public Function GetString( _
ByVal index As Integer _
) As String _
_
Implements IDataRecord.GetString
Syntax: C#
public string GetString(
intindex
);
Implements
IDataRecord.GetString
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.28. MySqlDataReader.GetTimeSpan Method
Syntax: Visual Basic
Public Function GetTimeSpan( _
ByVal index As Integer _
) As TimeSpan
Syntax: C#
public TimeSpan GetTimeSpan(
intindex
);
See Also
Connectors and APIs
2157
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.29. MySqlDataReader.GetUInt16 Method
Syntax: Visual Basic
Public Function GetUInt16( _
ByVal index As Integer _
) As UInt16
Syntax: C#
public ushort GetUInt16(
intindex
);
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.30. MySqlDataReader.GetUInt32 Method
Syntax: Visual Basic
Public Function GetUInt32( _
ByVal index As Integer _
) As UInt32
Syntax: C#
public uint GetUInt32(
intindex
);
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.31. MySqlDataReader.GetUInt64 Method
Syntax: Visual Basic
Public Function GetUInt64( _
ByVal index As Integer _
) As UInt64
Syntax: C#
public ulong GetUInt64(
intindex
);
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.32. MySqlDataReader.GetValue Method
Gets the value of the specified column in its native format.
Syntax: Visual Basic
NotOverridable Public Function GetValue( _
ByVal i As Integer _
) As Object _
_
Implements IDataRecord.GetValue
Connectors and APIs
2158
Syntax: C#
public object GetValue(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.GetValue
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.33. MySqlDataReader.GetValues Method
Gets all attribute columns in the collection for the current row.
Syntax: Visual Basic
NotOverridable Public Function GetValues( _
ByVal values As Object() _
) As Integer _
_
Implements IDataRecord.GetValues
Syntax: C#
public int GetValues(
object[]values
);
Parameters
values:
Return Value
Implements
IDataRecord.GetValues
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.34. MySqlDataReader.IsDBNull Method
Gets a value indicating whether the column contains non-existent or missing values.
Syntax: Visual Basic
NotOverridable Public Function IsDBNull( _
ByVal i As Integer _
) As Boolean _
_
Implements IDataRecord.IsDBNull
Connectors and APIs
2159
Syntax: C#
public bool IsDBNull(
inti
);
Parameters
i:
Return Value
Implements
IDataRecord.IsDBNull
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.35. MySqlDataReader.NextResult Method
Advances the data reader to the next result, when reading the results of batch SQL statements.
Syntax: Visual Basic
NotOverridable Public Function NextResult() As Boolean _
_
Implements IDataReader.NextResult
Syntax: C#
public bool NextResult();
Return Value
Implements
IDataReader.NextResult
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.1.1.1.36. MySqlDataReader.Read Method
Advances the MySqlDataReader to the next record.
Syntax: Visual Basic
NotOverridable Public Function Read() As Boolean _
_
Implements IDataReader.Read
Syntax: C#
public bool Read();
Return Value
Implements
IDataReader.Read
Connectors and APIs
2160
See Also
MySqlDataReader Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.13.2. MySqlCommand.ExecuteReader Method
Syntax: Visual Basic
Overloads Public Function ExecuteReader( _
ByVal behavior As CommandBehavior _
) As MySqlDataReader
Syntax: C#
public MySqlDataReader ExecuteReader(
CommandBehaviorbehavior
);
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace , MySqlCommand.ExecuteReader Overload List
21.2.5.1.2.1.14. MySqlCommand.ExecuteScalar Method
Syntax: Visual Basic
NotOverridable Public Function ExecuteScalar() As Object _
_
Implements IDbCommand.ExecuteScalar
Syntax: C#
public object ExecuteScalar();
Implements
IDbCommand.ExecuteScalar
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.2.1.15. MySqlCommand.Prepare Method
Syntax: Visual Basic
NotOverridable Public Sub Prepare() _
_
Implements IDbCommand.Prepare
Syntax: C#
public void Prepare();
Implements
IDbCommand.Prepare
See Also
MySqlCommand Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3. MySqlCommandBuilder Class
For a list of all members of this type, see MySqlCommandBuilder Members .
Connectors and APIs
2161
Syntax: Visual Basic
NotInheritable Public Class MySqlCommandBuilder_
Inherits Component
Syntax: C#
public sealed class MySqlCommandBuilder : Component
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlCommandBuilder Members , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1. MySqlCommandBuilder Members
MySqlCommandBuilder overview
Public Static (Shared) Methods
DeriveParameters Overloaded. Retrieves parameter information from the stored pro-
cedure specified in the MySqlCommand and populates the Para-
meters collection of the specified MySqlCommand object. This
method is not currently supported since stored procedures are not
available in MySql.
Public Instance Constructors
MySqlCommandBuilder Overloaded. Initializes a new instance of the MySqlCommand-
Builder class.
Public Instance Properties
Container(inherited from Component) Gets the IContainerthat contains the Component.
DataAdapter
QuotePrefix
QuoteSuffix
Site(inherited from Component) Gets or sets the ISiteof the Component.
Public Instance Methods
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
Dispose(inherited from Component) Releases all resources used by the Component.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetDeleteCommand
Connectors and APIs
2162
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetInsertCommand
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetType(inherited from Object) Gets the Typeof the current instance.
GetUpdateCommand
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
RefreshSchema
ToString(inherited from Component) Returns a Stringcontaining the name of the Component, if any.
This method should not be overridden.
Public Instance Events
Disposed(inherited from Component) Adds an event handler to listen to the Disposedevent on the com-
ponent.
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.1. DeriveParameters Method
Retrieves parameter information from the stored procedure specified in the MySqlCommand and populates the Parameters collection of
the specified MySqlCommand object. This method is not currently supported since stored procedures are not available in MySql.
Overload List
Retrieves parameter information from the stored procedure specified in the MySqlCommand and populates the Parameters collection of
the specified MySqlCommand object. This method is not currently supported since stored procedures are not available in MySql.
public static void DeriveParameters(MySqlCommand);
public static void DeriveParameters(MySqlCommand,bool);
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.1.1. MySqlCommandBuilder.DeriveParameters Method
Retrieves parameter information from the stored procedure specified in the MySqlCommand and populates the Parameters collection of
the specified MySqlCommand object. This method is not currently supported since stored procedures are not available in MySql.
Syntax: Visual Basic
Overloads Public Shared Sub DeriveParameters( _
ByVal command As MySqlCommand _
)
Syntax: C#
public static void DeriveParameters(
MySqlCommandcommand
);
Connectors and APIs
2163
Parameters
command: The MySqlCommand referencing the stored procedure from which the parameter information is to be derived. The de-
rived parameters are added to the Parameters collection of the MySqlCommand.
Exceptions
Exception Type Condition
InvalidOperationException The command text is not a valid stored procedure name.
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace , MySqlCommandBuilder.DeriveParameters Overload List
21.2.5.1.3.1.1.2. MySqlCommandBuilder.DeriveParameters Method
Syntax: Visual Basic
Overloads Public Shared Sub DeriveParameters( _
ByVal command As MySqlCommand, _
ByVal useProc As Boolean _
)
Syntax: C#
public static void DeriveParameters(
MySqlCommandcommand,
booluseProc
);
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace , MySqlCommandBuilder.DeriveParameters Overload List
21.2.5.1.3.1.2. MySqlCommandBuilder Constructor
Initializes a new instance of the MySqlCommandBuilder class.
Overload List
Initializes a new instance of the MySqlCommandBuilder class.
public MySqlCommandBuilder();
public MySqlCommandBuilder(MySqlDataAdapter);
public MySqlCommandBuilder(MySqlDataAdapter,bool);
public MySqlCommandBuilder(bool);
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.1. MySqlCommandBuilder Constructor
Initializes a new instance of the MySqlCommandBuilder class.
Syntax: Visual Basic
Overloads Public Sub New()
Connectors and APIs
2164
Syntax: C#
public MySqlCommandBuilder();
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace , MySqlCommandBuilder Constructor Overload List
21.2.5.1.3.1.2.2. MySqlCommandBuilder Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal adapter As MySqlDataAdapter _
)
Syntax: C#
public MySqlCommandBuilder(
MySqlDataAdapteradapter
);
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace , MySqlCommandBuilder Constructor Overload List
21.2.5.1.3.1.2.2.1. MySqlDataAdapter Class
For a list of all members of this type, see MySqlDataAdapter Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlDataAdapter_
Inherits DbDataAdapter
Syntax: C#
public sealed class MySqlDataAdapter : DbDataAdapter
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlDataAdapter Members , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1. MySqlDataAdapter Members
MySqlDataAdapter overview
Public Instance Constructors
MySqlDataAdapter Overloaded. Initializes a new instance of the MySqlDataAdapter
class.
Public Instance Properties
Connectors and APIs
2165
AcceptChangesDuringFill(inherited from DataAdapter) Gets or sets a value indicating whether AcceptChangesis called on
a DataRowafter it is added to the DataTableduring any of the Fill
operations.
AcceptChangesDuringUpdate(inherited from DataAdapter) Gets or sets whether AcceptChangesis called during a Update.
Container(inherited from Component) Gets the IContainerthat contains the Component.
ContinueUpdateOnError(inherited from DataAdapter) Gets or sets a value that specifies whether to generate an exception
when an error is encountered during a row update.
DeleteCommand Overloaded.
FillLoadOption(inherited from DataAdapter) Gets or sets the LoadOptionthat determines how the adapter fills
the DataTablefrom the DbDataReader.
InsertCommand Overloaded.
MissingMappingAction(inherited from DataAdapter) Determines the action to take when incoming data does not have a
matching table or column.
MissingSchemaAction(inherited from DataAdapter) Determines the action to take when existing DataSetschema does
not match incoming data.
ReturnProviderSpecificTypes(inherited from DataAdapter) Gets or sets whether the Fillmethod should return provider-specific
values or common CLS-compliant values.
SelectCommand Overloaded.
Site(inherited from Component) Gets or sets the ISiteof the Component.
TableMappings(inherited from DataAdapter) Gets a collection that provides the master mapping between a
source table and a DataTable.
UpdateBatchSize(inherited from DbDataAdapter) Gets or sets a value that enables or disables batch processing sup-
port, and specifies the number of commands that can be executed
in a batch.
UpdateCommand Overloaded.
Public Instance Methods
CreateObjRef(inherited from MarshalByRefObject) Creates an object that contains all the relevant information re-
quired to generate a proxy used to communicate with a remote ob-
ject.
Dispose(inherited from Component) Releases all resources used by the Component.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
Fill(inherited from DbDataAdapter) Overloaded. Adds or refreshes rows in the DataSetto match those
in the data source using the DataSetname, and creates a Data-
Tablenamed "Table."
FillSchema(inherited from DbDataAdapter) Overloaded. Configures the schema of the specified DataTable-
based on the specified SchemaType.
GetFillParameters(inherited from DbDataAdapter) Gets the parameters set by the user when executing an SQL SE-
LECT statement.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetLifetimeService(inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the life-
time policy for this instance.
GetType(inherited from Object) Gets the Typeof the current instance.
InitializeLifetimeService(inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for
this instance.
ResetFillLoadOption(inherited from DataAdapter) Resets FillLoadOptionto its default state and causes Fillto honor
AcceptChangesDuringFill.
ShouldSerializeAcceptChangesDuringFill(inherited from DataAd- Determines whether the AcceptChangesDuringFillproperty should
Connectors and APIs
2166
apter) be persisted.
ShouldSerializeFillLoadOption(inherited from DataAdapter) Determines whether the FillLoadOptionproperty should be per-
sisted.
ToString(inherited from Component) Returns a Stringcontaining the name of the Component, if any.
This method should not be overridden.
Update(inherited from DbDataAdapter) Overloaded. Calls the respective INSERT, UPDATE, or DELETE
statements for each inserted, updated, or deleted row in the spe-
cified DataSet.
Public Instance Events
Disposed(inherited from Component) Adds an event handler to listen to the Disposedevent on the com-
ponent.
FillError(inherited from DataAdapter) Returned when an error occurs during a fill operation.
RowUpdated Occurs during Update after a command is executed against the
data source. The attempt to update is made, so the event fires.
RowUpdating Occurs during Update before a command is executed against the
data source. The attempt to update is made, so the event fires.
Protected Internal Instance Properties
FillCommandBehavior(inherited from DbDataAdapter) Gets or sets the behavior of the command used to fill the data ad-
apter.
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.1. MySqlDataAdapter Constructor
Initializes a new instance of the MySqlDataAdapter class.
Overload List
Initializes a new instance of the MySqlDataAdapter class.
public MySqlDataAdapter();
public MySqlDataAdapter(MySqlCommand);
public MySqlDataAdapter(string,MySqlConnection);
public MySqlDataAdapter(string,string);
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.1.1. MySqlDataAdapter Constructor
Initializes a new instance of the MySqlDataAdapter class.
Syntax: Visual Basic
Overloads Public Sub New()
Connectors and APIs
2167
Syntax: C#
public MySqlDataAdapter();
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace , MySqlDataAdapter Constructor Overload List
21.2.5.1.3.1.2.2.1.1.1.2. MySqlDataAdapter Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal selectCommand As MySqlCommand _
)
Syntax: C#
public MySqlDataAdapter(
MySqlCommandselectCommand
);
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace , MySqlDataAdapter Constructor Overload List
21.2.5.1.3.1.2.2.1.1.1.3. MySqlDataAdapter Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal selectCommandText As String, _
ByVal connection As MySqlConnection _
)
Syntax: C#
public MySqlDataAdapter(
stringselectCommandText,
MySqlConnectionconnection
);
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace , MySqlDataAdapter Constructor Overload List
21.2.5.1.3.1.2.2.1.1.1.4. MySqlDataAdapter Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal selectCommandText As String, _
ByVal selectConnString As String _
)
Syntax: C#
public MySqlDataAdapter(
stringselectCommandText,
stringselectConnString
);
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace , MySqlDataAdapter Constructor Overload List
21.2.5.1.3.1.2.2.1.1.2. DeleteCommand Property
Connectors and APIs
2168
Syntax: Visual Basic
Overloads Public Property DeleteCommand As MySqlCommand
Syntax: C#
new public MySqlCommand DeleteCommand {get; set;}
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.3. InsertCommand Property
Syntax: Visual Basic
Overloads Public Property InsertCommand As MySqlCommand
Syntax: C#
new public MySqlCommand InsertCommand {get; set;}
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.4. SelectCommand Property
Syntax: Visual Basic
Overloads Public Property SelectCommand As MySqlCommand
Syntax: C#
new public MySqlCommand SelectCommand {get; set;}
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.5. UpdateCommand Property
Syntax: Visual Basic
Overloads Public Property UpdateCommand As MySqlCommand
Syntax: C#
new public MySqlCommand UpdateCommand {get; set;}
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.6. MySqlDataAdapter.RowUpdated Event
Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires.
Syntax: Visual Basic
Public Event RowUpdated As MySqlRowUpdatedEventHandler
Connectors and APIs
2169
Syntax: C#
public event MySqlRowUpdatedEventHandler RowUpdated;
Event Data
The event handler receives an argument of type MySqlRowUpdatedEventArgs containing data related to this event. The following
MySqlRowUpdatedEventArgsproperties provide information specific to this event.
Property Description
Command Gets or sets the MySqlCommand executed when Update is called.
Errors Gets any errors generated by the .NET Framework data provider
when the Commandwas executed.
RecordsAffected Gets the number of rows changed, inserted, or deleted by execu-
tion of the SQL statement.
Row Gets the DataRowsent through an Update.
RowCount Gets the number of rows processed in a batch of updated records.
StatementType Gets the type of SQL statement executed.
Status Gets the UpdateStatusof the Commandproperty.
TableMapping Gets the DataTableMappingsent through an Update.
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.6.1. MySqlRowUpdatedEventHandler Delegate
Represents the method that will handle the RowUpdatedevent of a MySqlDataAdapter .
Syntax: Visual Basic
Public Delegate Sub MySqlRowUpdatedEventHandler( _
ByVal sender As Object, _
ByVal e As MySqlRowUpdatedEventArgs _
)
Syntax: C#
public delegate void MySqlRowUpdatedEventHandler(
objectsender,
MySqlRowUpdatedEventArgse
);
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.6.1.1. MySqlRowUpdatedEventArgs Class
Provides data for the RowUpdated event. This class cannot be inherited.
For a list of all members of this type, see MySqlRowUpdatedEventArgs Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlRowUpdatedEventArgs_
Connectors and APIs
2170
Inherits RowUpdatedEventArgs
Syntax: C#
public sealed class MySqlRowUpdatedEventArgs : RowUpdatedEventArgs
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlRowUpdatedEventArgs Members , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.6.1.1.1. MySqlRowUpdatedEventArgs Members
MySqlRowUpdatedEventArgs overview
Public Instance Constructors
MySqlRowUpdatedEventArgs Constructor Initializes a new instance of the MySqlRowUpdatedEventArgs
class.
Public Instance Properties
Command Overloaded. Gets or sets the MySqlCommand executed when Up-
date is called.
Errors(inherited from RowUpdatedEventArgs) Gets any errors generated by the .NET Framework data provider
when the Commandwas executed.
RecordsAffected(inherited from RowUpdatedEventArgs) Gets the number of rows changed, inserted, or deleted by execu-
tion of the SQL statement.
Row(inherited from RowUpdatedEventArgs) Gets the DataRowsent through an Update.
RowCount(inherited from RowUpdatedEventArgs) Gets the number of rows processed in a batch of updated records.
StatementType(inherited from RowUpdatedEventArgs) Gets the type of SQL statement executed.
Status(inherited from RowUpdatedEventArgs) Gets the UpdateStatusof the Commandproperty.
TableMapping(inherited from RowUpdatedEventArgs) Gets the DataTableMappingsent through an Update.
Public Instance Methods
CopyToRows(inherited from RowUpdatedEventArgs) Overloaded. Copies references to the modified rows into the
provided array.
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
Connectors and APIs
2171
See Also
MySqlRowUpdatedEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.6.1.1.1.1. MySqlRowUpdatedEventArgs Constructor
Initializes a new instance of the MySqlRowUpdatedEventArgs class.
Syntax: Visual Basic
Public Sub New( _
ByVal row As DataRow, _
ByVal command As IDbCommand, _
ByVal statementType As StatementType, _
ByVal tableMapping As DataTableMapping _
)
Syntax: C#
public MySqlRowUpdatedEventArgs(
DataRowrow,
IDbCommandcommand,
StatementTypestatementType,
DataTableMappingtableMapping
);
Parameters
row: The DataRowsent through an Update.
command: The IDbCommandexecuted when Updateis called.
statementType: One of the StatementTypevalues that specifies the type of query executed.
tableMapping: The DataTableMappingsent through an Update.
See Also
MySqlRowUpdatedEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.6.1.1.1.2. Command Property
Gets or sets the MySqlCommand executed when Update is called.
Syntax: Visual Basic
Overloads Public ReadOnly Property Command As MySqlCommand
Syntax: C#
new public MySqlCommand Command {get;}
See Also
MySqlRowUpdatedEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.7. MySqlDataAdapter.RowUpdating Event
Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires.
Syntax: Visual Basic
Public Event RowUpdating As MySqlRowUpdatingEventHandler
Syntax: C#
Connectors and APIs
2172
public event MySqlRowUpdatingEventHandler RowUpdating;
Event Data
The event handler receives an argument of type MySqlRowUpdatingEventArgs containing data related to this event. The following
MySqlRowUpdatingEventArgsproperties provide information specific to this event.
Property Description
Command Gets or sets the MySqlCommand to execute when performing the
Update.
Errors Gets any errors generated by the .NET Framework data provider
when the Commandexecutes.
Row Gets the DataRowthat will be sent to the server as part of an insert,
update, or delete operation.
StatementType Gets the type of SQL statement to execute.
Status Gets or sets the UpdateStatusof the Commandproperty.
TableMapping Gets the DataTableMappingto send through the Update.
See Also
MySqlDataAdapter Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.7.1. MySqlRowUpdatingEventHandler Delegate
Represents the method that will handle the RowUpdatingevent of a MySqlDataAdapter .
Syntax: Visual Basic
Public Delegate Sub MySqlRowUpdatingEventHandler( _
ByVal sender As Object, _
ByVal e As MySqlRowUpdatingEventArgs _
)
Syntax: C#
public delegate void MySqlRowUpdatingEventHandler(
objectsender,
MySqlRowUpdatingEventArgse
);
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.7.1.1. MySqlRowUpdatingEventArgs Class
Provides data for the RowUpdating event. This class cannot be inherited.
For a list of all members of this type, see MySqlRowUpdatingEventArgs Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlRowUpdatingEventArgs_
Inherits RowUpdatingEventArgs
Syntax: C#
Connectors and APIs
2173
public sealed class MySqlRowUpdatingEventArgs : RowUpdatingEventArgs
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlRowUpdatingEventArgs Members , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.7.1.1.1. MySqlRowUpdatingEventArgs Members
MySqlRowUpdatingEventArgs overview
Public Instance Constructors
MySqlRowUpdatingEventArgs Constructor Initializes a new instance of the MySqlRowUpdatingEventArgs
class.
Public Instance Properties
Command Overloaded. Gets or sets the MySqlCommand to execute when
performing the Update.
Errors(inherited from RowUpdatingEventArgs) Gets any errors generated by the .NET Framework data provider
when the Commandexecutes.
Row(inherited from RowUpdatingEventArgs) Gets the DataRowthat will be sent to the server as part of an insert,
update, or delete operation.
StatementType(inherited from RowUpdatingEventArgs) Gets the type of SQL statement to execute.
Status(inherited from RowUpdatingEventArgs) Gets or sets the UpdateStatusof the Commandproperty.
TableMapping(inherited from RowUpdatingEventArgs) Gets the DataTableMappingto send through the Update.
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
See Also
MySqlRowUpdatingEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.7.1.1.1.1. MySqlRowUpdatingEventArgs Constructor
Initializes a new instance of the MySqlRowUpdatingEventArgs class.
Syntax: Visual Basic
Connectors and APIs
2174
Public Sub New( _
ByVal row As DataRow, _
ByVal command As IDbCommand, _
ByVal statementType As StatementType, _
ByVal tableMapping As DataTableMapping _
)
Syntax: C#
public MySqlRowUpdatingEventArgs(
DataRowrow,
IDbCommandcommand,
StatementTypestatementType,
DataTableMappingtableMapping
);
Parameters
row: The DataRowto Update.
command: The IDbCommandto execute during Update.
statementType: One of the StatementTypevalues that specifies the type of query executed.
tableMapping: The DataTableMappingsent through an Update.
See Also
MySqlRowUpdatingEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.2.1.1.7.1.1.1.2. Command Property
Gets or sets the MySqlCommand to execute when performing the Update.
Syntax: Visual Basic
Overloads Public Property Command As MySqlCommand
Syntax: C#
new public MySqlCommand Command {get; set;}
See Also
MySqlRowUpdatingEventArgs Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.2.3. MySqlCommandBuilder Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal adapter As MySqlDataAdapter, _
ByVal lastOneWins As Boolean _
)
Syntax: C#
public MySqlCommandBuilder(
MySqlDataAdapteradapter,
boollastOneWins
);
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace , MySqlCommandBuilder Constructor Overload List
Connectors and APIs
2175
21.2.5.1.3.1.2.4. MySqlCommandBuilder Constructor
Syntax: Visual Basic
Overloads Public Sub New( _
ByVal lastOneWins As Boolean _
)
Syntax: C#
public MySqlCommandBuilder(
boollastOneWins
);
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace , MySqlCommandBuilder Constructor Overload List
21.2.5.1.3.1.3. DataAdapter Property
Syntax: Visual Basic
Public Property DataAdapter As MySqlDataAdapter
Syntax: C#
public MySqlDataAdapter DataAdapter {get; set;}
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.4. QuotePrefix Property
Syntax: Visual Basic
Public Property QuotePrefix As String
Syntax: C#
public string QuotePrefix {get; set;}
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.5. QuoteSuffix Property
Syntax: Visual Basic
Public Property QuoteSuffix As String
Syntax: C#
public string QuoteSuffix {get; set;}
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.6. MySqlCommandBuilder.GetDeleteCommand Method
Syntax: Visual Basic
Connectors and APIs
2176
Public Function GetDeleteCommand() As MySqlCommand
Syntax: C#
public MySqlCommand GetDeleteCommand();
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.7. MySqlCommandBuilder.GetInsertCommand Method
Syntax: Visual Basic
Public Function GetInsertCommand() As MySqlCommand
Syntax: C#
public MySqlCommand GetInsertCommand();
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.8. MySqlCommandBuilder.GetUpdateCommand Method
Syntax: Visual Basic
Public Function GetUpdateCommand() As MySqlCommand
Syntax: C#
public MySqlCommand GetUpdateCommand();
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.3.1.9. MySqlCommandBuilder.RefreshSchema Method
Syntax: Visual Basic
Public Sub RefreshSchema()
Syntax: C#
public void RefreshSchema();
See Also
MySqlCommandBuilder Class , MySql.Data.MySqlClient Namespace
21.2.5.1.4. MySqlException Class
The exception that is thrown when MySQL returns an error. This class cannot be inherited.
For a list of all members of this type, see MySqlException Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlException_
Inherits SystemException
Connectors and APIs
2177
Syntax: C#
public sealed class MySqlException : SystemException
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlException Members , MySql.Data.MySqlClient Namespace
21.2.5.1.4.1. MySqlException Members
MySqlException overview
Public Instance Properties
Data(inherited from Exception) Gets a collection of key/value pairs that provide additional, user-
defined information about the exception.
HelpLink(inherited from Exception) Gets or sets a link to the help file associated with this exception.
InnerException(inherited from Exception) Gets the Exceptioninstance that caused the current exception.
Message(inherited from Exception) Gets a message that describes the current exception.
Number Gets a number that identifies the type of error. This number corres-
ponds to the error numbers given in Section B.3, Server Error
Codes and Messages.
Source(inherited from Exception) Gets or sets the name of the application or the object that causes
the error.
StackTrace(inherited from Exception) Gets a string representation of the frames on the call stack at the
time the current exception was thrown.
TargetSite(inherited from Exception) Gets the method that throws the current exception.
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetBaseException(inherited from Exception) When overridden in a derived class, returns the Exceptionthat is
the root cause of one or more subsequent exceptions.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetObjectData(inherited from Exception) When overridden in a derived class, sets the SerializationInfowith
information about the exception.
GetType(inherited from Exception) Gets the runtime type of the current instance.
ToString(inherited from Exception) Creates and returns a string representation of the current exception.
See Also
MySqlException Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2178
21.2.5.1.4.1.1. Number Property
Gets a number that identifies the type of error.
Syntax: Visual Basic
Public ReadOnly Property Number As Integer
Syntax: C#
public int Number {get;}
See Also
MySqlException Class , MySql.Data.MySqlClient Namespace
21.2.5.1.5. MySqlHelper Class
Helper class that makes it easier to work with the provider.
For a list of all members of this type, see MySqlHelper Members .
Syntax: Visual Basic
NotInheritable Public Class MySqlHelper
Syntax: C#
public sealed class MySqlHelper
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlHelper Members , MySql.Data.MySqlClient Namespace
21.2.5.1.5.1. MySqlHelper Members
MySqlHelper overview
Public Static (Shared) Methods
ExecuteDataRow Executes a single SQL statement and returns the first row of the
resultset. A new MySqlConnection object is created, opened, and
closed during this method.
ExecuteDataset Overloaded. Executes a single SQL statement and returns the res-
ultset in a DataSet. A new MySqlConnection object is created,
opened, and closed during this method.
ExecuteNonQuery Overloaded. Executes a single command against a MySQL data-
base. The MySqlConnection is assumed to be open when the
method is called and remains open after the method completes.
ExecuteReader Overloaded. Executes a single command against a MySQL data-
base.
Connectors and APIs
2179
ExecuteScalar Overloaded. Execute a single command against a MySQL data-
base.
UpdateDataSet Updates the given table with data from the given DataSet
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString(inherited from Object) Returns a Stringthat represents the current Object.
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
21.2.5.1.5.1.1. MySqlHelper.ExecuteDataRow Method
Executes a single SQL statement and returns the first row of the resultset. A new MySqlConnection object is created, opened, and
closed during this method.
Syntax: Visual Basic
Public Shared Function ExecuteDataRow( _
ByVal connectionString As String, _
ByVal commandText As String, _
ParamArray parms As MySqlParameter() _
) As DataRow
Syntax: C#
public static DataRow ExecuteDataRow(
stringconnectionString,
stringcommandText,
params MySqlParameter[]parms
);
Parameters
connectionString: Settings to be used for the connection
commandText: Command to execute
parms: Parameters to use for the command
Return Value
DataRow containing the first row of the resultset
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
21.2.5.1.5.1.2. ExecuteDataset Method
Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged
after execution of this method.
Overload List
Connectors and APIs
2180
Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged
after execution of this method.
public static DataSet ExecuteDataset(MySqlConnection,string);
Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged
after execution of this method.
public static DataSet ExecuteDataset(MySqlConnection,string,params MySqlParameter[]);
Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed
during this method.
public static DataSet ExecuteDataset(string,string);
Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed
during this method.
public static DataSet ExecuteDataset(string,string,params MySqlParameter[]);
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
21.2.5.1.5.1.2.1. MySqlHelper.ExecuteDataset Method
Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged
after execution of this method.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteDataset( _
ByVal connection As MySqlConnection, _
ByVal commandText As String _
) As DataSet
Syntax: C#
public static DataSet ExecuteDataset(
MySqlConnectionconnection,
stringcommandText
);
Parameters
connection: MySqlConnection object to use
commandText: Command to execute
Return Value
DataSetcontaining the resultset
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteDataset Overload List
Connectors and APIs
2181
21.2.5.1.5.1.2.2. MySqlHelper.ExecuteDataset Method
Executes a single SQL statement and returns the resultset in a DataSet. The state of the MySqlConnection object remains unchanged
after execution of this method.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteDataset( _
ByVal connection As MySqlConnection, _
ByVal commandText As String, _
ParamArray commandParameters As MySqlParameter() _
) As DataSet
Syntax: C#
public static DataSet ExecuteDataset(
MySqlConnectionconnection,
stringcommandText,
params MySqlParameter[]commandParameters
);
Parameters
connection: MySqlConnection object to use
commandText: Command to execute
commandParameters: Parameters to use for the command
Return Value
DataSetcontaining the resultset
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteDataset Overload List
21.2.5.1.5.1.2.3. MySqlHelper.ExecuteDataset Method
Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed
during this method.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteDataset( _
ByVal connectionString As String, _
ByVal commandText As String _
) As DataSet
Syntax: C#
public static DataSet ExecuteDataset(
stringconnectionString,
stringcommandText
);
Parameters
connectionString: Settings to be used for the connection
commandText: Command to execute
Return Value
Connectors and APIs
2182
DataSetcontaining the resultset
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteDataset Overload List
21.2.5.1.5.1.2.4. MySqlHelper.ExecuteDataset Method
Executes a single SQL statement and returns the resultset in a DataSet. A new MySqlConnection object is created, opened, and closed
during this method.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteDataset( _
ByVal connectionString As String, _
ByVal commandText As String, _
ParamArray commandParameters As MySqlParameter() _
) As DataSet
Syntax: C#
public static DataSet ExecuteDataset(
stringconnectionString,
stringcommandText,
params MySqlParameter[]commandParameters
);
Parameters
connectionString: Settings to be used for the connection
commandText: Command to execute
commandParameters: Parameters to use for the command
Return Value
DataSetcontaining the resultset
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteDataset Overload List
21.2.5.1.5.1.3. ExecuteNonQuery Method
Executes a single command against a MySQL database. The MySqlConnection is assumed to be open when the method is called and re-
mains open after the method completes.
Overload List
Executes a single command against a MySQL database. The MySqlConnection is assumed to be open when the method is called and re-
mains open after the method completes.
public static int ExecuteNonQuery(MySqlConnection,string,params MySqlParameter[]);
Executes a single command against a MySQL database. A new MySqlConnection is created using the ConnectionString given.
public static int ExecuteNonQuery(string,string,params MySqlParameter[]);
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
Connectors and APIs
2183
21.2.5.1.5.1.3.1. MySqlHelper.ExecuteNonQuery Method
Executes a single command against a MySQL database. The MySqlConnection is assumed to be open when the method is called and re-
mains open after the method completes.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteNonQuery( _
ByVal connection As MySqlConnection, _
ByVal commandText As String, _
ParamArray commandParameters As MySqlParameter() _
) As Integer
Syntax: C#
public static int ExecuteNonQuery(
MySqlConnectionconnection,
stringcommandText,
params MySqlParameter[]commandParameters
);
Parameters
connection: MySqlConnection object to use
commandText: SQL statement to be executed
commandParameters: Array of MySqlParameter objects to use with the command.
Return Value
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteNonQuery Overload List
21.2.5.1.5.1.3.2. MySqlHelper.ExecuteNonQuery Method
Executes a single command against a MySQL database. A new MySqlConnection is created using the ConnectionString given.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteNonQuery( _
ByVal connectionString As String, _
ByVal commandText As String, _
ParamArray parms As MySqlParameter() _
) As Integer
Syntax: C#
public static int ExecuteNonQuery(
stringconnectionString,
stringcommandText,
params MySqlParameter[]parms
);
Parameters
connectionString: ConnectionString to use
commandText: SQL statement to be executed
parms: Array of MySqlParameter objects to use with the command.
Return Value
Connectors and APIs
2184
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteNonQuery Overload List
21.2.5.1.5.1.4. ExecuteReader Method
Executes a single command against a MySQL database.
Overload List
Executes a single command against a MySQL database.
public static MySqlDataReader ExecuteReader(string,string);
Executes a single command against a MySQL database.
public static MySqlDataReader ExecuteReader(string,string,params MySqlParameter[]);
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
21.2.5.1.5.1.4.1. MySqlHelper.ExecuteReader Method
Executes a single command against a MySQL database.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteReader( _
ByVal connectionString As String, _
ByVal commandText As String _
) As MySqlDataReader
Syntax: C#
public static MySqlDataReader ExecuteReader(
stringconnectionString,
stringcommandText
);
Parameters
connectionString: Settings to use for this command
commandText: Command text to use
Return Value
MySqlDataReader object ready to read the results of the command
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteReader Overload List
21.2.5.1.5.1.4.2. MySqlHelper.ExecuteReader Method
Executes a single command against a MySQL database.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteReader( _
ByVal connectionString As String, _
Connectors and APIs
2185
ByVal commandText As String, _
ParamArray commandParameters As MySqlParameter() _
) As MySqlDataReader
Syntax: C#
public static MySqlDataReader ExecuteReader(
stringconnectionString,
stringcommandText,
params MySqlParameter[]commandParameters
);
Parameters
connectionString: Settings to use for this command
commandText: Command text to use
commandParameters: Array of MySqlParameter objects to use with the command
Return Value
MySqlDataReader object ready to read the results of the command
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteReader Overload List
21.2.5.1.5.1.5. ExecuteScalar Method
Execute a single command against a MySQL database.
Overload List
Execute a single command against a MySQL database.
public static object ExecuteScalar(MySqlConnection,string);
Execute a single command against a MySQL database.
public static object ExecuteScalar(MySqlConnection,string,params MySqlParameter[]);
Execute a single command against a MySQL database.
public static object ExecuteScalar(string,string);
Execute a single command against a MySQL database.
public static object ExecuteScalar(string,string,params MySqlParameter[]);
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
21.2.5.1.5.1.5.1. MySqlHelper.ExecuteScalar Method
Execute a single command against a MySQL database.
Connectors and APIs
2186
Syntax: Visual Basic
Overloads Public Shared Function ExecuteScalar( _
ByVal connection As MySqlConnection, _
ByVal commandText As String _
) As Object
Syntax: C#
public static object ExecuteScalar(
MySqlConnectionconnection,
stringcommandText
);
Parameters
connection: MySqlConnection object to use
commandText: Command text to use for the command
Return Value
The first column of the first row in the result set, or a null reference if the result set is empty.
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteScalar Overload List
21.2.5.1.5.1.5.2. MySqlHelper.ExecuteScalar Method
Execute a single command against a MySQL database.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteScalar( _
ByVal connection As MySqlConnection, _
ByVal commandText As String, _
ParamArray commandParameters As MySqlParameter() _
) As Object
Syntax: C#
public static object ExecuteScalar(
MySqlConnectionconnection,
stringcommandText,
params MySqlParameter[]commandParameters
);
Parameters
connection: MySqlConnection object to use
commandText: Command text to use for the command
commandParameters: Parameters to use for the command
Return Value
The first column of the first row in the result set, or a null reference if the result set is empty.
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteScalar Overload List
Connectors and APIs
2187
21.2.5.1.5.1.5.3. MySqlHelper.ExecuteScalar Method
Execute a single command against a MySQL database.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteScalar( _
ByVal connectionString As String, _
ByVal commandText As String _
) As Object
Syntax: C#
public static object ExecuteScalar(
stringconnectionString,
stringcommandText
);
Parameters
connectionString: Settings to use for the update
commandText: Command text to use for the update
Return Value
The first column of the first row in the result set, or a null reference if the result set is empty.
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteScalar Overload List
21.2.5.1.5.1.5.4. MySqlHelper.ExecuteScalar Method
Execute a single command against a MySQL database.
Syntax: Visual Basic
Overloads Public Shared Function ExecuteScalar( _
ByVal connectionString As String, _
ByVal commandText As String, _
ParamArray commandParameters As MySqlParameter() _
) As Object
Syntax: C#
public static object ExecuteScalar(
stringconnectionString,
stringcommandText,
params MySqlParameter[]commandParameters
);
Parameters
connectionString: Settings to use for the command
commandText: Command text to use for the command
commandParameters: Parameters to use for the command
Return Value
The first column of the first row in the result set, or a null reference if the result set is empty.
Connectors and APIs
2188
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace , MySqlHelper.ExecuteScalar Overload List
21.2.5.1.5.1.6. MySqlHelper.UpdateDataSet Method
Updates the given table with data from the given DataSet
Syntax: Visual Basic
Public Shared Sub UpdateDataSet( _
ByVal connectionString As String, _
ByVal commandText As String, _
ByVal ds As DataSet, _
ByVal tablename As String _
)
Syntax: C#
public static void UpdateDataSet(
stringconnectionString,
stringcommandText,
DataSetds,
stringtablename
);
Parameters
connectionString: Settings to use for the update
commandText: Command text to use for the update
ds: DataSetcontaining the new data to use in the update
tablename: Tablename in the data set to update
See Also
MySqlHelper Class , MySql.Data.MySqlClient Namespace
21.2.5.1.6. MySqlErrorCode Enumeration
Syntax: Visual Basic
Public Enum MySqlErrorCode
Syntax: C#
public enum MySqlErrorCode
Members
Member Name Description
PacketTooLarge
PasswordNotAllowed
DuplicateKeyEntry
HostNotPrivileged
PasswordNoMatch
AnonymousUser
DuplicateKey
KeyNotFound
Connectors and APIs
2189
DuplicateKeyName
Requirements
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySql.Data.MySqlClient Namespace
21.2.5.2. MySql.Data.Types
Namespace hierarchy
Classes
Class Description
MySqlConversionException Summary description for MySqlConversionException.
MySqlDateTime Summary description for MySqlDateTime.
MySqlValue
21.2.5.2.1. MySql.Data.TypesHierarchy
See Also
MySql.Data.Types Namespace
21.2.5.2.2. MySqlConversionException Class
Summary description for MySqlConversionException.
For a list of all members of this type, see MySqlConversionException Members .
Syntax: Visual Basic
Public Class MySqlConversionException_
Inherits ApplicationException
Syntax: C#
public class MySqlConversionException : ApplicationException
Thread Safety
Public static (Sharedin Visual Basic) members of this type are safe for multithreaded operations. Instance members are notguaranteed to
be thread-safe.
Requirements
Namespace: MySql.Data.Types
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlConversionException Members , MySql.Data.Types Namespace
21.2.5.2.2.1. MySqlConversionException Members
Connectors and APIs
2190
MySqlConversionException overview
Public Instance Constructors
MySqlConversionException Constructor Ctor
Public Instance Properties
Data(inherited from Exception) Gets a collection of key/value pairs that provide additional, user-
defined information about the exception.
HelpLink(inherited from Exception) Gets or sets a link to the help file associated with this exception.
InnerException(inherited from Exception) Gets the Exceptioninstance that caused the current exception.
Message(inherited from Exception) Gets a message that describes the current exception.
Source(inherited from Exception) Gets or sets the name of the application or the object that causes
the error.
StackTrace(inherited from Exception) Gets a string representation of the frames on the call stack at the
time the current exception was thrown.
TargetSite(inherited from Exception) Gets the method that throws the current exception.
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetBaseException(inherited from Exception) When overridden in a derived class, returns the Exceptionthat is
the root cause of one or more subsequent exceptions.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetObjectData(inherited from Exception) When overridden in a derived class, sets the SerializationInfowith
information about the exception.
GetType(inherited from Exception) Gets the runtime type of the current instance.
ToString(inherited from Exception) Creates and returns a string representation of the current exception.
Protected Instance Properties
HResult(inherited from Exception) Gets or sets HRESULT, a coded numerical value that is assigned
to a specific exception.
Protected Instance Methods
Finalize(inherited from Object) Allows an Objectto attempt to free resources and perform other
cleanup operations before the Objectis reclaimed by garbage col-
lection.
MemberwiseClone(inherited from Object) Creates a shallow copy of the current Object.
See Also
MySqlConversionException Class , MySql.Data.Types Namespace
21.2.5.2.2.1.1. MySqlConversionException Constructor
Syntax: Visual Basic
Connectors and APIs
2191
Public Sub New( _
ByVal msg As String _
)
Syntax: C#
public MySqlConversionException(
stringmsg
);
See Also
MySqlConversionException Class , MySql.Data.Types Namespace
21.2.5.2.3. MySqlDateTime Class
Summary description for MySqlDateTime.
For a list of all members of this type, see MySqlDateTime Members .
Syntax: Visual Basic
Public Class MySqlDateTime_
Inherits MySqlValue_
Implements IConvertible, IComparable
Syntax: C#
public class MySqlDateTime : MySqlValue, IConvertible, IComparable
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.Types
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlDateTime Members , MySql.Data.Types Namespace
21.2.5.2.3.1. MySqlDateTime Members
MySqlDateTime overview
Public Static (Shared) Type Conversions
Explicit MySqlDateTime to DateTime Conversion
Public Instance Properties
Day Returns the day portion of this datetime
Hour Returns the hour portion of this datetime
IsNull (inherited from MySqlValue)
IsValidDateTime Indicates if this object contains a value that can be represented as a
DateTime
Minute Returns the minute portion of this datetime
Month Returns the month portion of this datetime
Connectors and APIs
2192
Second Returns the second portion of this datetime
ValueAsObject (inherited from MySqlValue) Returns the value of this field as an object
Year Returns the year portion of this datetime
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetDateTime Returns this value as a DateTime
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString Returns a MySQL specific string representation of this value
Protected Instance Fields
classType (inherited from MySqlValue) The system type represented by this value
dbType (inherited from MySqlValue) The generic dbtype of this value
isNull (inherited from MySqlValue) Is this value null
mySqlDbType (inherited from MySqlValue) The specific MySQL db type
mySqlTypeName (inherited from MySqlValue) The MySQL specific typename of this value
objectValue (inherited from MySqlValue)
Protected Instance Methods
Finalize(inherited from Object) Allows an Objectto attempt to free resources and perform other
cleanup operations before the Objectis reclaimed by garbage col-
lection.
MemberwiseClone(inherited from Object) Creates a shallow copy of the current Object.
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.1. MySqlDateTime Explicit MySqlDateTime to DateTime Conversion
Syntax: Visual Basic
MySqlDateTime.op_Explicit(val)
Syntax: C#
public static explicit operator DateTime(
MySqlDateTimeval
);
Parameters
val:
Return Value
Connectors and APIs
2193
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.2. Day Property
Returns the day portion of this datetime
Syntax: Visual Basic
Public Property Day As Integer
Syntax: C#
public int Day {get; set;}
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.3. Hour Property
Returns the hour portion of this datetime
Syntax: Visual Basic
Public Property Hour As Integer
Syntax: C#
public int Hour {get; set;}
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4. IsNull Property
Syntax: Visual Basic
Public Property IsNull As Boolean
Syntax: C#
public bool IsNull {get; set;}
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1. MySqlValue Class
For a list of all members of this type, see MySqlValue Members .
Syntax: Visual Basic
MustInherit Public Class MySqlValue
Syntax: C#
public abstract class MySqlValue
Thread Safety
Connectors and APIs
2194
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed
to be thread-safe.
Requirements
Namespace: MySql.Data.Types
Assembly: MySql.Data (in MySql.Data.dll)
See Also
MySqlValue Members , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1. MySqlValue Members
MySqlValue overview
Protected Static (Shared) Fields
numberFormat
Public Instance Constructors
MySqlValue Constructor Initializes a new instance of the MySqlValue class.
Public Instance Properties
IsNull
ValueAsObject Returns the value of this field as an object
Public Instance Methods
Equals(inherited from Object) Determines whether the specified Objectis equal to the current Ob-
ject.
GetHashCode(inherited from Object) Serves as a hash function for a particular type. GetHashCodeis
suitable for use in hashing algorithms and data structures like a
hash table.
GetType(inherited from Object) Gets the Typeof the current instance.
ToString Returns a string representation of this value
Protected Instance Fields
classType The system type represented by this value
dbType The generic dbtype of this value
isNull Is this value null
mySqlDbType The specific MySQL db type
mySqlTypeName The MySQL specific typename of this value
objectValue
Protected Instance Methods
Finalize(inherited from Object) Allows an Objectto attempt to free resources and perform other
cleanup operations before the Objectis reclaimed by garbage col-
lection.
Connectors and APIs
2195
MemberwiseClone(inherited from Object) Creates a shallow copy of the current Object.
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.1. MySqlValue.numberFormat Field
Syntax: Visual Basic
Protected Shared numberFormat As NumberFormatInfo
Syntax: C#
protected static NumberFormatInfo numberFormat;
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.2. MySqlValue Constructor
Initializes a new instance of the MySqlValue class.
Syntax: Visual Basic
Public Sub New()
Syntax: C#
public MySqlValue();
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.3. ValueAsObject Property
Returns the value of this field as an object
Syntax: Visual Basic
Public ReadOnly Property ValueAsObject As Object
Syntax: C#
public object ValueAsObject {get;}
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.4. MySqlValue.ToString Method
Returns a string representation of this value
Syntax: Visual Basic
Overrides Public Function ToString() As String
Syntax: C#
Connectors and APIs
2196
public override string ToString();
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.5. MySqlValue.classType Field
The system type represented by this value
Syntax: Visual Basic
Protected classType As Type
Syntax: C#
protected Type classType;
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.6. MySqlValue.dbType Field
The generic dbtype of this value
Syntax: Visual Basic
Protected dbType As DbType
Syntax: C#
protected DbType dbType;
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.7. MySqlValue.mySqlDbType Field
The specific MySQL db type
Syntax: Visual Basic
Protected mySqlDbType As MySqlDbType
Syntax: C#
protected MySqlDbType mySqlDbType;
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.8. MySqlValue.mySqlTypeName Field
The MySQL specific typename of this value
Syntax: Visual Basic
Protected mySqlTypeName As String
Syntax: C#
Connectors and APIs
2197
protected string mySqlTypeName;
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.4.1.1.9. MySqlValue.objectValue Field
Syntax: Visual Basic
Protected objectValue As Object
Syntax: C#
protected object objectValue;
See Also
MySqlValue Class , MySql.Data.Types Namespace
21.2.5.2.3.1.5. IsValidDateTime Property
Indicates if this object contains a value that can be represented as a DateTime
Syntax: Visual Basic
Public ReadOnly Property IsValidDateTime As Boolean
Syntax: C#
public bool IsValidDateTime {get;}
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.6. Minute Property
Returns the minute portion of this datetime
Syntax: Visual Basic
Public Property Minute As Integer
Syntax: C#
public int Minute {get; set;}
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.7. Month Property
Returns the month portion of this datetime
Syntax: Visual Basic
Public Property Month As Integer
Syntax: C#
public int Month {get; set;}
Connectors and APIs
2198
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.8. Second Property
Returns the second portion of this datetime
Syntax: Visual Basic
Public Property Second As Integer
Syntax: C#
public int Second {get; set;}
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.9. Year Property
Returns the year portion of this datetime
Syntax: Visual Basic
Public Property Year As Integer
Syntax: C#
public int Year {get; set;}
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.10. MySqlDateTime.GetDateTime Method
Returns this value as a DateTime
Syntax: Visual Basic
Public Function GetDateTime() As Date
Syntax: C#
public DateTime GetDateTime();
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.5.2.3.1.11. MySqlDateTime.ToString Method
Returns a MySQL specific string representation of this value
Syntax: Visual Basic
Overrides Public Function ToString() As String
Syntax: C#
public override string ToString();
Connectors and APIs
2199
See Also
MySqlDateTime Class , MySql.Data.Types Namespace
21.2.6. Connector/NET Support
The developers of Connector/NET greatly value the input of our users in the software development process. If you find Connector/NET
lacking some feature important to you, or if you discover a bug and need to file a bug report, please use the instructions in Section 1.6,
How to Report Bugs or Problems.
21.2.6.1. Connector/NET Community Support
Community support for Connector/NET can be found through the forums at http://forums.mysql.com.
Community support for Connector/NET can also be found through the mailing lists at http://lists.mysql.com.
Paid support is available from Sun Microsystems, Inc. Additional information is available at http://www.mysql.com/support/.
21.2.6.2. How to report Connector/NET Problems or Bugs
If you encounter difficulties or problems with Connector/NET, contact the Connector/NET community Section 21.2.6.1,
Connector/NET Community Support.
You should first try to execute the same SQL statements and commands from the mysql client program or from admndemo. This
helps you determine whether the error is in Connector/NET or MySQL.
If reporting a problem, you should ideally include the following information with the email:
Operating system and version
Connector/NET version
MySQL server version
Copies of error messages or other unexpected output
Simple reproducible sample
Remember that the more information you can supply to us, the more likely it is that we can fix the problem.
If you believe the problem to be a bug, then you must report the bug through http://bugs.mysql.com/.
21.2.6.3. Connector/NET Change History
The Connector/NET Change History (Changelog) is located with the main Changelog for MySQL. See Section C.4, MySQL Connect-
or/NET Change History.
21.2.7. Connector/NET FAQ
Questions
21.2.7.1: How do I obtain the value of an auto-incremented column?
Questions and Answers
21.2.7.1: How do I obtain the value of an auto-incremented column?
When using the commandBuilder you should make sure that you set the ReturnGeneratedIdentifiers property to true.
Connectors and APIs
2200
Then, you can use an active view on a table to access the updated ID. For example:
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
da = new MySql.Data.MySqlClient.MySqlDataAdapter();
cmdBuilder = new MySql.Data.MySqlClient.MySqlCommandBuilder();
SystemDataDataSet = new System.Data.DataSet();
SystemDataDataView = new System.Data.DataView();
...
cmd.Connection = conn;
cmd.CommandText = "SELECT * FROM contacts";
da.SelectCommand = cmd;
da.Fill(SystemDataDataSet, "contacts");
cmdBuilder.DataAdapter = da;
cmdBuilder.ReturnGeneratedIdentifiers = true;
cmdBuilder.DataAdapter.SelectCommand.CommandText = "SELECT * FROM contacts";
cmdBuilder.RefreshSchema();
SystemDataDataView = SystemDataDataSet.Tables["contacts"].DefaultView;
SystemDataDataRow = SystemDataDataView.Table.NewRow();
SystemDataDataRow["status"] = 1;
SystemDataDataView.Table.Rows.Add(SystemDataDataRow);
da.Update(SystemDataDataSet, "contacts");
System.Console.WriteLine("ID after update: " + SystemDataDataRow["id"]);
The SystemDataDataRow object in this instance provides the interface to the updated auto-increment value in the id column.
21.3. MySQL Visual Studio Plugin
The MySQL Visual Studio Plugin is a DDEX provider; a plug-in for Visual Studio 2005 that allows developers to maintain database
structures, and supports built-in data-driven application development tools.
The current version of the MySQL Visual Studio Plugin includes only database maintenance tools. Data-driven application develop-
ment tools are not supported.
The MySQL DDEX Provider operates as a standard extension to the Visual Studio Data Designer functionality available through the
Server Explorer menu of Visual Studio 2005, and enables developers to create database objects and data within a MySQL database.
The MySQL Visual Studio Plugin is designed to work with MySQL version 5.0, but is also compatible with MySQL 4.1.1 and provides
limited compatibility with MySQL 5.1.
21.3.1. Installing the MySQL Visual Studio Plugin
The MySQL Visual Studio Plugin requires one of Visual Studio 2005 Standard, Professional or Team Developer Edition to be installed.
Other editions of Visual Studio 2005 are not supported.
Note
Starting with Connector/NET 5.1.2, the Visual Studio Plugin is included in the installation. If you have installed Connect-
or/NET 5.1.2, then you do not need to separately install the Visual Studio Plugin.
Here is the list of components that should already be installed before starting the installation of the MySQL Visual Studio Plugin:
Visual Studio 2005 Standard, Professional or Team Developer Edition.
MySQL Server 4.1.1 or later (either installed on the same machine, or a separate server).
MySQL Connector/NET 5.0.
Note
When installing Connector/NET you must ensure that the connector is installed into the Global Assembly Cache (GAC).
The Connector/NET installer handles this for you automatically, but in a custom installation the option may have been dis-
abled.
The user used to connect to the MySQL server must have the following privileges to use the functionality provided by the MySQL
Connectors and APIs
2201
Visual Studio Plugin:
The SELECT privilege for the INFORMATION_SCHEMA database.
The EXECUTE privilege for the SHOW CREATE TABLE statement.
The SELECT privilege for the mysql.proc table (required for operations with stored procedures and functions).
The SELECT privilege for the mysql.func table (required for operations with User Defined Functions (UDF)).
The EXECUTE privilege for the SHOW ENGINE STATUS statement (required for retrieving extended error information).
Appropriate privileges for performed operations (for example, the SELECT privilege is required to browse data from a table etc.).
The MySQL Visual Studio Plugin is delivered as a MSI package that can be used to install, uninstall or reinstall the Provider. If you are
not using Windows XP or Windows Server 2003 you upgrade the Windows Installer system to the latest version (see ht-
tp://support.microsoft.com/default.aspx?scid=kb;EN-US;292539 for details).
The MSI-package is named MySQL.VisualStudio.msi. To install the MySQL Visual Studio Plugin, right click on the MSI file
and select INSTALL. The installation process is as follow:
1. The standard Welcome dialog is opened. Click Next to continue installation.
2. The License agreement (GNU GPL) window is opened. Accept the agreement and click NEXT to continue.
3. The destination folder choice dialog is opened. Here you can point out the folder where the MySQL Visual Studio Plugin will be
installed. The default destination folder is %ProgramFilesDir%\MySQL\MySQL DDEX Data Provider, where
%ProgramFilesDir% is the Program Files folder of the installation machine. After choosing the destination folder, click NEXT
to continue.
4. The installer will ask to confirm that installation. Click Install to start installation process.
5. The installation will now take place. At the end of this step the Visual Studio command table is rebuilt (this process may take sev-
eral minutes).
6. Once installation is complete, click FINISH to end the installation process.
To uninstall the MySQL Visual Studio Plugin, you can use either Add/Remove Programs component of the Control Panel or the same
MSI-package. Choose the REMOVE option, and the Provider will be uninstalled automatically.
To repair the Provider, right click the MSI-package and choose the REPAIR option. The MySQL Visual Studio Plugin will be repaired
automatically.
The installation package includes the following files:
MySQL.VisualStudio.dll the MySQL DDEX Provider assembly.
MySQL.Data.dll the assembly containing the MySQL Connector .NET which is used by the Provider.
MySql.VisualStudio.dll.config the configuration file for the MySQL Visual Studio Plugin. This file contains default
values for the provider GUI layout.
Note
Do not remove this file before the first use of the Provider.
Register.reg the file with registry entries that can be used to register the MySQL DDEX Provider in the case of the manual
installation.
Install.js the script used to register the Connector .NET as an ADO.NET data provider in the machine.config file.
Release notes.doc the document with release notes.
Connectors and APIs
2202
To install the Provider manually, copy all files of the installation package in a desired folder, then set the full path to the Provider as-
sembly as a value of the CodeBase entry. For example:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\{79A115C9-B133-4891-9E7B-242509DAD272}]@="MySql.Data.VisualStudio.MySqlDataProviderPackage"
"InprocServer32"="C:\\WINNT\\system32\\mscoree.dll"
"Class"="MySql.Data.VisualStudio.MySqlDataProviderPackage"
"CodeBase"="C:\\MySqlDdexProvider\\MySql.VisualStudio.dll"
Then import information from the Register.reg file to the registry by clicking of the file. At the confirmation dialog choose Yes. Next
you must run the command devenv.exe /setup within a Command Prompt to rebuild the Visual Studio command table.
21.3.2. Creating a connection to the MySQL server
Once the MySQL Visual Studio Plugin is installed, you can use it to create, modify and delete connections to MySQL databases. To
create a connection with a MySQL database, perform the following steps:
1. Start Visual Studio 2005 and open Server Explorer window by choosing the SERVER EXPLORER option from the VIEW menu.
2. Right click on the DATA CONNECTIONS node and choose the ADD CONNECTION button.
3. The Add Connection dialog is opened. Press the CHANGE button to choose MySQL Database as a data source.
4. Change Data Source dialog is opened. Choose MySQL Database in the list of data sources (or the other option, if MySQL Data-
base is absent), and then choose .NET FRAMEWORK DATA PROVIDER FOR MYSQL in the combo box of data providers.
Press OK to confirm your choice.
5. Enter the connection settings: the server host name (for example, localhost if the MySQL server is installed on the local machine),
the user name, the password, and the default database schema. Note that you must specify the default schema name to open the
connection.
Connectors and APIs
2203
6. You can also set the port to connect with the MySQL server by pressing the ADVANCED button. To test a connection with the
MySQL server, ser the server host name, the user name, and the password, and press the TEST CONNECTION button. If the test fails,
check the connection values that you have supplied are correct and that the corresponding user and privileges have been configured
on the MySQL server.
7. After you set all settings and test the connection, press OK. The newly created connection is displayed in Server Explorer. Now
you can work with the MySQL server through standard Server Explorer interface.
After a connection is successfully established, all the connection settings are saved. When you next open Visual Studio, the connection
to the MySQL server will appear within Server Explorer so that you can re-establish a connection to the MySQL server.
To modify and delete a connection, use the SERVER EXPLORER context menu for the corresponding node. You can modify any of the
settings just by overwriting the existing values with new ones. Note that a connection should be modified or deleted only if no active ed-
itor for its objects is opened. Otherwise your data could be lost.
21.3.3. Using the MySQL Visual Studio Plugin
To work with a MySQL server using the MySQL Visual Studio Plugin, open the Visual Studio 2005, open the SERVER EXPLORER, and
select the required connection. The working area of the MySQL Visual Studio Plugin consists of three parts.
Connectors and APIs
2204
Database objects (tables, views, stored routines, triggers, and user defined functions) are displayed in the Server Explorer tree. Here
you can choose an object and edit its properties and definition.
Properties of a selected database object are displayed in the PROPERTIES panel. Certain properties can be edited directly within this
window.
The editor panel provides direct access to the SQL statement and definition of specific objects. Fore example, the SQL statements
within a stored procedure definition are shown and edited within this panel.
21.3.3.1. Editing Tables
The Table Editor can be accessed through a mouse action on table-type node of Server Explorer. To create a new table, right click on
the TABLES node (under the connection node) and choose the CREATE TABLE command from a context menu. To modify an existing ta-
ble, double click on a node of the table you wish to modify, or right click on this node and choose the ALTER TABLE command from a
context menu. Either of the commands opens the Table Editor.
Connectors and APIs
2205
The MySQL Visual Studio Plugin Table Editor is implemented in a similar fashion to the standard Query Browser Table Editor, but
with minor differences.
The Table Editor consists of the following parts:
Columns Editor for column creation, modification and deletion.
Indexes tab for table/column index management.
Foreign Keys tab for configuration of foreign keys.
Column Details tab used to set advanced column options.
Properties window used to set table properties.
To save changes you have made in the Table Editor, use either Save or Save All buttons of the Visual Studio main toolbar, or just press
Ctrl+S. Before changes are saved, a confirmation dialog will be displayed to confirm that you want to update the corresponding object
within the MySQL database.
21.3.3.1.1. Column Editor
You can use the Column Editor to set or change the name, data type, default value and other properties of a table column. To set the
properties of an individual column, select the column using the mouse. Alternatively, you can move through the grid using Tab and
Shift+Tab keys.
To set or change the name, data type, default value and comment of a column, select the appropriate cell and edit the desired value.
Connectors and APIs
2206
To set or unset flag-type column properties (for example, primary key, NOT NULL, auto-incremented, flags), check or uncheck the
corresponding checkboxes. Note that the available column flags will depend on the columns data type.
To reorder columns, index columns or foreign key columns in the Column Editor, select the whole column you wish to reorder by
clicking on the selector column at the left of the column grid. Then move the column by using Ctrl+Up (to move the column up)
and Ctrl+Down (to move the column down) keys.
To delete a column, select it by clicking on the selector column at the left of the column grid, then press the Delete button on a key-
board.
21.3.3.1.2. Indexes tab
Index management is performed via the Indexes tab.
To add an index, press the + button and set the properties in the INDEX SETTINGS groupbox at the right. You can set the index name,
index kind, index type and a set of index columns.
To remove an index, select the index from the list and press the - button.
To change index settings, select the index from the list; detailed information about the index is displayed in the INDEX SETTINGS
panel.
You cannot change a table column to an index column using drag and drop. Instead, you can add new index columns to a table and set
their table columns by using the embedded editor within the Indexes tab
21.3.3.1.3. Foreign Keys tab
Foreign Key management is performed via the Foreign Keys tab.
To add a foreign key, press the + button and set properties in the FOREIGN KEYS SETTINGS panel. You can set the foreign key
name, referenced table name, foreign key columns and actions on update and delete.
To remove a foreign key, select the foreign key and press the - button.
To change foreign key settings, select the foreign key and use the FOREIGN KEYS SETTINGS panel to edit the properties.
When a foreign key is changed, the MySQL Visual Studio Plugin generates two queries: the first query drops the changed keys and
the second one recreates the new values. The reason for such a behavior is to avoid the Bug#8377 and Bug#8919.
Note
If changed values are for some reason inconsistent and cause the second query to fail, all affected foreign keys will be
dropped. If this is the case, the MySQL Visual Studio Plugin will mark them as new in the Table Editor, and you will have
to recreate them later. But if you close the Table Editor without saving, these foreign keys will be lost.
21.3.3.1.4. Column Details tab
The Column Details tab can be used to set column options. Besides the main column properties that are presented in the Column Editor,
in the Column Details tab you can set two additional properties options: the character set and the collation sequence.
21.3.3.1.5. Table Properties window
There is no separate tab for table options and advanced options. All table options can be browsed and changed using the PROPERTIES
window of Visual Studio 2005.
The following table properties can be set:
AUTO INCREMENT
Connectors and APIs
2207
AVERAGE ROW LENGTH
CHARACTER SET
CHECKSUM FOR ROWS
COLLATION
COMMENT
CONNECTION
DATA DIRECTORY
DELAY KEY UPDATES
ENGINE
INDEX DIRECTORY
INSERT METHOD
MAXIMUM ROWS
MINIMUM ROWS
NAME
PACK KEYS
PASSWORD
ROW FORMAT
UNION
Some of these properties can have arbitrary text values, others accept values from a predefined set.
The properties SCHEMA and SERVER are read only.
21.3.3.2. Editing Table Data
The Table Data Editor, allows a user to browse, create and edit data of tables. The Table Data Editor is implemented as a simple data
grid with auto generated columns.
To access the Table Data Editor, right click on a node representing the table or view in Server Explorer. From the nodes context menu,
choose the BROWSE or EDIT DATA command. For tables and updatable views, this command opens the Table Data Editor in edit mode.
For nonupdatable views, this command opens the Table Data Editor in read-only mode.
When in the edit mode, you can modify table data by modifying the displayed table contents directly. To add a row, set desired values
in the last row of the grid. To modify values, set new values in appropriate cells. To delete a row, select it by clicking on the selector
column at the left of the grid, then press the DELETE button.
To save changes you have made in the Table Data Editor, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or
just press Ctrl+S. A confirmation dialog will confirm whether you want the changes saved to the database.
21.3.3.3. Editing Views
To create a new view, right click the Views node under the connection node in Server Explorer. From the nodes context menu, choose
the CREATE VIEW command. This command opens the SQL Editor.
To modify an existing view, double click on a node of the view you wish to modify, or right click on this node and choose the ALTER
VIEW command from a context menu. Either of the commands opens the SQL Editor.
To create or alter the view definition using SQL Editor, type the appropriate SQL statement in the SQL Editor.
Connectors and APIs
2208
Note
You should enter only the defining statement itself, without the CREATE VIEW AS preface.
All other view properties can be set in the PROPERTIES window. These properties are:
ALGORITHM
CHECK OPTION
DEFINER
NAME
SECURITY TYPE
Some of these properties can have arbitrary text values, others accept values from a predefined set.
The properties IS UPDATABLE, SCHEMA and SERVER are readonly.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. A con-
firmation dialog will confirm whether you want the changes saved to the database.
21.3.3.4. Editing Stored Procedures and Functions
To create a new stored procedure, right click the Stored Procedures node under the connection node in Server Explorer. From the nodes
context menu, choose the CREATE ROUTINE command. This command opens the SQL Editor.
To create a new stored function, right click the FUNCTIONS node under the connection node in Server Explorer. From the node's context
menu, choose the CREATE ROUTINE command.
To modify an existing stored routine (procedure or function), double click on a node of the routine you wish to modify, or right click on
this node and choose the ALTER ROUTINE command from a context menu. Either of the commands opens the SQL Editor.
To create or alter the routine definition using SQL Editor, type this definition in the SQL Editor using standard SQL.
All other routine properties can be set in the PROPERTIES window. These properties are:
Comment
Data Access
Definer
Is Deterministic
Security Type
Some of these properties can have arbitrary text values, others accept values only from a predefined set.
Also you can set all the options directly in the SQL Editor, using the standard CREATE PROCEDURE or CREATE FUNCTION state-
ment. However, it is recommended to use the PROPERTIES window instead.
Note
You should never add the CREATE preface to the routine definition.
The properties NAME, SCHEMA and SERVER in the PROPERTIES window are read-only. Set or change the procedure name in the SQL
editor.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. A con-
firmation dialog will confirm whether you want the changes saved to the database..
Connectors and APIs
2209
21.3.3.5. Editing Triggers
To create a new trigger, right click on a node of a table for which you wish to add a trigger. From the node's context menu, choose the
CREATE TRIGGER command. This command opens the SQL Editor.
To modify an existing trigger, double click on a node of the trigger you wish to modify, or right click on this node and choose the
ALTER TRIGGER command from a context menu. Either of the commands opens the SQL Editor.
To create or alter the trigger definition using SQL Editor, type the trigger statement in the SQL Editor using standard SQL.
Note
You should enter only the trigger statement, that is the part of the CREATE TRIGGER query that is placed after the FOR
EACH ROW clause.
All other trigger properties are set in the PROPERTIES window. These properties are:
DEFINER
EVENT MANIPULATION
NAME
TIMING
Some of these properties can have arbitrary text values, others accept values only from a predefined set.
The properties EVENT TABLE, SCHEMA and SERVER in the PROPERTIES window are read-only.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. A con-
firmation dialog will confirm whether you want the changes saved to the database.
21.3.3.6. Editing User Defined Functions (UDF)
To create a new User Defined Function (UDF), right click the UDFs node under the connection node in Server Explorer. From the
node's context menu, choose the CREATE UDF command. This command opens the UDF Editor.
To modify an existing UDF, double click on a node of the UDF you wish to modify, or right click on this node and choose the Alter
UDF command from a context menu. Either of the commands opens the UDF Editor.
The UDF editor allows you to set the following properties through the properties panel:
NAME
SO-NAME (DLL NAME)
RETURN TYPE
IS AGGREGATE
The property Server in the PROPERTIES window is read-only.
To save changes you have made, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. A con-
firmation dialog will confirm whether you want the changes saved to the database.
21.3.3.7. Dropping database objects
Tables, views, stored routines, triggers, an UDFs can be dropped with the appropriate DROP command from its context menu: DROP
TABLE, DROP VIEW, DROP ROUTINE, DROP TRIGGER, DROP UDF.
You will be asked to confirm the execution of the corresponding drop query in a confirmation dialog.
Connectors and APIs
2210
Dropping of multiple objects is not supported.
21.3.3.8. Cloning database objects
Tables, views, stored procedures and functions can be cloned with the appropriate CLONE command from its context menu: CLONE
TABLE, CLONE VIEW, CLONE ROUTINE. The clone commands open the corresponding editor for a new object: the TABLE EDITOR for
cloning a table and the SQL Editor for cloning a view or a routine.
To save the cloned object, use either SAVE or SAVE ALL buttons of the Visual Studio main toolbar, or just press Ctrl+S. A confirmation
dialog will confirm whether you want the changes saved to the database.
21.3.4. Visual Studio Plugin Support
If you have a comment, or if you discover a bug, please, use our MySQL bug tracking system (http://bugs.mysql.com) to report problem
or add your suggestion.
21.3.4.1. Visual Studio Plugin FAQ
Questions
21.3.4.1.1: When creating a connection, typing the connection details causes the connection window to immediately close.
Questions and Answers
21.3.4.1.1: When creating a connection, typing the connection details causes the connection window to immediately close.
There are known issues with versions of Connector/NET earlier than 5.0.2. Connector/NET 1.0.x is known not to work. If you have any
of these versions installed, or have previously upgraded from an earlier version, uninstall Connector/NET completely and then install
Connector/NET 5.0.2.
21.4. MySQL Connector/J
MySQL provides connectivity for client applications developed in the Java programming language via a JDBC driver, which is called
MySQL Connector/J.
MySQL Connector/J is a JDBC Type 4 driver. Different versions are available that are compatible with the JDBC 3.0 and JDBC 4.0
specifications. The Type 4 designation means that the driver is pure-Java implementation of the MySQL protocol and does not rely on
the MySQL client libraries.
Although JDBC is useful by itself, we would hope that if you are not familiar with JDBC that after reading the first few sections of this
manual, that you would avoid using naked JDBC for all but the most trivial problems and consider using one of the popular persistence
frameworks such as Hibernate, Spring's JDBC templates or Ibatis SQL Maps to do the majority of repetitive work and heavier lifting
that is sometimes required with JDBC.
This section is not designed to be a complete JDBC tutorial. If you need more information about using JDBC you might be interested in
the following online tutorials that are more in-depth than the information presented here:
JDBC Basics A tutorial from Sun covering beginner topics in JDBC
JDBC Short Course A more in-depth tutorial from Sun and JGuru
Key topics:
For help with connection strings, connection options setting up your connection through JDBC, see Section 21.4.4.1,
Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J.
For tips on using Connector/J and JDBC with generic J2EE toolkits, see Section 21.4.5.2, Using Connector/J with J2EE and Other
Java Frameworks.
Connectors and APIs
2211
Developers using the Tomcat server platform, see Section 21.4.5.2.2, Using Connector/J with Tomcat.
Developers using JBoss, see Section 21.4.5.2.3, Using Connector/J with JBoss.
Developers using Spring, see Section 21.4.5.2.4, Using Connector/J with Spring.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about using JDBC with MySQL in the Knowledge
Base articles about JDBC. Access to the MySQL Knowledge Base collection of articles is one of the advant-
ages of subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.4.1. Connector/J Versions
There are currently four versions of MySQL Connector/J available:
Connector/J 5.1 is the Type 4 pure Java JDBC driver, which conforms to the JDBC 3.0 and JDBC 4.0 specifications. It provides
compatibility with all the functionality of MySQL, including 4.1, 5.0, 5.1 and the 6.0 alpha release featuring the new Falcon storage
engine. Connector/J 5.1 provides ease of development features, including auto-registration with the Driver Manager, standardized
validity checks, categorized SQLExceptions, support for the JDBC-4.0 XML processing, per connection client information, NCHAR,
NVARCHAR and NCLOB types. This release also includes all bug fixes up to and including Connector/J 5.0.6.
Connector/J 5.0 provides support for all the functionality offered by Connector/J 3.1 and includes distributed transaction (XA) sup-
port.
Connector/J 3.1 was designed for connectivity to MySQL 4.1 and MySQL 5.0 servers and provides support for all the functionality
in MySQL 5.0 except distributed transaction (XA) support.
Connector/J 3.0 provides core functionality and was designed with connectivity to MySQL 3.x or MySQL 4.1 servers, although it
will provide basic compatibility with later versions of MySQL. Connector/J 3.0 does not support server-side prepared statements,
and does not support any of the features in versions of MySQL later than 4.1.
The following table summarizes the Connector/J versions available:
Connector/J version Driver Type JDBC version MySQL Server version Status
5.1 4 3.0, 4.0 4.1, 5.0, 5.1, 6.0 Recommended version
5.0 4 3.0 4.1, 5.0 Released version
3.1 4 3.0 4.1, 5.0 Obsolete
3.0 4 3.0 3.x, 4.1 Obsolete
The current recommended version for Connector/J is 5.1. This guide covers all four connector versions, with specific notes given where
a setting applies to a specific option.
21.4.1.1. Java Versions Supported
The following table summarizes Connector/J Java dependencies:
Connector/J version Java RTE required JDK required (to build source code)
5.1 1.4.x, 1.5.x, 1.6.x 1.6.x and 1.5.x (or older)
5.0 1.3.x, 1.4.x, 1.5.x, 1.6.x 1.4.2, 1.5.x, 1.6.x
3.1 1.2.x, 1.3.x, 1.4.x, 1.5.x, 1.6.x 1.4.2, 1.5.x, 1.6.x
3.0 1.2.x, 1.3.x, 1.4.x, 1.5.x, 1.6.x 1.4.2, 1.5.x, 1.6.x
MySQL Connector/J does not support JDK-1.1.x or JDK-1.0.x.
Connectors and APIs
2212
Because of the implementation of java.sql.Savepoint, Connector/J 3.1.0 and newer will not run on a Java runtime older than 1.4
unless the class verifier is turned off (by setting the -Xverify:none option to the Java runtime). This is because the class verifier
will try to load the class definition for java.sql.Savepoint even though it is not accessed by the driver unless you actually use
savepoint functionality.
Caching functionality provided by Connector/J 3.1.0 or newer is also not available on JVMs older than 1.4.x, as it relies on
java.util.LinkedHashMap which was first available in JDK-1.4.0.
If you are building Connector/J from source code using the source distribution (see Section 21.4.2.4, Installing from the Development
Source Tree) then you must use JDK 1.4.2 or newer to compile the Connector package. For Connector/J 5.1 you must have both JDK-
1.6.x. and JDK-1.5.x installed in order to be able to build the source code.
21.4.2. Connector/J Installation
You can install the Connector/J package using either the binary or source distribution. The binary distribution provides the easiest meth-
od for installation; the source distribution enables you to customize your installation further. With either solution, you must manually
add the Connector/J location to your Java CLASSPATH.
If you are upgrading from a previous version, read the upgrade information before continuing. See Section 21.4.2.3, Upgrading from
an Older Version.
21.4.2.1. Installing Connector/J from a Binary Distribution
The easiest method of installation is to use the binary distribution of the Connector/J package. The binary distribution is available either
as a Tar/Gzip or Zip file which you must extract to a suitable location and then optionally make the information about the package
available by changing your CLASSPATH (see Section 21.4.2.2, Installing the Driver and Configuring the CLASSPATH).
MySQL Connector/J is distributed as a .zip or .tar.gz archive containing the sources, the class files, and the JAR archive named
mysql-connector-java-[version]-bin.jar, and starting with Connector/J 3.1.8 a debug build of the driver in a file named
mysql-connector-java-[version]-bin-g.jar.
Starting with Connector/J 3.1.9, the .class files that constitute the JAR files are only included as part of the driver JAR file.
You should not use the debug build of the driver unless instructed to do so when reporting a problem or a bug, as it is not designed to be
run in production environments, and will have adverse performance impact when used. The debug binary also depends on the Aspect/J
runtime library, which is located in the src/lib/aspectjrt.jar file that comes with the Connector/J distribution.
You will need to use the appropriate graphical or command-line utility to extract the distribution (for example, WinZip for the .zip
archive, and tar for the .tar.gz archive). Because there are potentially long file names in the distribution, we use the GNU tar archive
format. You will need to use GNU tar (or an application that understands the GNU tar archive format) to unpack the .tar.gz variant of
the distribution.
21.4.2.2. Installing the Driver and Configuring the CLASSPATH
Once you have extracted the distribution archive, you can install the driver by placing mysql-connect-
or-java-[version]-bin.jar in your classpath, either by adding the full path to it to your CLASSPATH environment variable,
or by directly specifying it with the command line switch -cp when starting your JVM.
If you are going to use the driver with the JDBC DriverManager, you would use com.mysql.jdbc.Driver as the class that imple-
ments java.sql.Driver.
You can set the CLASSPATH environment variable under UNIX, Linux or Mac OS X either locally for a user within their .profile,
.login or other login file. You can also set it globally by editing the global /etc/profile file.
For example, under a C shell (csh, tcsh) you would add the Connector/J driver to your CLASSPATH using the following:
shell> setenv CLASSPATH /path/mysql-connector-java-[ver]-bin.jar:$CLASSPATH
Or with a Bourne-compatible shell (sh, ksh, bash):
shell> export set CLASSPATH=/path/mysql-connector-java-[ver]-bin.jar:$CLASSPATH
Within Windows 2000, Windows XP, Windows Server 2003 and Windows Vista, you must set the environment variable through the
System Control Panel.
Connectors and APIs
2213
If you want to use MySQL Connector/J with an application server such as GlassFish, Tomcat or JBoss, you will have to read your
vendor's documentation for more information on how to configure third-party class libraries, as most application servers ignore the
CLASSPATH environment variable. For configuration examples for some J2EE application servers, see Section 21.4.5.2, Using Con-
nector/J with J2EE and Other Java Frameworks. However, the authoritative source for JDBC connection pool configuration informa-
tion for your particular application server is the documentation for that application server.
If you are developing servlets or JSPs, and your application server is J2EE-compliant, you can put the driver's .jar file in the WEB-
INF/lib subdirectory of your webapp, as this is a standard location for third party class libraries in J2EE web applications.
You can also use the MysqlDataSource or MysqlConnectionPoolDataSource classes in the
com.mysql.jdbc.jdbc2.optional package, if your J2EE application server supports or requires them. Starting with Connect-
or/J 5.0.0, the javax.sql.XADataSource interface is implemented via the
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource class, which supports XA distributed transactions when used in
combination with MySQL server version 5.0.
The various MysqlDataSource classes support the following parameters (through standard set mutators):
user
password
serverName (see the previous section about fail-over hosts)
databaseName
port
21.4.2.3. Upgrading from an Older Version
We try to keep the upgrade process as easy as possible, however as is the case with any software, sometimes changes need to be made
in new versions to support new features, improve existing functionality, or comply with new standards.
This section has information about what users who are upgrading from one version of Connector/J to another (or to a new version of the
MySQL server, with respect to JDBC functionality) should be aware of.
21.4.2.3.1. Upgrading from MySQL Connector/J 3.0 to 3.1
Connector/J 3.1 is designed to be backward-compatible with Connector/J 3.0 as much as possible. Major changes are isolated to new
functionality exposed in MySQL-4.1 and newer, which includes Unicode character sets, server-side prepared statements, SQLState
codes returned in error messages by the server and various performance enhancements that can be enabled or disabled via configuration
properties.
Unicode Character Sets See the next section, as well as Section 9.1, Character Set Support, for information on this new fea-
ture of MySQL. If you have something misconfigured, it will usually show up as an error with a message similar to Illegal mix
of collations.
Server-side Prepared Statements Connector/J 3.1 will automatically detect and use server-side prepared statements when they
are available (MySQL server version 4.1.0 and newer).
Starting with version 3.1.7, the driver scans SQL you are preparing via all variants of Connection.prepareStatement() to
determine if it is a supported type of statement to prepare on the server side, and if it is not supported by the server, it instead pre-
pares it as a client-side emulated prepared statement. You can disable this feature by passing emulateUnsupportedPstmts=false in
your JDBC URL.
If your application encounters issues with server-side prepared statements, you can revert to the older client-side emulated prepared
statement code that is still presently used for MySQL servers older than 4.1.0 with the connection property useServerPrepSt-
mts=false
Datetimes with all-zero components (0000-00-00 ...) These values can not be represented reliably in Java. Connector/J
3.0.x always converted them to NULL when being read from a ResultSet.
Connector/J 3.1 throws an exception by default when these values are encountered as this is the most correct behavior according to
Connectors and APIs
2214
the JDBC and SQL standards. This behavior can be modified using the zeroDateTimeBehavior configuration property. The allow-
able values are:
exception (the default), which throws an SQLException with an SQLState of S1009.
convertToNull, which returns NULL instead of the date.
round, which rounds the date to the nearest closest value which is 0001-01-01.
Starting with Connector/J 3.1.7, ResultSet.getString() can be decoupled from this behavior via noDatetimeString-
Sync=true (the default value is false) so that you can retrieve the unaltered all-zero value as a String. It should be noted that this
also precludes using any time zone conversions, therefore the driver will not allow you to enable noDatetimeStringSync and use-
Timezone at the same time.
New SQLState Codes Connector/J 3.1 uses SQL:1999 SQLState codes returned by the MySQL server (if supported), which are
different from the legacy X/Open state codes that Connector/J 3.0 uses. If connected to a MySQL server older than MySQL-4.1.0
(the oldest version to return SQLStates as part of the error code), the driver will use a built-in mapping. You can revert to the old
mapping by using the configuration property useSqlStateCodes=false.
ResultSet.getString() Calling ResultSet.getString() on a BLOB column will now return the address of the
byte[] array that represents it, instead of a String representation of the BLOB. BLOB values have no character set, so they can-
not be converted to java.lang.Strings without data loss or corruption.
To store strings in MySQL with LOB behavior, use one of the TEXT types, which the driver will treat as a java.sql.Clob.
Debug builds Starting with Connector/J 3.1.8 a debug build of the driver in a file named
mysql-connector-java-[version]-bin-g.jar is shipped alongside the normal binary jar file that is named mysql-
connector-java-[version]-bin.jar.
Starting with Connector/J 3.1.9, we do not ship the .class files unbundled, they are only available in the JAR archives that ship with
the driver.
You should not use the debug build of the driver unless instructed to do so when reporting a problem or bug, as it is not designed to
be run in production environments, and will have adverse performance impact when used. The debug binary also depends on the As-
pect/J runtime library, which is located in the src/lib/aspectjrt.jar file that comes with the Connector/J distribution.
21.4.2.3.2. Upgrading to MySQL Connector/J 5.1.x
In Connector/J 5.0.x and earlier, the alias for a table in a SELECT statement is returned when accessing the result set metadata using
ResultSetMetaData.getColumnName(). This behavior however is not JDBC compliant, and in Connector/J 5.1 this beha-
vior was changed so that the original table name, rather than the alias, is returned.
The JDBC-compliant behavior is designed to let API users reconstruct the DML statement based on the metadata within Result-
Set and ResultSetMetaData.
You can get the alias for a column in a result set by calling ResultSetMetaData.getColumnLabel(). If you want to use
the old noncompliant behavior with ResultSetMetaData.getColumnName(), use the useOldAliasMetadataBeha-
vior option and set the value to true.
In Connector/J 5.0.x the default value of useOldAliasMetadataBehavior was true, but in Connector/J 5.1 this was changed
to a default value of false.
21.4.2.3.3. JDBC-Specific Issues When Upgrading to MySQL Server 4.1 or Newer
Using the UTF-8 Character Encoding - Prior to MySQL server version 4.1, the UTF-8 character encoding was not supported by the
server, however the JDBC driver could use it, allowing storage of multiple character sets in latin1 tables on the server.
Starting with MySQL-4.1, this functionality is deprecated. If you have applications that rely on this functionality, and can not up-
grade them to use the official Unicode character support in MySQL server version 4.1 or newer, you should add the following prop-
erty to your connection URL:
Connectors and APIs
2215
useOldUTF8Behavior=true
Server-side Prepared Statements - Connector/J 3.1 will automatically detect and use server-side prepared statements when they are
available (MySQL server version 4.1.0 and newer). If your application encounters issues with server-side prepared statements, you
can revert to the older client-side emulated prepared statement code that is still presently used for MySQL servers older than 4.1.0
with the following connection property:
useServerPrepStmts=false
21.4.2.4. Installing from the Development Source Tree
Caution
You should read this section only if you are interested in helping us test our new code. If you just want to get MySQL
Connector/J up and running on your system, you should use a standard binary release distribution.
To install MySQL Connector/J from the development source tree, make sure that you have the following prerequisites:
A Bazaar client, to check out the sources from our Launchpad repository (available from http://bazaar-vcs.org/).
Apache Ant version 1.7 or newer (available from http://ant.apache.org/).
JDK 1.4.2 or later. Although MySQL Connector/J can be be used with older JDKs, to compile it from source you must have at least
JDK 1.4.2. If you are building Connector/J 5.1 you will need JDK 1.6.x and an older JDK such as JDK 1.5.x. You will then need to
point your JAVA_HOME environment variable at the older installation.
The source code repository for MySQL Connector/J is located on Launchpad at https://code.launchpad.net/connectorj.
To check out and compile a specific branch of MySQL Connector/J, follow these steps:
1. Check out the latest code from the branch that you want with one of the following commands.
To check out the latest development branch use:
shell> bzr branch lp:connectorj
This creates a connectorj subdirectory in the current directory that contains the latest sources for the requested branch.
To check out the latest 5.1 code use:
shell> bzr branch lp:connectorj/5.1
This will create a 5.1 subdirectory in the current directory containing the latest 5.1 code.
2. If you are building Connector/J 5.1 make sure that you have both JDK 1.6.x installed and an older JDK such as JDK 1.5.x. This is
because Connector/J supports both JDBC 3.0 (which was prior to JDK 1.6.x) and JDBC 4.0. Set your JAVA_HOME environment
variable to the path of the older JDK installation.
3. Change location to either the connectorj or 5.1 directory, depending on which branch you want to build, to make it your cur-
rent working directory. For example:
shell> cd connectorj
4. If you are building Connector/J 5.1 you need to edit the build.xml to reflect the location of your JDK 1.6.x installation. The
lines that you need to change are:
<property name="com.mysql.jdbc.java6.javac" value="C:\jvms\jdk1.6.0\bin\javac.exe" />
<property name="com.mysql.jdbc.java6.rtjar" value="C:\jvms\jdk1.6.0\jre\lib\rt.jar" />
Connectors and APIs
2216
Alternatively, you can set the value of these property names through the Ant -D option.
5. Issue the following command to compile the driver and create a .jar file suitable for installation:
shell> ant dist
This creates a build directory in the current directory, where all build output will go. A directory is created in the build direct-
ory that includes the version number of the sources you are building from. This directory contains the sources, compiled .class
files, and a .jar file suitable for deployment. For other possible targets, including ones that will create a fully packaged distribu-
tion, issue the following command:
shell> ant -projecthelp
6. A newly created .jar file containing the JDBC driver will be placed in the directory
build/mysql-connector-java-[version].
Install the newly created JDBC driver as you would a binary .jar file that you download from MySQL by following the instruc-
tions in Section 21.4.2.2, Installing the Driver and Configuring the CLASSPATH.
A package containing both the binary and source code for Connector/J 5.1 can also be found at the following location: Connector/J 5.1
Download
21.4.3. Connector/J Examples
Examples of using Connector/J are located throughout this document, this section provides a summary and links to these examples.
Example 21.1, Connector/J: Obtaining a connection from the DriverManager
Example 21.2, Connector/J: Using java.sql.Statement to execute a SELECT query
Example 21.3, Connector/J: Calling Stored Procedures
Example 21.4, Connector/J: Using Connection.prepareCall()
Example 21.5, Connector/J: Registering output parameters
Example 21.6, Connector/J: Setting CallableStatement input parameters
Example 21.7, Connector/J: Retrieving results and output parameter values
Example 21.8, Connector/J: Retrieving AUTO_INCREMENT column values using Statement.getGeneratedKeys()
Example 21.9, Connector/J: Retrieving AUTO_INCREMENT column values using SELECT LAST_INSERT_ID()
Example 21.10, Connector/J: Retrieving AUTO_INCREMENT column values in Updatable ResultSets
Example 21.11, Connector/J: Using a connection pool with a J2EE application server
Example 21.12, Connector/J: Example of transaction with retry logic
21.4.4. Connector/J (JDBC) Reference
This section of the manual contains reference material for MySQL Connector/J, some of which is automatically generated during the
Connector/J build process.
21.4.4.1. Driver/Datasource Class Names, URL Syntax and Configuration Properties for Con-
nector/J
The name of the class that implements java.sql.Driver in MySQL Connector/J is com.mysql.jdbc.Driver. The
org.gjt.mm.mysql.Driver class name is also usable to remain backward-compatible with MM.MySQL. You should use this
Connectors and APIs
2217
class name when registering the driver, or when otherwise configuring software to use MySQL Connector/J.
The JDBC URL format for MySQL Connector/J is as follows, with items in square brackets ([, ]) being optional:
jdbc:mysql://[host][,failoverhost...][:port]/[database]
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
If the host name is not specified, it defaults to 127.0.0.1. If the port is not specified, it defaults to 3306, the default port number for
MySQL servers.
jdbc:mysql://[host:port],[host:port].../[database]
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
If the database is not specified, the connection will be made with no default database. In this case, you will need to either call the set-
Catalog() method on the Connection instance or fully specify table names using the database name (that is, SELECT db-
name.tablename.colname FROM dbname.tablename...) in your SQL. Not specifying the database to use upon connec-
tion is generally only useful when building tools that work with multiple databases, such as GUI database managers.
MySQL Connector/J has fail-over support. This allows the driver to fail-over to any number of slave hosts and still perform read-only
queries. Fail-over only happens when the connection is in an autoCommit(true) state, because fail-over can not happen reliably
when a transaction is in progress. Most application servers and connection pools set autoCommit to true at the end of every transac-
tion/connection use.
The fail-over functionality has the following behavior:
If the URL property autoReconnect is false: Failover only happens at connection initialization, and failback occurs when the driver
determines that the first host has become available again.
If the URL property autoReconnect is true: Failover happens when the driver determines that the connection has failed (before every
query), and falls back to the first host when it determines that the host has become available again (after queriesBe-
foreRetryMaster queries have been issued).
In either case, whenever you are connected to a "failed-over" server, the connection will be set to read-only state, so queries that would
modify data will have exceptions thrown (the query will never be processed by the MySQL server).
Configuration properties define how Connector/J will make a connection to a MySQL server. Unless otherwise noted, properties can be
set for a DataSource object or for a Connection object.
Configuration Properties can be set in one of the following ways:
Using the set*() methods on MySQL implementations of java.sql.DataSource (which is the preferred method when using imple-
mentations of java.sql.DataSource):
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
As a key/value pair in the java.util.Properties instance passed to DriverManager.getConnection() or
Driver.connect()
As a JDBC URL parameter in the URL given to java.sql.DriverManager.getConnection(),
java.sql.Driver.connect() or the MySQL implementations of the javax.sql.DataSource setURL() method.
Note
If the mechanism you use to configure a JDBC URL is XML-based, you will need to use the XML character literal &amp;
to separate configuration parameters, as the ampersand is a reserved character for XML.
The properties are listed in the following tables.
Connection/Authentication.
Property Name Definition Default Since Ver-
Connectors and APIs
2218
Value sion
user The user to connect as all versions
password The password to use when connecting all versions
socketFactory The name of the class that the driver should use for creating socket
connections to the server. This class must implement the interface
'com.mysql.jdbc.SocketFactory' and have public no-args construct-
or.
com.mysql.j
dbc.Standar
dSocket-
Factory
3.0.3
connectTimeout Timeout for socket connect (in milliseconds), with 0 being no
timeout. Only works on JDK-1.4 or newer. Defaults to '0'.
0 3.0.1
socketTimeout Timeout on network socket operations (0, the default means no
timeout).
0 3.0.1
connectionLifecycleInterceptors A comma-delimited list of classes that implement
"com.mysql.jdbc.ConnectionLifecycleInterceptor" that should no-
tified of connection lifecycle events (creation, destruction, com-
mit, rollback, setCatalog and setAutoCommit) and potentially alter
the execution of these commands. ConnectionLifecycleIntercept-
ors are "stackable", more than one interceptor may be specified via
the configuration property as a comma-delimited list, with the in-
terceptors executed in order from left to right.
5.1.4
useConfigs Load the comma-delimited list of configuration properties before
parsing the URL or applying user-specified properties. These con-
figurations are explained in the 'Configurations' of the documenta-
tion.
3.1.5
interactiveClient Set the CLIENT_INTERACTIVE flag, which tells MySQL to
timeout connections based on INTERACTIVE_TIMEOUT instead
of WAIT_TIMEOUT
false 3.1.0
localSocketAddress Host name or IP address given to explicitly configure the interface
that the driver will bind the client side of the TCP/IP connection to
when connecting.
5.0.5
mysqlIOFactory The name of the class which implements
"com.mysql.jdbc.MysqlIO" for communicating with mysqld.
(default is "com.mysql.jdbc.MysqlIOprotocol")
com.mysql.j
dbc.MysqlI
Oprotocol
6.0.0
propertiesTransform An implementation of
com.mysql.jdbc.ConnectionPropertiesTransform that the driver
will use to modify URL properties passed to the driver before at-
tempting a connection
3.1.4
useCompression Use zlib compression when communicating with the server
(true/false)? Defaults to 'false'.
false 3.0.17
Networking.
Property Name Definition Default
Value
Since Ver-
sion
tcpKeepAlive If connecting using TCP/IP, should the driver set
SO_KEEPALIVE?
true 5.0.7
tcpNoDelay If connecting using TCP/IP, should the driver set
SO_TCP_NODELAY (disabling the Nagle Algorithm)?
true 5.0.7
tcpRcvBuf If connecting using TCP/IP, should the driver set SO_RCV_BUF
to the given value? The default value of '0', means use the platform
default value for this property)
0 5.0.7
tcpSndBuf If connecting using TCP/IP, shuold the driver set SO_SND_BUF
to the given value? The default value of '0', means use the platform
default value for this property)
0 5.0.7
tcpTrafficClass If connecting using TCP/IP, should the driver set traffic class or
type-of-service fields ?See the documentation for
0 5.0.7
Connectors and APIs
2219
java.net.Socket.setTrafficClass() for more information.
High Availability and Clustering.
Property Name Definition Default
Value
Since Ver-
sion
autoReconnect Should the driver try to re-establish stale and/or dead connections?
If enabled the driver will throw an exception for a queries issued
on a stale or dead connection, which belong to the current transac-
tion, but will attempt reconnect before the next query issued on the
connection in a new transaction. The use of this feature is not re-
commended, because it has side effects related to session state and
data consistency when applications do not handle SQLExceptions
properly, and is only designed to be used when you are unable to
configure your application to handle SQLExceptions resulting
from dead and stale connections properly. Alternatively, investig-
ate setting the MySQL server variable "wait_timeout" to some
high value rather than the default of 8 hours.
false 1.1
autoReconnectForPools Use a reconnection strategy appropriate for connection pools
(defaults to 'false')
false 3.1.3
failOverReadOnly When failing over in autoReconnect mode, should the connection
be set to 'read-only'?
true 3.0.12
maxReconnects Maximum number of reconnects to attempt if autoReconnect is
true, default is '3'.
3 1.1
reconnectAtTxEnd If autoReconnect is set to true, should the driver attempt reconnec-
tions at the end of every transaction?
false 3.0.10
initialTimeout If autoReconnect is enabled, the initial time to wait between re-
connect attempts (in seconds, defaults to '2').
2 1.1
roundRobinLoadBalance When autoReconnect is enabled, and failoverReadonly is false,
should we pick hosts to connect to on a round-robin basis?
false 3.1.2
queriesBeforeRetryMaster Number of queries to issue before falling back to master when
failed over (when using multi-host failover). Whichever condition
is met first, 'queriesBeforeRetryMaster' or 'secondsBeforeRetry-
Master' will cause an attempt to be made to reconnect to the mas-
ter. Defaults to 50.
50 3.0.2
secondsBeforeRetryMaster How long should the driver wait, when failed over, before attempt-
ing
30 3.0.2
selfDestructOnPingMaxOperations =If set to a nonzero value, the driver will report close the connec-
tion and report failure when Connection.ping() or Connec-
tion.isValid(int) is called if the connnection's count of commands
sent to the server exceeds this value.
0 5.1.6
selfDestructOnPingSecondsLifetime If set to a nonzero value, the driver will report close the connection
and report failure when Connection.ping() or Connec-
tion.isValid(int) is called if the connnection's lifetime exceeds this
value.
0 5.1.6
resourceId A globally unique name that identifies the resource that this data-
source or connection is connected to, used for XARe-
source.isSameRM() when the driver cannot determine this value
based on host names used in the URL
5.0.1
Security.
Property Name Definition Default
Value
Since Ver-
sion
allowMultiQueries Allow the use of ';' to delimit multiple queries during one state-
ment (true/false), defaults to 'false'
false 3.1.1
Connectors and APIs
2220
useSSL Use SSL when communicating with the server (true/false), de-
faults to 'false'
false 3.0.2
requireSSL Require SSL connection if useSSL=true? (defaults to 'false'). false 3.1.0
verifyServerCertificate If "useSSL" is set to "true", should the driver verify the server's
certificate? When using this feature, the keystore parameters
should be specified by the "clientCertificateKeyStore*" properties,
rather than system properties.
true 5.1.6
clientCertificateKeyStoreUrl URL to the client certificate KeyStore (if not specified, use de-
faults)
5.1.0
clientCertificateKeyStoreType KeyStore type for client certificates (NULL or empty means use
default, standard keystore types supported by the JVM are "JKS"
and "PKCS12", your environment may have more available de-
pending on what security products are installed and available to
the JVM.
5.1.0
clientCertificateKeyStorePassword Password for the client certificates KeyStore 5.1.0
trustCertificateKeyStoreUrl URL to the trusted root certificate KeyStore (if not specified, use
defaults)
5.1.0
trustCertificateKeyStoreType KeyStore type for trusted root certificates (NULL or empty means
use default, standard keystore types supported by the JVM are
"JKS" and "PKCS12", your environment may have more available
depending on what security products are installed and available to
the JVM.
5.1.0
trustCertificateKeyStorePassword Password for the trusted root certificates KeyStore 5.1.0
allowLoadLocalInfile Should the driver allow use of 'LOAD DATA LOCAL INFILE...'
(defaults to 'true').
true 3.0.3
allowUrlInLocalInfile Should the driver allow URLs in 'LOAD DATA LOCAL INFILE'
statements?
false 3.1.4
paranoid Take measures to prevent exposure sensitive information in error
messages and clear data structures holding sensitive data when
possible? (defaults to 'false')
false 3.0.1
Performance Extensions.
Property Name Definition Default
Value
Since Ver-
sion
callableStmtCacheSize If 'cacheCallableStmts' is enabled, how many callable statements
should be cached?
100 3.1.2
metadataCacheSize The number of queries to cache ResultSetMetadata for if
cacheResultSetMetaData is set to 'true' (default 50)
50 3.1.1
prepStmtCacheSize If prepared statement caching is enabled, how many prepared
statements should be cached?
25 3.0.10
prepStmtCacheSqlLimit If prepared statement caching is enabled, what is the largest SQL
the driver will cache the parsing for?
256 3.0.10
alwaysSendSetIsolation Should the driver always communicate with the database when
Connection.setTransactionIsolation() is called? If set to false, the
driver will only communicate with the database when the reques-
ted transaction isolation is different than the whichever is newer,
the last value that was set via Connec-
tion.setTransactionIsolation(), or the value that was read from the
server when the connection was established.
true 3.1.7
maintainTimeStats Should the driver maintain various internal timers to enable idle
time calculations as well as more verbose error messages when the
connection to the server fails? Setting this property to false re-
moves at least two calls to System.getCurrentTimeMillis() per
query.
true 3.1.9
Connectors and APIs
2221
useCursorFetch If connected to MySQL > 5.0.2, and setFetchSize() > 0 on a state-
ment, should that statement use cursor-based fetching to retrieve
rows?
false 5.0.0
blobSendChunkSize Chunk to use when sending BLOB/CLOBs via ServerPrepared-
Statements
1048576 3.1.9
cacheCallableStmts Should the driver cache the parsing stage of CallableStatements false 3.1.2
cachePrepStmts Should the driver cache the parsing stage of PreparedStatements of
client-side prepared statements, the "check" for suitability of serv-
er-side prepared and server-side prepared statements themselves?
false 3.0.10
cacheResultSetMetadata Should the driver cache ResultSetMetaData for Statements and
PreparedStatements? (Req. JDK-1.4+, true/false, default 'false')
false 3.1.1
cacheServerConfiguration Should the driver cache the results of 'SHOW VARIABLES' and
'SHOW COLLATION' on a per-URL basis?
false 3.1.5
defaultFetchSize The driver will call setFetchSize(n) with this value on all newly-
created Statements
0 3.1.9
dontTrackOpenResources The JDBC specification requires the driver to automatically track
and close resources, however if your application doesn't do a good
job of explicitly calling close() on statements or result sets, this
can cause memory leakage. Setting this property to true relaxes
this constraint, and can be more memory efficient for some applic-
ations.
false 3.1.7
dynamicCalendars Should the driver retrieve the default calendar when required, or
cache it per connection/session?
false 3.1.5
elideSetAutoCommits If using MySQL-4.1 or newer, should the driver only issue 'set
autocommit=n' queries when the server's state doesn't match the
requested state by Connection.setAutoCommit(boolean)?
false 3.1.3
enableQueryTimeouts When enabled, query timeouts set via State-
ment.setQueryTimeout() use a shared java.util.Timer instance for
scheduling. Even if the timeout doesn't expire before the query is
processed, there will be memory used by the TimerTask for the
given timeout which will not be reclaimed until the time the
timeout would have expired if it hadn't been cancelled by the
driver. High-load environments might want to consider disabling
this functionality.
true 5.0.6
holdResultsOpenOverStatementClose Should the driver close result sets on Statement.close() as required
by the JDBC specification?
false 3.1.7
largeRowSizeThreshold What size result set row should the JDBC driver consider "large",
and thus use a more memory-efficient way of representing the row
internally?
2048 5.1.1
loadBalanceStrategy If using a load-balanced connection to connect to SQL nodes in a
MySQL Cluster/NDB configuration (by using the URL prefix "jd-
bc:mysql:loadbalance://"), which load balancing algorithm should
the driver use: (1) "random" - the driver will pick a random host
for each request. This tends to work better than round-robin, as the
randomness will somewhat account for spreading loads where re-
quests vary in response time, while round-robin can sometimes
lead to overloaded nodes if there are variations in response times
across the workload. (2) "bestResponseTime" - the driver will
route the request to the host that had the best response time for the
previous transaction.
random 5.0.6
locatorFetchBufferSize If 'emulateLocators' is configured to 'true', what size buffer should
be used when fetching BLOB data for getBinaryInputStream?
1048576 3.2.1
rewriteBatchedStatements Should the driver use multiqueries (irregardless of the setting of
"allowMultiQueries") as well as rewriting of prepared statements
for INSERT into multi-value inserts when executeBatch() is
called? Notice that this has the potential for SQL injection if using
plain java.sql.Statements and your code doesn't sanitize input cor-
rectly. Notice that for prepared statements, server-side prepared
false 3.1.13
Connectors and APIs
2222
statements can not currently take advantage of this rewrite option,
and that if you do not specify stream lengths when using Prepared-
Statement.set*Stream(), the driver will not be able to determine
the optimum number of parameters per batch and you might re-
ceive an error from the driver that the resultant packet is too large.
Statement.getGeneratedKeys() for these rewritten statements only
works when the entire batch includes INSERT statements.
useDirectRowUnpack Use newer result set row unpacking code that skips a copy from
network buffers to a MySQL packet instance and instead reads dir-
ectly into the result set row data buffers.
true 5.1.1
useDynamicCharsetInfo Should the driver use a per-connection cache of character set in-
formation queried from the server when necessary, or use a built-
in static mapping that is more efficient, but isn't aware of custom
character sets or character sets implemented after the release of the
JDBC driver?
true 5.0.6
useFastDateParsing Use internal String->Date/Time/Timestamp conversion routines to
avoid excessive object creation?
true 5.0.5
useFastIntParsing Use internal String->Integer conversion routines to avoid excess-
ive object creation?
true 3.1.4
useJvmCharsetConverters Always use the character encoding routines built into the JVM,
rather than using lookup tables for single-byte character sets?
false 5.0.1
useLocalSessionState Should the driver refer to the internal values of autocommit and
transaction isolation that are set by Connection.setAutoCommit()
and Connection.setTransactionIsolation() and transaction state as
maintained by the protocol, rather than querying the database or
blindly sending commands to the database for commit() or roll-
back() method calls?
false 3.1.7
useReadAheadInput Use newer, optimized nonblocking, buffered input stream when
reading from the server?
true 3.1.5
Debugging/Profiling.
Property Name Definition Default
Value
Since Ver-
sion
logger The name of a class that implements "com.mysql.jdbc.log.Log"
that will be used to log messages to. (default is
"com.mysql.jdbc.log.StandardLogger", which logs to STDERR)
com.mysql.j
dbc.log.Sta
ndardLog-
ger
3.1.1
gatherPerfMetrics Should the driver gather performance metrics, and report them via
the configured logger every 'reportMetricsIntervalMillis' milli-
seconds?
false 3.1.2
profileSQL Trace queries and their execution/fetch times to the configured
logger (true/false) defaults to 'false'
false 3.1.0
profileSql Deprecated, use 'profileSQL' instead. Trace queries and their exe-
cution/fetch times on STDERR (true/false) defaults to 'false'
2.0.14
reportMetricsIntervalMillis If 'gatherPerfMetrics' is enabled, how often should they be logged
(in ms)?
30000 3.1.2
maxQuerySizeToLog Controls the maximum length/size of a query that will get logged
when profiling or tracing
2048 3.1.3
packetDebugBufferSize The maximum number of packets to retain when 'enablePacketDe-
bug' is true
20 3.1.3
slowQueryThresholdMillis If 'logSlowQueries' is enabled, how long should a query (in ms)
before it is logged as 'slow'?
2000 3.1.2
slowQueryThresholdNanos If 'useNanosForElapsedTime' is set to true, and this property is set
to a nonzero value, the driver will use this threshold (in nano-
second units) to determine if a query was slow.
0 5.0.7
Connectors and APIs
2223
useUsageAdvisor Should the driver issue 'usage' warnings advising proper and effi-
cient usage of JDBC and MySQL Connector/J to the log
(true/false, defaults to 'false')?
false 3.1.1
autoGenerateTestcaseScript Should the driver dump the SQL it is executing, including server-
side prepared statements to STDERR?
false 3.1.9
autoSlowLog Instead of using slowQueryThreshold* to determine if a query is
slow enough to be logged, maintain statistics that allow the driver
to determine queries that are outside the 99th percentile?
true 5.1.4
clientInfoProvider The name of a class that implements the
com.mysql.jdbc.JDBC4ClientInfoProvider interface in order to
support JDBC-4.0's Connection.get/setClientInfo() methods
com.mysql.j
dbc.JDBC4
Com-
mentCli-
entInfoPro-
vider
5.1.0
dumpMetadataOnColumnNotFound Should the driver dump the field-level metadata of a result set into
the exception message when ResultSet.findColumn() fails?
false 3.1.13
dumpQueriesOnException Should the driver dump the contents of the query sent to the server
in the message for SQLExceptions?
false 3.1.3
enablePacketDebug When enabled, a ring-buffer of 'packetDebugBufferSize' packets
will be kept, and dumped when exceptions are thrown in key areas
in the driver's code
false 3.1.3
explainSlowQueries If 'logSlowQueries' is enabled, should the driver automatically is-
sue an 'EXPLAIN' on the server and send the results to the con-
figured log at a WARN level?
false 3.1.2
includeInnodbStatusInDeadlockExcep-
tions
Include the output of "SHOW ENGINE INNODB STATUS" in
exception messages when deadlock exceptions are detected?
false 5.0.7
logSlowQueries Should queries that take longer than 'slowQueryThresholdMillis'
be logged?
false 3.1.2
logXaCommands Should the driver log XA commands sent by MysqlXaConnection
to the server, at the DEBUG level of logging?
false 5.0.5
profilerEventHandler Name of a class that implements the interface
com.mysql.jdbc.profiler.ProfilerEventHandler that will be used to
handle profiling/tracing events.
com.mysql.j
dbc.profiler.
Logging-
Pro-
filerEventH
andler
5.1.6
resultSetSizeThreshold If the usage advisor is enabled, how many rows should a result set
contain before the driver warns that it is suspiciously large?
100 5.0.5
traceProtocol Should trace-level network protocol be logged? false 3.1.2
useNanosForElapsedTime For profiling/debugging functionality that measures elapsed time,
should the driver try to use nanoseconds resolution if available
(JDK >= 1.5)?
false 5.0.7
Miscellaneous.
Property Name Definition Default
Value
Since Ver-
sion
useUnicode Should the driver use Unicode character encodings when handling
strings? Should only be used when the driver cannot determine the
character set mapping, or you are trying to 'force' the driver to use
a character set that MySQL either doesn't natively support (such as
UTF-8), true/false, defaults to 'true'
true 1.1g
characterEncoding If 'useUnicode' is set to true, what character encoding should the
driver use when dealing with strings? (defaults is to 'autodetect')
1.1g
characterSetResults Character set to tell the server to return results as. 3.0.13
Connectors and APIs
2224
connectionCollation If set, tells the server to use this collation via 'set colla-
tion_connection'
3.0.13
useBlobToStoreUTF8OutsideBMP Tells the driver to treat [MEDIUM/LONG]BLOB columns as
[LONG]VARCHAR columns holding text encoded in UTF-8 that
has characters outside the BMP (4-byte encodings), which MySQL
server cannot handle natively.
false 5.1.3
utf8OutsideBmpExcludedColumnNam
ePattern
When "useBlobToStoreUTF8OutsideBMP" is set to "true",
column names matching the given regex will still be treated as
BLOBs unless they match the regex specified for
"utf8OutsideBmpIncludedColumnNamePattern". The regex must
follow the patterns used for the java.util.regex package.
5.1.3
utf8OutsideBmpIncludedColumnName
Pattern
Used to specify exclusion rules to
"utf8OutsideBmpExcludedColumnNamePattern". The regex must
follow the patterns used for the java.util.regex package.
5.1.3
sessionVariables A comma-separated list of name/value pairs to be sent as SET
SESSION ... to the server when the driver connects.
3.1.8
allowNanAndInf Should the driver allow NaN or +/- INF values in PreparedState-
ment.setDouble()?
false 3.1.5
autoClosePStmtStreams Should the driver automatically call .close() on streams/readers
passed as arguments via set*() methods?
false 3.1.12
autoDeserialize Should the driver automatically detect and de-serialize objects
stored in BLOB fields?
false 3.1.5
blobsAreStrings Should the driver always treat BLOBs as Strings - specifically to
work around dubious metadata returned by the server for GROUP
BY clauses?
false 5.0.8
capitalizeTypeNames Capitalize type names in DatabaseMetaData? (usually only useful
when using WebObjects, true/false, defaults to 'false')
true 2.0.7
clobCharacterEncoding The character encoding to use for sending and retrieving TEXT,
MEDIUMTEXT and LONGTEXT values instead of the con-
figured connection characterEncoding
5.0.0
clobberStreamingResults This will cause a 'streaming' ResultSet to be automatically closed,
and any outstanding data still streaming from the server to be dis-
carded if another query is executed before all the data has been
read from the server.
false 3.0.9
continueBatchOnError Should the driver continue processing batch commands if one
statement fails. The JDBC spec allows either way (defaults to
'true').
true 3.0.3
createDatabaseIfNotExist Creates the database given in the URL if it doesn't yet exist. As-
sumes the configured user has permissions to create databases.
false 3.1.9
emptyStringsConvertToZero Should the driver allow conversions from empty string fields to
numeric values of '0'?
true 3.1.8
emulateLocators Should the driver emulate java.sql.Blobs with locators? With this
feature enabled, the driver will delay loading the actual Blob data
until the one of the retrieval methods (getInputStream(), get-
Bytes(), and so forth) on the blob data stream has been accessed.
For this to work, you must use a column alias with the value of the
column to the actual name of the Blob. The feature also has the
following restrictions: The SELECT that created the result set
must reference only one table, the table must have a primary key;
the SELECT must alias the original blob column name, specified
as a string, to an alternate name; the SELECT must cover all
columns that make up the primary key.
false 3.1.0
emulateUnsupportedPstmts Should the driver detect prepared statements that are not supported
by the server, and replace them with client-side emulated ver-
sions?
true 3.1.7
functionsNeverReturnBlobs Should the driver always treat data from functions returning
BLOBs as Strings - specifically to work around dubious metadata
false 5.0.8
Connectors and APIs
2225
returned by the server for GROUP BY clauses?
generateSimpleParameterMetadata Should the driver generate simplified parameter metadata for Pre-
paredStatements when no metadata is available either because the
server couldn't support preparing the statement, or server-side pre-
pared statements are disabled?
false 5.0.5
ignoreNonTxTables Ignore nontransactional table warning for rollback? (defaults to
'false').
false 3.0.9
jdbcCompliantTruncation Should the driver throw java.sql.DataTruncation exceptions when
data is truncated as is required by the JDBC specification when
connected to a server that supports warnings (MySQL 4.1.0 and
newer)? This property has no effect if the server sql-mode includes
STRICT_TRANS_TABLES.
true 3.1.2
maxRows The maximum number of rows to return (0, the default means re-
turn all rows).
-1 all versions
netTimeoutForStreamingResults What value should the driver automatically set the server setting
'net_write_timeout' to when the streaming result sets feature is in
use? (value has unit of seconds, the value '0' means the driver will
not try and adjust this value)
600 5.1.0
noAccessToProcedureBodies When determining procedure parameter types for CallableState-
ments, and the connected user cannot access procedure bodies
through "SHOW CREATE PROCEDURE" or select on
mysql.proc should the driver instead create basic metadata (all
parameters reported as IN VARCHARs, but allowing registerOut-
Parameter() to be called on them anyway) instead of throwing an
exception?
false 5.0.3
noDatetimeStringSync Do not ensure that Result-
Set.getDatetimeType().toString().equals(ResultSet.getString())
false 3.1.7
noTimezoneConversionForTimeType Do not convert TIME values using the server timezone if 'use-
Timezone'='true'
false 5.0.0
nullCatalogMeansCurrent When DatabaseMetadataMethods ask for a 'catalog' parameter,
does the value null mean use the current catalog? (this is not JD-
BC-compliant, but follows legacy behavior from earlier versions
of the driver)
true 3.1.8
nullNamePatternMatchesAll Should DatabaseMetaData methods that accept *pattern paramet-
ers treat null the same as '%' (this is not JDBC-compliant, however
older versions of the driver accepted this departure from the spe-
cification)
true 3.1.8
overrideSupportsIntegrityEnhance-
mentFacility
Should the driver return "true" for Database-
MetaData.supportsIntegrityEnhancementFacility() even if the
database doesn't support it to workaround applications that require
this method to return "true" to signal support of foreign keys, even
though the SQL specification states that this facility contains much
more than just foreign key support (one such application being
OpenOffice)?
false 3.1.12
padCharsWithSpace If a result set column has the CHAR type and the value does not
fill the amount of characters specified in the DDL for the column,
should the driver pad the remaining characters with space (for AN-
SI compliance)?
false 5.0.6
pedantic Follow the JDBC spec to the letter. false 3.0.0
pinGlobalTxToPhysicalConnection When using XAConnections, should the driver ensure that opera-
tions on a given XID are always routed to the same physical con-
nection? This allows the XAConnection to support "XA START ...
JOIN" after "XA END" has been called
false 5.0.1
populateInsertRowWithDefaultValues When using ResultSets that are CONCUR_UPDATABLE, should
the driver pre-populate the "insert" row with default values from
the DDL for the table used in the query so those values are imme-
diately available for ResultSet accessors? This functionality re-
quires a call to the database for metadata each time a result set of
false 5.0.5
Connectors and APIs
2226
this type is created. If disabled (the default), the default values will
be populated by the an internal call to refreshRow() which pulls
back default values and/or values changed by triggers.
processEscapeCodesForPrepStmts Should the driver process escape codes in queries that are pre-
pared?
true 3.1.12
relaxAutoCommit If the version of MySQL the driver connects to does not support
transactions, still allow calls to commit(), rollback() and setAuto-
Commit() (true/false, defaults to 'false')?
false 2.0.13
retainStatementAfterResultSetClose Should the driver retain the Statement reference in a ResultSet
after ResultSet.close() has been called. This is not JDBC-com-
pliant after JDBC-4.0.
false 3.1.11
rollbackOnPooledClose Should the driver issue a rollback() when the logical connection in
a pool is closed?
true 3.0.15
runningCTS13 Enables workarounds for bugs in Sun's JDBC compliance testsuite
version 1.3
false 3.1.7
serverTimezone Override detection/mapping of timezone. Used when timezone
from server doesn't map to Java timezone
3.0.2
statementInterceptors A comma-delimited list of classes that implement
"com.mysql.jdbc.StatementInterceptor" that should be placed "in
between" query execution to influence the results. StatementInter-
ceptors are "chainable", the results returned by the "current" inter-
ceptor will be passed on to the next in in the chain, from left-
to-right order, as specified in this property.
5.1.1
strictFloatingPoint Used only in older versions of compliance test false 3.0.0
strictUpdates Should the driver do strict checking (all primary keys selected) of
updatable result sets (true, false, defaults to 'true')?
true 3.0.4
tinyInt1isBit Should the driver treat the datatype TINYINT(1) as the BIT type
(because the server silently converts BIT -> TINYINT(1) when
creating tables)?
true 3.0.16
transformedBitIsBoolean If the driver converts TINYINT(1) to a different type, should it use
BOOLEAN instead of BIT for future compatibility with MySQL-
5.0, as MySQL-5.0 has a BIT type?
false 3.1.9
treatUtilDateAsTimestamp Should the driver treat java.util.Date as a TIMESTAMP for the
purposes of PreparedStatement.setObject()?
true 5.0.5
ultraDevHack Create PreparedStatements for prepareCall() when required, be-
cause UltraDev is broken and issues a prepareCall() for _all_ state-
ments? (true/false, defaults to 'false')
false 2.0.3
useGmtMillisForDatetimes Convert between session timezone and GMT before creating Date
and Timestamp instances (value of "false" is legacy behavior,
"true" leads to more JDBC-compliant behavior.
false 3.1.12
useHostsInPrivileges Add '@hostname' to users in Database-
MetaData.getColumn/TablePrivileges() (true/false), defaults to
'true'.
true 3.0.2
useInformationSchema When connected to MySQL-5.0.7 or newer, should the driver use
the INFORMATION_SCHEMA to derive information used by
DatabaseMetaData?
false 5.0.0
useJDBCCompliantTimezoneShift Should the driver use JDBC-compliant rules when converting
TIME/TIMESTAMP/DATETIME values' timezone information
for those JDBC arguments which take a java.util.Calendar argu-
ment? (Notice that this option is exclusive of the "use-
Timezone=true" configuration option.)
false 5.0.0
useLegacyDatetimeCode Use code for DATE/TIME/DATETIME/TIMESTAMP handling
in result sets and statements that consistently handles timezone
conversions from client to server and back again, or use the legacy
code for these datatypes that has been in the driver for backwards-
compatibility?
true 5.1.6
Connectors and APIs
2227
useOldAliasMetadataBehavior Should the driver use the legacy behavior for "AS" clauses on
columns and tables, and only return aliases (if any) for ResultSet-
MetaData.getColumnName() or ResultSet-
MetaData.getTableName() rather than the original column/table
name? In 5.0.x, the default value was true.
false 5.0.4
useOldUTF8Behavior Use the UTF-8 behavior the driver did when communicating with
4.0 and older servers
false 3.1.6
useOnlyServerErrorMessages Do not prepend 'standard' SQLState error messages to error mes-
sages returned by the server.
true 3.0.15
useSSPSCompatibleTimezoneShift If migrating from an environment that was using server-side pre-
pared statements, and the configuration property "useJDBCCompli-
antTimeZoneShift" set to "true", use compatible behavior when
not using server-side prepared statements when sending
TIMESTAMP values to the MySQL server.
false 5.0.5
useServerPrepStmts Use server-side prepared statements if the server supports them? false 3.1.0
useSqlStateCodes Use SQL Standard state codes instead of 'legacy' X/Open/SQL
state codes (true/false), default is 'true'
true 3.1.3
useStreamLengthsInPrepStmts Honor stream length parameter in PreparedStatement/Result-
Set.setXXXStream() method calls (true/false, defaults to 'true')?
true 3.0.2
useTimezone Convert time/date types between client and server timezones
(true/false, defaults to 'false')?
false 3.0.2
useUnbufferedInput Do not use BufferedInputStream for reading data from the server true 3.0.11
yearIsDateType Should the JDBC driver treat the MySQL type "YEAR" as a
java.sql.Date, or as a SHORT?
true 3.1.9
zeroDateTimeBehavior What should happen when the driver encounters DATETIME val-
ues that are composed entirely of zeroes (used by MySQL to rep-
resent invalid dates)? Valid values are "exception", "round" and
"convertToNull".
exception 3.1.4
Connector/J also supports access to MySQL via named pipes on Windows NT/2000/XP using the NamedPipeSocketFactory as a plu-
gin-socket factory via the socketFactory property. If you do not use a namedPipePath property, the default of '\\.\pipe\MySQL' will be
used. If you use the NamedPipeSocketFactory, the host name and port number values in the JDBC url will be ignored. You can
enable this feature using:
socketFactory=com.mysql.jdbc.NamedPipeSocketFactory
Named pipes only work when connecting to a MySQL server on the same physical machine as the one the JDBC driver is being used
on. In simple performance tests, it appears that named pipe access is between 30%-50% faster than the standard TCP/IP access.
However, this varies per system, and named pipes are slower than TCP/IP in many Windows configurations.
You can create your own socket factories by following the example code in com.mysql.jdbc.NamedPipeSocketFactory, or
com.mysql.jdbc.StandardSocketFactory.
21.4.4.2. JDBC API Implementation Notes
MySQL Connector/J passes all of the tests in the publicly available version of Sun's JDBC compliance test suite. However, in many
places the JDBC specification is vague about how certain functionality should be implemented, or the specification allows leeway in
implementation.
This section gives details on a interface-by-interface level about how certain implementation decisions may affect how you use MySQL
Connector/J.
Blob
Starting with Connector/J version 3.1.0, you can emulate Blobs with locators by adding the property 'emulateLocators=true' to your
JDBC URL. Using this method, the driver will delay loading the actual Blob data until you retrieve the other data and then use re-
trieval methods (getInputStream(), getBytes(), and so forth) on the blob data stream.
Connectors and APIs
2228
For this to work, you must use a column alias with the value of the column to the actual name of the Blob, for example:
SELECT id, 'data' as blob_data from blobtable
For this to work, you must also follow these rules:
The SELECT must also reference only one table, the table must have a primary key.
The SELECT must alias the original blob column name, specified as a string, to an alternate name.
The SELECT must cover all columns that make up the primary key.
The Blob implementation does not allow in-place modification (they are copies, as reported by the Database-
MetaData.locatorsUpdateCopies() method). Because of this, you should use the corresponding PreparedState-
ment.setBlob() or ResultSet.updateBlob() (in the case of updatable result sets) methods to save changes back to the
database.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about type conversion in the Knowledge Base article,
Type Conversions Supported by MySQL Connector/J. To subscribe to MySQL Enterprise see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
CallableStatement
Starting with Connector/J 3.1.1, stored procedures are supported when connecting to MySQL version 5.0 or newer via the
CallableStatement interface. Currently, the getParameterMetaData() method of CallableStatement is not sup-
ported.
Clob
The Clob implementation does not allow in-place modification (they are copies, as reported by the Database-
MetaData.locatorsUpdateCopies() method). Because of this, you should use the PreparedState-
ment.setClob() method to save changes back to the database. The JDBC API does not have a ResultSet.updateClob()
method.
Connection
Unlike older versions of MM.MySQL the isClosed() method does not ping the server to determine if it is alive. In accordance
with the JDBC specification, it only returns true if closed() has been called on the connection. If you need to determine if the
connection is still valid, you should issue a simple query, such as SELECT 1. The driver will throw an exception if the connection
is no longer valid.
DatabaseMetaData
Foreign Key information (getImportedKeys()/getExportedKeys() and getCrossReference()) is only available
from InnoDB tables. However, the driver uses SHOW CREATE TABLE to retrieve this information, so when other storage engines
support foreign keys, the driver will transparently support them as well.
PreparedStatement
PreparedStatements are implemented by the driver, as MySQL does not have a prepared statement feature. Because of this, the
driver does not implement getParameterMetaData() or getMetaData() as it would require the driver to have a complete
SQL parser in the client.
Starting with version 3.1.0 MySQL Connector/J, server-side prepared statements and binary-encoded result sets are used when the
server supports them.
Take care when using a server-side prepared statement with large parameters that are set via setBinaryStream(), setAs-
ciiStream(), setUnicodeStream(), setBlob(), or setClob(). If you want to re-execute the statement with any large
parameter changed to a nonlarge parameter, it is necessary to call clearParameters() and set all parameters again. The reason
for this is as follows:
During both server-side prepared statements and client-side emulation, large data is exchanged only when PreparedState-
ment.execute() is called.
Connectors and APIs
2229
Once that has been done, the stream used to read the data on the client side is closed (as per the JDBC spec), and cannot be read
from again.
If a parameter changes from large to nonlarge, the driver must reset the server-side state of the prepared statement to allow the
parameter that is being changed to take the place of the prior large value. This removes all of the large data that has already been
sent to the server, thus requiring the data to be re-sent, via the setBinaryStream(), setAsciiStream(), setU-
nicodeStream(), setBlob() or setClob() methods.
Consequently, if you want to change the type of a parameter to a nonlarge one, you must call clearParameters() and set all
parameters of the prepared statement again before it can be re-executed.
ResultSet
By default, ResultSets are completely retrieved and stored in memory. In most cases this is the most efficient way to operate, and
due to the design of the MySQL network protocol is easier to implement. If you are working with ResultSets that have a large num-
ber of rows or large values, and can not allocate heap space in your JVM for the memory required, you can tell the driver to stream
the results back one row at a time.
To enable this functionality, you need to create a Statement instance in the following manner:
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);
The combination of a forward-only, read-only result set, with a fetch size of Integer.MIN_VALUE serves as a signal to the driver
to stream result sets row-by-row. After this any result sets created with the statement will be retrieved row-by-row.
There are some caveats with this approach. You will have to read all of the rows in the result set (or close it) before you can issue
any other queries on the connection, or an exception will be thrown.
The earliest the locks these statements hold can be released (whether they be MyISAM table-level locks or row-level locks in some
other storage engine such as InnoDB) is when the statement completes.
If the statement is within scope of a transaction, then locks are released when the transaction completes (which implies that the state-
ment needs to complete first). As with most other databases, statements are not complete until all the results pending on the state-
ment are read or the active result set for the statement is closed.
Therefore, if using streaming results, you should process them as quickly as possible if you want to maintain concurrent access to
the tables referenced by the statement producing the result set.
ResultSetMetaData
The isAutoIncrement() method only works when using MySQL servers 4.0 and newer.
Statement
When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the setFetchS-
ize() method has no effect, other than to toggle result set streaming as described above.
Connector/J 5.0.0 and later include support for both Statement.cancel() and Statement.setQueryTimeout(). Both
require MySQL 5.0.0 or newer server, and require a separate connection to issue the KILL QUERY statement. In the case of
setQueryTimeout(), the implementation creates an additional thread to handle the timeout functionality.
Note
Failures to cancel the statement for setQueryTimeout() may manifest themselves as RuntimeException rather
than failing silently, as there is currently no way to unblock the thread that is executing the query being cancelled due to
timeout expiration and have it throw the exception instead.
MySQL does not support SQL cursors, and the JDBC driver doesn't emulate them, so "setCursorName()" has no effect.
Connector/J 5.1.3 and later include two additional methods:
setLocalInfileInputStream() sets an InputStream instance that will be used to send data to the MySQL server for
a LOAD DATA LOCAL INFILE statement rather than a FileInputStream or URLInputStream that represents the
Connectors and APIs
2230
path given as an argument to the statement.
This stream will be read to completion upon execution of a LOAD DATA LOCAL INFILE statement, and will automatically
be closed by the driver, so it needs to be reset before each call to execute*() that would cause the MySQL server to request
data to fulfill the request for LOAD DATA LOCAL INFILE.
If this value is set to NULL, the driver will revert to using a FileInputStream or URLInputStream as required.
getLocalInfileInputStream() returns the InputStream instance that will be used to send data in response to a
LOAD DATA LOCAL INFILE statement.
This method returns NULL if no such stream has been set via setLocalInfileInputStream().
21.4.4.3. Java, JDBC and MySQL Types
MySQL Connector/J is flexible in the way it handles conversions between MySQL data types and Java data types.
In general, any MySQL data type can be converted to a java.lang.String, and any numerical type can be converted to any of the Java nu-
merical types, although round-off, overflow, or loss of precision may occur.
Starting with Connector/J 3.1.0, the JDBC driver will issue warnings or throw DataTruncation exceptions as is required by the JDBC
specification unless the connection was configured not to do so by using the property jdbcCompliantTruncation and setting it to false.
The conversions that are always guaranteed to work are listed in the following table:
Connection Properties - Miscellaneous.
These MySQL Data Types Can always be converted to these Java types
CHAR, VARCHAR, BLOB, TEXT, ENUM, and SET java.lang.String, java.io.InputStream,
java.io.Reader, java.sql.Blob, java.sql.Clob
FLOAT, REAL, DOUBLE PRECISION, NUMERIC,
DECIMAL, TINYINT, SMALLINT, MEDIUMINT, IN-
TEGER, BIGINT
java.lang.String, java.lang.Short,
java.lang.Integer, java.lang.Long,
java.lang.Double, java.math.BigDecimal
DATE, TIME, DATETIME, TIMESTAMP java.lang.String, java.sql.Date,
java.sql.Timestamp
Note
Round-off, overflow or loss of precision may occur if you choose a Java numeric data type that has less precision or capa-
city than the MySQL data type you are converting to/from.
The ResultSet.getObject() method uses the type conversions between MySQL and Java types, following the JDBC specifica-
tion where appropriate. The value returned by ResultSetMetaData.GetColumnClassName() is also shown below. For more
information on the java.sql.Types classes see Java 2 Platform Types.
MySQL Types to Java Types for ResultSet.getObject().
MySQL Type Name Return value of GetColumn-
ClassName
Returned as Java Class
BIT(1) (new in MySQL-5.0) BIT java.lang.Boolean
BIT( > 1) (new in MySQL-5.0) BIT byte[]
TINYINT TINYINT java.lang.Boolean if the configuration property tiny-
Int1isBit is set to true (the default) and the storage size is 1,
or java.lang.Integer if not.
BOOL, BOOLEAN TINYINT See TINYINT, above as these are aliases for TINYINT(1), cur-
rently.
SMALLINT[(M)]
[UNSIGNED]
SMALLINT [UNSIGNED] java.lang.Integer (regardless if UNSIGNED or not)
Connectors and APIs
2231
MEDIUMINT[(M)]
[UNSIGNED]
MEDIUMINT [UNSIGNED] java.lang.Integer, if UNSIGNED java.lang.Long
(C/J 3.1 and earlier), or java.lang.Integer for C/J 5.0 and
later
INT,INTEGER[(M)]
[UNSIGNED]
INTEGER [UNSIGNED] java.lang.Integer, if UNSIGNED java.lang.Long
BIGINT[(M)] [UNSIGNED] BIGINT [UNSIGNED] java.lang.Long, if UNSIGNED
java.math.BigInteger
FLOAT[(M,D)] FLOAT java.lang.Float
DOUBLE[(M,B)] DOUBLE java.lang.Double
DECIMAL[(M[,D])] DECIMAL java.math.BigDecimal
DATE DATE java.sql.Date
DATETIME DATETIME java.sql.Timestamp
TIMESTAMP[(M)] TIMESTAMP java.sql.Timestamp
TIME TIME java.sql.Time
YEAR[(2|4)] YEAR If yearIsDateType configuration property is set to false, then
the returned object type is java.sql.Short. If set to true (the
default) then an object of type java.sql.Date (with the date
set to January 1st, at midnight).
CHAR(M) CHAR java.lang.String (unless the character set for the column is
BINARY, then byte[] is returned.
VARCHAR(M) [BINARY] VARCHAR java.lang.String (unless the character set for the column is
BINARY, then byte[] is returned.
BINARY(M) BINARY byte[]
VARBINARY(M) VARBINARY byte[]
TINYBLOB TINYBLOB byte[]
TINYTEXT VARCHAR java.lang.String
BLOB BLOB byte[]
TEXT VARCHAR java.lang.String
MEDIUMBLOB MEDIUMBLOB byte[]
MEDIUMTEXT VARCHAR java.lang.String
LONGBLOB LONGBLOB byte[]
LONGTEXT VARCHAR java.lang.String
ENUM('value1','value2',...) CHAR java.lang.String
SET('value1','value2',...) CHAR java.lang.String
21.4.4.4. Using Character Sets and Unicode
All strings sent from the JDBC driver to the server are converted automatically from native Java Unicode form to the client character
encoding, including all queries sent via Statement.execute(), Statement.executeUpdate(), State-
ment.executeQuery() as well as all PreparedStatement and CallableStatement parameters with the exclusion of
parameters set using setBytes(), setBinaryStream(), setAsciiStream(), setUnicodeStream() and setBlob().
Prior to MySQL Server 4.1, Connector/J supported a single character encoding per connection, which could either be automatically de-
tected from the server configuration, or could be configured by the user through the useUnicode and characterEncoding prop-
erties.
Starting with MySQL Server 4.1, Connector/J supports a single character encoding between client and server, and any number of char-
acter encodings for data returned by the server to the client in ResultSets.
The character encoding between client and server is automatically detected upon connection. The encoding used by the driver is spe-
cified on the server via the character_set system variable for server versions older than 4.1.0 and character_set_server
for server versions 4.1.0 and newer. For more information, see Section 9.1.3.1, Server Character Set and Collation.
Connectors and APIs
2232
To override the automatically detected encoding on the client side, use the characterEncoding property in the URL used to con-
nect to the server.
When specifying character encodings on the client side, Java-style names should be used. The following table lists Java-style names for
MySQL character sets:
MySQL to Java Encoding Name Translations.
MySQL Character Set Name Java-Style Character Encoding Name
ascii US-ASCII
big5 Big5
gbk GBK
sjis SJIS (or Cp932 or MS932 for MySQL Server < 4.1.11)
cp932 Cp932 or MS932 (MySQL Server > 4.1.11)
gb2312 EUC_CN
ujis EUC_JP
euckr EUC_KR
latin1 ISO8859_1
latin2 ISO8859_2
greek ISO8859_7
hebrew ISO8859_8
cp866 Cp866
tis620 TIS620
cp1250 Cp1250
cp1251 Cp1251
cp1257 Cp1257
macroman MacRoman
macce MacCentralEurope
utf8 UTF-8
ucs2 UnicodeBig
Warning
Do not issue the query 'set names' with Connector/J, as the driver will not detect that the character set has changed, and
will continue to use the character set detected during the initial connection setup.
To allow multiple character sets to be sent from the client, the UTF-8 encoding should be used, either by configuring utf8 as the de-
fault server character set, or by configuring the JDBC driver to use UTF-8 through the characterEncoding property.
21.4.4.5. Connecting Securely Using SSL
SSL in MySQL Connector/J encrypts all data (other than the initial handshake) between the JDBC driver and the server. The perform-
ance penalty for enabling SSL is an increase in query processing time between 35% and 50%, depending on the size of the query, and
the amount of data it returns.
For SSL Support to work, you must have the following:
A JDK that includes JSSE (Java Secure Sockets Extension), like JDK-1.4.1 or newer. SSL does not currently work with a JDK that
you can add JSSE to, like JDK-1.2.x or JDK-1.3.x due to the following JSSE bug: ht-
tp://developer.java.sun.com/developer/bugParade/bugs/4273544.html
A MySQL server that supports SSL and has been compiled and configured to do so, which is MySQL-4.0.4 or later, see Sec-
tion 5.5.7, Using SSL for Secure Connections, for more information.
Connectors and APIs
2233
A client certificate (covered later in this section)
The system works through two Java truststore files, one file contains the certificate information for the server (truststore in the ex-
amples below). The other file contains the certificate for the client (keystore in the examples below). All Java truststore files are
password protected by supplying a suitable password to the keytool when you create the files. You need the file names and associ-
ated passwords to create an SSL connection.
You will first need to import the MySQL server CA Certificate into a Java truststore. A sample MySQL server CA Certificate is located
in the SSL subdirectory of the MySQL source distribution. This is what SSL will use to determine if you are communicating with a se-
cure MySQL server. Alternatively, use the CA Certificate that you have generated or been provided with by your SSL provider.
To use Java's keytool to create a truststore in the current directory , and import the server's CA certificate (cacert.pem), you can
do the following (assuming that keytool is in your path. The keytool should be located in the bin subdirectory of your JDK or
JRE):
shell> keytool -import -alias mysqlServerCACert \
-file cacert.pem -keystore truststore
You will need to enter the password when prompted for the keystore file. Interaction with keytool will look like this:
Enter keystore password: *********
Owner: [email protected], CN=Walrus,
O=MySQL AB, L=Orenburg, ST=Some-State, C=RU
Issuer: [email protected], CN=Walrus,
O=MySQL AB, L=Orenburg, ST=Some-State, C=RU
Serial number: 0
Valid from:
Fri Aug 02 16:55:53 CDT 2002 until: Sat Aug 02 16:55:53 CDT 2003
Certificate fingerprints:
MD5: 61:91:A0:F2:03:07:61:7A:81:38:66:DA:19:C4:8D:AB
SHA1: 25:77:41:05:D5:AD:99:8C:14:8C:CA:68:9C:2F:B8:89:C3:34:4D:6C
Trust this certificate? [no]: yes
Certificate was added to keystore
You then have two options, you can either import the client certificate that matches the CA certificate you just imported, or you can cre-
ate a new client certificate.
To import an existing certificate, the certificate should be in DER format. You can use openssl to convert an existing certificate into
the new format. For example:
shell> openssl x509 -outform DER -in client-cert.pem -out client.cert
You now need to import the converted certificate into your keystore using keytool:
shell> keytool -import -file client.cert -keystore keystore -alias mysqlClientCertificate
To generate your own client certificate, use keytool to create a suitable certificate and add it to the keystore file:
shell> keytool -genkey -keyalg rsa \
-alias mysqlClientCertificate -keystore keystore
Keytool will prompt you for the following information, and create a keystore named keystore in the current directory.
You should respond with information that is appropriate for your situation:
Enter keystore password: *********
What is your first and last name?
[Unknown]: Matthews
What is the name of your organizational unit?
[Unknown]: Software Development
What is the name of your organization?
[Unknown]: MySQL AB
What is the name of your City or Locality?
[Unknown]: Flossmoor
What is the name of your State or Province?
[Unknown]: IL
What is the two-letter country code for this unit?
[Unknown]: US
Is <CN=Matthews, OU=Software Development, O=MySQL AB,
L=Flossmoor, ST=IL, C=US> correct?
Connectors and APIs
2234
[no]: y
Enter key password for <mysqlClientCertificate>
(RETURN if same as keystore password):
Finally, to get JSSE to use the keystore and truststore that you have generated, you need to set the following system properties when
you start your JVM, replacing path_to_keystore_file with the full path to the keystore file you created, path_to_truststore_file with the
path to the truststore file you created, and using the appropriate password values for each property. You can do this either on the com-
mand line:
-Djavax.net.ssl.keyStore=path_to_keystore_file
-Djavax.net.ssl.keyStorePassword=password
-Djavax.net.ssl.trustStore=path_to_truststore_file
-Djavax.net.ssl.trustStorePassword=password
Or you can set the values directly within the application:
System.setProperty("javax.net.ssl.keyStore","path_to_keystore_file");
System.setProperty("javax.net.ssl.keyStorePassword","password");
System.setProperty("javax.net.ssl.trustStore","path_to_truststore_file");
System.setProperty("javax.net.ssl.trustStorePassword","password");
You will also need to set useSSL to true in your connection parameters for MySQL Connector/J, either by adding useSSL=true to
your URL, or by setting the property useSSL to true in the java.util.Properties instance you pass to DriverMan-
ager.getConnection().
You can test that SSL is working by turning on JSSE debugging (as detailed below), and look for the following key events:
...
*** ClientHello, v3.1
RandomCookie: GMT: 1018531834 bytes = { 199, 148, 180, 215, 74, 12,
54, 244, 0, 168, 55, 103, 215, 64, 16, 138, 225, 190, 132, 153, 2,
217, 219, 239, 202, 19, 121, 78 }
Session ID: {}
Cipher Suites: { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17 }
Compression Methods: { 0 }
***
[write] MD5 and SHA1 hashes: len = 59
0000: 01 00 00 37 03 01 3D B6 90 FA C7 94 B4 D7 4A 0C ...7..=.......J.
0010: 36 F4 00 A8 37 67 D7 40 10 8A E1 BE 84 99 02 D9 6...7g.@........
0020: DB EF CA 13 79 4E 00 00 10 00 05 00 04 00 09 00 ....yN..........
0030: 0A 00 12 00 13 00 03 00 11 01 00 ...........
main, WRITE: SSL v3.1 Handshake, length = 59
main, READ: SSL v3.1 Handshake, length = 74
*** ServerHello, v3.1
RandomCookie: GMT: 1018577560 bytes = { 116, 50, 4, 103, 25, 100, 58,
202, 79, 185, 178, 100, 215, 66, 254, 21, 83, 187, 190, 42, 170, 3,
132, 110, 82, 148, 160, 92 }
Session ID: {163, 227, 84, 53, 81, 127, 252, 254, 178, 179, 68, 63,
182, 158, 30, 11, 150, 79, 170, 76, 255, 92, 15, 226, 24, 17, 177,
219, 158, 177, 187, 143}
Cipher Suite: { 0, 5 }
Compression Method: 0
***
%% Created: [Session-1, SSL_RSA_WITH_RC4_128_SHA]
** SSL_RSA_WITH_RC4_128_SHA
[read] MD5 and SHA1 hashes: len = 74
0000: 02 00 00 46 03 01 3D B6 43 98 74 32 04 67 19 64 ...F..=.C.t2.g.d
0010: 3A CA 4F B9 B2 64 D7 42 FE 15 53 BB BE 2A AA 03 :.O..d.B..S..*..
0020: 84 6E 52 94 A0 5C 20 A3 E3 54 35 51 7F FC FE B2 .nR..\ ..T5Q....
0030: B3 44 3F B6 9E 1E 0B 96 4F AA 4C FF 5C 0F E2 18 .D?.....O.L.\...
0040: 11 B1 DB 9E B1 BB 8F 00 05 00 ..........
main, READ: SSL v3.1 Handshake, length = 1712
...
JSSE provides debugging (to STDOUT) when you set the following system property: -Djavax.net.debug=all This will tell you
what keystores and truststores are being used, as well as what is going on during the SSL handshake and certificate exchange. It will be
helpful when trying to determine what is not working when trying to get an SSL connection to happen.
21.4.4.6. Using Master/Slave Replication with ReplicationConnection
Starting with Connector/J 3.1.7, we've made available a variant of the driver that will automatically send queries to a read/write master,
or a failover or round-robin loadbalanced set of slaves based on the state of Connection.getReadOnly() .
An application signals that it wants a transaction to be read-only by calling Connection.setReadOnly(true), this replication-
Connectors and APIs
2235
aware connection will use one of the slave connections, which are load-balanced per-vm using a round-robin scheme (a given connec-
tion is sticky to a slave unless that slave is removed from service). If you have a write transaction, or if you have a read that is time-
sensitive (remember, replication in MySQL is asynchronous), set the connection to be not read-only, by calling Connec-
tion.setReadOnly(false) and the driver will ensure that further calls are sent to the master MySQL server. The driver takes
care of propagating the current state of autocommit, isolation level, and catalog between all of the connections that it uses to accomplish
this load balancing functionality.
To enable this functionality, use the " com.mysql.jdbc.ReplicationDriver " class when configuring your application server's
connection pool or when creating an instance of a JDBC driver for your standalone application. Because it accepts the same URL
format as the standard MySQL JDBC driver, ReplicationDriver does not currently work with java.sql.DriverManager -
based connection creation unless it is the only MySQL JDBC driver registered with the DriverManager .
Here is a short, simple example of how ReplicationDriver might be used in a standalone application.
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Properties;
import com.mysql.jdbc.ReplicationDriver;
public class ReplicationDriverDemo {
public static void main(String[] args) throws Exception {
ReplicationDriver driver = new ReplicationDriver();
Properties props = new Properties();
// We want this for failover on the slaves
props.put("autoReconnect", "true");
// We want to load balance between the slaves
props.put("roundRobinLoadBalance", "true");
props.put("user", "foo");
props.put("password", "bar");
//
// Looks like a normal MySQL JDBC url, with a
// comma-separated list of hosts, the first
// being the 'master', the rest being any number
// of slaves that the driver will load balance against
//
Connection conn =
driver.connect("jdbc:mysql://master,slave1,slave2,slave3/test",
props);
//
// Perform read/write work on the master
// by setting the read-only flag to "false"
//
conn.setReadOnly(false);
conn.setAutoCommit(false);
conn.createStatement().executeUpdate("UPDATE some_table ....");
conn.commit();
//
// Now, do a query from a slave, the driver automatically picks one
// from the list
//
conn.setReadOnly(true);
ResultSet rs =
conn.createStatement().executeQuery("SELECT a,b FROM alt_table");
.......
}
}
You may also want to investigate the Load Balancing JDBC Pool (lbpol) tool, which provides a wrapper around the standard JDBC
driver and allows you to use DB connection pools that includes checks for system failures and uneven load distribution. For more in-
formation, see Load Balancing JDBC Pool (lbpool).
21.4.4.7. Mapping MySQL Error Numbers to SQLStates
The table below provides a mapping of the MySQL Error Numbers to SQL States
Table 21.3. Mapping of MySQL Error Numbers to SQLStates
Connectors and APIs
2236
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
102
2
ER_DUP
_KEY
S10
00
230
00
103
7
ER_OUT
OFMEM
ORY
S10
01
HY
001
103
8
ER_OUT
_OF_SO
RT-
MEMOR
Y
S10
01
HY
001
104
0
ER_CON
_COUNT
_ERROR
080
04
080
04
104
2
ER_BAD
_HOST_
ERROR
080
04
08S
01
104
3
ER_HAN
DSHAK
E_ERRO
R
080
04
08S
01
104
4
ER_DBA
CCESS_
DENIED
_ERROR
S10
00
420
00
104
5
ER_ACC
ESS_DE
NIED_E
RROR
280
00
280
00
104
7
ER_UNK
NOWN_
COM_E
RROR
08S
01
HY
000
105
0
ER_TAB
LE_EXIS
TS_ERR
OR
S10
00
42S
01
105
1
ER_BAD
_TABLE
_ERROR
42S
02
42S
02
105
2
ER_NON
_UNIQ_
ERROR
S10
00
230
00
105
3
ER_SER
VER_SH
UT-
DOWN
S10
00
08S
01
105
4
ER_BAD
_FIELD_
ERROR
S00
22
42S
22
105
5
ER_WR
ONG_FI
S10
09
420
00
Connectors and APIs
2237
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
ELD_WI
TH_GRO
UP
105
6
ER_WR
ONG_G
ROUP_F
IELD
S10
09
420
00
105
7
ER_WR
ONG_SU
M_SELE
CT
S10
09
420
00
105
8
ER_WR
ONG_V
ALUE_C
OUNT
21S
01
21S
01
105
9
ER_TOO
_LONG_
IDENT
S10
09
420
00
106
0
ER_DUP
_FIELD
NAME
S10
09
42S
21
106
1
ER_DUP
_KEYN
AME
S10
09
420
00
106
2
ER_DUP
_ENTRY
S10
09
230
00
106
3
ER_WR
ONG_FI
ELD_SP
EC
S10
09
420
00
106
4
ER_PAR
SE_ERR
OR
420
00
420
00
106
5
ER_EMP
TY_QUE
RY
420
00
420
00
106
6
ER_NON
UNIQ_T
ABLE
S10
09
420
00
106
7
ER_INV
AL-
ID_DEF
AULT
S10
09
420
00
106
8
ER_MU
LTIPLE_
PRI_KE
Y
S10
09
420
00
106
9
ER_TOO
_MANY
_KEYS
S10
09
420
00
Connectors and APIs
2238
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
107
0
ER_TOO
_MANY
_KEY_P
ARTS
S10
09
420
00
107
1
ER_TOO
_LONG_
KEY
S10
09
420
00
107
2
ER_KEY
_COLU
MN_DO
ES_NOT
_EXITS
S10
09
420
00
107
3
ER_BLO
B_USED
_AS_KE
Y
S10
09
420
00
107
4
ER_TOO
_BIG_FI
ELDLEN
GTH
S10
09
420
00
107
5
ER_WR
ONG_A
UTO_KE
Y
S10
09
420
00
108
0
ER_FOR
CING_C
LOSE
S10
00
08S
01
108
1
ER_IPSO
CK_ERR
OR
08S
01
08S
01
108
2
ER_NO_
SUCH_I
NDEX
S10
09
42S
12
108
3
ER_WR
ONG_FI
ELD_TE
RMIN-
ATORS
S10
09
420
00
108
4
ER_BLO
BS_AND
_NO_TE
RMIN-
ATED
S10
09
420
00
109
0
ER_CAN
T_REM
OVE_AL
L_FIELD
S
S10
00
420
00
109
1
ER_CAN
T_DROP
_FIELD_
S10
00
420
00
Connectors and APIs
2239
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
OR_KEY
110
1
ER_BLO
B_CANT
_HAVE_
DE-
FAULT
S10
00
420
00
110
2
ER_WR
ONG_D
B_NAM
E
S10
00
420
00
110
3
ER_WR
ONG_T
ABLE_N
AME
S10
00
420
00
110
4
ER_TOO
_BIG_SE
LECT
S10
00
420
00
110
6
ER_UNK
NOWN_
PRO-
CED-
URE
S10
00
420
00
110
7
ER_WR
ONG_PA
RAM-
COUNT_
TO_PRO
CED-
URE
S10
00
420
00
110
9
ER_UNK
NOWN_
TABLE
S10
00
42S
02
111
0
ER_FIEL
D_SPECI
FIED_T
WICE
S10
00
420
00
111
2
ER_UNS
UPPOR-
TED_EX
TEN-
SION
S10
00
420
00
111
3
ER_TAB
LE_MUS
T_HAVE
_COLU
MNS
S10
00
420
00
111
5
ER_UNK
NOWN_
CHAR-
AC-
TER_SE
T
S10
00
420
00
Connectors and APIs
2240
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
111
8
ER_TOO
_BIG_R
OWSIZE
S10
00
420
00
112
0
ER_WR
ONG_O
UTER_J
OIN
S10
00
420
00
112
1
ER_NUL
L_COLU
MN_IN_
INDEX
S10
00
420
00
112
9
ER_HOS
T_IS_BL
OCKED
080
04
HY
000
113
0
ER_HOS
T_NOT_
PRIV-
ILEGED
080
04
HY
000
113
1
ER_PAS
SWORD
_ANON
YM-
OUS_US
ER
S10
00
420
00
113
2
ER_PAS
SWORD
_NOT_A
LLOWE
D
S10
00
420
00
113
3
ER_PAS
SWORD
_NO_M
ATCH
S10
00
420
00
113
6
ER_WR
ONG_V
ALUE_C
OUNT_
ON_RO
W
S10
00
21S
01
113
8
ER_INV
AL-
ID_USE_
OF_NUL
L
S10
00
420
00
113
9
ER_REG
EXP_ER
ROR
S10
00
420
00
114
0
ER_MIX
_OF_GR
OUP_FU
NC_AN
D_FIEL
S10
00
420
00
Connectors and APIs
2241
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
DS
114
1
ER_NON
EXIST-
ING_GR
ANT
S10
00
420
00
114
2
ER_TAB
LEAC-
CESS_D
ENIED_
ERROR
S10
00
420
00
114
3
ER_COL
UM-
NAC-
CESS_D
ENIED_
ERROR
S10
00
420
00
114
4
ER_ILLE
GAL_GR
ANT_FO
R_TABL
E
S10
00
420
00
114
5
ER_GRA
NT_WR
ONG_H
OST_OR
_USER
S10
00
420
00
114
6
ER_NO_
SUCH_T
ABLE
S10
00
42S
02
114
7
ER_NON
EXIST-
ING_TA
BLE_GR
ANT
S10
00
420
00
114
8
ER_NOT
_ALLO
WED_C
OM-
MAND
S10
00
420
00
114
9
ER_SYN
TAX_ER
ROR
S10
00
420
00
115
2
ER_ABO
RT-
ING_CO
NNEC-
TION
S10
00
08S
01
115
3
ER_NET
_PACKE
T_TOO_
LARGE
S10
00
08S
01
Connectors and APIs
2242
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
115
4
ER_NET
_READ_
ER-
ROR_FR
OM_PIP
E
S10
00
08S
01
115
5
ER_NET
_FCNTL
_ERROR
S10
00
08S
01
115
6
ER_NET
_PACKE
TS_OUT
_OF_OR
DER
S10
00
08S
01
115
7
ER_NET
_UNCO
MPRESS
_ERROR
S10
00
08S
01
115
8
ER_NET
_READ_
ERROR
S10
00
08S
01
115
9
ER_NET
_READ_
INTER-
RUPTED
S10
00
08S
01
116
0
ER_NET
_ERROR
_ON_W
RITE
S10
00
08S
01
116
1
ER_NET
_WRITE
_INTER
RUPTED
S10
00
08S
01
116
2
ER_TOO
_LONG_
STRING
S10
00
420
00
116
3
ER_TAB
LE_CAN
T_HAN
DLE_BL
OB
S10
00
420
00
116
4
ER_TAB
LE_CAN
T_HAN
DLE_AU
TO_INC
RE-
MENT
S10
00
420
00
116
6
ER_WR
ONG_C
OLUMN
_NAME
S10
00
420
00
Connectors and APIs
2243
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
116
7
ER_WR
ONG_K
EY_COL
UMN
S10
00
420
00
116
9
ER_DUP
_UNIQU
E
S10
00
230
00
117
0
ER_BLO
B_KEY_
WITHO
UT_LEN
GTH
S10
00
420
00
117
1
ER_PRI
MARY_
CANT_H
AVE_N
ULL
S10
00
420
00
117
2
ER_TOO
_MANY
_ROWS
S10
00
420
00
117
3
ER_REQ
UIRES_P
RIMAR
Y_KEY
S10
00
420
00
117
7
ER_CHE
CK_NO_
SUCH_T
ABLE
S10
00
420
00
117
8
ER_CHE
CK_NOT
_IMPLE
MEN-
TED
S10
00
420
00
117
9
ER_CAN
T_DO_T
HIS_DU
RING_A
N_TRAN
SAC-
TION
S10
00
250
00
118
4
ER_NE
W_ABO
RT-
ING_CO
NNEC-
TION
S10
00
08S
01
118
9
ER_MAS
TER_NE
T_READ
S10
00
08S
01
119
0
ER_MAS
TER_NE
T_WRIT
S10
00
08S
01
Connectors and APIs
2244
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
E
120
3
ER_TOO
_MANY
_USER_
CON-
NEC-
TIONS
S10
00
420
00
120
5
ER_LOC
K_WAIT
_TIMEO
UT
410
00
410
00
120
7
ER_REA
D_ONL
Y_TRAN
SAC-
TION
S10
00
250
00
121
1
ER_NO_
PERMIS-
SION_T
O_CREA
TE_USE
R
S10
00
420
00
121
3
ER_LOC
K_DEA
DLOCK
410
00
400
01
121
6
ER_NO_
REFER-
EN-
CED_RO
W
S10
00
230
00
121
7
ER_RO
W_IS_R
EFER-
ENCED
S10
00
230
00
121
8
ER_CON
NECT_T
O_MAS
TER
S10
00
08S
01
122
2
ER_WR
ONG_N
UM-
BER_OF
_COLU
MNS_IN
_SELEC
T
S10
00
210
00
122
6
ER_USE
R_LIMIT
_REACH
ED
S10
00
420
00
123
0
ER_NO_
DE-
S10
00
420
00
Connectors and APIs
2245
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
FAULT
123
1
ER_WR
ONG_V
ALUE_F
OR_VA
R
S10
00
420
00
123
2
ER_WR
ONG_T
YPE_FO
R_VAR
S10
00
420
00
123
4
ER_CAN
T_USE_
OP-
TION_H
ERE
S10
00
420
00
123
5
ER_NOT
_SUPPO
RTED_Y
ET
S10
00
420
00
123
9
ER_WR
ONG_FK
_DEF
S10
00
420
00
124
1
ER_OPE
RAND_
COLUM
NS
S10
00
210
00
124
2
ER_SUB
QUERY_
NO_1_R
OW
S10
00
210
00
124
7
ER_ILLE
GAL_RE
FER-
ENCE
S10
00
42S
22
124
8
ER_DER
IVED_M
UST_HA
VE_ALI
AS
S10
00
420
00
124
9
ER_SEL
ECT_RE
DUCED
S10
00
010
00
125
0
ER_TAB
LE-
NAME_
NOT_AL
LOWED
_HERE
S10
00
420
00
125
1
ER_NOT
_SUPPO
RTED_A
S10
00
080
04
Connectors and APIs
2246
My
SQ
L
Er-
ror
Nu
mb
er
MySQL
Error
Name
Leg
acy
(X/
Op
en)
SQ
LSt
ate
SQ
L
Sta
nd-
ard
SQ
LSt
ate
UTH_M
ODE
125
2
ER_SPA
TIAL_C
ANT_H
AVE_N
ULL
S10
00
420
00
125
3
ER_COL
LA-
TION_C
HAR-
SET_MI
SMATC
H
S10
00
420
00
126
1
ER_WA
RN_TOO
_FEW_R
ECORDS
S10
00
010
00
126
2
ER_WA
RN_TOO
_MANY
_RECOR
DS
S10
00
010
00
126
3
ER_WA
RN_NUL
L_TO_N
OT-
NULL
S10
00
010
00
126
4
ER_WA
RN_DAT
A_OUT_
OF_RAN
GE
S10
00
010
00
126
5
ER_WA
RN_DAT
A_TRUN
CATED
S10
00
010
00
128
0
ER_WR
ONG_N
AME_F
OR_IND
EX
S10
00
420
00
128
1
ER_WR
ONG_N
AME_F
OR_CAT
ALOG
S10
00
420
00
128
6
ER_UNK
NOWN_
STOR-
AGE_EN
GINE
S10
00
420
00
Connectors and APIs
2247
21.4.5. Connector/J Notes and Tips
21.4.5.1. Basic JDBC Concepts
This section provides some general JDBC background.
21.4.5.1.1. Connecting to MySQL Using the DriverManager Interface
When you are using JDBC outside of an application server, the DriverManager class manages the establishment of Connections.
The DriverManager needs to be told which JDBC drivers it should try to make Connections with. The easiest way to do this is to
use Class.forName() on the class that implements the java.sql.Driver interface. With MySQL Connector/J, the name of this
class is com.mysql.jdbc.Driver. With this method, you could use an external configuration file to supply the driver class name
and driver parameters to use when connecting to a database.
The following section of Java code shows how you might register MySQL Connector/J from the main() method of your application:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!
public class LoadDriver {
public static void main(String[] args) {
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception ex) {
// handle the error
}
}
}
After the driver has been registered with the DriverManager, you can obtain a Connection instance that is connected to a particu-
lar database by calling DriverManager.getConnection():
Example 21.1. Connector/J: Obtaining a connection from the DriverManager
This example shows how you can obtain a Connection instance from the DriverManager. There are a few different signatures for
the getConnection() method. You should see the API documentation that comes with your JDK for more specific information on
how to use them.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Connection conn = null;
...
try {
conn =
DriverManager.getConnection("jdbc:mysql://localhost/test?" +
"user=monty&password=greatsqldb");
// Do something with the Connection
...
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
Once a Connection is established, it can be used to create Statement and PreparedStatement objects, as well as retrieve
metadata about the database. This is explained in the following sections.
21.4.5.1.2. Using Statements to Execute SQL
Connectors and APIs
2248
Statement objects allow you to execute basic SQL queries and retrieve the results through the ResultSet class which is described
later.
To create a Statement instance, you call the createStatement() method on the Connection object you have retrieved via
one of the DriverManager.getConnection() or DataSource.getConnection() methods described earlier.
Once you have a Statement instance, you can execute a SELECT query by calling the executeQuery(String) method with the
SQL you want to use.
To update data in the database, use the executeUpdate(String SQL) method. This method returns the number of rows affected
by the update statement.
If you do not know ahead of time whether the SQL statement will be a SELECT or an UPDATE/INSERT, then you can use the ex-
ecute(String SQL) method. This method will return true if the SQL query was a SELECT, or false if it was an UPDATE,
INSERT, or DELETE statement. If the statement was a SELECT query, you can retrieve the results by calling the getResultSet()
method. If the statement was an UPDATE, INSERT, or DELETE statement, you can retrieve the affected rows count by calling getUp-
dateCount() on the Statement instance.
Example 21.2. Connector/J: Using java.sql.Statement to execute a SELECT query
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
// assume that conn is an already created JDBC connection (see previous examples)
Statement stmt = null;
ResultSet rs = null;
try {
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT foo FROM bar");
// or alternatively, if you don't know ahead of time that
// the query will be a SELECT...
if (stmt.execute("SELECT foo FROM bar")) {
rs = stmt.getResultSet();
}
// Now do something with the ResultSet ....
}
catch (SQLException ex){
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
finally {
// it is a good idea to release
// resources in a finally{} block
// in reverse-order of their creation
// if they are no-longer needed
if (rs != null) {
try {
rs.close();
} catch (SQLException sqlEx) { } // ignore
rs = null;
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException sqlEx) { } // ignore
stmt = null;
}
}
21.4.5.1.3. Using CallableStatements to Execute Stored Procedures
Connectors and APIs
2249
Starting with MySQL server version 5.0 when used with Connector/J 3.1.1 or newer, the java.sql.CallableStatement inter-
face is fully implemented with the exception of the getParameterMetaData() method.
For more information on MySQL stored procedures, please refer to http://dev.mysql.com/doc/mysql/en/stored-routines.html.
Connector/J exposes stored procedure functionality through JDBC's CallableStatement interface.
Note
Current versions of MySQL server do not return enough information for the JDBC driver to provide result set metadata for
callable statements. This means that when using CallableStatement, ResultSetMetaData may return NULL.
The following example shows a stored procedure that returns the value of inOutParam incremented by 1, and the string passed in via
inputParam as a ResultSet:
Example 21.3. Connector/J: Calling Stored Procedures
CREATE PROCEDURE demoSp(IN inputParam VARCHAR(255), \
INOUT inOutParam INT)
BEGIN
DECLARE z INT;
SET z = inOutParam + 1;
SET inOutParam = z;
SELECT inputParam;
SELECT CONCAT('zyxw', inputParam);
END
To use the demoSp procedure with Connector/J, follow these steps:
1. Prepare the callable statement by using Connection.prepareCall() .
Notice that you have to use JDBC escape syntax, and that the parentheses surrounding the parameter placeholders are not optional:
Example 21.4. Connector/J: Using Connection.prepareCall()
import java.sql.CallableStatement;
...
//
// Prepare a call to the stored procedure 'demoSp'
// with two parameters
//
// Notice the use of JDBC-escape syntax ({call ...})
//
CallableStatement cStmt = conn.prepareCall("{call demoSp(?, ?)}");
cStmt.setString(1, "abcdefg");
Note
Connection.prepareCall() is an expensive method, due to the metadata retrieval that the driver performs to sup-
port output parameters. For performance reasons, you should try to minimize unnecessary calls to Connec-
tion.prepareCall() by reusing CallableStatement instances in your code.
2. Register the output parameters (if any exist)
To retrieve the values of output parameters (parameters specified as OUT or INOUT when you created the stored procedure), JDBC
requires that they be specified before statement execution using the various registerOutputParameter() methods in the
CallableStatement interface:
Connectors and APIs
2250
Example 21.5. Connector/J: Registering output parameters
import java.sql.Types;
...
//
// Connector/J supports both named and indexed
// output parameters. You can register output
// parameters using either method, as well
// as retrieve output parameters using either
// method, regardless of what method was
// used to register them.
//
// The following examples show how to use
// the various methods of registering
// output parameters (you should of course
// use only one registration per parameter).
//
//
// Registers the second parameter as output, and
// uses the type 'INTEGER' for values returned from
// getObject()
//
cStmt.registerOutParameter(2, Types.INTEGER);
//
// Registers the named parameter 'inOutParam', and
// uses the type 'INTEGER' for values returned from
// getObject()
//
cStmt.registerOutParameter("inOutParam", Types.INTEGER);
...
3. Set the input parameters (if any exist)
Input and in/out parameters are set as for PreparedStatement objects. However, CallableStatement also supports set-
ting parameters by name:
Example 21.6. Connector/J: Setting CallableStatement input parameters
...
//
// Set a parameter by index
//
cStmt.setString(1, "abcdefg");
//
// Alternatively, set a parameter using
// the parameter name
//
cStmt.setString("inputParameter", "abcdefg");
//
// Set the 'in/out' parameter using an index
//
cStmt.setInt(2, 1);
//
// Alternatively, set the 'in/out' parameter
// by name
//
cStmt.setInt("inOutParam", 1);
...
4. Execute the CallableStatement, and retrieve any result sets or output parameters.
Although CallableStatement supports calling any of the Statement execute methods (executeUpdate(), ex-
Connectors and APIs
2251
ecuteQuery() or execute()), the most flexible method to call is execute(), as you do not need to know ahead of time if
the stored procedure returns result sets:
Example 21.7. Connector/J: Retrieving results and output parameter values
...
boolean hadResults = cStmt.execute();
//
// Process all returned result sets
//
while (hadResults) {
ResultSet rs = cStmt.getResultSet();
// process result set
...
hadResults = cStmt.getMoreResults();
}
//
// Retrieve output parameters
//
// Connector/J supports both index-based and
// name-based retrieval
//
int outputValue = cStmt.getInt(2); // index-based
outputValue = cStmt.getInt("inOutParam"); // name-based
...
21.4.5.1.4. Retrieving AUTO_INCREMENT Column Values
Before version 3.0 of the JDBC API, there was no standard way of retrieving key values from databases that supported auto increment
or identity columns. With older JDBC drivers for MySQL, you could always use a MySQL-specific method on the Statement inter-
face, or issue the query SELECT LAST_INSERT_ID() after issuing an INSERT to a table that had an AUTO_INCREMENT key. Us-
ing the MySQL-specific method call isn't portable, and issuing a SELECT to get the AUTO_INCREMENT key's value requires another
round-trip to the database, which isn't as efficient as possible. The following code snippets demonstrate the three different ways to re-
trieve AUTO_INCREMENT values. First, we demonstrate the use of the new JDBC-3.0 method getGeneratedKeys() which is now
the preferred method to use if you need to retrieve AUTO_INCREMENT keys and have access to JDBC-3.0. The second example shows
how you can retrieve the same value using a standard SELECT LAST_INSERT_ID() query. The final example shows how updatable
result sets can retrieve the AUTO_INCREMENT value when using the insertRow() method.
Example 21.8. Connector/J: Retrieving AUTO_INCREMENT column values using
Statement.getGeneratedKeys()
Statement stmt = null;
ResultSet rs = null;
try {
//
// Create a Statement instance that we can use for
// 'normal' result sets assuming you have a
// Connection 'conn' to a MySQL database already
// available
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_UPDATABLE);
//
// Issue the DDL queries for the table for this example
//
stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");
stmt.executeUpdate(
"CREATE TABLE autoIncTutorial ("
+ "priKey INT NOT NULL AUTO_INCREMENT, "
+ "dataField VARCHAR(64), PRIMARY KEY (priKey))");
Connectors and APIs
2252
//
// Insert one row that will generate an AUTO INCREMENT
// key in the 'priKey' field
//
stmt.executeUpdate(
"INSERT INTO autoIncTutorial (dataField) "
+ "values ('Can I Get the Auto Increment Field?')",
Statement.RETURN_GENERATED_KEYS);
//
// Example of using Statement.getGeneratedKeys()
// to retrieve the value of an auto-increment
// value
//
int autoIncKeyFromApi = -1;
rs = stmt.getGeneratedKeys();
if (rs.next()) {
autoIncKeyFromApi = rs.getInt(1);
} else {
// throw an exception from here
}
rs.close();
rs = null;
System.out.println("Key returned from getGeneratedKeys():"
+ autoIncKeyFromApi);
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException ex) {
// ignore
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException ex) {
// ignore
}
}
}
Example 21.9. Connector/J: Retrieving AUTO_INCREMENT column values using SELECT
LAST_INSERT_ID()
Statement stmt = null;
ResultSet rs = null;
try {
//
// Create a Statement instance that we can use for
// 'normal' result sets.
stmt = conn.createStatement();
//
// Issue the DDL queries for the table for this example
//
stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");
stmt.executeUpdate(
"CREATE TABLE autoIncTutorial ("
+ "priKey INT NOT NULL AUTO_INCREMENT, "
+ "dataField VARCHAR(64), PRIMARY KEY (priKey))");
//
// Insert one row that will generate an AUTO INCREMENT
// key in the 'priKey' field
//
stmt.executeUpdate(
"INSERT INTO autoIncTutorial (dataField) "
+ "values ('Can I Get the Auto Increment Field?')");
Connectors and APIs
2253
//
// Use the MySQL LAST_INSERT_ID()
// function to do the same thing as getGeneratedKeys()
//
int autoIncKeyFromFunc = -1;
rs = stmt.executeQuery("SELECT LAST_INSERT_ID()");
if (rs.next()) {
autoIncKeyFromFunc = rs.getInt(1);
} else {
// throw an exception from here
}
rs.close();
System.out.println("Key returned from " +
"'SELECT LAST_INSERT_ID()': " +
autoIncKeyFromFunc);
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException ex) {
// ignore
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException ex) {
// ignore
}
}
}
Example 21.10. Connector/J: Retrieving AUTO_INCREMENT column values in Updatable ResultSets
Statement stmt = null;
ResultSet rs = null;
try {
//
// Create a Statement instance that we can use for
// 'normal' result sets as well as an 'updatable'
// one, assuming you have a Connection 'conn' to
// a MySQL database already available
//
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_UPDATABLE);
//
// Issue the DDL queries for the table for this example
//
stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");
stmt.executeUpdate(
"CREATE TABLE autoIncTutorial ("
+ "priKey INT NOT NULL AUTO_INCREMENT, "
+ "dataField VARCHAR(64), PRIMARY KEY (priKey))");
//
// Example of retrieving an AUTO INCREMENT key
// from an updatable result set
//
rs = stmt.executeQuery("SELECT priKey, dataField "
+ "FROM autoIncTutorial");
rs.moveToInsertRow();
rs.updateString("dataField", "AUTO INCREMENT here?");
rs.insertRow();
//
// the driver adds rows at the end
//
Connectors and APIs
2254
rs.last();
//
// We should now be on the row we just inserted
//
int autoIncKeyFromRS = rs.getInt("priKey");
rs.close();
rs = null;
System.out.println("Key returned for inserted row: "
+ autoIncKeyFromRS);
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException ex) {
// ignore
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException ex) {
// ignore
}
}
}
When you run the preceding example code, you should get the following output: Key returned from getGeneratedKeys(): 1 Key
returned from SELECT LAST_INSERT_ID(): 1 Key returned for inserted row: 2 You should be aware, that at times, it can be tricky
to use the SELECT LAST_INSERT_ID() query, as that function's value is scoped to a connection. So, if some other query happens
on the same connection, the value will be overwritten. On the other hand, the getGeneratedKeys() method is scoped by the
Statement instance, so it can be used even if other queries happen on the same connection, but not on the same Statement in-
stance.
21.4.5.2. Using Connector/J with J2EE and Other Java Frameworks
This section describes how to use Connector/J in several contexts.
21.4.5.2.1. General J2EE Concepts
This section provides general background on J2EE concepts that pertain to use of Connector/J.
21.4.5.2.1.1. Understanding Connection Pooling
Connection pooling is a technique of creating and managing a pool of connections that are ready for use by any thread that needs them.
This technique of pooling connections is based on the fact that most applications only need a thread to have access to a JDBC connec-
tion when they are actively processing a transaction, which usually take only milliseconds to complete. When not processing a transac-
tion, the connection would otherwise sit idle. Instead, connection pooling allows the idle connection to be used by some other thread to
do useful work.
In practice, when a thread needs to do work against a MySQL or other database with JDBC, it requests a connection from the pool.
When the thread is finished using the connection, it returns it to the pool, so that it may be used by any other threads that want to use it.
When the connection is loaned out from the pool, it is used exclusively by the thread that requested it. From a programming point of
view, it is the same as if your thread called DriverManager.getConnection() every time it needed a JDBC connection,
however with connection pooling, your thread may end up using either a new, or already-existing connection.
Connection pooling can greatly increase the performance of your Java application, while reducing overall resource usage. The main be-
nefits to connection pooling are:
Reduced connection creation time
Connectors and APIs
2255
Although this is not usually an issue with the quick connection setup that MySQL offers compared to other databases, creating new
JDBC connections still incurs networking and JDBC driver overhead that will be avoided if connections are recycled.
Simplified programming model
When using connection pooling, each individual thread can act as though it has created its own JDBC connection, allowing you to
use straight-forward JDBC programming techniques.
Controlled resource usage
If you do not use connection pooling, and instead create a new connection every time a thread needs one, your application's resource
usage can be quite wasteful and lead to unpredictable behavior under load.
Remember that each connection to MySQL has overhead (memory, CPU, context switches, and so forth) on both the client and server
side. Every connection limits how many resources there are available to your application as well as the MySQL server. Many of these
resources will be used whether or not the connection is actually doing any useful work!
Connection pools can be tuned to maximize performance, while keeping resource utilization below the point where your application
will start to fail rather than just run slower.
Luckily, Sun has standardized the concept of connection pooling in JDBC through the JDBC-2.0 Optional interfaces, and all major ap-
plication servers have implementations of these APIs that work fine with MySQL Connector/J.
Generally, you configure a connection pool in your application server configuration files, and access it via the Java Naming and Direct-
ory Interface (JNDI). The following code shows how you might use a connection pool from an application deployed in a J2EE applica-
tion server:
Example 21.11. Connector/J: Using a connection pool with a J2EE application server
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class MyServletJspOrEjb {
public void doSomething() throws Exception {
/*
* Create a JNDI Initial context to be able to
* lookup the DataSource
*
* In production-level code, this should be cached as
* an instance or static variable, as it can
* be quite expensive to create a JNDI context.
*
* Note: This code only works when you are using servlets
* or EJBs in a J2EE application server. If you are
* using connection pooling in standalone Java code, you
* will have to create/configure datasources using whatever
* mechanisms your particular connection pooling library
* provides.
*/
InitialContext ctx = new InitialContext();
/*
* Lookup the DataSource, which will be backed by a pool
* that the application server provides. DataSource instances
* are also a good candidate for caching as an instance
* variable, as JNDI lookups can be expensive as well.
*/
DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/MySQLDB");
/*
* The following code is what would actually be in your
* Servlet, JSP or EJB 'service' method...where you need
* to work with a JDBC connection.
*/
Connection conn = null;
Connectors and APIs
2256
Statement stmt = null;
try {
conn = ds.getConnection();
/*
* Now, use normal JDBC programming to work with
* MySQL, making sure to close each resource when you're
* finished with it, which allows the connection pool
* resources to be recovered as quickly as possible
*/
stmt = conn.createStatement();
stmt.execute("SOME SQL QUERY");
stmt.close();
stmt = null;
conn.close();
conn = null;
} finally {
/*
* close any jdbc instances here that weren't
* explicitly closed during normal code path, so
* that we don't 'leak' resources...
*/
if (stmt != null) {
try {
stmt.close();
} catch (sqlexception sqlex) {
// ignore -- as we can't do anything about it here
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (sqlexception sqlex) {
// ignore -- as we can't do anything about it here
}
conn = null;
}
}
}
}
As shown in the example above, after obtaining the JNDI InitialContext, and looking up the DataSource, the rest of the code should
look familiar to anyone who has done JDBC programming in the past.
The most important thing to remember when using connection pooling is to make sure that no matter what happens in your code
(exceptions, flow-of-control, and so forth), connections, and anything created by them (such as statements or result sets) are closed, so
that they may be re-used, otherwise they will be stranded, which in the best case means that the MySQL server resources they represent
(such as buffers, locks, or sockets) may be tied up for some time, or worst case, may be tied up forever.
What Is the Best Size for my Connection Pool?
As with all other configuration rules-of-thumb, the answer is: it depends. Although the optimal size depends on anticipated load and av-
erage database transaction time, the optimum connection pool size is smaller than you might expect. If you take Sun's Java Petstore
blueprint application for example, a connection pool of 15-20 connections can serve a relatively moderate load (600 concurrent users)
using MySQL and Tomcat with response times that are acceptable.
To correctly size a connection pool for your application, you should create load test scripts with tools such as Apache JMeter or The
Grinder, and load test your application.
An easy way to determine a starting point is to configure your connection pool's maximum number of connections to be unbounded, run
a load test, and measure the largest amount of concurrently used connections. You can then work backward from there to determine
what values of minimum and maximum pooled connections give the best performance for your particular application.
21.4.5.2.2. Using Connector/J with Tomcat
The following instructions are based on the instructions for Tomcat-5.x, available at ht-
tp://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html which is current at the time this document was written.
First, install the .jar file that comes with Connector/J in $CATALINA_HOME/common/lib so that it is available to all applications in-
Connectors and APIs
2257
stalled in the container.
Next, Configure the JNDI DataSource by adding a declaration resource to $CATALINA_HOME/conf/server.xml in the context
that defines your web application:
<Context ....>
...
<Resource name="jdbc/MySQLDB"
auth="Container"
type="javax.sql.DataSource"/>
<!-- The name you used above, must match _exactly_ here!
The connection pool will be bound into JNDI with the name
"java:/comp/env/jdbc/MySQLDB"
-->
<ResourceParams name="jdbc/MySQLDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Don't set this any higher than max_connections on your
MySQL server, usually this should be a 10 or a few 10's
of connections, not hundreds or thousands -->
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<!-- You don't want to many idle connections hanging around
if you can avoid it, only enough to soak up a spike in
the load -->
<parameter>
<name>maxIdle</name>
<value>5</value>
</parameter>
<!-- Don't use autoReconnect=true, it's going away eventually
and it's a crutch for older connection pools that couldn't
test connections. You need to decide whether your application
is supposed to deal with SQLExceptions (hint, it should), and
how much of a performance penalty you're willing to pay
to ensure 'freshness' of the connection -->
<parameter>
<name>validationQuery</name>
<value>SELECT 1</value>
</parameter>
<!-- The most conservative approach is to test connections
before they're given to your application. For most applications
this is okay, the query used above is very small and takes
no real server resources to process, other than the time used
to traverse the network.
If you have a high-load application you'll need to rely on
something else. -->
<parameter>
<name>testOnBorrow</name>
<value>true</value>
</parameter>
<!-- Otherwise, or in addition to testOnBorrow, you can test
while connections are sitting idle -->
<parameter>
<name>testWhileIdle</name>
<value>true</value>
</parameter>
<!-- You have to set this value, otherwise even though
you've asked connections to be tested while idle,
the idle evicter thread will never run -->
<parameter>
<name>timeBetweenEvictionRunsMillis</name>
<value>10000</value>
</parameter>
<!-- Don't allow connections to hang out idle too long,
never longer than what wait_timeout is set to on the
server...A few minutes or even fraction of a minute
Connectors and APIs
2258
is sometimes okay here, it depends on your application
and how much spikey load it will see -->
<parameter>
<name>minEvictableIdleTimeMillis</name>
<value>60000</value>
</parameter>
<!-- Username and password used when connecting to MySQL -->
<parameter>
<name>username</name>
<value>someuser</value>
</parameter>
<parameter>
<name>password</name>
<value>somepass</value>
</parameter>
<!-- Class name for the Connector/J driver -->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to MySQL, notice
that if you want to pass any other MySQL-specific parameters
you should pass them here in the URL, setting them using the
parameter tags above will have no effect, you will also
need to use &amp; to separate parameter values as the
ampersand is a reserved character in XML -->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/test</value>
</parameter>
</ResourceParams>
</Context>
In general, you should follow the installation instructions that come with your version of Tomcat, as the way you configure datasources
in Tomcat changes from time-to-time, and unfortunately if you use the wrong syntax in your XML file, you will most likely end up with
an exception similar to the following:
Error: java.sql.SQLException: Cannot load JDBC driver class 'null ' SQL
state: null
21.4.5.2.3. Using Connector/J with JBoss
These instructions cover JBoss-4.x. To make the JDBC driver classes available to the application server, copy the .jar file that comes
with Connector/J to the lib directory for your server configuration (which is usually called default). Then, in the same configura-
tion directory, in the subdirectory named deploy, create a datasource configuration file that ends with "-ds.xml", which tells JBoss to de-
ploy this file as a JDBC Datasource. The file should have the following contents:
<datasources>
<local-tx-datasource>
<!-- This connection pool will be bound into JNDI with the name
"java:/MySQLDB" -->
<jndi-name>MySQLDB</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>user</user-name>
<password>pass</password>
<min-pool-size>5</min-pool-size>
<!-- Don't set this any higher than max_connections on your
MySQL server, usually this should be a 10 or a few 10's
of connections, not hundreds or thousands -->
<max-pool-size>20</max-pool-size>
<!-- Don't allow connections to hang out idle too long,
never longer than what wait_timeout is set to on the
server...A few minutes is usually okay here,
it depends on your application
and how much spikey load it will see -->
<idle-timeout-minutes>5</idle-timeout-minutes>
Connectors and APIs
2259
<!-- If you're using Connector/J 3.1.8 or newer, you can use
our implementation of these to increase the robustness
of the connection pool. -->
<exception-sorter-class-name>
com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
</exception-sorter-class-name>
<valid-connection-checker-class-name>
com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
</valid-connection-checker-class-name>
</local-tx-datasource>
</datasources>
21.4.5.2.4. Using Connector/J with Spring
The Spring Framework is a Java-based application framework designed for assisting in application design by providing a way to config-
ure components. The technique used by Spring is a well known design pattern called Dependency Injection (see Inversion of Control
Containers and the Dependency Injection pattern). This article will focus on Java-oriented access to MySQL databases with Spring 2.0.
For those wondering, there is a .NET port of Spring appropriately named Spring.NET.
Spring is not only a system for configuring components, but also includes support for aspect oriented programming (AOP). This is one
of the main benefits and the foundation for Spring's resource and transaction management. Spring also provides utilities for integrating
resource management with JDBC and Hibernate.
For the examples in this section the MySQL world sample database will be used. The first task is to set up a MySQL data source
through Spring. Components within Spring use the "bean" terminology. For example, to configure a connection to a MySQL server sup-
porting the world sample database you might use:
<util:map id="dbProps">
<entry key="db.driver" value="com.mysql.jdbc.Driver"/>
<entry key="db.jdbcurl" value="jdbc:mysql://localhost/world"/>
<entry key="db.username" value="myuser"/>
<entry key="db.password" value="mypass"/>
</util:map>
In the above example we are assigning values to properties that will be used in the configuration. For the datasource configuration:
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${db.driver}"/>
<property name="url" value="${db.jdbcurl}"/>
<property name="username" value="${db.username}"/>
<property name="password" value="${db.password}"/>
</bean>
The placeholders are used to provide values for properties of this bean. This means that you can specify all the properties of the config-
uration in one place instead of entering the values for each property on each bean. We do, however, need one more bean to pull this all
together. The last bean is responsible for actually replacing the placeholders with the property values.
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="dbProps"/>
</bean>
Now that we have our MySQL data source configured and ready to go, we write some Java code to access it. The example below will
retrieve three random cities and their corresponding country using the data source we configured with Spring.
// Create a new application context. this processes the Spring config
ApplicationContext ctx =
new ClassPathXmlApplicationContext("ex1appContext.xml");
// Retrieve the data source from the application context
DataSource ds = (DataSource) ctx.getBean("dataSource");
// Open a database connection using Spring's DataSourceUtils
Connection c = DataSourceUtils.getConnection(ds);
try {
// retrieve a list of three random cities
PreparedStatement ps = c.prepareStatement(
"select City.Name as 'City', Country.Name as 'Country' " +
"from City inner join Country on City.CountryCode = Country.Code " +
"order by rand() limit 3");
Connectors and APIs
2260
ResultSet rs = ps.executeQuery();
while(rs.next()) {
String city = rs.getString("City");
String country = rs.getString("Country");
System.out.printf("The city %s is in %s%n", city, country);
}
} catch (SQLException ex) {
// something has failed and we print a stack trace to analyse the error
ex.printStackTrace();
// ignore failure closing connection
try { c.close(); } catch (SQLException e) { }
} finally {
// properly release our connection
DataSourceUtils.releaseConnection(c, ds);
}
This is very similar to normal JDBC access to MySQL with the main difference being that we are using DataSourceUtils instead of the
DriverManager to create the connection.
While it may seem like a small difference, the implications are somewhat far reaching. Spring manages this resource in a way similar to
a container managed data source in a J2EE application server. When a connection is opened, it can be subsequently accessed in other
parts of the code if it is synchronized with a transaction. This makes it possible to treat different parts of your application as transaction-
al instead of passing around a database connection.
21.4.5.2.4.1. Using JdbcTemplate
Spring makes extensive use of the Template method design pattern (see Template Method Pattern). Our immediate focus will be on the
JdbcTemplate and related classes, specifically NamedParameterJdbcTemplate. The template classes handle obtaining and re-
leasing a connection for data access when one is needed.
The next example shows how to use NamedParameterJdbcTemplate inside of a DAO (Data Access Object) class to retrieve a
random city given a country code.
public class Ex2JdbcDao {
/**
* Data source reference which will be provided by Spring.
*/
private DataSource dataSource;
/**
* Our query to find a random city given a country code. Notice
* the ":country" parameter towards the end. This is called a
* named parameter.
*/
private String queryString = "select Name from City " +
"where CountryCode = :country order by rand() limit 1";
/**
* Retrieve a random city using Spring JDBC access classes.
*/
public String getRandomCityByCountryCode(String cntryCode) {
// A template that allows using queries with named parameters
NamedParameterJdbcTemplate template =
new NamedParameterJdbcTemplate(dataSource);
// A java.util.Map is used to provide values for the parameters
Map params = new HashMap();
params.put("country", cntryCode);
// We query for an Object and specify what class we are expecting
return (String)template.queryForObject(queryString, params, String.class);
}
/**
* A JavaBean setter-style method to allow Spring to inject the data source.
* @param dataSource
*/
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
}
The focus in the above code is on the getRandomCityByCountryCode() method. We pass a country code and use the Named-
ParameterJdbcTemplate to query for a city. The country code is placed in a Map with the key "country", which is the parameter
is named in the SQL query.
To access this code, you need to configure it with Spring by providing a reference to the data source.
<bean id="dao" class="code.Ex2JdbcDao">
<property name="dataSource" ref="dataSource"/>
Connectors and APIs
2261
</bean>
At this point, we can just grab a reference to the DAO from Spring and call getRandomCityByCountryCode().
// Create the application context
ApplicationContext ctx =
new ClassPathXmlApplicationContext("ex2appContext.xml");
// Obtain a reference to our DAO
Ex2JdbcDao dao = (Ex2JdbcDao) ctx.getBean("dao");
String countryCode = "USA";
// Find a few random cities in the US
for(int i = 0; i < 4; ++i)
System.out.printf("A random city in %s is %s%n", countryCode,
dao.getRandomCityByCountryCode(countryCode));
This example shows how to use Spring's JDBC classes to completely abstract away the use of traditional JDBC classes including Con-
nection and PreparedStatement.
21.4.5.2.4.2. Transactional JDBC Access
You might be wondering how we can add transactions into our code if we do not deal directly with the JDBC classes. Spring provides a
transaction management package that not only replaces JDBC transaction management, but also allows declarative transaction manage-
ment (configuration instead of code).
In order to use transactional database access, we will need to change the storage engine of the tables in the world database. The down-
loaded script explicitly creates MyISAM tables which do not support transactional semantics. The InnoDB storage engine does support
transactions and this is what we will be using. We can change the storage engine with the following statements.
ALTER TABLE City ENGINE=InnoDB;
ALTER TABLE Country ENGINE=InnoDB;
ALTER TABLE CountryLanguage ENGINE=InnoDB;
A good programming practice emphasized by Spring is separating interfaces and implementations. What this means is that we can cre-
ate a Java interface and only use the operations on this interface without any internal knowledge of what the actual implementation is.
We will let Spring manage the implementation and with this it will manage the transactions for our implementation.
First you create a simple interface:
public interface Ex3Dao {
Integer createCity(String name, String countryCode,
String district, Integer population);
}
This interface contains one method that will create a new city record in the database and return the id of the new record. Next you need
to create an implementation of this interface.
public class Ex3DaoImpl implements Ex3Dao {
protected DataSource dataSource;
protected SqlUpdate updateQuery;
protected SqlFunction idQuery;
public Integer createCity(String name, String countryCode,
String district, Integer population) {
updateQuery.update(new Object[] { name, countryCode,
district, population });
return getLastId();
}
protected Integer getLastId() {
return idQuery.run();
}
}
You can see that we only operate on abstract query objects here and do not deal directly with the JDBC API. Also, this is the complete
implementation. All of our transaction management will be dealt with in the configuration. To get the configuration started, we need to
create the DAO.
<bean id="dao" class="code.Ex3DaoImpl">
<property name="dataSource" ref="dataSource"/>
<property name="updateQuery">...</property>
<property name="idQuery">...</property>
Connectors and APIs
2262
</bean>
Now you need to set up the transaction configuration. The first thing you must do is create transaction manager to manage the data
source and a specification of what transaction properties are required for the dao methods.
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
The preceding code creates a transaction manager that handles transactions for the data source provided to it. The txAdvice uses this
transaction manager and the attributes specify to create a transaction for all methods. Finally you need to apply this advice with an AOP
pointcut.
<aop:config>
<aop:pointcut id="daoMethods"
expression="execution(* code.Ex3Dao.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="daoMethods"/>
</aop:config>
This basically says that all methods called on the Ex3Dao interface will be wrapped in a transaction. To make use of this, you only
have to retrieve the dao from the application context and call a method on the dao instance.
Ex3Dao dao = (Ex3Dao) ctx.getBean("dao");
Integer id = dao.createCity(name, countryCode, district, pop);
We can verify from this that there is no transaction management happening in our Java code and it is all configured with Spring. This is
a very powerful notion and regarded as one of the most beneficial features of Spring.
21.4.5.2.4.3. Connection Pooling
In many sitations, such as web applications, there will be a large number of small database transactions. When this is the case, it usually
makes sense to create a pool of database connections available for web requests as needed. Although MySQL does not spawn an extra
process when a connection is made, there is still a small amount of overhead to create and set up the connection. Pooling of connections
also alleviates problems such as collecting large amounts of sockets in the TIME_WAIT state.
Setting up pooling of MySQL connections with Spring is as simple as changing the data source configuration in the application context.
There are a number of configurations that we can use. The first example is based on the Jakarta Commons DBCP library. The example
below replaces the source configuration that was based on DriverManagerDataSource with DBCP's BasicDataSource.
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${db.driver}"/>
<property name="url" value="${db.jdbcurl}"/>
<property name="username" value="${db.username}"/>
<property name="password" value="${db.password}"/>
<property name="initialSize" value="3"/>
</bean>
The configuration of the two solutions is very similar. The difference is that DBCP will pool connections to the database instead of cre-
ating a new connection every time one is requested. We have also set a parameter here called initialSize. This tells DBCP that we
want three connections in the pool when it is created.
Another way to configure connection pooling is to configure a data source in our J2EE application server. Using JBoss as an example,
you can set up the MySQL connection pool by creating a file called mysql-local-ds.xml and placing it in the server/de-
fault/deploy directory in JBoss. Once we have this setup, we can use JNDI to look it up. With Spring, this lookup is very simple. The
data source configuration looks like this.
<jee:jndi-lookup id="dataSource" jndi-name="java:MySQL_DS"/>
21.4.5.2.5. Using Connector/J with GlassFish
Connectors and APIs
2263
21.4.5.3. Common Problems and Solutions
There are a few issues that seem to be commonly encountered often by users of MySQL Connector/J. This section deals with their
symptoms, and their resolutions.
Questions
21.4.5.3.1: When I try to connect to the database with MySQL Connector/J, I get the following exception:
SQLException: Server configuration denies access to data source
SQLState: 08001
VendorError: 0
What is going on? I can connect just fine with the MySQL command-line client.
21.4.5.3.2: My application throws an SQLException 'No Suitable Driver'. Why is this happening?
21.4.5.3.3: I'm trying to use MySQL Connector/J in an applet or application and I get an exception similar to:
SQLException: Cannot connect to MySQL server on host:3306.
Is there a MySQL server running on the machine/port you
are trying to connect to?
(java.security.AccessControlException)
SQLState: 08S01
VendorError: 0
21.4.5.3.4: I have a servlet/application that works fine for a day, and then stops working overnight
21.4.5.3.5: I'm trying to use JDBC-2.0 updatable result sets, and I get an exception saying my result set is not updatable.
21.4.5.3.6: I cannot connect to the MySQL server using Connector/J, and I'm sure the connection paramters are correct.
21.4.5.3.7: I am trying to connect to my MySQL server within my application, but I get the following error and stack trace:
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1392)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1414)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1926)
at com.mysql.jdbc.Connection.<init>(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
21.4.5.3.8: My application is deployed through JBoss and I am using transactions to handle the statements on the MySQL database.
Under heavy loads I am getting a error and stack trace, but these only occur after a fixed period of heavy activity.
21.4.5.3.9: When using gcj an java.io.CharConversionException is raised when working with certain character se-
quences.
21.4.5.3.10: Updating a table that contains a primary key that is either FLOAT or compound primary key that uses FLOAT fails to
update the table and raises an exception.
21.4.5.3.11: You get an ER_NET_PACKET_TOO_LARGE exception, even though the binary blob size you want to insert via JDBC
is safely below the max_allowed_packet size.
Questions and Answers
21.4.5.3.1: When I try to connect to the database with MySQL Connector/J, I get the following exception:
SQLException: Server configuration denies access to data source
SQLState: 08001
VendorError: 0
Connectors and APIs
2264
What is going on? I can connect just fine with the MySQL command-line client.
MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as Java does not support Unix Domain Sockets. Therefore, when
MySQL Connector/J connects to MySQL, the security manager in MySQL server will use its grant tables to determine whether the con-
nection should be allowed.
You must add the necessary security credentials to the MySQL server for this to happen, using the GRANT statement to your MySQL
Server. See Section 12.5.1.3, GRANT Syntax, for more information.
Note
Testing your connectivity with the mysql command-line client will not work unless you add the --host flag, and use
something other than localhost for the host. The mysql command-line client will use Unix domain sockets if you use
the special host name localhost. If you are testing connectivity to localhost, use 127.0.0.1 as the host name in-
stead.
Warning
Changing privileges and permissions improperly in MySQL can potentially cause your server installation to not have op-
timal security properties.
21.4.5.3.2: My application throws an SQLException 'No Suitable Driver'. Why is this happening?
There are three possible causes for this error:
The Connector/J driver is not in your CLASSPATH, see Section 21.4.2, Connector/J Installation.
The format of your connection URL is incorrect, or you are referencing the wrong JDBC driver.
When using DriverManager, the jdbc.drivers system property has not been populated with the location of the Connector/J
driver.
21.4.5.3.3: I'm trying to use MySQL Connector/J in an applet or application and I get an exception similar to:
SQLException: Cannot connect to MySQL server on host:3306.
Is there a MySQL server running on the machine/port you
are trying to connect to?
(java.security.AccessControlException)
SQLState: 08S01
VendorError: 0
Either you're running an Applet, your MySQL server has been installed with the "--skip-networking" option set, or your MySQL server
has a firewall sitting in front of it.
Applets can only make network connections back to the machine that runs the web server that served the .class files for the applet. This
means that MySQL must run on the same machine (or you must have some sort of port re-direction) for this to work. This also means
that you will not be able to test applets from your local file system, you must always deploy them to a web server.
MySQL Connector/J can only communicate with MySQL using TCP/IP, as Java does not support Unix domain sockets. TCP/IP com-
munication with MySQL might be affected if MySQL was started with the "--skip-networking" flag, or if it is firewalled.
If MySQL has been started with the "--skip-networking" option set (the Debian Linux package of MySQL server does this for example),
you need to comment it out in the file /etc/mysql/my.cnf or /etc/my.cnf. Of course your my.cnf file might also exist in the data direct-
ory of your MySQL server, or anywhere else (depending on how MySQL was compiled for your system). Binaries created by us always
look in /etc/my.cnf and [datadir]/my.cnf. If your MySQL server has been firewalled, you will need to have the firewall configured to al-
low TCP/IP connections from the host where your Java code is running to the MySQL server on the port that MySQL is listening to (by
default, 3306).
21.4.5.3.4: I have a servlet/application that works fine for a day, and then stops working overnight
MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the
"autoReconnect" parameter (see Section 21.4.4.1, Driver/Datasource Class Names, URL Syntax and Configuration Properties for Con-
nector/J).
Also, you should be catching SQLExceptions in your application and dealing with them, rather than propagating them all the way until
Connectors and APIs
2265
your application exits, this is just good programming practice. MySQL Connector/J will set the SQLState (see
java.sql.SQLException.getSQLState() in your APIDOCS) to "08S01" when it encounters network-connectivity issues
during the processing of a query. Your application code should then attempt to re-connect to MySQL at this point.
The following (simplistic) example shows what code that can handle these exceptions might look like:
Example 21.12. Connector/J: Example of transaction with retry logic
public void doBusinessOp() throws SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
//
// How many times do you want to retry the transaction
// (or at least _getting_ a connection)?
//
int retryCount = 5;
boolean transactionCompleted = false;
do {
try {
conn = getConnection(); // assume getting this from a
// javax.sql.DataSource, or the
// java.sql.DriverManager
conn.setAutoCommit(false);
//
// Okay, at this point, the 'retry-ability' of the
// transaction really depends on your application logic,
// whether or not you're using autocommit (in this case
// not), and whether you're using transacational storage
// engines
//
// For this example, we'll assume that it's _not_ safe
// to retry the entire transaction, so we set retry
// count to 0 at this point
//
// If you were using exclusively transaction-safe tables,
// or your application could recover from a connection going
// bad in the middle of an operation, then you would not
// touch 'retryCount' here, and just let the loop repeat
// until retryCount == 0.
//
retryCount = 0;
stmt = conn.createStatement();
String query = "SELECT foo FROM bar ORDER BY baz";
rs = stmt.executeQuery(query);
while (rs.next()) {
}
rs.close();
rs = null;
stmt.close();
stmt = null;
conn.commit();
conn.close();
conn = null;
transactionCompleted = true;
} catch (SQLException sqlEx) {
//
// The two SQL states that are 'retry-able' are 08S01
// for a communications error, and 40001 for deadlock.
//
// Only retry if the error was due to a stale connection,
// communications problem or deadlock
//
String sqlState = sqlEx.getSQLState();
if ("08S01".equals(sqlState) || "40001".equals(sqlState)) {
retryCount--;
} else {
retryCount = 0;
Connectors and APIs
2266
}
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException sqlEx) {
// You'd probably want to log this . . .
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException sqlEx) {
// You'd probably want to log this as well . . .
}
}
if (conn != null) {
try {
//
// If we got here, and conn is not null, the
// transaction should be rolled back, as not
// all work has been done
try {
conn.rollback();
} finally {
conn.close();
}
} catch (SQLException sqlEx) {
//
// If we got an exception here, something
// pretty serious is going on, so we better
// pass it up the stack, rather than just
// logging it. . .
throw sqlEx;
}
}
}
} while (!transactionCompleted && (retryCount > 0));
}
Note
Use of the autoReconnect option is not recommended because there is no safe method of reconnecting to the MySQL
server without risking some corruption of the connection state or database state information. Instead, you should use a con-
nection pool which will enable your application to connect to the MySQL server using an available connection from the
pool. The autoReconnect facility is deprecated, and may be removed in a future release.
21.4.5.3.5: I'm trying to use JDBC-2.0 updatable result sets, and I get an exception saying my result set is not updatable.
Because MySQL does not have row identifiers, MySQL Connector/J can only update result sets that have come from queries on tables
that have at least one primary key, the query must select every primary key and the query can only span one table (that is, no joins).
This is outlined in the JDBC specification.
Note that this issue only occurs when using updatable result sets, and is caused because Connector/J is unable to guarantee that it can
identify the correct rows within the result set to be updated without having a unique reference to each row. There is no requirement to
have a unique field on a table if you are using UPDATE or DELETE statements on a table where you can individually specify the criteria
to be matched using a WHERE clause.
21.4.5.3.6: I cannot connect to the MySQL server using Connector/J, and I'm sure the connection paramters are correct.
Make sure that the skip-networking option has not been enabled on your server. Connector/J must be able to communicate with
your server over TCP/IP, named sockets are not supported. Also ensure that you are not filtering connections through a Firewall or other
network security system. For more information, see Section B.1.2.2, Can't connect to [local] MySQL server.
21.4.5.3.7: I am trying to connect to my MySQL server within my application, but I get the following error and stack trace:
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
Connectors and APIs
2267
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1392)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1414)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1926)
at com.mysql.jdbc.Connection.<init>(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
The error probably indicates that you are using a older version of the Connector/J JDBC driver (2.0.14 or 3.0.x) and you are trying to
connect to a MySQL server with version 4.1x or newer. The older drivers are not compatible with 4.1 or newer of MySQL as they do
not support the newer authentication mechanisms.
It is likely that the older version of the Connector/J driver exists within your application directory or your CLASSPATH includes the
older Connector/J package.
21.4.5.3.8: My application is deployed through JBoss and I am using transactions to handle the statements on the MySQL data-
base. Under heavy loads I am getting a error and stack trace, but these only occur after a fixed period of heavy activity.
This is a JBoss, not Connector/J, issue and is connected to the use of transactions. Under heavy loads the time taken for transactions to
complete can increase, and the error is caused because you have exceeded the predefined timeout.
You can increase the timeout value by setting the TransactionTimeout attribute to the TransactionManagerService with-
in the /conf/jboss-service.xml file (pre-4.0.3) or /deploy/jta-service.xml for JBoss 4.0.3 or later. See Transaction-
Timeoute within the JBoss wiki for more information.
21.4.5.3.9: When using gcj an java.io.CharConversionException is raised when working with certain character se-
quences.
This is a known issue with gcj which raises an exception when it reaches an unknown character or one it cannot convert. You should
add useJvmCharsetConverters=true to your connection string to force character conversion outside of the gcj libraries, or try
a different JDK.
21.4.5.3.10: Updating a table that contains a primary key that is either FLOAT or compound primary key that uses FLOAT fails
to update the table and raises an exception.
Connector/J adds conditions to the WHERE clause during an UPDATE to check the old values of the primary key. If there is no match
then Connector/J considers this a failure condition and raises an exception.
The problem is that rounding differences between supplied values and the values stored in the database may mean that the values never
match, and hence the update fails. The issue will affect all queries, not just those from Connector/J.
To prevent this issue, use a primary key that does not use FLOAT. If you have to use a floating point column in your primary key use
DOUBLE or DECIMAL types in place of FLOAT.
21.4.5.3.11: You get an ER_NET_PACKET_TOO_LARGE exception, even though the binary blob size you want to insert via JD-
BC is safely below the max_allowed_packet size.
This is because the hexEscapeBlock() method in com.mysql.jdbc.PreparedStatement.streamToBytes() may al-
most double the size of your data.
21.4.6. Connector/J Support
21.4.6.1. Connector/J Community Support
Sun Microsystems, Inc. provides assistance to the user community by means of its mailing lists. For Connector/J related issues, you can
get help from experienced users by using the MySQL and Java mailing list. Archives and subscription information is available online at
http://lists.mysql.com/java.
For information about subscribing to MySQL mailing lists or to browse list archives, visit http://lists.mysql.com/. See Section 1.5.1,
MySQL Mailing Lists.
Community support from experienced users is also available through the JDBC Forum. You may also find help from other users in the
other MySQL Forums, located at http://forums.mysql.com. See Section 1.5.2, MySQL Community Support at the MySQL Forums.
21.4.6.2. How to Report Connector/J Bugs or Problems
Connectors and APIs
2268
The normal place to report bugs is http://bugs.mysql.com/, which is the address for our bugs database. This database is public, and can
be browsed and searched by anyone. If you log in to the system, you will also be able to enter new reports.
If you have found a sensitive security bug in MySQL, you can send email to <[email protected]>.
Writing a good bug report takes patience, but doing it right the first time saves time both for us and for yourself. A good bug report,
containing a full test case for the bug, makes it very likely that we will fix the bug in the next release.
This section will help you write your report correctly so that you do not waste your time doing things that may not help us much or at
all.
If you have a repeatable bug report, please report it to the bugs database at http://bugs.mysql.com/. Any bug that we are able to repeat
has a high chance of being fixed in the next MySQL release.
To report other problems, you can use one of the MySQL mailing lists.
Remember that it is possible for us to respond to a message containing too much information, but not to one containing too little. People
often omit facts because they think they know the cause of a problem and assume that some details do not matter.
A good principle is this: If you are in doubt about stating something, state it. It is faster and less troublesome to write a couple more
lines in your report than to wait longer for the answer if we must ask you to provide information that was missing from the initial report.
The most common errors made in bug reports are (a) not including the version number of Connector/J or MySQL used, and (b) not fully
describing the platform on which Connector/J is installed (including the JVM version, and the platform type and version number that
MySQL itself is installed on).
This is highly relevant information, and in 99 cases out of 100, the bug report is useless without it. Very often we get questions like,
Why doesn't this work for me? Then we find that the feature requested wasn't implemented in that MySQL version, or that a bug de-
scribed in a report has already been fixed in newer MySQL versions.
Sometimes the error is platform-dependent; in such cases, it is next to impossible for us to fix anything without knowing the operating
system and the version number of the platform.
If at all possible, you should create a repeatable, stanalone testcase that doesn't involve any third-party classes.
To streamline this process, we ship a base class for testcases with Connector/J, named
'com.mysql.jdbc.util.BaseBugReport'. To create a testcase for Connector/J using this class, create your own class that in-
herits from com.mysql.jdbc.util.BaseBugReport and override the methods setUp(), tearDown() and runTest().
In the setUp() method, create code that creates your tables, and populates them with any data needed to demonstrate the bug.
In the runTest() method, create code that demonstrates the bug using the tables and data you created in the setUp method.
In the tearDown() method, drop any tables you created in the setUp() method.
In any of the above three methods, you should use one of the variants of the getConnection() method to create a JDBC connection
to MySQL:
getConnection() - Provides a connection to the JDBC URL specified in getUrl(). If a connection already exists, that con-
nection is returned, otherwise a new connection is created.
getNewConnection() - Use this if you need to get a new connection for your bug report (that is, there is more than one connec-
tion involved).
getConnection(String url) - Returns a connection using the given URL.
getConnection(String url, Properties props) - Returns a connection using the given URL and properties.
If you need to use a JDBC URL that is different from 'jdbc:mysql:///test', override the method getUrl() as well.
Use the assertTrue(boolean expression) and assertTrue(String failureMessage, boolean expres-
sion) methods to create conditions that must be met in your testcase demonstrating the behavior you are expecting (vs. the behavior
you are observing, which is why you are most likely filing a bug report).
Connectors and APIs
2269
Finally, create a main() method that creates a new instance of your testcase, and calls the run method:
public static void main(String[] args) throws Exception {
new MyBugReport().run();
}
Once you have finished your testcase, and have verified that it demonstrates the bug you are reporting, upload it with your bug report to
http://bugs.mysql.com/.
21.4.6.3. Connector/J Change History
The Connector/J Change History (Changelog) is located with the main Changelog for MySQL. See Section C.6, MySQL Connector/J
Change History.
21.5. MySQL Connector/MXJ
MySQL Connector/MXJ is a Java Utility package for deploying and managing a MySQL database. Deploying and using MySQL can be
as easy as adding an additional parameter to the JDBC connection url, which will result in the database being started when the first con-
nection is made. This makes it easy for Java developers to deploy applications which require a database by reducing installation barriers
for their end-users.
MySQL Connector/MXJ makes the MySQL database appear to be a java-based component. It does this by determining what platform
the system is running on, selecting the appropriate binary, and launching the executable. It will also optionally deploy an initial data-
base, with any specified parameters.
Included are instructions for use with a JDBC driver and deploying as a JMX MBean to JBoss.
You can download sources and binaries from: http://dev.mysql.com/downloads/connector/mxj/
This a beta release and feedback is welcome and encouraged.
Please send questions or comments to the MySQL and Java mailing list.
21.5.1. Connector/MXJ Overview
Connector/MXJ consists of a Java class, a copy of the mysqld binary for a specific list of platforms, and associated files and support
utilities. The Java class controls the initialization of an instance of the embedded mysqld binary, and the ongoing management of the
mysqld process. The entire sequence and management can be controlled entirely from within Java using the Connector/MXJ Java
classes. You can see an overview of the contents of the Connector/MXJ package in the figure below.
Connectors and APIs
2270
It is important to note that Connector/MXJ is not an embedded version of MySQL, or a version of MySQL written as part of a Java
class. Connector/MXJ works through the use of an embedded, compiled binary of mysqld as would normally be used when deploying
a standard MySQL installation.
It is the Connector/MXJ wrapper, support classes and tools, that enable Connector/MXJ to appear as a MySQL instance.
When Connector/MXJ is initialized, the corresponding mysqld binary for the current platform is extracted, along with a pre-
configured data directed. Both are contained within the Connector/MXJ JAR file. The mysqld instance is then started, with any addi-
tional options as specified during the initialization, and the MySQL database becomes accessible.
Because Connector/MXJ works in combination with Connector/J, you can access and integrate with the MySQL instance through a JD-
BC connection. When you have finished with the server, the instance is terminated, and, by default, any data created during the session
is retained within the temporary directory created when the instance was started.
Connector/MXJ and the embedded mysqld instance can be deployed in a number of environments where relying on an existing data-
base, or installing a MySQL instance would be impossible, including CD-ROM embedded database applications and temporary data-
base requirements within a Java-based application environment.
21.5.2. Connector/MXJ Versions
Connector/MXJ 5.x, currently in beta status, includes mysqld version 5.x and includes binaries for Linux x86, Mac OS X PPC,
Windows XP/NT/2000 x86 and Solaris SPARC. Connector/MXJ 5.x requires the Connector/J 5.x package.
The exact version of mysqld included depends on the version of Connector/MXJ
1. Connector/MXJ v5.0.3 included MySQL v5.0.22
2. Connector/MXJ v5.0.4 includes MySQL v5.0.27 (Community) or MySQL v5.0.32 (Enterprise)
3. Connector/MXJ v5.0.6 includes MySQL 5.0.37 (Community)
4. Connector/MXJ v5.0.7 includes MySQL 5.0.41 (Community) or MySQL 5.0.42 (Enterprise)
5. Connector/MXJ v5.0.8 includes MySQL 5.0.45 (Community) or MySQL 5.0.46 (Enterprise)
6. Connector/MXJ v5.0.9 includes MySQL 5.0.51a (Community) or MySQL 5.0.54 (Enterprise)
Connector/MXJ 1.x includes mysqld version 4.1.13 and includes binaries for Linux x86, Windows XP/NT/2000 x86 and Solaris
Connectors and APIs
2271
SPARC. Connector/MXJ 1.x requires the Connector/J 3.x package.
A summary of the different MySQL versions supplied with each Connector/MXJ release are shown in the table.
Connector/MXJ Version MySQL Version(s)
5.0.8 5.0.45 (CS), 5.0.46 (ES)
5.0.7 5.0.41 (CS), 5.0.42 (ES)
5.0.6 5.0.37 (CS), 5.0.40 (ES)
5.0.5 5.0.37 (CS), 5.0.36 (ES)
5.0.4 5.0.27 (CS), 5.0.32 (ES)
5.0.3 5.0.22
5.0.2 5.0.19
This guide provides information on the Connector/MXJ 5.x release. For information on using the older releases, please see the docu-
mentation included with the appropriate distribution.
21.5.3. Connector/MXJ Installation
Connector/MXJ does not have a installation application or process, but there are some steps you can follow to make the installation and
deployment of Connector/MXJ easier.
Before you start, there are some baseline requirements for
Java Runtime Environment (v1.4.0 or newer) if you are only going to deploy the package.
Java Development Kit (v1.4.0 or newer) if you want to build Connector/MXJ from source.
Connector/J 5.0 or newer.
Depending on your target installation/deployment environment you may also require:
JBoss - 4.0rc1 or newer
Apache Tomcat - 5.0 or newer
Sun's JMX reference implementation version 1.2.1 (from http://java.sun.com/products/JavaManagement/)
21.5.3.1. Supported Platforms
Connector/MXJ is compatible with any platform supporting Java and MySQL. By default, Connector/MXJ incorporates the mysqld
binary for a select number of platforms which differs by version. The following platforms have been tested and working as deployment
platforms. Support for all the platforms listed below is not included by default.
Linux (i386)
FreeBSD (i386)
Windows NT (x86), Windows 2000 (x86), Windows XP (x86), Windows Vista (x86)
Solaris 8, SPARC 32-bit (compatible with Solaris 8, Solaris 9 and Solaris 10 on SPARC 32-bit and 64-bit platforms)
Mac OS X (PowerPC and Intel)
The Connector/MXJ 5.0.8 release includes mysqld binaries for the following platforms by as standard:
Connectors and APIs
2272
Linux (i386)
Windows (x86), compatible with Windows NT, Windows 2000, Windows XP , Windows Vista
Solaris 8, SPARC 32-bit (compatible with Solaris 8, Solaris 9 and Solaris 10 on SPARC 32-bit and 64-bit platforms)
Mac OS X (PowerPC and Intel)
For more information on packaging your own Connector/MXJ with the platforms you require, see Section 21.5.6.1, Creating your own
Connector/MXJ Package
21.5.3.2. Connector/MXJ Base Installation
Because there is no formal installation process, the method, installation directory, and access methods you use for Connector/MXJ are
entirely up to your individual requirements.
To perform a basic installation, choose a target directory for the files included in the Connector/MXJ package. On Unix/Linux systems
you may opt to use a directory such as /usr/local/connector-mxj; On Windows, you may want to install the files in the base
directory, C:\Connector-MXJ, or within the Program Files directory.
To install the files, for a Connector/MXJ 5.0.4 installation:
1. Download the Connector/MXJ package, either in Tar/Gzip format (ideal for Unix/Linux systems) or Zip format (Windows).
2. Extract the files from the package. This will create a directory mysql-connector-mxj-gpl-[ver]. Copy and optionally re-
name this directory to your desired location.
3. For best results, you should update your global CLASSPATH variable with the location of the required jar files.
Within Unix/Linux you can do this globally by editing the global shell profile, or on a user by user basis by editing their individual
shell profile.
On Windows 2000, Windows NT and Windows XP, you can edit the global CLASSPATH by editing the Environment Vari-
ables configured through the System control panel.
For Connector/MXJ 5.0.6 and later you need the following JAR files in your CLASSPATH:
1. mysql-connector-mxj-gpl-[ver].jar contains the main Connector/MXJ classes.
2. mysql-connector-mxj-gpl-[ver]-db-files.jar contains the embedded mysqld and database files.
3. aspectjrt.jar the AspectJ runtime library, located in lib/aspectjrt.jar in the Connector/MXJ package.
4. mysql-connector-java-[ver]-bin.jar Connector/J, see Section 21.4, MySQL Connector/J.
For Connector/MXJ 5.0.4 and later you need the following JAR files in your CLASSPATH:
1. connector-mxj.jar contains the main Connector/MXJ classes.
2. connector-mxj-db-files.jar contains the embedded mysqld and database files.
3. aspectjrt.jar the AspectJ runtime library, located in lib/aspectjrt.jar in the Connector/MXJ package.
4. mysql-connector-mxj-gpl-[ver].jar Connector/J, see Section 21.4, MySQL Connector/J.
For Connector/MXJ 5.0.3 and earlier, you need the following JAR files:
1. connector-mxj.jar
Connectors and APIs
2273
2. aspectjrt.jar the AspectJ runtime library, located in lib/aspectjrt.jar in the Connector/MXJ package.
3. mysql-connector-mxj-gpl-[ver].jar Connector/J, see Section 21.4, MySQL Connector/J.
21.5.3.3. Connector/MXJ Quick Start Guide
Once you have extracted the Connector/MXJ and Connector/J components you can run one of the sample applications that initiates a
MySQL instance. You can test the installation by running the ConnectorMXJUrlTestExample:
shell> java ConnectorMXJUrlTestExample
jdbc:mysql:mxj://localhost:3336/our_test_app?server.basedir
=/var/tmp/test-mxj&createDatabaseIfNotExist=true&server.initialize-user=true
[/var/tmp/test-mxj/bin/mysqld][--no-defaults][--port=3336][--socket=mysql.sock]
[--basedir=/var/tmp/test-mxj][--datadir=/var/tmp/test-mxj/data]
[--pid-file=/var/tmp/test-mxj/data/MysqldResource.pid]
[MysqldResource] launching mysqld (driver_launched_mysqld_1)
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
080220 9:40:20 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
080220 9:40:20 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
080220 9:40:20 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
080220 9:40:21 InnoDB: Started; log sequence number 0 0
080220 9:40:21 [Note] /var/tmp/test-mxj/bin/mysqld: ready for connections.
Version: '5.0.51a' socket: 'mysql.sock' port: 3336 MySQL Community Server (GPL)
[MysqldResource] mysqld running as process: 2238
------------------------
SELECT VERSION()
------------------------
5.0.51a
------------------------
[MysqldResource] stopping mysqld (process: 2238)
080220 9:40:27 [Note] /var/tmp/test-mxj/bin/mysqld: Normal shutdown
080220 9:40:27 InnoDB: Starting shutdown...
080220 9:40:29 InnoDB: Shutdown completed; log sequence number 0 43655
080220 9:40:29 [Note] /var/tmp/test-mxj/bin/mysqld: Shutdown complete
[MysqldResource] shutdown complete
The above output shows an instance of MySQL starting, the necessary files being created (log files, InnoDB data files) and the MySQL
database entering the running state. The instance is then shutdown by Connector/MXJ before the example terminates.
Warning
You should avoid running your Connector/MXJ application as the root user, because this will cause the mysqld to also
be executed with root privileges. For more information, see Section 5.3.5, How to Run MySQL as a Normal User.
21.5.3.4. Deploying Connector/MXJ using Driver Launch
Connector/MXJ and Connector/J work together to enable you to launch an instance of the mysqld server through the use of a keyword
in the JDBC connection string. Deploying Connector/MXJ within a Java application can be automated through this method, making the
deployment of Connector/MXJ a simple process:
1. Download and unzip Connector/MXJ, add mysql-connector-mxj-gpl-[ver].jar to the CLASSPATH.
If you are using Connector/MXJ v5.0.4 or later you will also need to add the mysql-connect-
or-mxj-gpl-[ver]-db-files.jar file to your CLASSPATH.
2. To the JDBC connection string, embed the mxj keyword, for example: jdbc:mysql:mxj://localhost:PORT/DBNAME.
For more details, see Section 21.5.4, Connector/MXJ Configuration.
Connectors and APIs
2274
21.5.3.5. Deploying Connector/MXJ within JBoss
For deployment within a JBoss environment, you must configure the JBoss environment to use the Connector/MXJ component within
the JDBC parameters:
1. Download Connector/MXJ and copy the mysql-connector-mxj-gpl-[ver].jar file to the
$JBOSS_HOME/server/default/lib directory.
If you are using Connector/MXJ v5.0.4 or later you will also need to copy the mysql-connect-
or-mxj-gpl-[ver]-db-files.jar file to $JBOSS_HOME/server/default/lib.
2. Download Connector/J and copy the mysql-connector-java-5.1.5-bin.jar file to the
$JBOSS_HOME/server/default/lib directory.
3. Create an MBean service xml file in the $JBOSS_HOME/server/default/deploy directory with any attributes set, for in-
stance the datadir and autostart.
4. Set the JDBC parameters of your web application to use:
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql:///test?propertiesTransform="+
"com.mysql.management.jmx.ConnectorMXJPropertiesTransform";
String user = "root";
String password = "";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, password);
You may wish to create a separate users and database table spaces for each application, rather than using "root and test".
We highly suggest having a routine backup procedure for backing up the database files in the datadir.
21.5.3.6. Verifying Installation using JUnit
The best way to ensure that your platform is supported is to run the JUnit tests. These will test the Connector/MXJ classes and the asso-
ciated components.
21.5.3.6.1. JUnit Test Requirements
The first thing to do is make sure that the components will work on the platform. The MysqldResource class is really a wrapper for
a native version of MySQL, so not all platforms are supported. At the time of this writing, Linux on the i386 architecture has been
tested and seems to work quite well, as does OS X v10.3. There has been limited testing on Windows and Solaris.
Requirements:
1. JDK-1.4 or newer (or the JRE if you aren't going to be compiling the source or JSPs).
2. MySQL Connector/J version 5.0 or newer (from http://dev.mysql.com/downloads/connector/j/) installed and available via your
CLASSPATH.
3. The javax.management classes for JMX version 1.2.1, these are present in the following application servers:
JBoss - 4.0rc1 or newer.
Apache Tomcat - 5.0 or newer.
Sun's JMX reference implementation version 1.2.1 (from http://java.sun.com/products/JavaManagement/).
4. JUnit 3.8.1 (from http://www.junit.org/).
If building from source, All of the requirements from above, plus:
1. Ant version 1.5 or newer (download from http://ant.apache.org/).
Connectors and APIs
2275
21.5.3.6.2. Running the JUnit Tests
1. The tests attempt to launch MySQL on the port 3336. If you have a MySQL running, it may conflict, but this isn't very likely be-
cause the default port for MySQL is 3306. However, You may set the "c-mxj_test_port" Java property to a port of your choosing.
Alternatively, you may wish to start by shutting down any instances of MySQL you have running on the target machine.
The tests suppress output to the console by default. For verbose output, you may set the "c-mxj_test_silent" Java property to
"false".
2. To run the JUnit test suite, the $CLASSPATH must include the following:
JUnit
JMX
Connector/J
MySQL Connector/MXJ
3. If connector-mxj.jar is not present in your download, unzip MySQL Connector/MXJ source archive.
cd mysqldjmx
ant dist
Then add $TEMP/cmxj/stage/connector-mxj/connector-mxj.jar to the CLASSPATH.
4. If you have junit, execute the unit tests. From the command line, type:
java com.mysql.management.AllTestsSuite
The output should look something like this:
.........................................
.........................................
..........
Time: 259.438
OK (101 tests)
Note that the tests are a bit slow near the end, so please be patient.
21.5.4. Connector/MXJ Configuration
21.5.4.1. Running as part of the JDBC Driver
A feature of the MySQL Connector/J JDBC driver is the ability to specify a connection to an embedded Connector/MXJ instance
through the use of the mxj keyword in the JDBC connection string.
In the following example, we have a program which creates a connection, executes a query, and prints the result to the System.out. The
MySQL database will be deployed and started as part of the connection process, and shutdown as part of the finally block.
You can find this file in the Connector/MXJ package as src/ConnectorMXJUrlTestExample.java.
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import com.mysql.management.driverlaunched.ServerLauncherSocketFactory;
import com.mysql.management.util.QueryUtil;
public class ConnectorMXJUrlTestExample {
public static String DRIVER = "com.mysql.jdbc.Driver";
public static String JAVA_IO_TMPDIR = "java.io.tmpdir";
Connectors and APIs
2276
public static void main(String[] args) throws Exception {
File ourAppDir = new File(System.getProperty(JAVA_IO_TMPDIR));
File databaseDir = new File(ourAppDir, "test-mxj");
int port = Integer.parseInt(System.getProperty("c-mxj_test_port", "3336"));
String dbName = "our_test_app";
String url = "jdbc:mysql:mxj://localhost:" + port + "/" + dbName //
+ "?" + "server.basedir=" + databaseDir //
+ "&" + "createDatabaseIfNotExist=true"//
+ "&" + "server.initialize-user=true" //
;
System.out.println(url);
String userName = "alice";
String password = "q93uti0opwhkd";
Class.forName(DRIVER);
Connection conn = null;
try {
conn = DriverManager.getConnection(url, userName, password);
String sql = "SELECT VERSION()";
String queryForString = new QueryUtil(conn).queryForString(sql);
System.out.println("------------------------");
System.out.println(sql);
System.out.println("------------------------");
System.out.println(queryForString);
System.out.println("------------------------");
System.out.flush();
Thread.sleep(100); // wait for System.out to finish flush
} finally {
try {
if (conn != null)
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
ServerLauncherSocketFactory.shutdown(databaseDir, null);
}
}
}
To run the above program, be sure to have connector-mxj.jar and Connector/J in the CLASSPATH. Then type:
java ConnectorMXJTestExample
21.5.4.2. Running within a Java Object
If you have a java application and wish to embed a MySQL database, make use of the
com.mysql.management.MysqldResource class directly. This class may be instantiated with the default (no argument) con-
structor, or by passing in a java.io.File object representing the directory you wish the server to be "unzipped" into. It may also be instan-
tiated with printstreams for "stdout" and "stderr" for logging.
Once instantiated, a java.util.Map, the object will be able to provide a java.util.Map of server options appropriate for the
platform and version of MySQL which you will be using.
The MysqldResource enables you to "start" MySQL with a java.util.Map of server options which you provide, as well as
"shutdown" the database. The following example shows a simplistic way to embed MySQL in an application using plain java objects.
You can find this file in the Connector/MXJ package as src/ConnectorMXJObjectTestExample.java.
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.HashMap;
import java.util.Map;
import com.mysql.management.MysqldResource;
import com.mysql.management.MysqldResourceI;
import com.mysql.management.util.QueryUtil;
public class ConnectorMXJObjectTestExample {
public static final String DRIVER = "com.mysql.jdbc.Driver";
public static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
public static void main(String[] args) throws Exception {
Connectors and APIs
2277
File ourAppDir = new File(System.getProperty(JAVA_IO_TMPDIR));
File databaseDir = new File(ourAppDir, "mysql-mxj");
int port = Integer.parseInt(System.getProperty("c-mxj_test_port",
"3336"));
String userName = "alice";
String password = "q93uti0opwhkd";
MysqldResource mysqldResource = startDatabase(databaseDir, port,
userName, password);
Class.forName(DRIVER);
Connection conn = null;
try {
String dbName = "our_test_app";
String url = "jdbc:mysql://localhost:" + port + "/" + dbName //
+ "?" + "createDatabaseIfNotExist=true"//
;
conn = DriverManager.getConnection(url, userName, password);
String sql = "SELECT VERSION()";
String queryForString = new QueryUtil(conn).queryForString(sql);
System.out.println("------------------------");
System.out.println(sql);
System.out.println("------------------------");
System.out.println(queryForString);
System.out.println("------------------------");
System.out.flush();
Thread.sleep(100); // wait for System.out to finish flush
} finally {
try {
if (conn != null) {
conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
mysqldResource.shutdown();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static MysqldResource startDatabase(File databaseDir, int port,
String userName, String password) {
MysqldResource mysqldResource = new MysqldResource(databaseDir);
Map database_options = new HashMap();
database_options.put(MysqldResourceI.PORT, Integer.toString(port));
database_options.put(MysqldResourceI.INITIALIZE_USER, "true");
database_options.put(MysqldResourceI.INITIALIZE_USER_NAME, userName);
database_options.put(MysqldResourceI.INITIALIZE_PASSWORD, password);
mysqldResource.start("test-mysqld-thread", database_options);
if (!mysqldResource.isRunning()) {
throw new RuntimeException("MySQL did not start.");
}
System.out.println("MySQL is running.");
return mysqldResource;
}
}
21.5.4.3. Setting server options
Of course there are many options we may wish to set for a MySQL database. These options may be specified as part of the JDBC con-
nection string simply by prefixing each server option with server.. In the following example we set two driver parameters and two
server parameters:
String url = "jdbc:mysql://" + hostColonPort + "/"
+ "?"
+ "cacheServerConfiguration=true"
+ "&"
+ "useLocalSessionState=true"
+ "&"
+ "server.basedir=/opt/myapp/db"
+ "&"
+ "server.datadir=/mnt/bigdisk/myapp/data";
Starting with Connector/MXJ 5.0.6 you can use the initializer-user property to a connection string. If set to true, the default an-
Connectors and APIs
2278
onymous and root users will be removed and the user/password combination from the connection URL will be used to create a new
user. For example:
String url = "jdbc:mysql:mxj://localhost:" + port
+ "/alice_db"
+ "?server.datadir=" + dataDir.getPath()
+ "&server.initialize-user=true"
+ "&createDatabaseIfNotExist=true"
;
21.5.5. Connector/MXJ Reference
The following sections include detailed information on the different API interfaces to Connector/MXJ.
21.5.5.1. MysqldResource Constructors
The MysqldResource class supports three different constructor forms:
public MysqldResource(File baseDir, File dataDir, String mysqlVersionString, PrintStream
out, PrintStream err)
Enables you to set the base directory, data directory, select a server by its version string, standard out and standard error.
public MysqldResource(File baseDir, File dataDir, String mysqlVersionString)
Enables you to set the base directory, data directory and select a server by its version string. Output for standard out and standard err
are directed to System.out and System.err.
public MysqldResource(File baseDir, File dataDir)
Enables you to set the base directory and data directory. The default MySQL version is selected, and output for standard out and
standard err are directed to System.out and System.err.
public MysqldResource(File baseDir);
Allows the setting of the "basedir" to deploy the MySQL files to. Output for standard out and standard err are directed to System.out
and System.err.
public MysqldResource();
The basedir is defaulted to a subdirectory of the java.io.tempdir. Output for standard out and standard err are directed to System.out
and System.err;
21.5.5.2. MysqldResource Methods
MysqldResource API includes the following methods:
void start(String threadName, Map mysqldArgs);
Deploys and starts MySQL. The "threadName" string is used to name the thread which actually performs the execution of the
MySQL command line. The map is the set of arguments and their values to be passed to the command line.
void shutdown();
Shuts down the MySQL instance managed by the MysqldResource object.
Map getServerOptions();
Returns a map of all the options and their current (or default, if not running) options available for the MySQL database.
boolean isRunning();
Returns true if the MySQL database is running.
Connectors and APIs
2279
boolean isReadyForConnections();
Returns true once the database reports that is ready for connections.
void setKillDelay(int millis);
The default Kill Delay is 30 seconds. This represents the amount of time to wait between the initial request to shutdown and issu-
ing a force kill if the database has not shutdown by itself.
void addCompletionListenser(Runnable listener);
Allows for applications to be notified when the server process completes. Each ''listener'' will be fired off in its own thread.
String getVersion();
Returns the version of MySQL.
void setVersion(int MajorVersion, int minorVersion, int patchLevel);
The standard distribution comes with only one version of MySQL packaged. However, it is possible to package multiple versions,
and specify which version to use.
21.5.6. Connector/MXJ Notes and Tips
This section contains notes and tips on using the Connector/MXJ component within your applications.
21.5.6.1. Creating your own Connector/MXJ Package
If you want to create a custom Connector/MXJ package that includes a specific mysqld version or platform then you must extract and
rebuild the mysql-connector-mxj.jar (Connector/MXJ v5.0.3 or earlier) or mysql-connect-
or-mxj-gpl-[ver]-db-files.jar (Connector/MXJ v5.0.4 or later) file.
First, you should create a new directory into which you can extract the current connector-mxj.jar:
shell> mkdir custom-mxj
shell> cd custom-mxj
shell> jar -xf connector-mxj.jar
shell> ls
5-0-22/
ConnectorMXJObjectTestExample.class
ConnectorMXJUrlTestExample.class
META-INF/
TestDb.class
com/
kill.exe
If you are using Connector/MXJ v5.0.4 or later, you should unpack the connector-mxj-db-files.jar:
shell> mkdir custom-mxj
shell> cd custom-mxj
shell> jar -xf connector-mxj-db-files.jar
shell> ls
5-0-51a/
META-INF/
connector-mxj.properties
The MySQL version directory, 5-0-22 or 5-0-51a in the preceding examples, contains all of the files used to create an instance of
MySQL when Connector/MXJ is executed. All of the files in this directory are required for each version of MySQL that you want to
embed. Note as well the format of the version number, which uses hyphens instead of periods to separate the version number compon-
ents.
Within the version specific directory are the platform specific directories, and archives of the data and share directory required by
MySQL for the various platforms. For example, here is the listing for the default Connector/MXJ package:
shell>> ls
Linux-i386/
META-INF/
Mac_OS_X-ppc/
SunOS-sparc/
Connectors and APIs
2280
Win-x86/
com/
data_dir.jar
share_dir.jar
win_share_dir.jar
Platform specific directories are listed by their OS and platform - for example the mysqld for Mac OS X PowerPC is located within
the Mac_OS_X-ppc directory. You can delete directories from this location that you do not require, and add new directories for addi-
tional platforms that you want to support.
To add a platform specific mysqld, create a new directory with the corresponding name for your operating system/platform. For ex-
ample, you could add a directory for Mac OS X/Intel using the directory Mac_OS_X-i386.
On Unix systems, you can determine the platform using uname:
shell> uname -p
i386
In Connector/MXJ v5.0.9 and later, an additional platform-map.properties file is used to associate a specific platform and op-
erating system combination with the directory in which the mysqld for that combination is located. The determined operating system
and platform are on the left, and the directory name where the appropriate mysqld is located is on the right. You can see a sample of the
file below:
Linux-i386=Linux-i386
Linux-x86=Linux-i386
Linux-i686=Linux-i386
Linux-x86_64=Linux-i386
Linux-ia64=Linux-i386
#Linux-ppc=Linux-ppc
#Linux-ppc64=Linux-ppc
Mac_OS_X-i386=Mac_OS_X-i386
Mac_OS_X-ppc=Mac_OS_X-ppc
Rhapsody-PowerPC=Mac_OS_X-ppc
#Mac_OS-PowerPC=
#macos-PowerPC=
#MacOS-PowerPC=
SunOS-sparc=SunOS-sparc
Solaris-sparc=SunOS-sparc
SunOS-x86=SunOS-x86
Solaris-x86=SunOS-x86
FreeBSD-x86=FreeBSD-x86
Windows_Vista-x86=Win-x86
Windows_2003-x86=Win-x86
Windows_XP-x86=Win-x86
Windows_2000-x86=Win-x86
Windows_NT-x86=Win-x86
Windows_NT_(unknown)-x86=Win-x86
Now you need to download or compile mysqld for the MySQL version and platform you want to include in your custom connect-
or-mxj.jar package into the new directory.
Create a file called version.txt in the OS/platform directory you have just created that contains the version string/path of the
mysqld binary. For example:
mysql-5.0.22-osx10.3-i386/bin/mysqld
You can now recreate the connector-mxj.jar file with the added mysqld:
shell> cd custom-mxj
shell> jar -cf ../connector-mxj.jar *
For Connector/MXJ v5.0.4 and later, you should repackage to the connector-mxj-db-files.jar:
shell> cd custom-mxj
shell> jar -cf ../mysql-connector-mxj-gpl-[ver]-db-files.jar *
You should test this package using the steps outlined in Section 21.5.3.3, Connector/MXJ Quick Start Guide.
Connectors and APIs
2281
Note
Because the mysql-connector-mxj-gpl-[ver]-db-files.jar file is separate from the main Connector/MXJ
classes you can distribute different mysql-connector-mxj-gpl-[ver]-db-files.jar files to different hotsts
or for different projects without having to create a completely new main mysql-connector-mxj-gpl-[ver].jar
file for each one.
21.5.6.2. Deploying Connector/MXJ with a pre-configured database
To include a pre-configured/populated database within your Connector/MXJ JAR file you must create a custom data_dir.jar file,
as included within the main connector-mxj.jar (Connector/MXJ 5.0.3 or earlier) or mysql-connect-
or-mxj-gpl-[ver]-db-files.jar (Connector/MXJ 5.0.4 or later) file:
1. First extract the connector-mxj.jar or mysql-connector-gpl-[ver]-db-files.jar file, as outlined in the previ-
ous section (see Section 21.5.6.1, Creating your own Connector/MXJ Package).
2. First, create your database and populate the database with the information you require in an existing instance of MySQL - includ-
ing Connector/MXJ instances. Data file formats are compatible across platforms.
3. Shutdown the instance of MySQL.
4. Create a JAR file of the data directory and databases that you want to include your Connector/MXJ package. You should include
the mysql database, which includes user authentication information, in addition to the specific databases you want to include. For
example, to create a JAR of the mysql and mxjtest databases:
shell> jar -cf ../data_dir.jar mysql mxjtest
5. For Connector/MXJ 5.0.3 or earlier, copy the data_dir.jar file into the extracted connector-mxj.jar directory, and then
create an archive for connector-mxj.jar.
For Connector/MXJ 5.0.4 or later, copy the data_dir.jar file into the extracted mysql-connect-
or-mxj-gpl-[ver]-db-files.jar directory, and then create an archive for mysql-connect-
or-mxj-db-gpl-[ver]--files.jar.
Note that if you are create databases using the InnoDB engine, you must include the ibdata.* and ib_logfile* files within the
data_dir.jar archive.
21.5.6.3. Running within a JMX Agent (custom)
As a JMX MBean, MySQL Connector/MXJ requires a JMX v1.2 compliant MBean container, such as JBoss version 4. The MBean will
uses the standard JMX management APIs to present (and allow the setting of) parameters which are appropriate for that platform.
If you are not using the SUN Reference implementation of the JMX libraries, you should skip this section. Or, if you are deploying to
JBoss, you also may wish to skip to the next section.
We want to see the MysqldDynamicMBean in action inside of a JMX agent. In the com.mysql.management.jmx.sunri pack-
age is a custom JMX agent with two MBeans:
1. The MysqldDynamicMBean, and
2. A com.sun.jdmk.comm.HtmlAdaptorServer, which provides a web interface for manipulating the beans inside of a JMX agent.
When this very simple agent is started, it will allow a MySQL database to be started and stopped with a web browser.
1. Complete the testing of the platform as above.
Current JDK, JUnit, Connector/J, MySQL Connector/MXJ
This section requires the SUN reference implementation of JMX
Connectors and APIs
2282
PATH, JAVA_HOME, ANT_HOME, CLASSPATH
2. If not building from source, skip to next step
Rebuild with the "sunri.present"
ant -Dsunri.present=true dist
re-run tests:
java junit.textui.TestRunner com.mysql.management.AllTestsSuite
3. Launch the test agent from the command line:
java com.mysql.management.jmx.sunri.MysqldTestAgentSunHtmlAdaptor &
4. From a browser:
http://localhost:9092/
5. Under MysqldAgent,
select "name=mysqld"
6. Observe the MBean View
7. Scroll to the bottom of the screen press the STARTMYSQLD button
8. Click Back to MBean View
9. Scroll to the bottom of the screen press STOPMYSQLD button
10. Kill the java process running the Test Agent (jmx server)
21.5.6.4. Deployment in a standard JMX Agent environment (JBoss)
Once there is confidence that the MBean will function on the platform, deploying the MBean inside of a standard JMX Agent is the next
step. Included are instructions for deploying to JBoss.
1. Ensure a current version of java development kit (v1.4.x), see above.
Ensure JAVA_HOME is set (JBoss requires JAVA_HOME)
Ensure JAVA_HOME/bin is in the PATH (You will NOT need to set your CLASSPATH, nor will you need any of the jars
used in the previous tests).
2. Ensure a current version of JBoss (v4.0RC1 or better)
http://www.jboss.org/index.html
select "Downloads"
select "jboss-4.0.zip"
pick a mirror
unzip ~/dload/jboss-4.0.zip
create a JBOSS_HOME environment variable set to the unzipped directory
unix only:
cd $JBOSS_HOME/bin
chmod +x *.sh
3. Deploy (copy) the connector-mxj.jar to $JBOSS_HOME/server/default/lib.
4. Deploy (copy) mysql-connector-java-3.1.4-beta-bin.jar to $JBOSS_HOME/server/default/lib.
5. Create a mxjtest.war directory in $JBOSS_HOME/server/default/deploy.
Connectors and APIs
2283
6. Deploy (copy) index.jsp to $JBOSS_HOME/server/default/deploy/mxjtest.war.
7. Create a mysqld-service.xml file in $JBOSS_HOME/server/default/deploy.
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="com.mysql.management.jmx.jboss.JBossMysqldDynamicMBean"
name="mysql:type=service,name=mysqld">
<attribute name="datadir">/tmp/xxx_data_xxx</attribute>
<attribute name="autostart">true</attribute>
</mbean>
</server>
8. Start jboss:
On unix: $JBOSS_HOME/bin/run.sh
On windows: %JBOSS_HOME%\bin\run.bat
Be ready: JBoss sends a lot of output to the screen.
9. When JBoss seems to have stopped sending output to the screen, open a web browser to: ht-
tp://localhost:8080/jmx-console
10. Scroll down to the bottom of the page in the mysql section, select the bulleted mysqld link.
11. Observe the JMX MBean View page. MySQL should already be running.
12. (If "autostart=true" was set, you may skip this step.) Scroll to the bottom of the screen. You may press the INVOKE button to stop
(or start) MySQL observe Operation completed successfully without a return value. Click Back to
MBean View
13. To confirm MySQL is running, open a web browser to http://localhost:8080/mxjtest/ and you should see that
SELECT 1
returned with a result of
1
14. Guided by the $JBOSS_HOME/server/default/deploy/mxjtest.war/index.jsp you will be able to use MySQL
in your Web Application. There is a test database and a root user (no password) ready to experiment with. Try creating a table,
inserting some rows, and doing some selects.
15. Shut down MySQL. MySQL will be stopped automatically when JBoss is stopped, or: from the browser, scroll down to the bottom
of the MBean View press the stop service INVOKE button to halt the service. Observe Operation completed success-
fully without a return value. Using ps or task manager see that MySQL is no longer running
As of 1.0.6-beta version is the ability to have the MBean start the MySQL database upon start up. Also, we've taken advantage of the
JBoss life-cycle extension methods so that the database will gracefully shut down when JBoss is shutdown.
21.5.7. Connector/MXJ Support
There are a wide variety of options available for obtaining support for using Connector/MXJ. You should contact the Connector/MXJ
community for help before reporting a potential bug or problem. See Section 21.5.7.1, Connector/MXJ Community Support.
21.5.7.1. Connector/MXJ Community Support
Sun Microsystems, Inc. provides assistance to the user community by means of a number of mailing lists and web based forums.
You can find help and support through the MySQL and Java mailing list.
For information about subscribing to MySQL mailing lists or to browse list archives, visit http://lists.mysql.com/. See Section 1.5.1,
MySQL Mailing Lists.
Connectors and APIs
2284
Community support from experienced users is also available through the MyODBC Forum. You may also find help from other users in
the other MySQL Forums, located at http://forums.mysql.com. See Section 1.5.2, MySQL Community Support at the MySQL For-
ums.
21.5.7.2. How to Report Connector/MXJ Problems
If you encounter difficulties or problems with Connector/MXJ, contact the Connector/MXJ community Section 21.5.7.1,
Connector/MXJ Community Support.
If reporting a problem, you should ideally include the following information with the email:
Operating system and version
Connector/MXJ version
MySQL server version
Copies of error messages or other unexpected output
Simple reproducible sample
Remember that the more information you can supply to us, the more likely it is that we can fix the problem.
If you believe the problem to be a bug, then you must report the bug through http://bugs.mysql.com/.
21.5.7.3. Connector/MXJ Change History
The Connector/MXJ Change History (Changelog) is located with the main Changelog for MySQL. See Section C.7, MySQL Connect-
or/MXJ Change History.
21.6. MySQL Connector/C++
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
MySQL Connector/C++ is a MySQL database connector for C++.
The MySQL Connector/C++ is licensed under the terms of the GPL, like most MySQL Connectors. There are special exceptions to the
terms and conditions of the GPL as it is applied to this software, see FLOSS License Exception. If you need a non-GPL license for com-
mercial distribution please contact us.
The MySQL Connector/C++ is compatible with the JDBC 4.0 API. However, MySQL Connector/C++ does not implement all of the
JDBC 4.0 API. The MySQL Connector/C++ current version features the following classes:
Connection
DatabaseMetaData
Driver
PreparedStatement
ResultSet
ResultSetMetaData
Savepoint
Statement
Connectors and APIs
2285
The JDBC 4.0 API defines approximately 450 methods for the above mentioned classes. MySQL Connector/C++ implements around
80% of these and makes them available in the preview release.
The Beta release has been successfully compiled and tested on the following platforms:
AIX
5.2 (PPC32, PPC64)
5.3 (PPC32, PPC64)
FreeBSD
6.0 (x86, x86_64)
HPUX
11.11 (PA-RISC 32bit, PA-RISC 64bit)
Linux
Debian 3.1 (PPC32, x86)
FC4 (x86)
RHEL 3 (ia64, x86, x86_64)
RHEL 4 (ia64, x86, x86_64)
RHEL 5 (ia64, x86, x86_64)
SLES 9 (ia64, x86, x86_64)
SLES 10 (ia64, x86_64)
SuSE 10.3, (x86_64)
Ubuntu 8.04 (x86)
Ubuntu 8.10 (x86_64)
Mac
MacOSX 10.3 (PPC32, PPC64)
MacOSX 10.4 (PPC32, PPC64, x86)
MacOSX 10.5 (PPC32, PPC64, x86, x86_64)
SunOS
Solaris 8 (SPARC32, SPARC64, x86)
Solaris 9 (SPARC32, SPARC64, x86)
Solaris 10 (SPARC32, SPARC64, x86, x86_64)
Connectors and APIs
2286
Windows
XP Professional (32bit)
2003 (64bit)
Future versions will run on all platforms supported by the MySQL Server.
Note
MySQL Connector/C++ supports MySQL 5.1 and later.
Note
MySQL Connector/C++ supports only Microsoft Visual Studio 2003 and above on Windows.
MySQL Connector/C++ Download
You can download the source code for the MySQL Connector/C++ preview release at the download site.
MySQL Connector/C++ Source repository
The latest development version is also available through Launchpad.
Bazaar is used for the MySQL Connector/C++ code repository. You can check out the source code using the bzr command line tool:
shell> bzr branch lp:~mysql/mysql-connector-cpp/trunk .
The source of the 1.0.3alpha release is available from the following branch:
shell> bzr branch lp:~andrey-mysql/mysql-connector-cpp/v1_0_3
The source of the 1.0.2alpha release is available from the following branch:
shell> bzr branch lp:~andrey-mysql/mysql-connector-cpp/v1_0_2
The source of the 1.0.1alpha release is available from the following branch:
shell> bzr branch lp:~andrey-mysql/mysql-connector-cpp/v1_0_1
Binary distributions
Starting with 1.0.4 Beta, binary distributions will be made available in addition to source code releases. The releases available are
shown below.
Microsoft Windows platform:
Without installer, a Zip file
MSI installer package
Other platforms:
Compressed GNU TAR archive (tar.gz)
Note
Note that source packages are available for all platforms in the Compressed GNU TAR archive (tar.gz) format.
Connectors and APIs
2287
MySQL Connector/C++ Advantages
Using MySQL Connector/C++ instead of the MySQL C API (MySQL Client Library) offers the following advantages for C++ users:
Convenience of pure C++, no C function calls required
Supports an industry standard API, JDBC 4.0
Supports the object-oriented programming paradigm
Reduces development time
MySQL Connector/C++ is licensed under the GPL with the FLOSS License Exception
MySQL Connector/C++ is available under a commercial license upon request
MySQL Connector/C++ Status
MySQL Connector/C++ is available as a development preview version. We kindly ask users and developers to try it out and provide us
with feedback. We do not encourage you to use it in production environments.
Note that MySQL Workbench is successfully using MySQL Connector/C++.
Note
Sun Microsystems does not provide formal support for MySQL Connector/C++.
If you have any queries please contact us.
21.6.1. MySQL Connector/C++ Binary Installation
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
Caution
One problem that can occur is when the tools you use to build your application are not compatible with the tools used to
build the binary versions of MySQL Connector/C++. Ideally you need to build your application with the same tools that
were used to build the MySQL Connector/C++ binaries. To help with this the following resources are provided.
All distributions contain a README file, which contains platform-specific notes. At the end of the README file contained
in the binary distribution you will find the settings used to build the binaries. If you experience build-related issues on a
platform, it may help to check the settings used on the platform to build the binary.
For your convenience the same information, but more frequently updated, can be found on the MySQL Forge site.
A better solution is to build your MySQL Connector/C++ libraries from the source code, using the same tools that you use
for building your application. This ensures compatibility.
Archive Package
Unpack the archive into an appropriate directory. If you plan to use a dynamically linked version of MySQL Connector/C++, make sure
that your system can reference the MySQL Client Library. Consult your operating system documentation on how do modify and expand
the search path for libraries. In case you cannot modify the library search path it may help to copy your application, the MySQL Con-
nector/C++ library and the MySQL Client Library into the same directory. Most systems search for libraries in the current directory.
Windows MSI Installer
Windows users can choose between two binary packages:
1. Without installer (unzip in C:\)
Connectors and APIs
2288
2. Windows MSI Installer (x86)
Using the MSI Installer may be the easiest solution. Running the MSI Installer does not require any administrative permissions as it
simply copies files.
Figure 21.40. Windows Installer Welcome Screen
Figure 21.41. Windows Installer Overview Screen
Connectors and APIs
2289
The Typical installation consists of all required header files and the Release libraries. The only available Custom installation option
allows you to install additional Debug versions of the connector libraries.
Figure 21.42. Windows Installer Custom Setup Screen
Connectors and APIs
2290
21.6.2. MySQL Connector/C++ Source Installation
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
The MySQL Connector/C++ is based on the MySQL Client Library (MySQL C API). MySQL Connector/C++ is linked against the
MySQL Client Library. You need to have the MySQL Client Library installed in order to compile MySQL Connector/C++.
You also need to have the cross-platform build tool CMake 2.4, or newer, and GLib 2.2.3 or newer installed. Check the README file
included with the distribution for platform specific notes on building for Windows and SunOS.
Typically the MySQL Client Library is installed when the MySQL Server is installed. However, check your operating system docu-
mentation for other installation options.
21.6.2.1. Building source on Unix, Solaris and Mac OS X
1. Run CMake to build a Makefile:
shell> me@host:/path/to/mysql-connector-cpp> cmake .
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
[...]
-- Generating done
-- Build files have been written to: /path/to/mysql-connector-cpp/
Connectors and APIs
2291
On non-Windows systems, CMake first checks to see if the CMake variable MYSQL_CONFIG_EXECUTABLE is set. If it is not
found CMake will try to locate mysql_config in the default locations.
If you have any problems with the configure process please check the troubleshooting instructions below.
2. Use make to build the libraries. First make sure you have a clean build:
shell> me@host:/path/to/mysql-connector-cpp> make clean
Then build the connector:
me@host:/path/to/mysql-connector-cpp> make
[ 1%] Building CXX object
driver/CMakeFiles/mysqlcppconn.dir/mysql_connection.o
[ 3%] Building CXX object
driver/CMakeFiles/mysqlcppconn.dir/mysql_constructed_resultset.o
[...]
[100%] Building CXX object examples/CMakeFiles/statement.dir/statement.o
Linking CXX executable statement
If all goes well, you will find the MySQL Connector/C++ library in /path/to/cppconn/libmysqlcppconn.so.
3. Finally make sure the header and library files are installed to their correct locations:
make install
Unless you have changed this in the configuration step, the header files will be copied to the directory /usr/local/include.
The header files copied are mysql_connection.h and mysql_driver.h.
Again, unless you have specified otherwise, the library files will be copied to /usr/local/lib. The files copied are
libmysqlcppcon.so, the dynamic library, and libmysqlcppconn-static.a, the static library.
If you encounter any errors, please first carry out the checks shown below:
1. CMake options: MySQL installation path, debug version and more
In case of configure and/or compile problems check the list of CMake options:
shell> me@host:/path/to/mysql-connector-cpp> cmake -L
[...]
CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_PREFIX:PATH=/usr/local
EXECUTABLE_OUTPUT_PATH:PATH=
LIBRARY_OUTPUT_PATH:PATH=
MYSQLCPPCONN_GCOV_ENABLE:BOOL=0
MYSQLCPPCONN_TRACE_ENABLE:BOOL=0
MYSQL_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/mysql_config
For example, if your MySQL Server installation path is not /usr/local/mysql and you want to build a debug version of the
MySQL Connector/C++ use:
shell> me@host:/path/to/mysql-connector-cpp> cmake
-D CMAKE_BUILD_TYPE:STRING=Debug
-D MYSQL_CONFIG_EXECUTABLE=/path/to/my/mysql/server/bin/mysql_config .
2. Verify your settings with cmake -L:
shell> me@host:/path/to/mysql-connector-cpp> cmake -L
[...]
CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_PREFIX:PATH=/usr/local
EXECUTABLE_OUTPUT_PATH:PATH=
LIBRARY_OUTPUT_PATH:PATH=
MYSQLCPPCONN_GCOV_ENABLE:BOOL=0
MYSQLCPPCONN_TRACE_ENABLE:BOOL=0
MYSQL_CONFIG_EXECUTABLE=/path/to/my/mysql/server/bin/mysql_config
Connectors and APIs
2292
Proceed by carrying out a make clean command followed by a make command, as described above.
21.6.2.2. Building on Windows
Note
Please note the only compiler formally supported for Windows is Microsoft Visual Studio 2003 and above.
The basic steps for building the connector on Windows are the same as for Unix. It is important to use CMake 2.6.2 or newer to gener-
ate build files for your compiler and to invoke the compiler.
Note
On Windows, mysql_config is not present, so CMake will attempt to retrieve the location of MySQL from the envir-
onment variable $ENV{MYSQL_DIR}. If MYSQL_DIR is not set, CMake will then proceed to check for MySQL in the
following locations: $ENV{ProgramFiles}/MySQL/*/include, and
$ENV{SystemDrive}/MySQL/*/include.
CMake makes it easy for you to try out other compilers. However, you may experience compile warnings, compile errors or linking is-
sues not detected by Visual Studio. Patches are gratefully accepted to fix issues with other compilers.
Consult the CMake manual or check cmake --help to find out which build systems are supported by your CMake version:
C:\>cmake --help
cmake version 2.6-patch 2
Usage
[...]
Generators
The following generators are available on this platform:
Borland Makefiles = Generates Borland makefiles.
MSYS Makefiles = Generates MSYS makefiles.
MinGW Makefiles = Generates a make file for use with
mingw32-make.
NMake Makefiles = Generates NMake makefiles.
Unix Makefiles = Generates standard UNIX makefiles.
Visual Studio 6 = Generates Visual Studio 6 project files.
Visual Studio 7 = Generates Visual Studio .NET 2002 project
files.
Visual Studio 7 .NET 2003 = Generates Visual Studio .NET 2003 project
files.
Visual Studio 8 2005 = Generates Visual Studio .NET 2005 project
files.
Visual Studio 8 2005 Win64 = Generates Visual Studio .NET 2005 Win64
project files.
Visual Studio 9 2008 = Generates Visual Studio 9 2008 project fil
Visual Studio 9 2008 Win64 = Generates Visual Studio 9 2008 Win64 proje
files.
[...]
It is likely that your CMake binary will support more compilers, known by CMake as generators, than supported by MySQL Connect-
or/C++. We have built the connector using the following generators:
Microsoft Visual Studio 8 (Visual Studio 2005)
Microsoft Visual Studio 9 (Visual Studio 2008, Visual Studio 2008 Express)
NMake
Please see the building instructions for Unix, Solaris and Mac OS X for troubleshooting and configuration hints.
The steps to build the connector are given below:
1. Run CMake to generate build files for your generator:
Visual Studio
Connectors and APIs
2293
C:\path_to_mysql_cpp>cmake -G "Visual Studio 9 2008"
-- Check for working C compiler: cl
-- Check for working C compiler: cl -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: cl
-- Check for working CXX compiler: cl -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- ENV{MYSQL_DIR} =
-- MySQL Include dir: C:/Programme/MySQL/MySQL Server 5.1/include
-- MySQL Library : C:/Progams/MySQL/MySQL Server 5.1/lib/opt/mysqlclient.lib
-- MySQL Library dir: C:/Progams/MySQL/MySQL Server 5.1/lib/opt
-- MySQL CFLAGS:
-- MySQL Link flags:
-- MySQL Include dir: C:/Progams/MySQL/MySQL Server 5.1/include
-- MySQL Library dir: C:/Progams/MySQL/MySQL Server 5.1/lib/opt
-- MySQL CFLAGS:
-- MySQL Link flags:
-- Configuring cppconn
-- Configuring test cases
-- Looking for isinf
-- Looking for isinf - not found
-- Looking for isinf
-- Looking for isinf - not found.
-- Looking for finite
-- Looking for finite - not found.
-- Configuring C/J junit tests port
-- Configuring examples
-- Configuring done
-- Generating done
-- Build files have been written to: C:\path_to_mysql_cpp
C:\path_to_mysql_cpp>dir *.sln *.vcproj
[...]
19.11.2008 12:16 23.332 MYSQLCPPCONN.sln
[...]
19.11.2008 12:16 27.564 ALL_BUILD.vcproj
19.11.2008 12:16 27.869 INSTALL.vcproj
19.11.2008 12:16 28.073 PACKAGE.vcproj
19.11.2008 12:16 27.495 ZERO_CHECK.vcproj
NMake
C:\path_to_mysql_cpp>cmake -G "NMake Makefiles"
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
[...]
-- Build files have been written to: C:\path_to_mysql_cpp
2. Use your compiler to build MySQL Connector/C++
Visual Studio - GUI
Open the newly generated project files in the Visual Studio GUI or use a Visual Studio command line to build the driver. The
project files contain a variety of different configurations. Among them debug and nondebug versions.
Visual Studio - NMake
C:\path_to_mysql_cpp>nmake
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
Scanning dependencies of target mysqlcppconn
[ 2%] Building CXX object driver/CMakeFiles/mysqlcppconn.dir/mysql_connection.obj
mysql_connection.cpp
[...]
Linking CXX executable statement.exe
[100%] Built target statement
21.6.3. MySQL Connector/C++ Building Windows applications with Microsoft
Visual Studio
MySQL Connector/C++ is available as a static or dynamic library to use with your application. This section looks at how to link the lib-
rary to your application.
Connectors and APIs
2294
Note
To avoid potential crashes the build configuration of MySQL Connector/C++ should match the build configuration of the
application using it. For example, do not use the release build of MySQL Connector/C++ with a debug build of the client
application.
Static library
The MySQL Connector/C++ static library file is mysqlcppconn-static.lib. This needs to be statically linked with your applica-
tion. You also need to link against the files libmysql.dll and libmysql.lib. Once linking has been successfully completed, the
application will require access to libmysql.dll at run time.
Dynamic library
The MySQL Connector/C++ dynamic library file is mysqlcppconn.dll. In order to build your client application you need to link it
with the file mysqlcppconn.lib. At run time the application will require access to the files mysqlcppconn.dll and
libmysql.dll.
Building a MySQL Connector/C++ application with Microsoft Visual Studio
Initially, the procedure for building an application to use either the static or dynamic library is the same. You then carry out some addi-
tional steps depending on whether you want to build your application to use the static or dynamic library.
1. Select FILE, NEW, PROJECT from the main menu.
Figure 21.43. Creating a New Project
2. In the wizard select VISUAL C++, WIN32. From VISUAL STUDIO INSTALLED TEMPLATES select the application type WIN32
Connectors and APIs
2295
ONSOLE APPLICATION. Enter a name for the application, and then click OK, to move to the Win32 Application Wizard.
Figure 21.44. The New Project Dialog Box
3. In the Win32 Application Wizard, click on APPLICATION SETTINGS and ensure the defaults are selected. The radio button CON-
SOLE APPLICATION, and the checkbox PRECOMPILED HEADERS will be selected. Click FINISH to close the wizard.
Figure 21.45. The Win32 Application Wizard
Connectors and APIs
2296
4. From the drop down list box on the toolbar, change from the default DEBUG build to the RELEASE build.
Figure 21.46. Selecting the Release Build
5. From the main menu select PROJECT, PROPERTIES. This can also be accessed using the hot key ALT + F7.
Figure 21.47. Selecting Project Properties from the Main Menu
Connectors and APIs
2297
6. Under CONFIGURATION PROPERTIES, open the tree view.
7. Select C++, GENERAL in the tree view.
Figure 21.48. Setting Properties
Connectors and APIs
2298
8. You now need to ensure that Visual Studio can find the MySQL include directory. This directory includes header files that can op-
tionally be installed when installing MySQL Server.
Figure 21.49. MySQL Include Directory
Connectors and APIs
2299
9. Then in the ADDITIONAL INCLUDE DIRECTORIES text field, add the MySQL include/ directory.
Figure 21.50. Select Directory Dialog
Connectors and APIs
2300
10. You will also need to set the location of additional libraries that Visual Studio will need in order to build the application. These are
located in the MySQL lib/opt directory, a sub-directory of the MySQL Server installation directory.
Figure 21.51. Typical Contents of MySQL lib/opt Directory
Connectors and APIs
2301
11. In the tree view open LINKER, GENERAL, ADDITIONAL LIBRARY DIRECTORIES.
Figure 21.52. Additional Library Directories
Connectors and APIs
2302
12. Add the lib/opt directory into the ADDITIONAL LIBRARY DIRECTORIES text field. This allows the library file
libmysql.lib to be found.
Figure 21.53. Additional Library Directories Dialog
Connectors and APIs
2303
The remaining steps depend on whether you are building an application to use the MySQL Connector/C++ static or dynamic library. If
you are building your application to use the dynamic library go here. If you are building your application to use the static library, carry
out the following steps:
1. Then open LINKER, INPUT, ADDITIONAL DEPENDENCIES.
Figure 21.54.
Connectors and APIs
2304
2. Enter mysqlcppconn-static.lib and libmysql.lib.
Figure 21.55. Adding Additional Dependencies
Connectors and APIs
2305
3. By default CPPCONN_PUBLIC_FUNC is defined to declare functions to be compatible with an application that calls a DLL. If
building an application to call the static library, you must ensure that function prototypes are compatible with this. In this case CP-
PCONN_PUBLIC_FUNC needs to be defined to be an empty string, so that functions are declared with the correct prototype.
In the PROJECT, PROPERTIES tree view, under C++, PREPROCESSOR, enter CPPCONN_PUBLIC_FUNC= into the PREPROCESSOR
DEFINITIONS text field.
Figure 21.56. Setting the CPPCONN_PUBLIC_FUNC Define
Connectors and APIs
2306
Note
Make sure you enter CPPCONN_PUBLIC_FUNC= and not CPPCONN_PUBLIC_FUNC, as it needs to be defined as an
empty string.
If building an application to use the MySQL Connector/C++ dynamically linked library carry out these steps:
1. Under LINKER, INPUT, add mysqlcppconn.lib into the ADDITIONAL DEPENDENCIES text field.
2. The application will need to access the MySQL Connector/C++ Dynamic Linked Library at run time. Therefore, mysqlcp-
pconn.dll needs to be in the same directory as the application executable, or somewhere on the system's path.
Copy mysqlcppconn.dll to the same directory as the application. Alternatively, extend the PATH environment variable using
SET PATH=%PATH%;C:\path\to\cpp. Alternatively, you can copy mysqlcppconn.dll to the Windows installation Dir-
ectory, typically c:\windows.
21.6.4. MySQL Connector/C++ Building Linux applications with NetBeans
This section describes how you can build MySQL Connector/C++ applications for Linux using the NetBeans IDE.
Figure 21.57. The NetBeans IDE
Connectors and APIs
2307
Note
To avoid potential crashes the build configuration of MySQL Connector/C++ should match the build configuration of the
application using it. For example, do not use the release build of MySQL Connector/C++ with a debug build of the client
application.
1. The first step of building your application is to create a new project. Select FILE, NEW PROJECT. Choose a C/C++ APPLICATION
and click NEXT.
2. Give the project a name and click FINISH. A new project is created.
3. In the PROJECTS tab, right-click on SOURCE FILES and select NEW, then MAIN C++ FILE....
4. Change the filename, or simply select the defaults and click FINISH to add the new file to the project.
5. You now need to add some working code to you main source file. Explore your MySQL Connector/C++ installation and navigate
to the examples directory.
6. Select a suitable example such as standalone_example_docs1.cpp. Copy all the code in this file, and use it to replace the
code in your existing main source file. Amend the code to reflect the connection properties required for your test database. You
now have a working example that will access a MySQL database using MySQL Connector/C++.
7. You will notice that at this point NetBeans is showing some errors in the source code. This is because you need to direct NetBeans
to the necessary header files that need to be included. Select FILE, PROJECT PROPERTIES from the main menu.
8. In the CATEGORIES: tree view panel, navigate to BUILD, C++ COMPILER.
Connectors and APIs
2308
9. In the GENERAL panel, select INCLUDE DIRECTORIES.
10. Click the ... button.
11. Click ADD and then navigate to the directory where the MySQL Connector/C++ header files are located. This will be /
usr/local/include unless you have installed the files to a different location. Click SELECT. Click OK.
Figure 21.58. Setting the Header Include Directory
12. Click OK again to close the PROJECT PROPERTIES dialog.
At this point you have created a NetBeans project, containing a single C++ source file. You have also ensured that the necessary include
files are accessible. Before continuing, you need to decide whether your project is to use the MySQL Connector/C++ static or dynamic
library. The project settings are slightly different in each case, as you need to link against a different library.
Using the static library
If you intend to use the static library you will need to link against two library files, libmysqlcppconn-static.a and
libmysqlclient.a. The locations of the files will depend on your setup, but typically the former will be found in /
usr/local/lib and the latter in /usr/lib. Note the file libmysqlclient.a is not part of MySQL Connector/C++, but is the
MySQL Client Library file distributed with MySQL Server. Remember, the MySQL Client Library is an optional component as part of
the MySQL Server installation process. Note the MySQL Client Library is also available as part of the new MySQL Connector/C distri-
bution.
1. The first step is to set the project to link the necessary library files. Select FILE, PROJECT PROPERTIES from the main menu.
2. In the CATEGORES: tree view navigate to LINKER.
Connectors and APIs
2309
3. In the GENERAL panel select ADDITIONAL LIBRARY DIRECTORIES. Click the ... button.
4. Select and add the /usr/lib and /usr/local/lib directories.
5. In the same panel add the two library files required for static linking as discussed earlier. The properties panel should then look
similar to the following screenshot:
Figure 21.59. Setting the Static Library Directories and File Names
6. Click OK to close the PROJECT PROPERTIES dialog.
Using the dynamic library
If you require your application to use the MySQL Connector/C++ dynamic library, you simply need to link your project with a single
library file, libmysqlcppconn.so. The location of this file will depend on how you configured your installation of MySQL Con-
nector/C++, but will typically be /usr/local/lib.
1. The first step is to set the project to link the necessary library file. Select FILE, PROJECT PROPERTIES from the main menu.
2. In the CATEGORIES: tree view navigate to LINKER.
3. In the GENERAL panel select ADDITIONAL LIBRARY DIRECTORIES. Click the ... button.
4. Select and add the /usr/local/lib directories.
5. In the same panel add the library file required for static linking as discussed earlier. The properties panel should then look similar
to the following screenshot:
Connectors and APIs
2310
Figure 21.60. Setting the Dynamic Library Directory and File Name
6. Click OK to close the Project Properties dialog.
Having configured your project you can build it by selecting RUN, BUILD MAIN PROJECT from the main menu. You can then run the
project using RUN, RUN MAIN PROJECT.
On running the application you should see a screen similar to the following (this is actually the static version of the application shown):
Figure 21.61. The Example Application Running
Connectors and APIs
2311
Note
Note the above settings and procedures were carried out for the default Debug configuration. If you want to create a Re-
lease configuration you will need to select that configuration before setting the Project Properties.
21.6.5. MySQL Connector/C++ Getting Started: Usage Examples
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
The download package contains usage examples in the directory examples/. The examples explain the basic usage of the following
classes:
Connection
Driver
PreparedStatement
ResultSet
ResultSetMetaData
Statement
The examples cover:
Connectors and APIs
2312
Using the Driver class to connect to MySQL
Creating tables, inserting rows, fetching rows using (simple) statements
Creating tables, inserting rows, fetching rows using prepared statements
Hints for working around prepared statement limitations
Accessing result set meta data
The examples in this document are only code snippets. The code snippets provide a brief overview on the API. They are not complete
programs. Please check the examples/ directory of your MySQL Connector/C++ installation for complete programs. Please also read
the README file in the examples/ directory. Note to test the example code you will first need to edit the examples.h file in the
examples/ directory, to add your connection information. Then simply rebuild the code by issuing a make command.
The examples in the examples/ directory include:
examples/connect.cpp:
How to create a connection, insert data into MySQL and handle exceptions.
examples/connection_meta_schemaobj.cpp:
How to obtain meta data associated with a connection object, for example, a list of tables, databases, MySQL version, connector
version.
examples/debug.cpp:
How to activate and deactivate the MySQL Connector/C++ debug protocol.
examples/exceptions.cpp:
A closer look at the exceptions thrown by the connector and how to fetch error information.
examples/prepared_statements.cpp:
How to run Prepared Statements including an example how to handle SQL commands that cannot be prepared by the MySQL Serv-
er.
examples/resultset.cpp:
How to fetch data and iterate over the result set (cursor).
examples/resultset_meta.cpp:
How to obtain meta data associated with a result set, for example, number of columns and column types.
examples/resultset_types.cpp:
Result sets returned from meta data methods - this is more a test than much of an example.
examples/standalone_example.cpp:
Simple standalone program not integrated into regular CMake builds.
examples/statements.cpp:
How to run SQL commands without using Prepared Statements.
examples/cpp_trace_analyzer.cpp:
This example shows how to filter the output of the debug trace. Please see the inline comments for further documentation. This
script is unsupported.
Connectors and APIs
2313
21.6.5.1. MySQL Connector/C++ Connecting to MySQL
A connection to MySQL is established by retrieving an instance of sql::Connection from a sql::mysql::MySQL_Driver
object. A sql::mysql::MySQL_Driver object is returned by
sql::mysql::MySQL_Driver::get_mysql_driver_instance().
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
driver = sql::mysql::MySQL_Driver::get_mysql_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "user", "password");
delete con;
Make sure that you free the sql::Connection object as soon as you do not need it any more. But do not explicitly free the connect-
or object!
21.6.5.2. MySQL Connector/C++ Running a simple query
For running simple queries you can use the methods sql::Statement::execute(), sql::Statement::executeQuery()
and sql::Statement::executeUpdate(). The method sql::Statement::execute() should be used if your query does
not return a result set or if your query returns more than one result set. See the examples/ directory for more on this.
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
sql::Statement *stmt
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "user", "password");
stmt = con->createStatement();
stmt->execute("USE " EXAMPLE_DB);
stmt->execute("DROP TABLE IF EXISTS test");
stmt->execute("CREATE TABLE test(id INT, label CHAR(1))");
stmt->execute("INSERT INTO test(id, label) VALUES (1, 'a')");
delete stmt;
delete con;
Note that you have to free sql::Statement and sql::Connection objects explicitly using delete.
21.6.5.3. MySQL Connector/C++ Fetching results
The API for fetching result sets is identical for (simple) statments and prepared statements. If your query returns one result set you
should use sql::Statement::executeQuery() or sql::PreparedStatement::executeQuery() to run your query.
Both methods return sql::ResultSet objects. The preview version does buffer all result sets on the client to support cursors.
// ...
sql::Connection *con;
sql::Statement *stmt
sql::ResultSet *res;
// ...
stmt = con->createStatement();
// ...
res = stmt->executeQuery("SELECT id, label FROM test ORDER BY id ASC");
while (res->next()) {
// You can use either numeric offsets...
cout << "id = " <&;t; res->getInt(0);
// ... or column names for accessing results.
The latter is recommended.
cout << ", label = '" <<
res->getString("label") << "'" << endl;
}
delete res;
delete stmt;
delete con;
Note that you have to free sql::Statement, sql::Connection and sql::ResultSet objects explicitly using delete.
The usage of cursors is demonstrated in the examples contained in the download package.
21.6.5.4. MySQL Connector/C++ Using Prepared Statements
Connectors and APIs
2314
If you are not familiar with Prepared Statements on MySQL have an extra look at the source code comments and explanations in the file
examples/prepared_statement.cpp.
sql::PreparedStatement is created by passing a SQL query to sql::Connection::prepareStatement(). As
sql::PreparedStatement is derived from sql::Statement, you will feel familiar with the API once you have learned how
to use (simple) statements (sql::Statement). For example, the syntax for fetching results is identical.
// ...
sql::Connection *con;
sql::PreparedStatement *prep_stmt
// ...
prep_stmt = con->prepareStatement("INSERT INTO test(id, label) VALUES (?, ?)");
prep_stmt->setInt(1, 1);
prep_stmt->setString(2, "a");
prep_stmt->execute();
prep_stmt->setInt(1, 2);
prep_stmt->setString(2, "b");
prep_stmt->execute();
delete prep_stmt;
delete con;
As usual, you have to free sql::PreparedStatement and sql::Connection objects explicitly.
21.6.5.5. MySQL Connector/C++ Complete Example 1
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under only the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
There are special exceptions to the terms and conditions of the GPL
as it is applied to this software. View the full text of the
exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this
software distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>
/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
using namespace std;
int main(void)
{
cout << endl;
cout << "Running 'SELECT 'Hello World!'
AS _message'..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
/* Create a connection */
Connectors and APIs
2315
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
while (res->next()) {
cout << "\t... MySQL replies: ";
/* Access column data by alias or column name */
cout << res->getString("_message") << endl;
cout << "\t... MySQL says it again: ";
/* Access column fata by numeric offset, 1 is the first column */
cout << res->getString(1) << endl;
}
delete res;
delete stmt;
delete con;
} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line "
<< __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}
cout << endl;
return EXIT_SUCCESS;
}
21.6.5.6. MySQL Connector/C++ Complete Example 2
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
There are special exceptions to the terms and conditions of the GPL
as it is applied to this software. View the full text of the
exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this
software distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>
/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
using namespace std;
int main(void)
{
cout << endl;
cout << "Let's have MySQL count from 10 to 1..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
Connectors and APIs
2316
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
stmt->execute("DROP TABLE IF EXISTS test");
stmt->execute("CREATE TABLE test(id INT)");
delete stmt;
/* '?' is the supported placeholder syntax */
pstmt = con->prepareStatement("INSERT INTO test(id) VALUES (?)");
for (int i = 1; i <= 10; i++) {
pstmt->setInt(1, i);
pstmt->executeUpdate();
}
delete pstmt;
/* Select in ascending order */
pstmt = con->prepareStatement("SELECT id FROM test ORDER BY id ASC");
res = pstmt->executeQuery();
/* Fetch in reverse = descending order! */
res->afterLast();
while (res->previous())
cout << "\t... MySQL counts: " << res->getInt("id") << endl;
delete res;
delete pstmt;
delete con;
} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line "
<< __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() <<
" )" << endl;
}
cout << endl;
return EXIT_SUCCESS;
}
21.6.6. MySQL Connector/C++ Debug Tracing
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
Although a debugger can be used to debug your application, you may find it beneficial to turn on the debug traces of the connector.
Some problems happen randomly which makes them difficult to debug using a debugger. In such cases debug traces and protocol files
are more useful because they allow you to trace the activities of all instances of your program.
DTrace is a very powerful technology to trace any application without having to develop an extra trace module for your application. Un-
fortunately, DTrace is currently only available on OpenSolaris, Solaris, MacOS 10.5 and FreeBSD.
The MySQL Connector/C++ can write two trace files:
1. Trace file generated by the MySQL Client Library
2. Trace file generated internally by MySQL Connector/C++
The first trace file can be generated by the underlying MySQL Client Library (libmysql). To enable this trace the connector will call the
C-API function mysql_debug() internally. Only debug versions of the MySQL Client Library are capable of writing a trace file.
Therefore you need to compile MySQL Connector/C++ against a debug version of the library, if you want utilize this trace. The trace
shows the internal function calls and the addresses of internal objects as you can see below:
>mysql_stmt_init
| >_mymalloc
Connectors and APIs
2317
| | enter: Size: 816
| | exit: ptr: 0x68e7b8
| <_mymalloc | >init_alloc_root
| | enter: root: 0x68e7b8
| | >_mymalloc
| | | enter: Size: 2064
| | | exit: ptr: 0x68eb28
[...]
The second trace is the MySQL Connector/C++ internal trace. It is available with debug and nondebug builds of the connector as long
as you have enabled the tracing module at compile time using cmake -DMYSQLCPPCONN_TRACE_ENABLE:BOOL=1. By default,
the tracing functionality is not available and calls to trace functions are removed by the preprocessor.
Compiling the connector with tracing functionality enabled will cause two additional tracing function calls per each connector function
call. You will need to run your own benchmark to find out how much this will impact the performance of your application.
A simple test using a loop running 30,000 INSERT SQL statements showed no significant real-time impact. The two variants of this ap-
plication using a trace enabled and trace disabled version of the connector performed equally well. The run time measured in real-time
was not significantly impacted as long as writing a debug trace was not enabled. However, there will be a difference in the time spent in
the application. When writing a debug trace the IO subsystem may become a bottleneck.
In summary, use connector builds with tracing enabled carefully. Trace enabled versions may cause higher CPU usage even if the over-
all run time of your application is not impacted significantly.
| INF: Tracing enabled
<MySQL_Connection::setClientOption
>MySQL_Prepared_Statement::setInt
| INF: this=0x69a2e0
| >MySQL_Prepared_Statement::checkClosed
| <MySQL_Prepared_Statement::checkClosed
| <MySQL_Prepared_Statement::setInt
[...]
The example from examples/debug.cpp demonstrates how to activate the debug traces in your program. Currently they can only
be activated through API calls. The traces are controlled on a per-connection basis. You can use the setClientOptions() method
of a connection object to activate and deactivate the generation of a trace. The MySQL Client Library trace is always written into a file,
whereas the connector's protocol messages are printed to standard out.
sql::Driver *driver;
int on_off = 1;
/* Using the Driver to create a connection */
driver = get_driver_instance();
std::auto_ptr< sql::Connection > con(driver->connect(host, user, pass));
/*
Activate debug trace of the MySQL Client Library (C-API)
Only available with a debug build of the MySQL Client Library!
*/
con->setClientOption("libmysql_debug", "d:t:O,client.trace");
/*
Tracing is available if you have compiled the driver using
cmake -DMYSQLCPPCONN_TRACE_ENABLE:BOOL=1
*/
con->setClientOption("client_trace", &on_off);
21.6.7. MySQL Connector/C++ References
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
See the JDBC overview for information on JDBC 4.0. Please also check the examples/ directory of the download package.
Notes on using the MySQL Connector/C++ API
DatabaseMetaData::supportsBatchUpdates() returns true because MySQL supports batch updates in general.
However, no API calls for batch updates are provided by the MySQL Connector/C++ API.
Two non-JDBC methods have been introduced for fetching and setting unsigned integers: getUInt64() and getUInt(). These
Connectors and APIs
2318
are available for ResultSet and Prepared_Statement:
ResultSet::getUInt64()
ResultSet::getUInt()
Prepared_Statement::setUInt64()
Prepared_Statement::setUInt()
The corresponding getLong() and setLong() methods have been removed.
The method DatabaseMetaData::getColumns() has 23 columns in its result set, rather than the 22 columns defined by JD-
BC. The first 22 columns are as described in the JDBC documentation, but column 23 is new:
23. IS_AUTOINCREMENT: String which is YES if the column is an auto-increment column. Otherwise the string contains NO.
MySQL Connector/C++ may return different metadata for the same column.
When you have any column that accepts a charset and a collation in its specification and you specify a binary collation, such as:
CHAR(250) CHARACTER SET 'latin1' COLLATE 'latin1_bin'
The server sets the BINARY flag in the result set metadata of this column. The method ResultSet-
Metadata::getColumnTypeName() uses the metadata and will report, due to the BINARY flag, that the column type name is
BINARY. This is illustrated below:
mysql> create table varbin(a varchar(20) character set utf8 collate utf8_bin);
Query OK, 0 rows affected (0.00 sec)
mysql> select * from varbin;
Field 1: `a`
Catalog: `def`
Database: `test`
Table: `varbin`
Org_table: `varbin`
Type: VAR_STRING
Collation: latin1_swedish_ci (8)
Length: 20
Max_length: 0
Decimals: 0
Flags: BINARY
0 rows in set (0.00 sec)
mysql> select * from information_schema.columns where table_name='varbin'\G
*************************** 1. row ***************************
TABLE_CATALOG: NULL
TABLE_SCHEMA: test
TABLE_NAME: varbin
COLUMN_NAME: a
ORDINAL_POSITION: 1
COLUMN_DEFAULT: NULL
IS_NULLABLE: YES
DATA_TYPE: varchar
CHARACTER_MAXIMUM_LENGTH: 20
CHARACTER_OCTET_LENGTH: 60
NUMERIC_PRECISION: NULL
NUMERIC_SCALE: NULL
CHARACTER_SET_NAME: utf8
COLLATION_NAME: utf8_bin
COLUMN_TYPE: varchar(20)
COLUMN_KEY:
EXTRA:
PRIVILEGES: select,insert,update,references
COLUMN_COMMENT:
1 row in set (0.01 sec)
However, INFORMATION_SCHEMA gives no hint in its COLUMNS table that metadata will contain the BINARY flag. Database-
MetaData::getColumns() uses INFORMATION_SCHEMA. It will report the type name CHAR for the same column. Note, a
different type code is also returned.
The MySQL Connector/C++ class sql::DataType defines the following JDBC standard data types: UNKNOWN, BIT, TINYINT,
SMALLINT, MEDIUMINT, INTEGER, BIGINT, REAL, DOUBLE, DECIMAL, NUMERIC, CHAR, BINARY, VARCHAR, VARBIN-
ARY, LONGVARCHAR, LONGVARBINARY, TIMESTAMP, DATE, TIME, GEOMETRY, ENUM, SET, SQLNULL.
Connectors and APIs
2319
However, the following JDBC standard data types are not supported by MySQL Connector/C++: ARRAY, BLOB, CLOB, DIS-
TINCT, FLOAT, OTHER, REF, STRUCT.
When inserting or updating BLOB or TEXT columns, MySQL Connector/C++ developers are advised not to use setString().
Instead it is recommended that the dedicated API function setBlob() be used instead.
The use of setString() can cause a Packet too large error message. The error will occur if the length of the string passed to the
connector using setString() exceeds max_allowed_packet (minus a few bytes reserved in the protocol for control pur-
poses). This situation is not handled in MySQL Connector/C++, as this could lead to security issues, such as extremely large
memory allocation requests due to malevolently long strings.
However, if setBlob() is used, this problem does not arise. This is because setBlob() takes a streaming approach based on
std::istream. When sending the data from the stream to MySQL Server, MySQL Connector/C++ will split the stream into
chunks appropriate for MySQL Server and observe the max_allowed_packet setting currently being used.
Caution
When using setString() it is not possible to set max_packet_size to a value large enough for the string, prior to
passing it to MySQL Connector/C++. The MySQL 6.0 documentation for max_packet_size states: As of MySQL
6.0.9, the session value of this variable is read only. Before 6.0.9, setting the session value is allowed but has no effect.
This difference with the JDBC specification ensures that MySQL Connector/C++ is not vulnerable to memory flooding attacks.
In general MySQL Connector/C++ works with MySQL 5.0, but it is not completely supported. Some methods may not be available
when connecting to MySQL 5.0. This is because the Information Schema is used to obtain the requested information. There are no
plans to improve the support for 5.0 because the current GA version of MySQL Server is 5.1. As a new product, MySQL Connector/
C++ is primarily targeted at the MySQL Server GA version that was available on its release.
The following methods will throw a sql::MethodNotImplemented exception when you connect to MySQL earlier than
5.1.0:
DatabaseMetadata::getCrossReference()
DatabaseMetadata::getExportedKeys()
MySQL Connector/C++ includes a method Connection::getClientOption() which is not included in the JDBC API spe-
cification. The prototype is:
void getClientOption(const std::string & optionName, void * optionValue)
The method can be used to check the value of connection properties set when establishing a database connection. The values are re-
turned through the optionValue argument passed to the method with the type void *.
Currently, getClientOption() supports fetching the optionValue of the following options:
metadataUseInfoSchema
defaultStatementResultType
defaultPreparedStatementResultType
The connection option metadataUseInfoSchema controls whether to use the Information_Schemata for returning the
meta data of SHOW commands. In the case of metadataUseInfoSchema the optionValue argument should be interpreted as
a boolean upon return.
In the case of both defaultStatementResultType and defaultPreparedStatementResultType, the option-
Value argument should be interpreted as an integer upon return.
The connection property can be either set when establishing the connection through the connection property map or using void
Connection::setClientOption(const std::string & optionName, const void * optionValue)
where optionName is assigned the value metadataUseInfoSchema.
Some examples are given below:
int defaultStmtResType;
int defaultPStmtResType;
Connectors and APIs
2320
conn->getClientOption("defaultStatementResultType", (void *) &defaultStmtResType);
conn->getClientOption("defaultPreparedStatementResultType", (void *) &defaultPStmtResType);
bool isInfoSchemaUsed;
conn->getClientOption("metadataUseInfoSchema", (void *) &isInfoSchemaUsed);
MySQL Connector/C++ also supports the following methods not found in the JDBC API standard:
std::string MySQL_Connection::getSessionVariable(const std::string & varname)
void MySQL_Connection::setSessionVariable(const std::string & varname, const std::string & value)
Note that both methods are members of the MySQL_Connection class. The methods get and set MySQL session variables.
setSessionVariable() is equivalent to executing:
SET SESSION <varname> = <value>
getSessionVariable() is equivalent to executing the following and fetching the first return value:
SHOW SESSION VARIABLES LIKE "<varname>"
You can use % and other placeholders in <varname>, if the underlying MySQL server supports this.
21.6.8. MySQL Connector/C++ Known Bugs and Issues
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
Note
Please report bugs through MySQL Bug System .
Known bugs:
None.
Known issues:
When linking against a static library for 1.0.3 on Windows you need to define CPPDBC_PUBLIC_FUNC either in the compiler op-
tions (preferable) or with /D "CPPCONN_PUBLIC_FUNC=". You can also explicitly define it in your code by placing #define
CPPCONN_PUBLIC_FUNC before the header inclusions.
Generally speaking C++ library binaries are less portable than C library binaries. Issues can be caused by name mangling, different
Standard Template Library (STL) versions and using different compilers and linkers for linking against the libraries than were used
for building the library itself.
Even a small change in the compiler version can, but does not have to, cause problems. If you obtain error messages, that you sus-
pect are related to binary incompatibilities, build MySQL Connector/C++ from source, using the same compiler and linker that you
will use to build and link your application.
Due to the variations between Linux distributions, compiler and linker versions and STL versions, it is not possible to provide binar-
ies for each and every possible configuration. However, the MySQL Connector/C++ binary distributions contain a README file that
describes the environment and settings used to build the binary versions of the libraries.
To avoid potential crashes the build configuration of MySQL Connector/C++ should match the build configuration of the applica-
tion using it. For example, do not use the release build of MySQL Connector/C++ with a debug build of the client application.
See also the MySQL Connector/C++ Changelogs which can be found here Section C.8, MySQL Connector/C++ Change History.
Connectors and APIs
2321
21.6.9. MySQL Connector/C++ Feature requests
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
You can suggest new features in the first instance by joining the mailing list or forum and talking with the developers directly. See Sec-
tion 21.6.10, MySQL Connector/C++ Support
The following feature requests are currently being worked on:
C++ references for Statements, ResultSets, and exceptions, are being considered, instead of pointers to heap memory. This
reduces the exception handling burden for the programmer.
Adopt STL (suggestions are welcome).
JDBC compliance: datatype interfaces and support through ResultSet:getType() and PreparedStatement:bind().
Introduce sql::Blob, sql::Clob, sql::Date, sql::Time, sql::Timestamp, sql::URL. Support
get|setBlob(), get|setClob(), get|setDate(), get|setTime(), get|setTimestamp(), get|setURL()
Add support for all C-API connection options. Improved support for mysql_options.
Add connect method which supports passing options using HashMaps.
Create Windows installer.
21.6.10. MySQL Connector/C++ Support
Caution
Please note, official support is not available for the beta version of MySQL Connector/C++.
For general discussion of the MySQL Connector/C++ please use the C/C++ community forum or join the MySQL Connector/C++ mail-
ing list.
Bugs can be reported at the MySQL bug website.
For Licensing questions, and to purchase MySQL Products and Services, please Contact MySQL
The MySQL Connector/C++ Changelogs can be found here Section C.8, MySQL Connector/C++ Change History
21.6.11. MySQL Connector/C++ FAQ
Questions
21.6.11.1: What is MySQL Connector/C++?
21.6.11.2: Which MySQL Server version(s) is MySQL Connector/C++ compatible with?
21.6.11.3: Does MySQL Connector/C++ implement the client-server protocol?
21.6.11.4: Are any MySQL products using MySQL Connector/C++?
Questions and Answers
21.6.11.1: What is MySQL Connector/C++?
MySQL Connector/C++ is a MySQL database connector for C++. It allows you develop applications in C++ that connect to the
MySQL Server. MySQL Connector/C++ is compatible with the JDBC 4.0 API.
21.6.11.2: Which MySQL Server version(s) is MySQL Connector/C++ compatible with?
Connectors and APIs
2322
MySQL Connector/C++ fully supports MySQL Server version 5.1 and later.
21.6.11.3: Does MySQL Connector/C++ implement the client-server protocol?
No. MySQL Connector/C++ uses the MySQL Client Library for the client-server communication.
21.6.11.4: Are any MySQL products using MySQL Connector/C++?
Yes, MySQL Workbench and MySQL Connector/OpenOffice.org.
21.7. MySQL Connector/C
What is MySQL Connector/C?
MySQL Connector/C is a C client library for client-server communication. It is a standalone replacement for the MySQL Client Library
shipped with the MySQL Server.
Why have a replacement for MySQL Client Library?
There is no need to compile or install the MySQL Server package if you only need the client library.
MySQL Connector/C does not rely on the MySQL Server release cycle, so bug fixes and new features are released more often.
MySQL Connector/C API documentation is available online.
Supported platforms include:
Windows
Windows x64
Linux
Solaris
FreeBSD
Mac OS X
HP-UX
IBM AIX
IBM i5/OS
21.7.1. Building MySQL Connector/C from the Source Code
Obtaining the Source Code
The source can be downloaded as a Zip file or tar-ball from the source repository on Launchpad.
Building on Unix
Examples of supported Unix or Unix-like operating systems include:
Solaris
Linux
HP-UX
AIX
Connectors and APIs
2323
OS X
Compiler Tools
Ideally, the native compiler tool set for the target platform is used for compilation. This would be SunStudio for Solaris and aCC for
HP-UX for example. However, the GNU tool-chain can be used across all platforms.
You also need CMake 2.6 or newer, which is available online.
To Build
If using GNU AutoTools change to the MySQL Connector/C source directory and follow the procedure below.
1. To generate the makefile enter:
shell> cmake -G "Unix Makefiles"
or for a Debug build enter:
shell> cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
2. Then build the project using:
shell> make
To Install
By default make install will install the MySQL Connector/C files in the /usr/local directory. You can change this behavior by
specifying another directory when generating the makefile:
shell> cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/mypath
Now, in the root shell, enter the following to install the MySQL Connector/C libraries and tools:
root-shell> make install
At this point all of the MySQL Connector/C files will be in place.
Building on Microsoft Windows
Older versions of Microsoft Windows are not supported. Supported versions are Windows 2000, Windows XP, Windows Vista,
Windows Server 2003, or Windows Server 2008.
Compiler Tools
Microsoft Visual Studio 8 and 9 are recommended. The Express Edition of Visual Studio and other compilers may work, but are un-
tested.
You also need CMake 2.6 or newer, available at http://www.cmake.org
To Build
You need to have the environment variables set for the Visual Studio toolchain. Visual Studio includes a batch file to set these for
you, and installs a shortcut into the START menu to open a command prompt with these variables set.
Build MySQL Connector/C using the CMake command-line tool by entering the following from the source root directory in a com-
mand prompt window:
shell> cmake -G "Visual Studio 9 2008"
This produces a project file that you can open with Visual Studio or build from the command line with either of:
shell> devenv.com libmysql.sln /build Release
Connectors and APIs
2324
shell> devenv.com libmysql.sln /build RelWithDebInfo
For other versions of Visual Studio or nmake based build, run the following command:
shell> cmake --help
to check the supported generators.
To compile the Debug build, you must run set the CMake build type so the correct version of external libraries are used:
shell> cmake -G "Visual Studio 8 2005" -DCMAKE_BUILD_TYPE=Debug
Followed by:
shell> devenv.com libmysql.sln /build Debug
To Install
To create a install package you can choose between two variants:
1. Creating a Zip package
2. Creating an MSI install package
Zip package
To create a Zip package, run the cpack command from the root of your MySQL Connector/C source directory.
MSI Install package
The required tools include Windows XML Installer toolset (WIX), which is available online.
To create the MSI install package change to the subdirectory win and generate the makefile:
shell> cmake -G "NMake Makefiles"
Create the MSI install package by calling nmake:
shell> nmake
Build Options
The following options can be used when building the MySQL Connector/C source code:
Build Option Description
-DWITH_OPENSSL=1 Enables dynamic linking to the system OpenSSL library.
-DWITH_EXTERNAL_ZLIB=1 Enables dynamic linking to the system Zlib library.
21.7.2. Testing MySQL Connector/C
For testing MySQL Connector/C you will need a running MySQL server instance. Before you run the test suite you need to specify the
following environment variables:
MYSQL_TEST_HOST (default localhost)
MYSQL_TEST_USER
MYSQL_TEST_PASSWD
Connectors and APIs
2325
MYSQL_TEST_PORT
MYSQL_TEST_SOCKET
MYSQL_TEST_DB (default test)
To run the test suite, execute ctest from the command line:
shell> ctest
21.7.3. MySQL Connector/C FAQ
Questions
21.7.3.1: What is libmysqld?
21.7.3.2: What is MySQL Connector/C?
21.7.3.3: What is the MySQL Native C API? What are its typical benefits and use cases?
21.7.3.4: What is the difference between Native C API, libmysql, libmysqld and MySQL Connector/C?
21.7.3.5: Does MySQL Connector/C replace any of Native C API, libmysql and libmysqld?
21.7.3.6: What is libmysql?
Questions and Answers
21.7.3.1: What is libmysqld?
libmysqld is an embedded database server with the same API as MySQL Connector/C. It is included with the MySQL Server distri-
bution.
21.7.3.2: What is MySQL Connector/C?
MySQL Connector/C is a standalone distribution of the libmysql library, which was previously only available as part of the MySQL
Server distribution. The version of libmysql included with MySQL Connector/C and the version bundled with the server are func-
tionally equivalent, but the cross-platform build system for MySQL Connector/C uses CMake.
21.7.3.3: What is the MySQL Native C API? What are its typical benefits and use cases?
MySQL Connector/C, also known as libmysql, or MySQL Native C API, is a standalone, C-based API and library that you can use
in C applications to connect with the MySQL Server. It implements the same MySQL client API that has been in use for a decade.
It is also used as the foundation for drivers for standard database APIs such as ODBC, Perl's DBI, and Python's DB API.
21.7.3.4: What is the difference between Native C API, libmysql, libmysqld and MySQL Connector/C?
MySQL Connector/C and libmysql are the native C API for MySQL, and all three terms can be used interchangeably. libmysqld
is the embedded version of the MySQL Server, and is included in the server distribution.
21.7.3.5: Does MySQL Connector/C replace any of Native C API, libmysql and libmysqld?
MySQL Connector/C contains libmysql, and implements a native C API. It does not include libmysqld, which can be found with
the MySQL server distribution.
21.7.3.6: What is libmysql?
libmysql is the name of the library that MySQL Connector/C provides.
21.8. MySQL Connector/OpenOffice.org
Connectors and APIs
2326
MySQL Connector/OpenOffice.org is a native MySQL database connector for OpenOffice.org. Currently, it is in preview status and
supports OpenOffice.org 2.4 only. It can be used to connect OpenOffice.org applications to a MySQL server.
Before MySQL Connector/OpenOffice.org became available you would have to use MySQL Connector/J (JDBC) or MySQL Connect-
or/ODBC to connect to a MySQL server.
Connector/OpenOffice.org is a community project, although Sun Microsystems actively contributes code. The source code for Connect-
or/OpenOffice.org is available under GPL with the FLOSS License Exception.
In the future a closed-source StarOffice version of Connector/OpenOffice.org will be made available.
Advantages
Using MySQL Connector/OpenOffice.org has the following advantages:
Easy installation through the OpenOffice.org Extension Manager.
Seamless integration into OpenOffice.org.
No need to go through an additional Connector installation routine (ODBC/JDBC)
No need to configure or register an additional Connector (ODBC)
No need to install or configure a driver manager (ODBC)
Status
MySQL Connector/OpenOffice.org is available as a development preview version. We kindly ask users and developers to try it out and
provide us with feedback. We do not encourage you to use it in production environments, though.
Note
Sun Microsystems does not provide formal support for Connector/OpenOffice.org.
If you have any queries please contact us through our mailing list at <[email protected]>
21.8.1. Installation
1. Install or upgrade to OpenOffice.org 2.4.
2. Download MySQL Connector/OpenOffice.org from The OpenOffice.org download site. Save the file, mysql-nat-
ive-win32.oxt or mysql-native-linux.oxt, respectively, to a location of your choice, for example My Documents
or ~/Documents.
3. Add the .oxt extension through the Extension Manager of OpenOffice.org. In OpenOffice.org, select TOOLS, EXTENSION MAN-
AGER... and specify the .oxt file as a new extension. When done, MySQL Connector/OpenOffice.org will show up as a new ex-
tension under MY EXTENSIONS.
Figure 21.62. Adding an Extension
Connectors and APIs
2327
4. Restart OpenOffice.org.
21.8.2. Getting Started: Connecting to MySQL
MySQL Connector/OpenOffice.org allows you to access the MySQL Server and its schemata from the OpenOffice.org suite. Currently
the connector is in preview status, and only OpenOffice.org 2.4 is supported.
The following example demonstrates the creation of a new OpenOffice.org Base database which uses a local MySQL Server for storage
and the new connector for connecting.
1. Select the database
Create a new database by selecting FILE, NEW, DATABASE. This starts a wizard that allows you to create a new, open an existing,
or connect to existing database. Select the latter option. From the drop-down list, select MySQL native driver. Click NEXT >>.
Figure 21.63. Selecting the Database
Connectors and APIs
2328
2. Fill in the connection settings
Under MYSQL NATIVE DRIVER, fill in the host name, and optionally a database name, and port name, for example:
localhost/test
This will connect to a MySQL server running on the local host and select the test database. Note that is you do not specify a data-
base the process below will still work, and all databases will be available for selection.
On Linux, you may have to specify an IP number and a port number instead, due to a limitation in Connector/OpenOffice.org. You
have to do so if your MySQL socket file is not /tmp/mysql.sock. Enter your data using the format illustrated in the following
example:
127.0.0.1:3006/test
This will connect to a MySQL server running on the local host, but do so via TCP/IP using 3306 as the port number. Click NEXT
>>.
Figure 21.64. Entering Connection Settings
Connectors and APIs
2329
3. Fill in credentials
If you are using MySQL server's anonymous account without a password, you do not have to fill in anything in this step. Other-
wise, fill in your MySQL user name and check the password checkbox. Note, for security reasons, you should not normally use the
anonymous account without a password.
Figure 21.65. Setting Up User Authentication
Connectors and APIs
2330
You can now test your connection to the MySQL database server by clicking the TEST CONNECTION button. Check the checkbox if
you do not want OpenOffice.org to ask you for your password again in the current session. Testing the connection is optional, al-
though recommended.
Figure 21.66. Entering User Credentials
Click NEXT >>.
4. Finish the wizard
Leave the default settings and click FINISH. You will be forwarded to the OpenOffice.org Base main window. Note that you can in-
voke the wizard again at any point by right-clicking in the TABLES section of the BASE main window and selecting DATABASE,
CONNECTION TYPE.
21.8.3. Getting Started: Usage Examples
Connectors and APIs
2331
Listing Tables
In the DATABASE area of the BASE main window, select TABLES. If this is the first time you are accessing the database you will be
prompted for your credentials (user name and password); you can store these settings for your current Base session.
Figure 21.67. Listing Tables
Depending on your connection settings you will now see all databases with all their tables, or just the database you have specified in the
connection settings.
21.8.4. References
See the OpenOffice.org website for documentation of the office suite and its Extension Manager.
Connectors and APIs
2332
21.8.5. Known Bugs
If you discover a bug in Connector/OpenOffice.org please add it to this list and send an email to <[email protected]>.
You need to be logged in with an OpenOffice.org account for both; see the project mailing list for details.
21.8.6. Contact
To discuss the new MySQL Connector/OpenOffice.org, please subscribe to the mailing list <[email protected]>. It is
a low-volume list with less than 10 mails per day.
21.9. libmysqld, the Embedded MySQL Server Library
The embedded MySQL server library makes it possible to run a full-featured MySQL server inside a client application. The main bene-
fits are increased speed and more simple management for embedded applications.
The embedded server library is based on the client/server version of MySQL, which is written in C/C++. Consequently, the embedded
server also is written in C/C++. There is no embedded server available in other languages.
The API is identical for the embedded MySQL version and the client/server version. To change an old threaded application to use the
embedded library, you normally only have to add calls to the following functions.
Function When to Call
mysql_library_init() Should be called before any other MySQL function is called, preferably early in the main() func-
tion.
mysql_library_end() Should be called before your program exits.
mysql_thread_init() Should be called in each thread you create that accesses MySQL.
mysql_thread_end() Should be called before calling pthread_exit()
Then you must link your code with libmysqld.a instead of libmysqlclient.a. To ensure binary compatibility between your
application and the server library, be sure to compile your application against headers for the same series of MySQL that was used to
compile the server library. For example, if libmysqld was compiled against MySQL 4.1 headers, do not compile your application
against MySQL 5.1 headers, or vice versa.
The mysql_library_xxx() functions are also included in libmysqlclient.a to allow you to change between the embedded
and the client/server version by just linking your application with the right library. See Section 21.10.3.40,
mysql_library_init().
One difference between the embedded server and the standalone server is that for the embedded server, authentication for connections is
disabled by default. To use authentication for the embedded server, specify the --with-embedded-privilege-control option
when you invoke configure to configure your MySQL distribution.
21.9.1. Compiling Programs with libmysqld
In precompiled binary MySQL distributions that include libmysqld, the embedded server library, MySQL builds the library using
the appropriate vendor compiler if there is one.
To get a libmysqld library if you build MySQL from source yourself, you should configure MySQL with the -
-with-embedded-server option. See Section 2.10.2, Typical configure Options.
When you link your program with libmysqld, you must also include the system-specific pthread libraries and some libraries that
the MySQL server uses. You can get the full list of libraries by executing mysql_config --libmysqld-libs.
The correct flags for compiling and linking a threaded program must be used, even if you do not directly call any thread functions in
your code.
To compile a C program to include the necessary files to embed the MySQL server library into an executable version of a program, the
compiler will need to know where to find various files and need instructions on how to compile the program. The following example
shows how a program could be compiled from the command line, assuming that you are using gcc, use the GNU C compiler:
gcc mysql_test.c -o mysql_test -lz \
`/usr/local/mysql/bin/mysql_config --include --libmysqld-libs`
Connectors and APIs
2333
Immediately following the gcc command is the name of the C program source file. After it, the -o option is given to indicate that the
file name that follows is the name that the compiler is to give to the output file, the compiled program. The next line of code tells the
compiler to obtain the location of the include files and libraries and other settings for the system on which it is compiled. Because of a
problem with mysql_config, the option -lz (for compression) is added here. The mysql_config command is contained in back-
ticks, not single quotes.
On some non-gcc platforms, the embedded library depends on C++ runtime libraries and linking against the embedded library might
result in missing-symbol errors. To solve this, link using a C++ compiler or explicitly list the required libraries on the link command
line.
21.9.2. Restrictions When Using the Embedded MySQL Server
The embedded server has the following limitations:
No user-defined functions (UDFs).
No stack trace on core dump.
You cannot set this up as a master or a slave (no replication).
Very large result sets may be unusable on low memory systems.
You cannot connect to an embedded server from an outside process with sockets or TCP/IP. However, you can connect to an inter-
mediate application, which in turn can connect to an embedded server on the behalf of a remote client or outside process.
InnoDB is not reentrant in the embedded server and cannot be used for multiple connections, either successively or simultaneously.
The Event Scheduler is not available. Because of this, the event_scheduler system variable is disabled.
Some of these limitations can be changed by editing the mysql_embed.h include file and recompiling MySQL.
21.9.3. Options with the Embedded Server
Any options that may be given with the mysqld server daemon, may be used with an embedded server library. Server options may be
given in an array as an argument to the mysql_library_init(), which initializes the server. They also may be given in an option
file like my.cnf. To specify an option file for a C program, use the --defaults-file option as one of the elements of the second
argument of the mysql_library_init() function. See Section 21.10.3.40, mysql_library_init(), for more information
on the mysql_library_init() function.
Using option files can make it easier to switch between a client/server application and one where MySQL is embedded. Put common
options under the [server] group. These are read by both MySQL versions. Client/server-specific options should go under the
[mysqld] section. Put options specific to the embedded MySQL server library in the [embedded] section. Options specific to ap-
plications go under section labeled [ApplicationName_SERVER]. See Section 4.2.3.3, Using Option Files.
21.9.4. Embedded Server Examples
These two example programs should work without any changes on a Linux or FreeBSD system. For other operating systems, minor
changes are needed, mostly with file paths. These examples are designed to give enough details for you to understand the problem,
without the clutter that is a necessary part of a real application. The first example is very straightforward. The second example is a little
more advanced with some error checking. The first is followed by a command-line entry for compiling the program. The second is fol-
lowed by a GNUmake file that may be used for compiling instead.
Example 1
test1_libmysqld.c
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "mysql.h"
MYSQL *mysql;
MYSQL_RES *results;
MYSQL_ROW record;
Connectors and APIs
2334
static char *server_options[] = \
{ "mysql_test", "--defaults-file=my.cnf", NULL };
int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
static char *server_groups[] = { "libmysqld_server",
"libmysqld_client", NULL };
int main(void)
{
mysql_library_init(num_elements, server_options, server_groups);
mysql = mysql_init(NULL);
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "libmysqld_client");
mysql_options(mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL);
mysql_real_connect(mysql, NULL,NULL,NULL, "database1", 0,NULL,0);
mysql_query(mysql, "SELECT column1, column2 FROM table1");
results = mysql_store_result(mysql);
while((record = mysql_fetch_row(results))) {
printf("%s - %s \n", record[0], record[1]);
}
mysql_free_result(results);
mysql_close(mysql);
mysql_library_end();
return 0;
}
Here is the command line for compiling the above program:
gcc test1_libmysqld.c -o test1_libmysqld -lz \
`/usr/local/mysql/bin/mysql_config --include --libmysqld-libs`
Example 2
To try out the example, create an test2_libmysqld directory at the same level as the MySQL source directory. Save the
test2_libmysqld.c source and the GNUmakefile in the directory, and run GNU make from inside the test2_libmysqld
directory.
test2_libmysqld.c
/*
* A simple example client, using the embedded MySQL server library
*/
#include <mysql.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
MYSQL *db_connect(const char *dbname);
void db_disconnect(MYSQL *db);
void db_do_query(MYSQL *db, const char *query);
const char *server_groups[] = {
"test2_libmysqld_SERVER", "embedded", "server", NULL
};
int
main(int argc, char **argv)
{
MYSQL *one, *two;
/* mysql_library_init() must be called before any other mysql
* functions.
*
* You can use mysql_library_init(0, NULL, NULL), and it
* initializes the server using groups = {
* "server", "embedded", NULL
* }.
*
* In your $HOME/.my.cnf file, you probably want to put:
[test2_libmysqld_SERVER]
language = /path/to/source/of/mysql/sql/share/english
* You could, of course, modify argc and argv before passing
* them to this function. Or you could create new ones in any
* way you like. But all of the arguments in argv (except for
* argv[0], which is the program name) should be valid options
* for the MySQL server.
Connectors and APIs
2335
*
* If you link this client against the normal mysqlclient
* library, this function is just a stub that does nothing.
*/
mysql_library_init(argc, argv, (char **)server_groups);
one = db_connect("test");
two = db_connect(NULL);
db_do_query(one, "SHOW TABLE STATUS");
db_do_query(two, "SHOW DATABASES");
mysql_close(two);
mysql_close(one);
/* This must be called after all other mysql functions */
mysql_library_end();
exit(EXIT_SUCCESS);
}
static void
die(MYSQL *db, char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
(void)putc('\n', stderr);
if (db)
db_disconnect(db);
exit(EXIT_FAILURE);
}
MYSQL *
db_connect(const char *dbname)
{
MYSQL *db = mysql_init(NULL);
if (!db)
die(db, "mysql_init failed: no memory");
/*
* Notice that the client and server use separate group names.
* This is critical, because the server does not accept the
* client's options, and vice versa.
*/
mysql_options(db, MYSQL_READ_DEFAULT_GROUP, "test2_libmysqld_CLIENT");
if (!mysql_real_connect(db, NULL, NULL, NULL, dbname, 0, NULL, 0))
die(db, "mysql_real_connect failed: %s", mysql_error(db));
return db;
}
void
db_disconnect(MYSQL *db)
{
mysql_close(db);
}
void
db_do_query(MYSQL *db, const char *query)
{
if (mysql_query(db, query) != 0)
goto err;
if (mysql_field_count(db) > 0)
{
MYSQL_RES *res;
MYSQL_ROW row, end_row;
int num_fields;
if (!(res = mysql_store_result(db)))
goto err;
num_fields = mysql_num_fields(res);
while ((row = mysql_fetch_row(res)))
{
(void)fputs(">> ", stdout);
for (end_row = row + num_fields; row < end_row; ++row)
(void)printf("%s\t", row ? (char*)*row : "NULL");
(void)fputc('\n', stdout);
}
(void)fputc('\n', stdout);
mysql_free_result(res);
}
else
(void)printf("Affected rows: %lld\n", mysql_affected_rows(db));
return;
err:
die(db, "db_do_query failed: %s [%s]", mysql_error(db), query);
Connectors and APIs
2336
}
GNUmakefile
# This assumes the MySQL software is installed in /usr/local/mysql
inc := /usr/local/mysql/include/mysql
lib := /usr/local/mysql/lib
# If you have not installed the MySQL software yet, try this instead
#inc := $(HOME)/mysql-5.1/include
#lib := $(HOME)/mysql-5.1/libmysqld
CC := gcc
CPPFLAGS := -I$(inc) -D_THREAD_SAFE -D_REENTRANT
CFLAGS := -g -W -Wall
LDFLAGS := -static
# You can change -lmysqld to -lmysqlclient to use the
# client/server library
LDLIBS = -L$(lib) -lmysqld -lz -lm -ldl -lcrypt
ifneq (,$(shell grep FreeBSD /COPYRIGHT 2>/dev/null))
# FreeBSD
LDFLAGS += -pthread
else
# Assume Linux
LDLIBS += -lpthread
endif
# This works for simple one-file test programs
sources := $(wildcard *.c)
objects := $(patsubst %c,%o,$(sources))
targets := $(basename $(sources))
all: $(targets)
clean:
rm -f $(targets) $(objects) *.core
21.9.5. Licensing the Embedded Server
We encourage everyone to promote free software by releasing code under the GPL or a compatible license. For those who are not able
to do this, another option is to purchase a commercial license for the MySQL code from Sun Microsystems, Inc. For details, please see
http://www.mysql.com/company/legal/licensing/.
21.10. MySQL C API
The C API code is distributed with MySQL. It is included in the mysqlclient library and allows C programs to access a database.
Many of the clients in the MySQL source distribution are written in C. If you are looking for examples that demonstrate how to use the
C API, take a look at these clients. You can find these in the client directory in the MySQL source distribution.
Most of the other client APIs (all except Connector/J and Connector/NET) use the mysqlclient library to communicate with the
MySQL server. This means that, for example, you can take advantage of many of the same environment variables that are used by other
client programs, because they are referenced from the library. See Chapter 4, MySQL Programs, for a list of these variables.
The client has a maximum communication buffer size. The size of the buffer that is allocated initially (16KB) is automatically increased
up to the maximum size (the maximum is 16MB). Because buffer sizes are increased only as demand warrants, simply increasing the
default maximum limit does not in itself cause more resources to be used. This size check is mostly a check for erroneous statements
and communication packets.
The communication buffer must be large enough to contain a single SQL statement (for client-to-server traffic) and one row of returned
data (for server-to-client traffic). Each thread's communication buffer is dynamically enlarged to handle any query or row up to the
maximum limit. For example, if you have BLOB values that contain up to 16MB of data, you must have a communication buffer limit of
at least 16MB (in both server and client). The client's default maximum is 16MB, but the default maximum in the server is 1MB. You
can increase this by changing the value of the max_allowed_packet parameter when the server is started. See Section 7.5.3,
Tuning Server Parameters.
The MySQL server shrinks each communication buffer to net_buffer_length bytes after each query. For clients, the size of the
buffer associated with a connection is not decreased until the connection is closed, at which time client memory is reclaimed.
For programming with threads, see Section 21.10.17, How to Make a Threaded Client. For creating a standalone application which in-
cludes the "server" and "client" in the same program (and does not communicate with an external MySQL server), see Section 21.9,
Connectors and APIs
2337
libmysqld, the Embedded MySQL Server Library.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about using the C API in the Knowledge Base articles,
The C API. Access to the MySQL Knowledge Base collection of articles is one of the advantages of subscribing
to MySQL Enterprise. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
21.10.1. C API Data Types
This section describes C API data types other than those used for prepared statements. For information about the latter, see Sec-
tion 21.10.5, C API Prepared Statement Data types.
MYSQL
This structure represents a handle to one database connection. It is used for almost all MySQL functions. You should not try to make
a copy of a MYSQL structure. There is no guarantee that such a copy will be usable.
MYSQL_RES
This structure represents the result of a query that returns rows (SELECT, SHOW, DESCRIBE, EXPLAIN). The information returned
from a query is called the result set in the remainder of this section.
MYSQL_ROW
This is a type-safe representation of one row of data. It is currently implemented as an array of counted byte strings. (You cannot
treat these as null-terminated strings if field values may contain binary data, because such values may contain null bytes internally.)
Rows are obtained by calling mysql_fetch_row().
MYSQL_FIELD
This structure contains information about a field, such as the field's name, type, and size. Its members are described in more detail
here. You may obtain the MYSQL_FIELD structures for each field by calling mysql_fetch_field() repeatedly. Field values
are not part of this structure; they are contained in a MYSQL_ROW structure.
MYSQL_FIELD_OFFSET
This is a type-safe representation of an offset into a MySQL field list. (Used by mysql_field_seek().) Offsets are field num-
bers within a row, beginning at zero.
my_ulonglong
The type used for the number of rows and for mysql_affected_rows(), mysql_num_rows(), and
mysql_insert_id(). This type provides a range of 0 to 1.84e19.
On some systems, attempting to print a value of type my_ulonglong does not work. To print such a value, convert it to un-
signed long and use a %lu print format. Example:
printf ("Number of rows: %lu\n",
(unsigned long) mysql_num_rows(result));
my_bool
A boolean type, for values that are true (nonzero) or false (zero).
The MYSQL_FIELD structure contains the members described in the following list:
char * name
The name of the field, as a null-terminated string. If the field was given an alias with an AS clause, the value of name is the alias.
char * org_name
The name of the field, as a null-terminated string. Aliases are ignored.
Connectors and APIs
2338
char * table
The name of the table containing this field, if it isn't a calculated field. For calculated fields, the table value is an empty string. If
the column is selected from a view, table names the view. If the table or view was given an alias with an AS clause, the value of
table is the alias. For a UNION, the value is the empty string.
char * org_table
The name of the table, as a null-terminated string. Aliases are ignored. If the column is selected from a view, org_table names
the underlying table. For a UNION, the value is the empty string.
char * db
The name of the database that the field comes from, as a null-terminated string. If the field is a calculated field, db is an empty
string. For a UNION, the value is the empty string.
char * catalog
The catalog name. This value is always "def".
char * def
The default value of this field, as a null-terminated string. This is set only if you use mysql_list_fields().
unsigned long length
The width of the field. This corresponds to the display length, in bytes.
unsigned long max_length
The maximum width of the field for the result set (the length in bytes of the longest field value for the rows actually in the result
set). If you use mysql_store_result() or mysql_list_fields(), this contains the maximum length for the field. If you
use mysql_use_result(), the value of this variable is zero.
The value of max_length is the length of the string representation of the values in the result set. For example, if you retrieve a
FLOAT column and the widest value is -12.345, max_length is 7 (the length of '-12.345').
If you are using prepared statements, max_length is not set by default because for the binary protocol the lengths of the values
depend on the types of the values in the result set. (See Section 21.10.5, C API Prepared Statement Data types.) If you want the
max_length values anyway, enable the STMT_ATTR_UPDATE_MAX_LENGTH option with mysql_stmt_attr_set() and
the lengths will be set when you call mysql_stmt_store_result(). (See Section 21.10.7.3,
mysql_stmt_attr_set(), and Section 21.10.7.27, mysql_stmt_store_result().)
unsigned int name_length
The length of name.
unsigned int org_name_length
The length of org_name.
unsigned int table_length
The length of table.
unsigned int org_table_length
The length of org_table.
unsigned int db_length
The length of db.
unsigned int catalog_length
The length of catalog.
Connectors and APIs
2339
unsigned int def_length
The length of def.
unsigned int flags
Different bit-flags for the field. The flags value may have zero or more of the following bits set.
Flag Value Flag Description
NOT_NULL_FLAG Field can't be NULL
PRI_KEY_FLAG Field is part of a primary key
UNIQUE_KEY_FLAG Field is part of a unique key
MULTIPLE_KEY_FLAG Field is part of a nonunique key
UNSIGNED_FLAG Field has the UNSIGNED attribute
ZEROFILL_FLAG Field has the ZEROFILL attribute
BINARY_FLAG Field has the BINARY attribute
AUTO_INCREMENT_FLAG Field has the AUTO_INCREMENT attribute
ENUM_FLAG Field is an ENUM (deprecated)
SET_FLAG Field is a SET (deprecated)
BLOB_FLAG Field is a BLOB or TEXT (deprecated)
TIMESTAMP_FLAG Field is a TIMESTAMP (deprecated)
NO_DEFAULT_VALUE_FLAG Field has no default value; see additional notes following table
Use of the BLOB_FLAG, ENUM_FLAG, SET_FLAG, and TIMESTAMP_FLAG flags is deprecated because they indicate the type of
a field rather than an attribute of its type. It is preferable to test field->type against MYSQL_TYPE_BLOB,
MYSQL_TYPE_ENUM, MYSQL_TYPE_SET, or MYSQL_TYPE_TIMESTAMP instead.
NUM_FLAG indicates that a column is numeric. This includes columns with a type of MYSQL_TYPE_DECIMAL,
MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24, and
MYSQL_TYPE_YEAR.
NO_DEFAULT_VALUE_FLAG indicates that a column has no DEFAULT clause in its definition. This does not apply to NULL
columns (because such columns have a default of NULL), or to AUTO_INCREMENT columns (which have an implied default value).
The following example illustrates a typical use of the flags value:
if (field->flags & NOT_NULL_FLAG)
printf("Field can't be null\n");
You may use the following convenience macros to determine the boolean status of the flags value.
Flag Status Description
IS_NOT_NULL(flags) True if this field is defined as NOT NULL
IS_PRI_KEY(flags) True if this field is a primary key
IS_BLOB(flags) True if this field is a BLOB or TEXT (deprecated; test field->type instead)
unsigned int decimals
The number of decimals for numeric fields.
unsigned int charsetnr
An ID number that indicates the character set/collation pair for the field.
To distinguish between binary and nonbinary data for string data types, check whether the charsetnr value is 63. If so, the char-
Connectors and APIs
2340
acter set is binary, which indicates binary rather than nonbinary data. This enables you to distinguish BINARY from CHAR, VAR-
BINARY from VARCHAR, and the BLOB types from the TEXT types.
charsetnr values are the same as those displayed in the Id column of the SHOW COLLATION statement or the ID column of
the INFORMATION_SCHEMA COLLATIONS table. You can use those information sources to see which character set and collation
specific charsetnr values indicate:
mysql> SHOW COLLATION WHERE Id = 63;
+-----------+---------+----+---------+----------+---------+
| Collation | Charset | Id | Default | Compiled | Sortlen |
+-----------+---------+----+---------+----------+---------+
| binary | binary | 63 | Yes | Yes | 1 |
+-----------+---------+----+---------+----------+---------+
mysql> SELECT COLLATION_NAME, CHARACTER_SET_NAME
-> FROM INFORMATION_SCHEMA.COLLATIONS WHERE ID = 33;
+-----------------+--------------------+
| COLLATION_NAME | CHARACTER_SET_NAME |
+-----------------+--------------------+
| utf8_general_ci | utf8 |
+-----------------+--------------------+
enum enum_field_types type
The type of the field. The type value may be one of the MYSQL_TYPE_ symbols shown in the following table.
Type Value Type Description
MYSQL_TYPE_TINY TINYINT field
MYSQL_TYPE_SHORT SMALLINT field
MYSQL_TYPE_LONG INTEGER field
MYSQL_TYPE_INT24 MEDIUMINT field
MYSQL_TYPE_LONGLONG BIGINT field
MYSQL_TYPE_DECIMAL DECIMAL or NUMERIC field
MYSQL_TYPE_NEWDECIMAL Precision math DECIMAL or NUMERIC
MYSQL_TYPE_FLOAT FLOAT field
MYSQL_TYPE_DOUBLE DOUBLE or REAL field
MYSQL_TYPE_BIT BIT field
MYSQL_TYPE_TIMESTAMP TIMESTAMP field
MYSQL_TYPE_DATE DATE field
MYSQL_TYPE_TIME TIME field
MYSQL_TYPE_DATETIME DATETIME field
MYSQL_TYPE_YEAR YEAR field
MYSQL_TYPE_STRING CHAR or BINARY field
MYSQL_TYPE_VAR_STRING VARCHAR or VARBINARY field
MYSQL_TYPE_BLOB BLOB or TEXT field (use max_length to determine the maximum length)
MYSQL_TYPE_SET SET field
MYSQL_TYPE_ENUM ENUM field
MYSQL_TYPE_GEOMETRY Spatial field
MYSQL_TYPE_NULL NULL-type field
You can use the IS_NUM() macro to test whether a field has a numeric type. Pass the type value to IS_NUM() and it evaluates
to TRUE if the field is numeric:
if (IS_NUM(field->type))
printf("Field is numeric\n");
Connectors and APIs
2341
21.10.2. C API Function Overview
The functions available in the C API are summarized here and described in greater detail in a later section. See Section 21.10.3, C API
Function Descriptions.
Function Description
my_init() Initialize global variables, and thread handler in thread-safe programs
mysql_affected_rows() Returns the number of rows changed/deleted/inserted by the last UPDATE, DELETE, or
INSERT query
mysql_autocommit() Toggles autocommit mode on/off
mysql_change_user() Changes user and database on an open connection
mysql_character_set_name() Return default character set name for current connection
mysql_close() Closes a server connection
mysql_commit() Commits the transaction
mysql_connect() Connects to a MySQL server (this function is deprecated; use
mysql_real_connect() instead)
mysql_create_db() Creates a database (this function is deprecated; use the SQL statement CREATE DATA-
BASE instead)
mysql_data_seek() Seeks to an arbitrary row number in a query result set
mysql_debug() Does a DBUG_PUSH with the given string
mysql_drop_db() Drops a database (this function is deprecated; use the SQL statement DROP DATABASE
instead)
mysql_dump_debug_info() Makes the server write debug information to the log
mysql_eof() Determines whether the last row of a result set has been read (this function is deprecated;
mysql_errno() or mysql_error() may be used instead)
mysql_errno() Returns the error number for the most recently invoked MySQL function
mysql_error() Returns the error message for the most recently invoked MySQL function
mysql_escape_string() Escapes special characters in a string for use in an SQL statement
mysql_fetch_field() Returns the type of the next table field
mysql_fetch_field_direct() Returns the type of a table field, given a field number
mysql_fetch_fields() Returns an array of all field structures
mysql_fetch_lengths() Returns the lengths of all columns in the current row
mysql_fetch_row() Fetches the next row from the result set
mysql_field_count() Returns the number of result columns for the most recent statement
mysql_field_seek() Puts the column cursor on a specified column
mysql_field_tell() Returns the position of the field cursor used for the last mysql_fetch_field()
mysql_free_result() Frees memory used by a result set
mysql_get_character_set_info
()
Return information about default character set
mysql_get_client_info() Returns client version information as a string
mysql_get_client_version() Returns client version information as an integer
mysql_get_host_info() Returns a string describing the connection
mysql_get_proto_info() Returns the protocol version used by the connection
mysql_get_server_info() Returns the server version number
mysql_get_server_version() Returns version number of server as an integer
mysql_get_ssl_cipher() Return current SSL cipher
mysql_hex_string() Encode string in hexadecimal format
mysql_info() Returns information about the most recently executed query
mysql_init() Gets or initializes a MYSQL structure
Connectors and APIs
2342
mysql_insert_id() Returns the ID generated for an AUTO_INCREMENT column by the previous query
mysql_kill() Kills a given thread
mysql_library_end() Finalize the MySQL C API library
mysql_library_init() Initialize the MySQL C API library
mysql_list_dbs() Returns database names matching a simple regular expression
mysql_list_fields() Returns field names matching a simple regular expression
mysql_list_processes() Returns a list of the current server threads
mysql_list_tables() Returns table names matching a simple regular expression
mysql_more_results() Checks whether any more results exist
mysql_next_result() Returns/initiates the next result in multiple-statement executions
mysql_num_fields() Returns the number of columns in a result set
mysql_num_rows() Returns the number of rows in a result set
mysql_options() Sets connect options for mysql_real_connect()
mysql_ping() Checks whether the connection to the server is working, reconnecting as necessary
mysql_query() Executes an SQL query specified as a null-terminated string
mysql_real_connect() Connects to a MySQL server
mysql_real_escape_string() Escapes special characters in a string for use in an SQL statement, taking into account the
current character set of the connection
mysql_real_query() Executes an SQL query specified as a counted string
mysql_refresh() Flush or reset tables and caches
mysql_reload() Tells the server to reload the grant tables
mysql_rollback() Rolls back the transaction
mysql_row_seek() Seeks to a row offset in a result set, using value returned from mysql_row_tell()
mysql_row_tell() Returns the row cursor position
mysql_select_db() Selects a database
mysql_server_end() Finalize the MySQL C API library
mysql_server_init() Initialize the MySQL C API library
mysql_set_character_set() Set default character set for current connection
mysql_set_local_infile_defau
lt()
Set the LOAD DATA LOCAL INFILE handler callbacks to their default values
mysql_set_local_infile_handl
er()
Install application-specific LOAD DATA LOCAL INFILE handler callbacks
mysql_set_server_option() Sets an option for the connection (like multi-statements)
mysql_sqlstate() Returns the SQLSTATE error code for the last error
mysql_shutdown() Shuts down the database server
mysql_ssl_set() Prepare to establish SSL connection to server
mysql_stat() Returns the server status as a string
mysql_store_result() Retrieves a complete result set to the client
mysql_thread_end() Finalize thread handler
mysql_thread_id() Returns the current thread ID
mysql_thread_init() Initialize thread handler
mysql_thread_safe() Returns 1 if the clients are compiled as thread-safe
mysql_use_result() Initiates a row-by-row result set retrieval
mysql_warning_count() Returns the warning count for the previous SQL statement
Connectors and APIs
2343
Application programs should use this general outline for interacting with MySQL:
1. Initialize the MySQL library by calling mysql_library_init(). This function exists in both the mysqlclient C client
library and the mysqld embedded server library, so it is used whether you build a regular client program by linking with the -
libmysqlclient flag, or an embedded server application by linking with the -libmysqld flag.
2. Initialize a connection handler by calling mysql_init() and connect to the server by calling mysql_real_connect().
3. Issue SQL statements and process their results. (The following discussion provides more information about how to do this.)
4. Close the connection to the MySQL server by calling mysql_close().
5. End use of the MySQL library by calling mysql_library_end().
The purpose of calling mysql_library_init() and mysql_library_end() is to provide proper initialization and finalization
of the MySQL library. For applications that are linked with the client library, they provide improved memory management. If you don't
call mysql_library_end(), a block of memory remains allocated. (This does not increase the amount of memory used by the ap-
plication, but some memory leak detectors will complain about it.) For applications that are linked with the embedded server, these calls
start and stop the server.
In a nonmulti-threaded environment, the call to mysql_library_init() may be omitted, because mysql_init() will invoke it
automatically as necessary. However, mysql_library_init() is not thread-safe in a multi-threaded environment, and thus neither
is mysql_init(), which calls mysql_library_init(). You must either call mysql_library_init() prior to spawning
any threads, or else use a mutex to protect the call, whether you invoke mysql_library_init() or indirectly via
mysql_init(). This should be done prior to any other client library call.
To connect to the server, call mysql_init() to initialize a connection handler, then call mysql_real_connect() with that
handler (along with other information such as the host name, user name, and password). Upon connection,
mysql_real_connect() sets the reconnect flag (part of the MYSQL structure) to a value of 1 in versions of the API older than
5.0.3, or 0 in newer versions. A value of 1 for this flag indicates that if a statement cannot be performed because of a lost connection, to
try reconnecting to the server before giving up. You can use the MYSQL_OPT_RECONNECT option to mysql_options() to control
reconnection behavior. When you are done with the connection, call mysql_close() to terminate it.
While a connection is active, the client may send SQL statements to the server using mysql_query() or mysql_real_query().
The difference between the two is that mysql_query() expects the query to be specified as a null-terminated string whereas
mysql_real_query() expects a counted string. If the string contains binary data (which may include null bytes), you must use
mysql_real_query().
For each non-SELECT query (for example, INSERT, UPDATE, DELETE), you can find out how many rows were changed (affected) by
calling mysql_affected_rows().
For SELECT queries, you retrieve the selected rows as a result set. (Note that some statements are SELECT-like in that they return
rows. These include SHOW, DESCRIBE, and EXPLAIN. They should be treated the same way as SELECT statements.)
There are two ways for a client to process result sets. One way is to retrieve the entire result set all at once by calling
mysql_store_result(). This function acquires from the server all the rows returned by the query and stores them in the client.
The second way is for the client to initiate a row-by-row result set retrieval by calling mysql_use_result(). This function initial-
izes the retrieval, but does not actually get any rows from the server.
In both cases, you access rows by calling mysql_fetch_row(). With mysql_store_result(), mysql_fetch_row() ac-
cesses rows that have previously been fetched from the server. With mysql_use_result(), mysql_fetch_row() actually re-
trieves the row from the server. Information about the size of the data in each row is available by calling
mysql_fetch_lengths().
After you are done with a result set, call mysql_free_result() to free the memory used for it.
The two retrieval mechanisms are complementary. Client programs should choose the approach that is most appropriate for their re-
quirements. In practice, clients tend to use mysql_store_result() more commonly.
An advantage of mysql_store_result() is that because the rows have all been fetched to the client, you not only can access rows
sequentially, you can move back and forth in the result set using mysql_data_seek() or mysql_row_seek() to change the cur-
rent row position within the result set. You can also find out how many rows there are by calling mysql_num_rows(). On the other
hand, the memory requirements for mysql_store_result() may be very high for large result sets and you are more likely to en-
counter out-of-memory conditions.
Connectors and APIs
2344
An advantage of mysql_use_result() is that the client requires less memory for the result set because it maintains only one row at
a time (and because there is less allocation overhead, mysql_use_result() can be faster). Disadvantages are that you must process
each row quickly to avoid tying up the server, you don't have random access to rows within the result set (you can only access rows se-
quentially), and you don't know how many rows are in the result set until you have retrieved them all. Furthermore, you must retrieve
all the rows even if you determine in mid-retrieval that you've found the information you were looking for.
The API makes it possible for clients to respond appropriately to statements (retrieving rows only as necessary) without knowing
whether the statement is a SELECT. You can do this by calling mysql_store_result() after each mysql_query() (or
mysql_real_query()). If the result set call succeeds, the statement was a SELECT and you can read the rows. If the result set call
fails, call mysql_field_count() to determine whether a result was actually to be expected. If mysql_field_count() returns
zero, the statement returned no data (indicating that it was an INSERT, UPDATE, DELETE, and so forth), and was not expected to re-
turn rows. If mysql_field_count() is nonzero, the statement should have returned rows, but didn't. This indicates that the state-
ment was a SELECT that failed. See the description for mysql_field_count() for an example of how this can be done.
Both mysql_store_result() and mysql_use_result() allow you to obtain information about the fields that make up the
result set (the number of fields, their names and types, and so forth). You can access field information sequentially within the row by
calling mysql_fetch_field() repeatedly, or by field number within the row by calling mysql_fetch_field_direct().
The current field cursor position may be changed by calling mysql_field_seek(). Setting the field cursor affects subsequent calls
to mysql_fetch_field(). You can also get information for fields all at once by calling mysql_fetch_fields().
For detecting and reporting errors, MySQL provides access to error information by means of the mysql_errno() and
mysql_error() functions. These return the error code or error message for the most recently invoked function that can succeed or
fail, allowing you to determine when an error occurred and what it was.
21.10.3. C API Function Descriptions
In the descriptions here, a parameter or return value of NULL means NULL in the sense of the C programming language, not a MySQL
NULL value.
Functions that return a value generally return a pointer or an integer. Unless specified otherwise, functions returning a pointer return a
non-NULL value to indicate success or a NULL value to indicate an error, and functions returning an integer return zero to indicate suc-
cess or nonzero to indicate an error. Note that nonzero means just that. Unless the function description says otherwise, do not test
against a value other than zero:
if (result) /* correct */
... error ...
if (result < 0) /* incorrect */
... error ...
if (result == -1) /* incorrect */
... error ...
When a function returns an error, the Errors subsection of the function description lists the possible types of errors. You can find out
which of these occurred by calling mysql_errno(). A string representation of the error may be obtained by calling
mysql_error().
MySQL Enterprise
MySQL Enterprise subscribers will find more information about the C API functions in the Knowledge Base art-
icles, The C API. Access to the MySQL Knowledge Base collection of articles is one of the advantages of sub-
scribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.10.3.1. mysql_affected_rows()
my_ulonglong mysql_affected_rows(MYSQL *mysql)
Description
After executing a statement with mysql_query() or mysql_real_query(), returns the number of rows changed (for UPDATE),
deleted (for DELETE), or inserted (for INSERT). For SELECT statements, mysql_affected_rows() works like
mysql_num_rows().
Return Values
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records were updated for an UP-
Connectors and APIs
2345
DATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query re-
turned an error or that, for a SELECT query, mysql_affected_rows() was called prior to calling mysql_store_result().
Because mysql_affected_rows() returns an unsigned value, you can check for -1 by comparing the return value to
(my_ulonglong)-1 (or to (my_ulonglong)~0, which is equivalent).
Errors
None.
Example
char *stmt = "UPDATE products SET cost=cost*1.25 WHERE group=10";
mysql_query(&mysql,stmt);
printf("%ld products updated",
(long) mysql_affected_rows(&mysql));
For UPDATE statements, if you specify the CLIENT_FOUND_ROWS flag when connecting to mysqld, mysql_affected_rows()
returns the number of rows matched by the WHERE clause. Otherwise, the default behavior is to return the number of rows actually
changed.
Note that when you use a REPLACE command, mysql_affected_rows() returns 2 if the new row replaced an old row, because in
this case, one row was inserted after the duplicate was deleted.
If you use INSERT ... ON DUPLICATE KEY UPDATE to insert a row, mysql_affected_rows() returns 1 if the row is in-
serted as a new row and 2 if an existing row is updated.
mysql_affected_rows() returns 0 following a CALL statement for a stored procedure that contains a statement that modifies
rows because in this case mysql_insert_id() applies to CALL and not the statement within the procedure. Within the procedure,
you can use ROW_COUNT() at the SQL level to obtain the AUTO_INCREMENT value.
21.10.3.2. mysql_autocommit()
my_bool mysql_autocommit(MYSQL *mysql, my_bool mode)
Description
Sets autocommit mode on if mode is 1, off if mode is 0.
Return Values
Zero if successful. Nonzero if an error occurred.
Errors
None.
21.10.3.3. mysql_change_user()
my_bool mysql_change_user(MYSQL *mysql, const char *user, const char *password, const char
*db)
Description
Changes the user and causes the database specified by db to become the default (current) database on the connection specified by
mysql. In subsequent queries, this database is the default for table references that do not include an explicit database specifier.
mysql_change_user() fails if the connected user cannot be authenticated or doesn't have permission to use the database. In this
case, the user and database are not changed.
The db parameter may be set to NULL if you don't want to have a default database.
This command resets the state as if one had done a new connect. (See Section 21.10.11, Controlling Automatic Reconnection Behavi-
or.) It always performs a ROLLBACK of any active transactions, closes and drops all temporary tables, and unlocks all locked tables.
Session system variables are reset to the values of the corresponding global system variables. Prepared statements are released and
HANDLER variables are closed. Locks acquired with GET_LOCK() are released. These effects occur even if the user didn't change.
Return Values
Connectors and APIs
2346
Zero for success. Nonzero if an error occurred.
Errors
The same that you can get from mysql_real_connect().
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
ER_UNKNOWN_COM_ERROR
The MySQL server doesn't implement this command (probably an old server).
ER_ACCESS_DENIED_ERROR
The user or password was wrong.
ER_BAD_DB_ERROR
The database didn't exist.
ER_DBACCESS_DENIED_ERROR
The user did not have access rights to the database.
ER_WRONG_DB_NAME
The database name was too long.
Example
if (mysql_change_user(&mysql, "user", "password", "new_database"))
{
fprintf(stderr, "Failed to change user. Error: %s\n",
mysql_error(&mysql));
}
21.10.3.4. mysql_character_set_name()
const char *mysql_character_set_name(MYSQL *mysql)
Description
Returns the default character set name for the current connection.
Return Values
The default character set name
Errors
None.
Connectors and APIs
2347
21.10.3.5. mysql_close()
void mysql_close(MYSQL *mysql)
Description
Closes a previously opened connection. mysql_close() also deallocates the connection handle pointed to by mysql if the handle
was allocated automatically by mysql_init() or mysql_connect().
Return Values
None.
Errors
None.
21.10.3.6. mysql_commit()
my_bool mysql_commit(MYSQL *mysql)
Description
Commits the current transaction.
The action of this function is subject to the value of the completion_type system variable. In particular, if the value of comple-
tion_type is 2, the server performs a release after terminating a transaction and closes the client connection. The client program
should call mysql_close() to close the connection from the client side.
Return Values
Zero if successful. Nonzero if an error occurred.
Errors
None.
21.10.3.7. mysql_connect()
MYSQL *mysql_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd)
Description
This function is deprecated. Use mysql_real_connect() instead.
mysql_connect() attempts to establish a connection to a MySQL database engine running on host. mysql_connect() must
complete successfully before you can execute any of the other API functions, with the exception of mysql_get_client_info().
The meanings of the parameters are the same as for the corresponding parameters for mysql_real_connect() with the difference
that the connection parameter may be NULL. In this case, the C API allocates memory for the connection structure automatically and
frees it when you call mysql_close(). The disadvantage of this approach is that you can't retrieve an error message if the connec-
tion fails. (To get error information from mysql_errno() or mysql_error(), you must provide a valid MYSQL pointer.)
Return Values
Same as for mysql_real_connect().
Errors
Same as for mysql_real_connect().
21.10.3.8. mysql_create_db()
int mysql_create_db(MYSQL *mysql, const char *db)
Connectors and APIs
2348
Description
Creates the database named by the db parameter.
This function is deprecated. It is preferable to use mysql_query() to issue an SQL CREATE DATABASE statement instead.
Return Values
Zero if the database was created successfully. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
if(mysql_create_db(&mysql, "my_database"))
{
fprintf(stderr, "Failed to create new database. Error: %s\n",
mysql_error(&mysql));
}
21.10.3.9. mysql_data_seek()
void mysql_data_seek(MYSQL_RES *result, my_ulonglong offset)
Description
Seeks to an arbitrary row in a query result set. The offset value is a row number and should be in the range from 0 to
mysql_num_rows(result)-1.
This function requires that the result set structure contains the entire result of the query, so mysql_data_seek() may be used only
in conjunction with mysql_store_result(), not with mysql_use_result().
Return Values
None.
Errors
None.
21.10.3.10. mysql_debug()
void mysql_debug(const char *debug)
Description
Does a DBUG_PUSH with the given string. mysql_debug() uses the Fred Fish debug library. To use this function, you must compile
the client library to support debugging. See MySQL Internals: Porting.
Connectors and APIs
2349
Return Values
None.
Errors
None.
Example
The call shown here causes the client library to generate a trace file in /tmp/client.trace on the client machine:
mysql_debug("d:t:O,/tmp/client.trace");
21.10.3.11. mysql_drop_db()
int mysql_drop_db(MYSQL *mysql, const char *db)
Description
Drops the database named by the db parameter.
This function is deprecated. It is preferable to use mysql_query() to issue an SQL DROP DATABASE statement instead.
Return Values
Zero if the database was dropped successfully. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
if(mysql_drop_db(&mysql, "my_database"))
fprintf(stderr, "Failed to drop the database: Error: %s\n",
mysql_error(&mysql));
21.10.3.12. mysql_dump_debug_info()
int mysql_dump_debug_info(MYSQL *mysql)
Description
Instructs the server to write some debug information to the log. For this to work, the connected user must have the SUPER privilege.
Return Values
Zero if the command was successful. Nonzero if an error occurred.
Connectors and APIs
2350
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.13. mysql_eof()
my_bool mysql_eof(MYSQL_RES *result)
Description
This function is deprecated. mysql_errno() or mysql_error() may be used instead.
mysql_eof() determines whether the last row of a result set has been read.
If you acquire a result set from a successful call to mysql_store_result(), the client receives the entire set in one operation. In
this case, a NULL return from mysql_fetch_row() always means the end of the result set has been reached and it is unnecessary to
call mysql_eof(). When used with mysql_store_result(), mysql_eof() always returns true.
On the other hand, if you use mysql_use_result() to initiate a result set retrieval, the rows of the set are obtained from the server
one by one as you call mysql_fetch_row() repeatedly. Because an error may occur on the connection during this process, a NULL
return value from mysql_fetch_row() does not necessarily mean the end of the result set was reached normally. In this case, you
can use mysql_eof() to determine what happened. mysql_eof() returns a nonzero value if the end of the result set was reached
and zero if an error occurred.
Historically, mysql_eof() predates the standard MySQL error functions mysql_errno() and mysql_error(). Because those
error functions provide the same information, their use is preferred over mysql_eof(), which is deprecated. (In fact, they provide
more information, because mysql_eof() returns only a boolean value whereas the error functions indicate a reason for the error
when one occurs.)
Return Values
Zero if no error occurred. Nonzero if the end of the result set has been reached.
Errors
None.
Example
The following example shows how you might use mysql_eof():
mysql_query(&mysql,"SELECT * FROM some_table");
result = mysql_use_result(&mysql);
while((row = mysql_fetch_row(result)))
{
// do something with data
}
if(!mysql_eof(result)) // mysql_fetch_row() failed due to an error
{
fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
}
Connectors and APIs
2351
However, you can achieve the same effect with the standard MySQL error functions:
mysql_query(&mysql,"SELECT * FROM some_table");
result = mysql_use_result(&mysql);
while((row = mysql_fetch_row(result)))
{
// do something with data
}
if(mysql_errno(&mysql)) // mysql_fetch_row() failed due to an error
{
fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
}
21.10.3.14. mysql_errno()
unsigned int mysql_errno(MYSQL *mysql)
Description
For the connection specified by mysql, mysql_errno() returns the error code for the most recently invoked API function that can
succeed or fail. A return value of zero means that no error occurred. Client error message numbers are listed in the MySQL errmsg.h
header file. Server error message numbers are listed in mysqld_error.h. Errors also are listed at Appendix B, Errors, Error Codes,
and Common Problems.
Note that some functions like mysql_fetch_row() don't set mysql_errno() if they succeed.
A rule of thumb is that all functions that have to ask the server for information reset mysql_errno() if they succeed.
MySQL-specific error numbers returned by mysql_errno() differ from SQLSTATE values returned by mysql_sqlstate().
For example, the mysql client program displays errors using the following format, where 1146 is the mysql_errno() value and
'42S02' is the corresponding mysql_sqlstate() value:
shell> SELECT * FROM no_such_table;
ERROR 1146 (42S02): Table 'test.no_such_table' doesn't exist
Return Values
An error code value for the last mysql_xxx() call, if it failed. zero means no error occurred.
Errors
None.
21.10.3.15. mysql_error()
const char *mysql_error(MYSQL *mysql)
Description
For the connection specified by mysql, mysql_error() returns a null-terminated string containing the error message for the most
recently invoked API function that failed. If a function didn't fail, the return value of mysql_error() may be the previous error or an
empty string to indicate no error.
A rule of thumb is that all functions that have to ask the server for information reset mysql_error() if they succeed.
For functions that reset mysql_error(), the following two tests are equivalent:
if(*mysql_error(&mysql))
{
// an error occurred
}
if(mysql_error(&mysql)[0])
{
// an error occurred
}
The language of the client error messages may be changed by recompiling the MySQL client library. Currently, you can choose error
messages in several different languages. See Section 9.3, Setting the Error Message Language.
Connectors and APIs
2352
Return Values
A null-terminated character string that describes the error. An empty string if no error occurred.
Errors
None.
21.10.3.16. mysql_escape_string()
You should use mysql_real_escape_string() instead!
This function is identical to mysql_real_escape_string() except that mysql_real_escape_string() takes a connec-
tion handler as its first argument and escapes the string according to the current character set. mysql_escape_string() does not
take a connection argument and does not respect the current character set.
21.10.3.17. mysql_fetch_field()
MYSQL_FIELD *mysql_fetch_field(MYSQL_RES *result)
Description
Returns the definition of one column of a result set as a MYSQL_FIELD structure. Call this function repeatedly to retrieve information
about all columns in the result set. mysql_fetch_field() returns NULL when no more fields are left.
mysql_fetch_field() is reset to return information about the first field each time you execute a new SELECT query. The field re-
turned by mysql_fetch_field() is also affected by calls to mysql_field_seek().
If you've called mysql_query() to perform a SELECT on a table but have not called mysql_store_result(), MySQL returns
the default blob length (8KB) if you call mysql_fetch_field() to ask for the length of a BLOB field. (The 8KB size is chosen be-
cause MySQL doesn't know the maximum length for the BLOB. This should be made configurable sometime.) Once you've retrieved
the result set, field->max_length contains the length of the largest value for this column in the specific query.
Return Values
The MYSQL_FIELD structure for the current column. NULL if no columns are left.
Errors
None.
Example
MYSQL_FIELD *field;
while((field = mysql_fetch_field(result)))
{
printf("field name %s\n", field->name);
}
21.10.3.18. mysql_fetch_field_direct()
MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *result, unsigned int fieldnr)
Description
Given a field number fieldnr for a column within a result set, returns that column's field definition as a MYSQL_FIELD structure.
You may use this function to retrieve the definition for an arbitrary column. The value of fieldnr should be in the range from 0 to
mysql_num_fields(result)-1.
Return Values
The MYSQL_FIELD structure for the specified column.
Errors
Connectors and APIs
2353
None.
Example
unsigned int num_fields;
unsigned int i;
MYSQL_FIELD *field;
num_fields = mysql_num_fields(result);
for(i = 0; i < num_fields; i++)
{
field = mysql_fetch_field_direct(result, i);
printf("Field %u is %s\n", i, field->name);
}
21.10.3.19. mysql_fetch_fields()
MYSQL_FIELD *mysql_fetch_fields(MYSQL_RES *result)
Description
Returns an array of all MYSQL_FIELD structures for a result set. Each structure provides the field definition for one column of the res-
ult set.
Return Values
An array of MYSQL_FIELD structures for all columns of a result set.
Errors
None.
Example
unsigned int num_fields;
unsigned int i;
MYSQL_FIELD *fields;
num_fields = mysql_num_fields(result);
fields = mysql_fetch_fields(result);
for(i = 0; i < num_fields; i++)
{
printf("Field %u is %s\n", i, fields[i].name);
}
21.10.3.20. mysql_fetch_lengths()
unsigned long *mysql_fetch_lengths(MYSQL_RES *result)
Description
Returns the lengths of the columns of the current row within a result set. If you plan to copy field values, this length information is also
useful for optimization, because you can avoid calling strlen(). In addition, if the result set contains binary data, you must use this
function to determine the size of the data, because strlen() returns incorrect results for any field containing null characters.
The length for empty columns and for columns containing NULL values is zero. To see how to distinguish these two cases, see the de-
scription for mysql_fetch_row().
Return Values
An array of unsigned long integers representing the size of each column (not including any terminating null characters). NULL if an er-
ror occurred.
Errors
mysql_fetch_lengths() is valid only for the current row of the result set. It returns NULL if you call it before calling
mysql_fetch_row() or after retrieving all rows in the result.
Example
Connectors and APIs
2354
MYSQL_ROW row;
unsigned long *lengths;
unsigned int num_fields;
unsigned int i;
row = mysql_fetch_row(result);
if (row)
{
num_fields = mysql_num_fields(result);
lengths = mysql_fetch_lengths(result);
for(i = 0; i < num_fields; i++)
{
printf("Column %u is %lu bytes in length.\n",
i, lengths[i]);
}
}
21.10.3.21. mysql_fetch_row()
MYSQL_ROW mysql_fetch_row(MYSQL_RES *result)
Description
Retrieves the next row of a result set. When used after mysql_store_result(), mysql_fetch_row() returns NULL when
there are no more rows to retrieve. When used after mysql_use_result(), mysql_fetch_row() returns NULL when there are
no more rows to retrieve or if an error occurred.
The number of values in the row is given by mysql_num_fields(result). If row holds the return value from a call to
mysql_fetch_row(), pointers to the values are accessed as row[0] to row[mysql_num_fields(result)-1]. NULL val-
ues in the row are indicated by NULL pointers.
The lengths of the field values in the row may be obtained by calling mysql_fetch_lengths(). Empty fields and fields containing
NULL both have length 0; you can distinguish these by checking the pointer for the field value. If the pointer is NULL, the field is
NULL; otherwise, the field is empty.
Return Values
A MYSQL_ROW structure for the next row. NULL if there are no more rows to retrieve or if an error occurred.
Errors
Note that error is not reset between calls to mysql_fetch_row()
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
MYSQL_ROW row;
unsigned int num_fields;
unsigned int i;
num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
unsigned long *lengths;
lengths = mysql_fetch_lengths(result);
for(i = 0; i < num_fields; i++)
{
printf("[%.*s] ", (int) lengths[i],
row[i] ? row[i] : "NULL");
}
printf("\n");
}
21.10.3.22. mysql_field_count()
Connectors and APIs
2355
unsigned int mysql_field_count(MYSQL *mysql)
Description
Returns the number of columns for the most recent query on the connection.
The normal use of this function is when mysql_store_result() returned NULL (and thus you have no result set pointer). In this
case, you can call mysql_field_count() to determine whether mysql_store_result() should have produced a nonempty
result. This allows the client program to take proper action without knowing whether the query was a SELECT (or SELECT-like) state-
ment. The example shown here illustrates how this may be done.
See Section 21.10.10.1, Why mysql_store_result() Sometimes Returns NULL After mysql_query() Returns Success.
Return Values
An unsigned integer representing the number of columns in a result set.
Errors
None.
Example
MYSQL_RES *result;
unsigned int num_fields;
unsigned int num_rows;
if (mysql_query(&mysql,query_string))
{
// error
}
else // query succeeded, process any data returned by it
{
result = mysql_store_result(&mysql);
if (result) // there are rows
{
num_fields = mysql_num_fields(result);
// retrieve rows, then call mysql_free_result(result)
}
else // mysql_store_result() returned nothing; should it have?
{
if(mysql_field_count(&mysql) == 0)
{
// query does not return data
// (it was not a SELECT)
num_rows = mysql_affected_rows(&mysql);
}
else // mysql_store_result() should have returned data
{
fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
}
}
}
An alternative is to replace the mysql_field_count(&mysql) call with mysql_errno(&mysql). In this case, you are check-
ing directly for an error from mysql_store_result() rather than inferring from the value of mysql_field_count() whether
the statement was a SELECT.
21.10.3.23. mysql_field_seek()
MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset)
Description
Sets the field cursor to the given offset. The next call to mysql_fetch_field() retrieves the field definition of the column associ-
ated with that offset.
To seek to the beginning of a row, pass an offset value of zero.
Return Values
The previous value of the field cursor.
Connectors and APIs
2356
Errors
None.
21.10.3.24. mysql_field_tell()
MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *result)
Description
Returns the position of the field cursor used for the last mysql_fetch_field(). This value can be used as an argument to
mysql_field_seek().
Return Values
The current offset of the field cursor.
Errors
None.
21.10.3.25. mysql_free_result()
void mysql_free_result(MYSQL_RES *result)
Description
Frees the memory allocated for a result set by mysql_store_result(), mysql_use_result(), mysql_list_dbs(), and
so forth. When you are done with a result set, you must free the memory it uses by calling mysql_free_result().
Do not attempt to access a result set after freeing it.
Return Values
None.
Errors
None.
21.10.3.26. mysql_get_character_set_info()
void mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs)
Description
This function provides information about the default client character set. The default character set may be changed with the
mysql_set_character_set() function.
Example
This example shows the fields that are available in the MY_CHARSET_INFO structure:
if (!mysql_set_character_set(&mysql, "utf8"))
{
MY_CHARSET_INFO cs;
mysql_get_character_set_info(&mysql, &cs);
printf("character set information:\n");
printf("character set+collation number: %d\n", cs.number);
printf("character set name: %s\n", cs.name);
printf("collation name: %s\n", cs.csname);
printf("comment: %s\n", cs.comment);
printf("directory: %s\n", cs.dir);
printf("multi byte character min. length: %d\n", cs.mbminlen);
printf("multi byte character max. length: %d\n", cs.mbmaxlen);
}
21.10.3.27. mysql_get_client_info()
Connectors and APIs
2357
const char *mysql_get_client_info(void)
Description
Returns a string that represents the client library version.
Return Values
A character string that represents the MySQL client library version.
Errors
None.
21.10.3.28. mysql_get_client_version()
unsigned long mysql_get_client_version(void)
Description
Returns an integer that represents the client library version. The value has the format XYYZZ where X is the major version, YY is the re-
lease level, and ZZ is the version number within the release level. For example, a value of 40102 represents a client library version of
4.1.2.
Return Values
An integer that represents the MySQL client library version.
Errors
None.
21.10.3.29. mysql_get_host_info()
const char *mysql_get_host_info(MYSQL *mysql)
Description
Returns a string describing the type of connection in use, including the server host name.
Return Values
A character string representing the server host name and the connection type.
Errors
None.
21.10.3.30. mysql_get_proto_info()
unsigned int mysql_get_proto_info(MYSQL *mysql)
Description
Returns the protocol version used by current connection.
Return Values
An unsigned integer representing the protocol version used by the current connection.
Errors
None.
21.10.3.31. mysql_get_server_info()
Connectors and APIs
2358
const char *mysql_get_server_info(MYSQL *mysql)
Description
Returns a string that represents the server version number.
Return Values
A character string that represents the server version number.
Errors
None.
21.10.3.32. mysql_get_server_version()
unsigned long mysql_get_server_version(MYSQL *mysql)
Description
Returns the version number of the server as an integer.
Return Values
A number that represents the MySQL server version in this format:
major_version*10000 + minor_version *100 + sub_version
For example, 5.1.5 is returned as 50105.
This function is useful in client programs for quickly determining whether some version-specific server capability exists.
Errors
None.
21.10.3.33. mysql_get_ssl_cipher()
const char *mysql_get_ssl_cipher(MYSQL *mysql)
Description
mysql_get_ssl_cipher() returns the SSL cipher used for the given connection to the server. mysql is the connection handler
returned from mysql_init().
This function was added in MySQL 5.1.11.
Return Values
A string naming the SSL cipher used for the connection, or NULL if no cipher is being used.
21.10.3.34. mysql_hex_string()
unsigned long mysql_hex_string(char *to, const char *from, unsigned long length)
Description
This function is used to create a legal SQL string that you can use in an SQL statement. See Section 8.1.1, Strings.
The string in from is encoded to hexadecimal format, with each character encoded as two hexadecimal digits. The result is placed in
to and a terminating null byte is appended.
The string pointed to by from must be length bytes long. You must allocate the to buffer to be at least length*2+1 bytes long.
When mysql_hex_string() returns, the contents of to is a null-terminated string. The return value is the length of the encoded
string, not including the terminating null character.
Connectors and APIs
2359
The return value can be placed into an SQL statement using either 0xvalue or X'value' format. However, the return value does not
include the 0x or X'...'. The caller must supply whichever of those is desired.
Example
char query[1000],*end;
end = strmov(query,"INSERT INTO test_table values(");
end = strmov(end,"0x");
end += mysql_hex_string(end,"What is this",12);
end = strmov(end,",0x");
end += mysql_hex_string(end,"binary data: \0\r\n",16);
*end++ = ')';
if (mysql_real_query(&mysql,query,(unsigned int) (end - query)))
{
fprintf(stderr, "Failed to insert row, Error: %s\n",
mysql_error(&mysql));
}
The strmov() function used in the example is included in the mysqlclient library and works like strcpy() but returns a point-
er to the terminating null of the first parameter.
Return Values
The length of the value placed into to, not including the terminating null character.
Errors
None.
21.10.3.35. mysql_info()
const char *mysql_info(MYSQL *mysql)
Description
Retrieves a string providing information about the most recently executed statement, but only for the statements listed here. For other
statements, mysql_info() returns NULL. The format of the string varies depending on the type of statement, as described here. The
numbers are illustrative only; the string contains values appropriate for the statement.
INSERT INTO ... SELECT ...
String format: Records: 100 Duplicates: 0 Warnings: 0
INSERT INTO ... VALUES (...),(...),(...)...
String format: Records: 3 Duplicates: 0 Warnings: 0
LOAD DATA INFILE ...
String format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
ALTER TABLE
String format: Records: 3 Duplicates: 0 Warnings: 0
UPDATE
String format: Rows matched: 40 Changed: 40 Warnings: 0
Note that mysql_info() returns a non-NULL value for INSERT ... VALUES only for the multiple-row form of the statement
(that is, only if multiple value lists are specified).
Return Values
A character string representing additional information about the most recently executed statement. NULL if no information is available
Connectors and APIs
2360
for the statement.
Errors
None.
21.10.3.36. mysql_init()
MYSQL *mysql_init(MYSQL *mysql)
Description
Allocates or initializes a MYSQL object suitable for mysql_real_connect(). If mysql is a NULL pointer, the function allocates,
initializes, and returns a new object. Otherwise, the object is initialized and the address of the object is returned. If mysql_init() al-
locates a new object, it is freed when mysql_close() is called to close the connection.
Return Values
An initialized MYSQL* handle. NULL if there was insufficient memory to allocate a new object.
Errors
In case of insufficient memory, NULL is returned.
21.10.3.37. mysql_insert_id()
my_ulonglong mysql_insert_id(MYSQL *mysql)
Description
Returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement. Use this function after
you have performed an INSERT statement into a table that contains an AUTO_INCREMENT field, or have used INSERT or UPDATE to
set a column value with LAST_INSERT_ID(expr).
The return value of mysql_insert_id() is always zero unless explicitly updated under one of the following conditions:
INSERT statements that store a value into an AUTO_INCREMENT column. This is true whether the value is automatically generated
by storing the special values NULL or 0 into the column, or is an explicit nonspecial value.
In the case of a multiple-row INSERT statement, the return value of mysql_insert_id() depends on the MySQL server ver-
sion.
In MySQL 5.1.12 and later, mysql_insert_id() returns the first automatically generated AUTO_INCREMENT value that was
successfully inserted. In MySQL 5.1.11 and earlier, mysql_insert_id() returns the first automatically generated
AUTO_INCREMENT value, regardless of whether insertion of that value was successful.
If no rows are successfully inserted, mysql_insert_id() returns 0.
Starting in MySQL 5.1.12, if an INSERT ... SELECT statement is executed, and no automatically generated value is success-
fully inserted, mysql_insert_id() returns the ID of the last inserted row.
Starting in MySQL 5.1.12, if an INSERT ... SELECT statement uses LAST_INSERT_ID(expr), mysql_insert_id()
returns expr.
INSERT statements that generate an AUTO_INCREMENT value by inserting LAST_INSERT_ID(expr) into any column or by
updating any column to LAST_INSERT_ID(expr).
If the previous statement returned an error, the value of mysql_insert_id() is undefined.
For 5.1.12 and later, the return value of mysql_insert_id() can be simplified to the following sequence:
1. If there is an AUTO_INCREMENT column, and an automatically generated value was successfully inserted, return the first such
value.
Connectors and APIs
2361
2. If LAST_INSERT_ID(expr) occurred in the statement, return expr, even if there was an AUTO_INCREMENT column in the
affected table.
3. The return value varies depending on the statement used. When called after an INSERT statement:
If there is an AUTO_INCREMENT column in the table, and there were some explicit values for this column that were success-
fully inserted into the table, return the last of the explicit values.
When called after an INSERT ... ON DUPLICATE KEY UPDATE statement:
If there is an AUTO_INCREMENT column in the table and there were some explicit succesfully inserted values, or some up-
dated rows, return the last of the inserted or updated values.
mysql_insert_id() returns 0 if the previous statement does not use an AUTO_INCREMENT value. If you need to save the value
for later, be sure to call mysql_insert_id() immediately after the statement that generates the value.
The value of mysql_insert_id() is affected only by statements issued within the current client connection. It is not affected by
statements issued by other clients.
The LAST_INSERT_ID() SQL function returns the value of the first automatically generated value that was successfully inserted
(starting from 5.1.12) or the first automatically generated value if any rows were successfully inserted (before 5.1.12).
LAST_INSERT_ID() is not reset between statements because the value of that function is maintained in the server. Another differ-
ence from mysql_insert_id() is that LAST_INSERT_ID() is not updated if you set an AUTO_INCREMENT column to a specif-
ic nonspecial value. See Section 11.11.3, Information Functions.
mysql_insert_id() returns 0 following a CALL statement for a stored procedure that generates an AUTO_INCREMENT value be-
cause in this case mysql_insert_id() applies to CALL and not the statement within the procedure. Within the procedure, you can
use LAST_INSERT_ID() at the SQL level to obtain the AUTO_INCREMENT value.
The reason for the differences between LAST_INSERT_ID() and mysql_insert_id() is that LAST_INSERT_ID() is made
easy to use in scripts while mysql_insert_id() tries to provide more exact information about what happens to the
AUTO_INCREMENT column.
Return Values
Described in the preceding discussion.
Errors
None.
21.10.3.38. mysql_kill()
int mysql_kill(MYSQL *mysql, unsigned long pid)
Description
Asks the server to kill the thread specified by pid.
This function is deprecated. It is preferable to use mysql_query() to issue an SQL KILL statement instead.
Return Values
Zero for success. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
Connectors and APIs
2362
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.39. mysql_library_end()
void mysql_library_end(void)
Description
This function finalizes the MySQL library. You should call it when you are done using the library (for example, after disconnecting
from the server). The action taken by the call depends on whether your application is linked to the MySQL client library or the MySQL
embedded server library. For a client program linked against the libmysqlclient library by using the -lmysqlclient flag,
mysql_library_end() performs some memory management to clean up. For an embedded server application linked against the
libmysqld library by using the -lmysqld flag, mysql_library_end() shuts down the embedded server and then cleans up.
For usage information, see Section 21.10.2, C API Function Overview, and Section 21.10.3.40, mysql_library_init().
21.10.3.40. mysql_library_init()
int mysql_library_init(int argc, char **argv, char **groups)
Description
This function should be called to initialize the MySQL library before you call any other MySQL function, whether your application is a
regular client program or uses the embedded server. If the application uses the embedded server, this call starts the server and initializes
any subsystems (mysys, InnoDB, and so forth) that the server uses.
After your application is done using the MySQL library, call mysql_library_end() to clean up. See Section 21.10.3.39,
mysql_library_end().
The choice of whether the application operates as a regular client or uses the embedded server depends on whether you use the
libmysqlclient or libmysqld library at link time to produce the final executable. For additional information, see Sec-
tion 21.10.2, C API Function Overview.
In a nonmulti-threaded environment, the call to mysql_library_init() may be omitted, because mysql_init() will invoke it
automatically as necessary. However, mysql_library_init() is not thread-safe in a multi-threaded environment, and thus neither
is mysql_init(), which calls mysql_library_init(). You must either call mysql_library_init() prior to spawning
any threads, or else use a mutex to protect the call, whether you invoke mysql_library_init() or indirectly via
mysql_init(). This should be done prior to any other client library call.
The argc and argv arguments are analogous to the arguments to main(), and enable passing of options to the embedded server. For
convenience, argc may be 0 (zero) if there are no command-line arguments for the server. This is the usual case for applications inten-
ded for use only as regular (nonembedded) clients, and the call typically is written as mysql_library_init(0, NULL, NULL).
#include <mysql.h>
#include <stdlib.h>
int main(void) {
if (mysql_library_init(0, NULL, NULL)) {
fprintf(stderr, "could not initialize MySQL library\n");
exit(1);
}
/* Use any MySQL API functions here */
mysql_library_end();
return EXIT_SUCCESS;
}
When arguments are to be passed (argc is greater than 0), the first element of argv is ignored (it typically contains the program
name). mysql_library_init() makes a copy of the arguments so it is safe to destroy argv or groups after the call.
Connectors and APIs
2363
For embedded applications, if you want to connect to an external server without starting the embedded server, you have to specify a
negative value for argc.
The groups argument should be an array of strings that indicate the groups in option files from which options should be read. See Sec-
tion 4.2.3.3, Using Option Files. The final entry in the array should be NULL. For convenience, if the groups argument itself is
NULL, the [server] and [embedded] groups are used by default.
#include <mysql.h>
#include <stdlib.h>
static char *server_args[] = {
"this_program", /* this string is not used */
"--datadir=.",
"--key_buffer_size=32M"
};
static char *server_groups[] = {
"embedded",
"server",
"this_program_SERVER",
(char *)NULL
};
int main(void) {
if (mysql_library_init(sizeof(server_args) / sizeof(char *),
server_args, server_groups)) {
fprintf(stderr, "could not initialize MySQL library\n");
exit(1);
}
/* Use any MySQL API functions here */
mysql_library_end();
return EXIT_SUCCESS;
}
Return Values
Zero if successful. Nonzero if an error occurred.
21.10.3.41. mysql_list_dbs()
MYSQL_RES *mysql_list_dbs(MYSQL *mysql, const char *wild)
Description
Returns a result set consisting of database names on the server that match the simple regular expression specified by the wild paramet-
er. wild may contain the wildcard characters % or _, or may be a NULL pointer to match all databases. Calling
mysql_list_dbs() is similar to executing the query SHOW DATABASES [LIKE wild].
You must free the result set with mysql_free_result().
Return Values
A MYSQL_RES result set for success. NULL if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
Connectors and APIs
2364
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.42. mysql_list_fields()
MYSQL_RES *mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
Description
Returns a result set consisting of field names in the given table that match the simple regular expression specified by the wild paramet-
er. wild may contain the wildcard characters % or _, or may be a NULL pointer to match all fields. Calling
mysql_list_fields() is similar to executing the query SHOW COLUMNS FROM tbl_name [LIKE wild].
It is preferable to use SHOW COLUMNS FROM tbl_name instead of mysql_list_fields().
You must free the result set with mysql_free_result().
Return Values
A MYSQL_RES result set for success. NULL if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.43. mysql_list_processes()
MYSQL_RES *mysql_list_processes(MYSQL *mysql)
Description
Returns a result set describing the current server threads. This is the same kind of information as that reported by mysqladmin pro-
cesslist or a SHOW PROCESSLIST query.
You must free the result set with mysql_free_result().
Return Values
A MYSQL_RES result set for success. NULL if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Connectors and APIs
2365
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.44. mysql_list_tables()
MYSQL_RES *mysql_list_tables(MYSQL *mysql, const char *wild)
Description
Returns a result set consisting of table names in the current database that match the simple regular expression specified by the wild
parameter. wild may contain the wildcard characters % or _, or may be a NULL pointer to match all tables. Calling
mysql_list_tables() is similar to executing the query SHOW TABLES [LIKE wild].
You must free the result set with mysql_free_result().
Return Values
A MYSQL_RES result set for success. NULL if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.45. mysql_more_results()
my_bool mysql_more_results(MYSQL *mysql)
Description
This function is used when you execute multiple statements specified as a single statement string, or when you execute CALL state-
ments, which can return multiple result sets.
mysql_more_results() true if more results exist from the currently executed statement, in which case the application must call
mysql_next_result() to fetch the results.
Return Values
Connectors and APIs
2366
TRUE (1) if more results exist. FALSE (0) if no more results exist.
In most cases, you can call mysql_next_result() instead to test whether more results exist and initiate retrieval if so.
See Section 21.10.12, C API Support for Multiple Statement Execution, and Section 21.10.3.46, mysql_next_result().
Errors
None.
21.10.3.46. mysql_next_result()
int mysql_next_result(MYSQL *mysql)
Description
This function is used when you execute multiple statements specified as a single statement string, or when you use CALL statements to
execute stored procedures, which can return multiple result sets.
mysql_next_result() reads the next statement result and returns a status to indicate whether more results exist. If
mysql_next_result() returns an error, there are no more results.
Before each call to mysql_next_result(), you must call mysql_free_result() for the current statement if it is a statement
that returned a result set (rather than just a result status).
After calling mysql_next_result() the state of the connection is as if you had called mysql_real_query() or
mysql_query() for the next statement. This means that you can call mysql_store_result(), mysql_warning_count(),
mysql_affected_rows(), and so forth.
If your program uses CALL statements to execute stored procedures, the CLIENT_MULTI_RESULTS flag must be enabled. This is be-
cause each CALL returns a result to indicate the call status, in addition to any result sets that might be returned by statements executed
within the procedure. Because CALL can return multiple results, you should process them using a loop that calls
mysql_next_result() to determine whether there are more results.
CLIENT_MULTI_RESULTS can be enabled when you call mysql_real_connect(), either explicitly by passing the CLI-
ENT_MULTI_RESULTS flag itself, or implicitly by passing CLIENT_MULTI_STATEMENTS (which also enables CLI-
ENT_MULTI_RESULTS).
It is also possible to test whether there are more results by calling mysql_more_results(). However, this function does not
change the connection state, so if it returns true, you must still call mysql_next_result() to advance to the next result.
For an example that shows how to use mysql_next_result(), see Section 21.10.12, C API Support for Multiple Statement Exe-
cution.
Return Values
Return Value Description
0 Successful and there are more results
-1 Successful and there are no more results
>0 An error occurred
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order. For example if you didn't call mysql_use_result() for a previous result set.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
Connectors and APIs
2367
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.47. mysql_num_fields()
unsigned int mysql_num_fields(MYSQL_RES *result)
To pass a MYSQL* argument instead, use unsigned int mysql_field_count(MYSQL *mysql).
Description
Returns the number of columns in a result set.
Note that you can get the number of columns either from a pointer to a result set or to a connection handle. You would use the connec-
tion handle if mysql_store_result() or mysql_use_result() returned NULL (and thus you have no result set pointer). In
this case, you can call mysql_field_count() to determine whether mysql_store_result() should have produced a
nonempty result. This allows the client program to take proper action without knowing whether the query was a SELECT (or SELECT-
like) statement. The example shown here illustrates how this may be done.
See Section 21.10.10.1, Why mysql_store_result() Sometimes Returns NULL After mysql_query() Returns Success.
Return Values
An unsigned integer representing the number of columns in a result set.
Errors
None.
Example
MYSQL_RES *result;
unsigned int num_fields;
unsigned int num_rows;
if (mysql_query(&mysql,query_string))
{
// error
}
else // query succeeded, process any data returned by it
{
result = mysql_store_result(&mysql);
if (result) // there are rows
{
num_fields = mysql_num_fields(result);
// retrieve rows, then call mysql_free_result(result)
}
else // mysql_store_result() returned nothing; should it have?
{
if (mysql_errno(&mysql))
{
fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
}
else if (mysql_field_count(&mysql) == 0)
{
// query does not return data
// (it was not a SELECT)
num_rows = mysql_affected_rows(&mysql);
}
}
}
An alternative (if you know that your query should have returned a result set) is to replace the mysql_errno(&mysql) call with a
check whether mysql_field_count(&mysql) returns 0. This happens only if something went wrong.
21.10.3.48. mysql_num_rows()
my_ulonglong mysql_num_rows(MYSQL_RES *result)
Connectors and APIs
2368
Description
Returns the number of rows in the result set.
The use of mysql_num_rows() depends on whether you use mysql_store_result() or mysql_use_result() to return
the result set. If you use mysql_store_result(), mysql_num_rows() may be called immediately. If you use
mysql_use_result(), mysql_num_rows() does not return the correct value until all the rows in the result set have been re-
trieved.
mysql_num_rows() is intended for use with statements that return a result set, such as SELECT. For statements such as INSERT,
UPDATE, or DELETE, the number of affected rows can be obtained with mysql_affected_rows().
Return Values
The number of rows in the result set.
Errors
None.
21.10.3.49. mysql_options()
int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg)
Description
Can be used to set extra connect options and affect behavior for a connection. This function may be called multiple times to set several
options.
mysql_options() should be called after mysql_init() and before mysql_connect() or mysql_real_connect().
The option argument is the option that you want to set; the arg argument is the value for the option. If the option is an integer, arg
should point to the value of the integer.
The following list describes the possible options, their effect, and how arg is used for each option. Several of the options apply only
when the application is linked against the libmysqld embedded server library and are unused for applications linked against the
libmysql client library. For option descriptions that indicate arg is unused, its value is irrelevant; it is conventional to pass 0.
MYSQL_INIT_COMMAND (argument type: char *)
SQL statement to execute when connecting to the MySQL server. Automatically re-executed if reconnection occurs.
MYSQL_OPT_COMPRESS (argument: not used)
Use the compressed client/server protocol.
MYSQL_OPT_CONNECT_TIMEOUT (argument type: unsigned int *)
Connect timeout in seconds.
MYSQL_OPT_GUESS_CONNECTION (argument: not used)
For an application linked against the libmysqld embedded server library, this allows the library to guess whether to use the em-
bedded server or a remote server. Guess means that if the host name is set and is not localhost, it uses a remote server. This
behavior is the default. MYSQL_OPT_USE_EMBEDDED_CONNECTION and MYSQL_OPT_USE_REMOTE_CONNECTION can be
used to override it. This option is ignored for applications linked against the libmysqlclient client library.
MYSQL_OPT_LOCAL_INFILE (argument type: optional pointer to unsigned int)
If no pointer is given or if pointer points to an unsigned int that has a nonzero value, the LOAD LOCAL INFILE statement is
enabled.
MYSQL_OPT_NAMED_PIPE (argument: not used)
Use named pipes to connect to a MySQL server on Windows, if the server allows named-pipe connections.
Connectors and APIs
2369
MYSQL_OPT_PROTOCOL (argument type: unsigned int *)
Type of protocol to use. Should be one of the enum values of mysql_protocol_type defined in mysql.h.
MYSQL_OPT_READ_TIMEOUT (argument type: unsigned int *)
The timeout in seconds for attempts to read from the server. Each attempt uses this timeout value and there are retries if necessary,
so the total effective timeout value is three times the option value. You can set the value so that a lost connection can be detected
earlier than the TCP/IP Close_Wait_Timeout value of 10 minutes. This option works only for TCP/IP connections and, prior to
MySQL 5.1.12, only for Windows.
MYSQL_OPT_RECONNECT (argument type: my_bool *)
Enable or disable automatic reconnection to the server if the connection is found to have been lost. Reconnect is off by default; this
option provides a way to set reconnection behavior explicitly.
Note: mysql_real_connect() incorrectly reset the MYSQL_OPT_RECONNECT option to its default value before MySQL
5.1.6. Therefore, prior to that version, if you want reconnect to be enabled for each connection, you must call mysql_options()
with the MYSQL_OPT_RECONNECT option after each call to mysql_real_connect(). This is not necessary as of 5.1.6: Call
mysql_options() only before mysql_real_connect() as usual.
MYSQL_SET_CLIENT_IP (argument type: char *)
For an application linked against the libmysqld embedded server library (when libmysqld is compiled with authentication
support), this means that the user is considered to have connected from the specified IP address (specified as a string) for authentica-
tion purposes. This option is ignored for applications linked against the libmysqlclient client library.
MYSQL_OPT_SSL_VERIFY_SERVER_CERT (argument type: my_bool *)
Enable or disable verification of the server's Common Name value in its certificate against the host name used when connecting to
the server. The connection is rejected if there is a mismatch. This feature can be used to prevent man-in-the-middle attacks. Verific-
ation is disabled by default. Added in MySQL 5.1.11.
MYSQL_OPT_USE_EMBEDDED_CONNECTION (argument: not used)
For an application linked against the libmysqld embedded server library, this forces the use of the embedded server for the con-
nection. This option is ignored for applications linked against the libmysqlclient client library.
MYSQL_OPT_USE_REMOTE_CONNECTION (argument: not used)
For an application linked against the libmysqld embedded server library, this forces the use of a remote server for the connec-
tion. This option is ignored for applications linked against the libmysqlclient client library.
MYSQL_OPT_USE_RESULT (argument: not used)
This option is unused.
MYSQL_OPT_WRITE_TIMEOUT (argument type: unsigned int *)
The timeout in seconds for attempts to write to the server. Each attempt uses this timeout value and there are net_retry_count
retries if necessary, so the total effective timeout value is net_retry_count times the option value. This option works only for
TCP/IP connections and, prior to MySQL 5.1.12, only for Windows.
MYSQL_READ_DEFAULT_FILE (argument type: char *)
Read options from the named option file instead of from my.cnf.
MYSQL_READ_DEFAULT_GROUP (argument type: char *)
Read options from the named group from my.cnf or the file specified with MYSQL_READ_DEFAULT_FILE.
MYSQL_REPORT_DATA_TRUNCATION (argument type: my_bool *)
Enable or disable reporting of data truncation errors for prepared statements via the error member of MYSQL_BIND structures.
(Default: enabled.)
Connectors and APIs
2370
MYSQL_SECURE_AUTH (argument type: my_bool *)
Whether to connect to a server that does not support the password hashing used in MySQL 4.1.1 and later.
MYSQL_SET_CHARSET_DIR (argument type: char *)
The path name to the directory that contains character set definition files.
MYSQL_SET_CHARSET_NAME (argument type: char *)
The name of the character set to use as the default character set.
MYSQL_SHARED_MEMORY_BASE_NAME (argument type: char *)
The name of the shared-memory object for communication to the server on Windows, if the server supports shared-memory connec-
tions. Should have the same value as the --shared-memory-base-name option used for the mysqld server you want to con-
nect to.
The client group is always read if you use MYSQL_READ_DEFAULT_FILE or MYSQL_READ_DEFAULT_GROUP.
The specified group in the option file may contain the following options.
Option Description
character-sets-dir=path The directory where character sets are installed.
compress Use the compressed client/server protocol.
connect-timeout=seconds Connect timeout in seconds. On Linux this timeout is also used for waiting for the first
answer from the server.
database=db_name Connect to this database if no database was specified in the connect command.
debug Debug options.
default-character-set=char-
set_name
The default character set to use.
disable-local-infile Disable use of LOAD DATA LOCAL.
host=host_name Default host name.
init-command=stmt Statement to execute when connecting to MySQL server. Automatically re-executed if
reconnection occurs.
interactive-timeout=seconds Same as specifying CLIENT_INTERACTIVE to mysql_real_connect(). See
Section 21.10.3.52, mysql_real_connect().
local-infile[={0|1}] If no argument or nonzero argument, enable use of LOAD DATA LOCAL; otherwise
disable.
max_allowed_packet=bytes Maximum size of packet that client can read from server.
multi-queries, multi-results Allow multiple result sets from multiple-statement executions or stored procedures.
multi-statements Allow the client to send multiple statements in a single string (separated by ;).
password=password Default password.
pipe Use named pipes to connect to a MySQL server on Windows.
port=port_num Default port number.
pro-
tocol={TCP|SOCKET|PIPE|MEMORY}
The protocol to use when connecting to the server.
return-found-rows Tell mysql_info() to return found rows instead of updated rows when using UP-
DATE.
shared-memory-base-name=name Shared-memory name to use to connect to server.
socket=path Default socket file.
ssl-ca=file_name Certificate Authority file.
ssl-capath=path Certificate Authority directory.
ssl-cert=file_name Certificate file.
Connectors and APIs
2371
ssl-cipher=cipher_list Allowable SSL ciphers.
ssl-key=file_name Key file.
timeout=seconds Like connect-timeout.
user Default user.
timeout has been replaced by connect-timeout, but timeout is still supported in MySQL 5.1 for backward compatibility.
For more information about option files, see Section 4.2.3.3, Using Option Files.
Before MySQL 5.1.18, the arg argument was declared as char *.
Return Values
Zero for success. Nonzero if you specify an unknown option.
Example
The following mysql_options() calls request the use of compression in the client/server protocol, cause options to be read from the
[odbc] group of option files, and disable transaction autocommit mode:
MYSQL mysql;
mysql_init(&mysql);
mysql_options(&mysql,MYSQL_OPT_COMPRESS,0);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"odbc");
mysql_options(&mysql,MYSQL_INIT_COMMAND,"SET autocommit=0");
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",
mysql_error(&mysql));
}
This code requests that the client use the compressed client/server protocol and read the additional options from the odbc section in the
my.cnf file.
21.10.3.50. mysql_ping()
int mysql_ping(MYSQL *mysql)
Description
Checks whether the connection to the server is working. If the connection has gone down and auto-reconnect is enabled an attempt to
reconnect is made. If the connection is down and auto-reconnect is disabled, mysql_ping() returns an error.
Auto-reconnect is disabled by default. To enable it, call mysql_options() with the MYSQL_OPT_RECONNECT option. For details,
see Section 21.10.3.49, mysql_options().
mysql_ping() can be used by clients that remain idle for a long while, to check whether the server has closed the connection and re-
connect if necessary.
If mysql_ping()) does cause a reconnect, there is no explicit indication of it. To determine whether a reconnect occurs, call
mysql_thread_id() to get the original connection identifier before calling mysql_ping(), and then call
mysql_thread_id() again to see whether the identifier has changed.
If reconnect occurs, some characteristics of the connection will have been reset. For details about these characteristics, see Sec-
tion 21.10.11, Controlling Automatic Reconnection Behavior.
Return Values
Zero if the connection to the server is alive. Nonzero if an error occurred. A nonzero return does not indicate whether the MySQL server
itself is down; the connection might be broken for other reasons such as network problems.
Errors
Connectors and APIs
2372
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.51. mysql_query()
int mysql_query(MYSQL *mysql, const char *stmt_str)
Description
Executes the SQL statement pointed to by the null-terminated string stmt_str. Normally, the string must consist of a single SQL
statement and you should not add a terminating semicolon (;) or \g to the statement. If multiple-statement execution has been en-
abled, the string can contain several statements separated by semicolons. See Section 21.10.12, C API Support for Multiple Statement
Execution.
mysql_query() cannot be used for statements that contain binary data; you must use mysql_real_query() instead. (Binary
data may contain the \0 character, which mysql_query() interprets as the end of the statement string.)
If you want to know whether the statement should return a result set, you can use mysql_field_count() to check for this. See
Section 21.10.3.22, mysql_field_count().
Return Values
Zero if the statement was successful. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.52. mysql_real_connect()
MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char
*passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long cli-
ent_flag)
Description
mysql_real_connect() attempts to establish a connection to a MySQL database engine running on host.
mysql_real_connect() must complete successfully before you can execute any other API functions that require a valid MYSQL
connection handle structure.
Connectors and APIs
2373
The parameters are specified as follows:
The first parameter should be the address of an existing MYSQL structure. Before calling mysql_real_connect() you must
call mysql_init() to initialize the MYSQL structure. You can change a lot of connect options with the mysql_options()
call. See Section 21.10.3.49, mysql_options().
The value of host may be either a host name or an IP address. If host is NULL or the string "localhost", a connection to the
local host is assumed: For Windows, the client connects using a shared-memory connection, if the server has shared-memory con-
nections enabled. Otherwise, TCP/IP is used. For Unix, the client connects using a Unix socket file. For local connections, you can
also influence the type of connection to use with the MYSQL_OPT_PROTOCOL or MYSQL_OPT_NAMED_PIPE options to
mysql_options(). The type of connection must be supported by the server. For a host value of "." on Windows, the client
connects using a named pipe, if the server has named-pipe connections enabled. If named-pipe connections are not enabled, an error
occurs.
The user parameter contains the user's MySQL login ID. If user is NULL or the empty string "", the current user is assumed.
Under Unix, this is the current login name. Under Windows ODBC, the current user name must be specified explicitly. See the My-
ODBC section of Chapter 21, Connectors and APIs.
The passwd parameter contains the password for user. If passwd is NULL, only entries in the user table for the user that have
a blank (empty) password field are checked for a match. This allows the database administrator to set up the MySQL privilege sys-
tem in such a way that users get different privileges depending on whether they have specified a password.
Note
Do not attempt to encrypt the password before calling mysql_real_connect(); password encryption is handled auto-
matically by the client API.
The user and passwd parameters use whatever character set has been configured for the MYSQL object. By default, this is lat-
in1, but can be changed by calling mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "charset_name") prior
to connecting.
db is the database name. If db is not NULL, the connection sets the default database to this value.
If port is not 0, the value is used as the port number for the TCP/IP connection. Note that the host parameter determines the type
of the connection.
If unix_socket is not NULL, the string specifies the socket or named pipe that should be used. Note that the host parameter de-
termines the type of the connection.
The value of client_flag is usually 0, but can be set to a combination of the following flags to enable certain features.
Flag Name Flag Description
CLIENT_COMPRESS Use compression protocol.
CLIENT_FOUND_ROWS Return the number of found (matched) rows, not the number of changed rows.
CLIENT_IGNORE_SIGPIPE Prevents the client library from installing a SIGPIPE signal handler. This can be used
to avoid conflicts with a handler that the application has already installed.
CLIENT_IGNORE_SPACE Allow spaces after function names. Makes all functions names reserved words.
CLIENT_INTERACTIVE Allow interactive_timeout seconds (instead of wait_timeout seconds) of
inactivity before closing the connection. The client's session wait_timeout variable
is set to the value of the session interactive_timeout variable.
CLIENT_LOCAL_FILES Enable LOAD DATA LOCAL handling.
CLIENT_MULTI_RESULTS Tell the server that the client can handle multiple result sets from multiple-statement
executions or stored procedures. This flag is automatically enabled if CLI-
ENT_MULTI_STATEMENTS is enabled. See the note following this table for more in-
formation about this flag.
CLIENT_MULTI_STATEMENTS Tell the server that the client may send multiple statements in a single string (separated
by ;). If this flag is not set, multiple-statement execution is disabled. See the note
following this table for more information about this flag.
CLIENT_NO_SCHEMA Don't allow the db_name.tbl_name.col_name syntax. This is for ODBC. It
causes the parser to generate an error if you use that syntax, which is useful for trap-
Connectors and APIs
2374
ping bugs in some ODBC programs.
CLIENT_ODBC Unused.
CLIENT_SSL Use SSL (encrypted protocol). This option should not be set by application programs;
it is set internally in the client library. Instead, use mysql_ssl_set() before calling
mysql_real_connect().
CLIENT_REMEMBER_OPTIONS Remember options specified by calls to mysql_options(). Without this option, if
mysql_real_connect() fails, you must repeat the mysql_options() calls
before trying to connect again. With this option, the mysql_options() calls need
not be repeated.
If your program uses CALL statements to execute stored procedures, the CLIENT_MULTI_RESULTS flag must be enabled. This is be-
cause each CALL returns a result to indicate the call status, in addition to any result sets that might be returned by statements executed
within the procedure. Because CALL can return multiple results, you should process them using a loop that calls
mysql_next_result() to determine whether there are more results.
CLIENT_MULTI_RESULTS can be enabled when you call mysql_real_connect(), either explicitly by passing the CLI-
ENT_MULTI_RESULTS flag itself, or implicitly by passing CLIENT_MULTI_STATEMENTS (which also enables CLI-
ENT_MULTI_RESULTS).
If you enable CLIENT_MULTI_STATEMENTS or CLIENT_MULTI_RESULTS, you should process the result for every call to
mysql_query() or mysql_real_query() by using a loop that calls mysql_next_result() to determine whether there are
more results. For an example, see Section 21.10.12, C API Support for Multiple Statement Execution.
For some parameters, it is possible to have the value taken from an option file rather than from an explicit value in the
mysql_real_connect() call. To do this, call mysql_options() with the MYSQL_READ_DEFAULT_FILE or
MYSQL_READ_DEFAULT_GROUP option before calling mysql_real_connect(). Then, in the mysql_real_connect()
call, specify the no-value value for each parameter to be read from an option file:
For host, specify a value of NULL or the empty string ("").
For user, specify a value of NULL or the empty string.
For passwd, specify a value of NULL. (For the password, a value of the empty string in the mysql_real_connect() call can-
not be overridden in an option file, because the empty string indicates explicitly that the MySQL account must have an empty pass-
word.)
For db, specify a value of NULL or the empty string.
For port, specify a value of 0.
For unix_socket, specify a value of NULL.
If no value is found in an option file for a parameter, its default value is used as indicated in the descriptions given earlier in this section.
Return Values
A MYSQL* connection handle if the connection was successful, NULL if the connection was unsuccessful. For a successful connection,
the return value is the same as the value of the first parameter.
Errors
CR_CONN_HOST_ERROR
Failed to connect to the MySQL server.
CR_CONNECTION_ERROR
Failed to connect to the local MySQL server.
Connectors and APIs
2375
CR_IPSOCK_ERROR
Failed to create an IP socket.
CR_OUT_OF_MEMORY
Out of memory.
CR_SOCKET_CREATE_ERROR
Failed to create a Unix socket.
CR_UNKNOWN_HOST
Failed to find the IP address for the host name.
CR_VERSION_ERROR
A protocol mismatch resulted from attempting to connect to a server with a client library that uses a different protocol version.
CR_NAMEDPIPEOPEN_ERROR
Failed to create a named pipe on Windows.
CR_NAMEDPIPEWAIT_ERROR
Failed to wait for a named pipe on Windows.
CR_NAMEDPIPESETSTATE_ERROR
Failed to get a pipe handler on Windows.
CR_SERVER_LOST
If connect_timeout > 0 and it took longer than connect_timeout seconds to connect to the server or if the server died
while executing the init-command.
Example
MYSQL mysql;
mysql_init(&mysql);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"your_prog_name");
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",
mysql_error(&mysql));
}
By using mysql_options() the MySQL library reads the [client] and [your_prog_name] sections in the my.cnf file
which ensures that your program works, even if someone has set up MySQL in some nonstandard way.
Note that upon connection, mysql_real_connect() sets the reconnect flag (part of the MYSQL structure) to a value of 1 in
versions of the API older than 5.0.3, or 0 in newer versions. A value of 1 for this flag indicates that if a statement cannot be performed
because of a lost connection, to try reconnecting to the server before giving up. You can use the MYSQL_OPT_RECONNECT option to
mysql_options() to control reconnection behavior.
21.10.3.53. mysql_real_escape_string()
unsigned long mysql_real_escape_string(MYSQL *mysql, char *to, const char *from, unsigned
long length)
Note that mysql must be a valid, open connection. This is needed because the escaping depends on the character set in use by the serv-
er.
Description
Connectors and APIs
2376
This function is used to create a legal SQL string that you can use in an SQL statement. See Section 8.1.1, Strings.
The string in from is encoded to an escaped SQL string, taking into account the current character set of the connection. The result is
placed in to and a terminating null byte is appended. Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z
(see Section 8.1, Literal Values). (Strictly speaking, MySQL requires only that backslash and the quote character used to quote the
string in the query be escaped. This function quotes the other characters to make them easier to read in log files.)
The string pointed to by from must be length bytes long. You must allocate the to buffer to be at least length*2+1 bytes long.
(In the worst case, each character may need to be encoded as using two bytes, and you need room for the terminating null byte.) When
mysql_real_escape_string() returns, the contents of to is a null-terminated string. The return value is the length of the en-
coded string, not including the terminating null character.
If you need to change the character set of the connection, you should use the mysql_set_character_set() function rather than
executing a SET NAMES (or SET CHARACTER SET) statement. mysql_set_character_set() works like SET NAMES but
also affects the character set used by mysql_real_escape_string(), which SET NAMES does not.
Example
char query[1000],*end;
end = strmov(query,"INSERT INTO test_table values(");
*end++ = '\'';
end += mysql_real_escape_string(&mysql, end,"What is this",12);
*end++ = '\'';
*end++ = ',';
*end++ = '\'';
end += mysql_real_escape_string(&mysql, end,"binary data: \0\r\n",16);
*end++ = '\'';
*end++ = ')';
if (mysql_real_query(&mysql,query,(unsigned int) (end - query)))
{
fprintf(stderr, "Failed to insert row, Error: %s\n",
mysql_error(&mysql));
}
The strmov() function used in the example is included in the mysqlclient library and works like strcpy() but returns a point-
er to the terminating null of the first parameter.
Return Values
The length of the value placed into to, not including the terminating null character.
Errors
None.
21.10.3.54. mysql_real_query()
int mysql_real_query(MYSQL *mysql, const char *stmt_str, unsigned long length)
Description
Executes the SQL statement pointed to by stmt_str, which should be a string length bytes long. Normally, the string must consist
of a single SQL statement and you should not add a terminating semicolon (;) or \g to the statement. If multiple-statement execution
has been enabled, the string can contain several statements separated by semicolons. See Section 21.10.12, C API Support for Multiple
Statement Execution.
mysql_query() cannot be used for statements that contain binary data; you must use mysql_real_query() instead. (Binary
data may contain the \0 character, which mysql_query() interprets as the end of the statement string.) In addition,
mysql_real_query() is faster than mysql_query() because it does not call strlen() on the statement string.
If you want to know whether the statement should return a result set, you can use mysql_field_count() to check for this. See
Section 21.10.3.22, mysql_field_count().
Return Values
Zero if the statement was successful. Nonzero if an error occurred.
Connectors and APIs
2377
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.55. mysql_refresh()
int mysql_refresh(MYSQL *mysql, unsigned int options)
Description
This function flushes tables or caches, or resets replication server information. The connected user must have the RELOAD privilege.
The options argument is a bit mask composed from any combination of the following values. Multiple values can be OR'ed together
to perform multiple operations with a single call.
REFRESH_GRANT
Refresh the grant tables, like FLUSH PRIVILEGES.
REFRESH_LOG
Flush the logs, like FLUSH LOGS.
REFRESH_TABLES
Flush the table cache, like FLUSH TABLES.
REFRESH_HOSTS
Flush the host cache, like FLUSH HOSTS.
REFRESH_STATUS
Reset status variables, like FLUSH STATUS.
REFRESH_THREADS
Flush the thread cache.
REFRESH_SLAVE
On a slave replication server, reset the master server information and restart the slave, like RESET SLAVE.
REFRESH_MASTER
On a master replication server, remove the binary log files listed in the binary log index and truncate the index file, like RESET
MASTER.
Return Values
Connectors and APIs
2378
Zero for success. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.56. mysql_reload()
int mysql_reload(MYSQL *mysql)
Description
Asks the MySQL server to reload the grant tables. The connected user must have the RELOAD privilege.
This function is deprecated. It is preferable to use mysql_query() to issue an SQL FLUSH PRIVILEGES statement instead.
Return Values
Zero for success. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.57. mysql_rollback()
my_bool mysql_rollback(MYSQL *mysql)
Description
Rolls back the current transaction.
The action of this function is subject to the value of the completion_type system variable. In particular, if the value of comple-
tion_type is 2, the server performs a release after terminating a transaction and closes the client connection. The client program
Connectors and APIs
2379
should call mysql_close() to close the connection from the client side.
Return Values
Zero if successful. Nonzero if an error occurred.
Errors
None.
21.10.3.58. mysql_row_seek()
MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET offset)
Description
Sets the row cursor to an arbitrary row in a query result set. The offset value is a row offset that should be a value returned from
mysql_row_tell() or from mysql_row_seek(). This value is not a row number; if you want to seek to a row within a result
set by number, use mysql_data_seek() instead.
This function requires that the result set structure contains the entire result of the query, so mysql_row_seek() may be used only in
conjunction with mysql_store_result(), not with mysql_use_result().
Return Values
The previous value of the row cursor. This value may be passed to a subsequent call to mysql_row_seek().
Errors
None.
21.10.3.59. mysql_row_tell()
MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES *result)
Description
Returns the current position of the row cursor for the last mysql_fetch_row(). This value can be used as an argument to
mysql_row_seek().
You should use mysql_row_tell() only after mysql_store_result(), not after mysql_use_result().
Return Values
The current offset of the row cursor.
Errors
None.
21.10.3.60. mysql_select_db()
int mysql_select_db(MYSQL *mysql, const char *db)
Description
Causes the database specified by db to become the default (current) database on the connection specified by mysql. In subsequent
queries, this database is the default for table references that do not include an explicit database specifier.
mysql_select_db() fails unless the connected user can be authenticated as having permission to use the database.
Return Values
Zero for success. Nonzero if an error occurred.
Errors
Connectors and APIs
2380
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.61. mysql_set_character_set()
int mysql_set_character_set(MYSQL *mysql, const char *csname)
Description
This function is used to set the default character set for the current connection. The string csname specifies a valid character set name.
The connection collation becomes the default collation of the character set. This function works like the SET NAMES statement, but
also sets the value of mysql->charset, and thus affects the character set used by mysql_real_escape_string()
Return Values
Zero for success. Nonzero if an error occurred.
Example
MYSQL mysql;
mysql_init(&mysql);
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",
mysql_error(&mysql));
}
if (!mysql_set_character_set(&mysql, "utf8"))
{
printf("New client character set: %s\n",
mysql_character_set_name(&mysql));
}
21.10.3.62. mysql_set_local_infile_default()
void mysql_set_local_infile_default(MYSQL *mysql);
Description
Sets the LOAD LOCAL DATA INFILE handler callback functions to the defaults used internally by the C client library. The library
calls this function automatically if mysql_set_local_infile_handler() has not been called or does not supply valid func-
tions for each of its callbacks.
The mysql_set_local_infile_default() function was added in MySQL 4.1.2.
Return Values
None.
Errors
None.
Connectors and APIs
2381
21.10.3.63. mysql_set_local_infile_handler()
void mysql_set_local_infile_handler(MYSQL *mysql, int (*local_infile_init)(void **, const
char *, void *), int (*local_infile_read)(void *, char *, unsigned int), void
(*local_infile_end)(void *), int (*local_infile_error)(void *, char*, unsigned int), void
*userdata);
Description
This function installs callbacks to be used during the execution of LOAD DATA LOCAL INFILE statements. It enables application
programs to exert control over local (client-side) data file reading. The arguments are the connection handler, a set of pointers to call-
back functions, and a pointer to a data area that the callbacks can use to share information.
To use mysql_set_local_infile_handler(), you must write the following callback functions:
int
local_infile_init(void **ptr, const char *filename, void *userdata);
The initialization function. This is called once to do any setup necessary, open the data file, allocate data structures, and so forth. The
first void** argument is a pointer to a pointer. You can set the pointer (that is, *ptr) to a value that will be passed to each of the oth-
er callbacks (as a void*). The callbacks can use this pointed-to value to maintain state information. The userdata argument is the
same value that is passed to mysql_set_local_infile_handler().
The initialization function should return zero for success, nonzero for an error.
int
local_infile_read(void *ptr, char *buf, unsigned int buf_len);
The data-reading function. This is called repeatedly to read the data file. buf points to the buffer where the read data should be stored,
and buf_len is the maximum number of bytes that the callback can read and store in the buffer. (It can read fewer bytes, but should
not read more.)
The return value is the number of bytes read, or zero when no more data could be read (this indicates EOF). Return a value less than
zero if an error occurs.
void
local_infile_end(void *ptr)
The termination function. This is called once after local_infile_read() has returned zero (EOF) or an error. This function
should deallocate any memory allocated by local_infile_init() and perform any other cleanup necessary. It is invoked even if
the initalization function returns an error.
int
local_infile_error(void *ptr,
char *error_msg,
unsigned int error_msg_len);
The error-handling function. This is called to get a textual error message to return to the user in case any of your other functions returns
an error. error_msg points to the buffer into which the message should be written, and error_msg_len is the length of the buffer.
The message should be written as a null-terminated string, so the message can be at most error_msg_len1 bytes long.
The return value is the error number.
Typically, the other callbacks store the error message in the data structure pointed to by ptr, so that local_infile_error() can
copy the message from there into error_msg.
After calling mysql_set_local_infile_handler() in your C code and passing pointers to your callback functions, you can
then issue a LOAD DATA LOCAL INFILE statement (for example, by using mysql_query()). The client library automatically in-
vokes your callbacks. The file name specified in LOAD DATA LOCAL INFILE will be passed as the second parameter to the loc-
al_infile_init() callback.
The mysql_set_local_infile_handler() function was added in MySQL 4.1.2.
Return Values
Connectors and APIs
2382
None.
Errors
None.
21.10.3.64. mysql_set_server_option()
int mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option)
Description
Enables or disables an option for the connection. option can have one of the following values.
MYSQL_OPTION_MULTI_STATEMENTS_ON Enable multiple-statement support
MYSQL_OPTION_MULTI_STATEMENTS_OFF Disable multiple-statement support
If you enable multiple-statement support, you should retrieve results from calls to mysql_query() or mysql_real_query() by
using a loop that calls mysql_next_result() to determine whether there are more results. For an example, see Section 21.10.12,
C API Support for Multiple Statement Execution.
Enabling multiple-statement support with MYSQL_OPTION_MULTI_STATEMENTS_ON does not have quite the same effect as en-
abling it by passing the CLIENT_MULTI_STATEMENTS flag to mysql_real_connect(): CLIENT_MULTI_STATEMENTS also
enables CLIENT_MULTI_RESULTS. If you are using the CALL SQL statement in your programs, multiple-result support must be en-
abled; this means that MYSQL_OPTION_MULTI_STATEMENTS_ON by itself is insufficient to allow the use of CALL.
Return Values
Zero for success. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
ER_UNKNOWN_COM_ERROR
The server didn't support mysql_set_server_option() (which is the case that the server is older than 4.1.1) or the server
didn't support the option one tried to set.
21.10.3.65. mysql_shutdown()
int mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
Description
Asks the database server to shut down. The connected user must have the SHUTDOWN privilege. MySQL 5.1 servers support only one
type of shutdown; shutdown_level must be equal to SHUTDOWN_DEFAULT. Additional shutdown levels are planned to make it
possible to choose the desired level. Dynamically linked executables which have been compiled with older versions of the libmysql-
client headers and call mysql_shutdown() need to be used with the old libmysqlclient dynamic library.
The shutdown process is described in Section 5.1.11, The Shutdown Process.
Connectors and APIs
2383
Return Values
Zero for success. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.66. mysql_sqlstate()
const char *mysql_sqlstate(MYSQL *mysql)
Description
Returns a null-terminated string containing the SQLSTATE error code for the most recently executed SQL statement. The error code
consists of five characters. '00000' means no error. The values are specified by ANSI SQL and ODBC. For a list of possible val-
ues, see Appendix B, Errors, Error Codes, and Common Problems.
SQLSTATE values returned by mysql_sqlstate() differ from MySQL-specific error numbers returned by mysql_errno().
For example, the mysql client program displays errors using the following format, where 1146 is the mysql_errno() value and
'42S02' is the corresponding mysql_sqlstate() value:
shell> SELECT * FROM no_such_table;
ERROR 1146 (42S02): Table 'test.no_such_table' doesn't exist
Not all MySQL error numbers are mapped to SQLSTATE error codes. The value 'HY000' (general error) is used for unmapped error
numbers.
If you call mysql_sqlstate() after mysql_real_connect() fails, mysql_sqlstate() might not return a useful value.
For example, this happens if a host is blocked by the server and the connection is closed without any SQLSTATE value being sent to
the client.
Return Values
A null-terminated character string containing the SQLSTATE error code.
See Also
See Section 21.10.3.14, mysql_errno(), Section 21.10.3.15, mysql_error(), and Section 21.10.7.26,
mysql_stmt_sqlstate().
21.10.3.67. mysql_ssl_set()
my_bool mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca,
const char *capath, const char *cipher)
Description
mysql_ssl_set() is used for establishing secure connections using SSL. It must be called before mysql_real_connect().
Connectors and APIs
2384
mysql_ssl_set() does nothing unless SSL support is enabled in the client library.
mysql is the connection handler returned from mysql_init(). The other parameters are specified as follows:
key is the path name to the key file.
cert is the path name to the certificate file.
ca is the path name to the certificate authority file.
capath is the path name to a directory that contains trusted SSL CA certificates in pem format.
cipher is a list of allowable ciphers to use for SSL encryption.
Any unused SSL parameters may be given as NULL.
Return Values
This function always returns 0. If SSL setup is incorrect, mysql_real_connect() returns an error when you attempt to connect.
21.10.3.68. mysql_stat()
const char *mysql_stat(MYSQL *mysql)
Description
Returns a character string containing information similar to that provided by the mysqladmin status command. This includes up-
time in seconds and the number of running threads, questions, reloads, and open tables.
Return Values
A character string describing the server status. NULL if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.69. mysql_store_result()
MYSQL_RES *mysql_store_result(MYSQL *mysql)
Description
After invoking mysql_query() or mysql_real_query(), you must call mysql_store_result() or
mysql_use_result() for every statement that successfully produces a result set (SELECT, SHOW, DESCRIBE, EXPLAIN, CHECK
TABLE, and so forth). You must also call mysql_free_result() after you are done with the result set.
You don't have to call mysql_store_result() or mysql_use_result() for other statements, but it does not do any harm or
Connectors and APIs
2385
cause any notable performance degradation if you call mysql_store_result() in all cases. You can detect whether the statement
has a result set by checking whether mysql_store_result() returns a nonzero value (more about this later on).
If you enable multiple-statement support, you should retrieve results from calls to mysql_query() or mysql_real_query() by
using a loop that calls mysql_next_result() to determine whether there are more results. For an example, see Section 21.10.12,
C API Support for Multiple Statement Execution.
If you want to know whether a statement should return a result set, you can use mysql_field_count() to check for this. See Sec-
tion 21.10.3.22, mysql_field_count().
mysql_store_result() reads the entire result of a query to the client, allocates a MYSQL_RES structure, and places the result into
this structure.
mysql_store_result() returns a null pointer if the statement didn't return a result set (for example, if it was an INSERT state-
ment).
mysql_store_result() also returns a null pointer if reading of the result set failed. You can check whether an error occurred by
checking whether mysql_error() returns a nonempty string, mysql_errno() returns nonzero, or mysql_field_count()
returns zero.
An empty result set is returned if there are no rows returned. (An empty result set differs from a null pointer as a return value.)
After you have called mysql_store_result() and gotten back a result that isn't a null pointer, you can call
mysql_num_rows() to find out how many rows are in the result set.
You can call mysql_fetch_row() to fetch rows from the result set, or mysql_row_seek() and mysql_row_tell() to ob-
tain or set the current row position within the result set.
See Section 21.10.10.1, Why mysql_store_result() Sometimes Returns NULL After mysql_query() Returns Success.
Return Values
A MYSQL_RES result structure with the results. NULL (0) if an error occurred.
Errors
mysql_store_result() resets mysql_error() and mysql_errno() if it succeeds.
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.70. mysql_thread_id()
unsigned long mysql_thread_id(MYSQL *mysql)
Description
Returns the thread ID of the current connection. This value can be used as an argument to mysql_kill() to kill the thread.
Connectors and APIs
2386
If the connection is lost and you reconnect with mysql_ping(), the thread ID changes. This means you should not get the thread ID
and store it for later. You should get it when you need it.
Return Values
The thread ID of the current connection.
Errors
None.
21.10.3.71. mysql_use_result()
MYSQL_RES *mysql_use_result(MYSQL *mysql)
Description
After invoking mysql_query() or mysql_real_query(), you must call mysql_store_result() or
mysql_use_result() for every statement that successfully produces a result set (SELECT, SHOW, DESCRIBE, EXPLAIN, CHECK
TABLE, and so forth). You must also call mysql_free_result() after you are done with the result set.
mysql_use_result() initiates a result set retrieval but does not actually read the result set into the client like
mysql_store_result() does. Instead, each row must be retrieved individually by making calls to mysql_fetch_row(). This
reads the result of a query directly from the server without storing it in a temporary table or local buffer, which is somewhat faster and
uses much less memory than mysql_store_result(). The client allocates memory only for the current row and a communication
buffer that may grow up to max_allowed_packet bytes.
On the other hand, you shouldn't use mysql_use_result() if you are doing a lot of processing for each row on the client side, or if
the output is sent to a screen on which the user may type a ^S (stop scroll). This ties up the server and prevent other threads from updat-
ing any tables from which the data is being fetched.
When using mysql_use_result(), you must execute mysql_fetch_row() until a NULL value is returned, otherwise, the un-
fetched rows are returned as part of the result set for your next query. The C API gives the error Commands out of sync; you
can't run this command now if you forget to do this!
You may not use mysql_data_seek(), mysql_row_seek(), mysql_row_tell(), mysql_num_rows(), or
mysql_affected_rows() with a result returned from mysql_use_result(), nor may you issue other queries until
mysql_use_result() has finished. (However, after you have fetched all the rows, mysql_num_rows() accurately returns the
number of rows fetched.)
You must call mysql_free_result() once you are done with the result set.
When using the libmysqld embedded server, the memory benefits are essentially lost because memory usage incrementally increases
with each row retrieved until mysql_free_result() is called.
Return Values
A MYSQL_RES result structure. NULL if an error occurred.
Errors
mysql_use_result() resets mysql_error() and mysql_errno() if it succeeds.
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
Connectors and APIs
2387
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.3.72. mysql_warning_count()
unsigned int mysql_warning_count(MYSQL *mysql)
Description
Returns the number of warnings generated during execution of the previous SQL statement.
Return Values
The warning count.
Errors
None.
21.10.4. C API Prepared Statements
The MySQL client/server protocol provides for the use of prepared statements. This capability uses the MYSQL_STMT statement hand-
ler data structure returned by the mysql_stmt_init() initialization function. Prepared execution is an efficient way to execute a
statement more than once. The statement is first parsed to prepare it for execution. Then it is executed one or more times at a later time,
using the statement handle returned by the initialization function.
Prepared execution is faster than direct execution for statements executed more than once, primarily because the query is parsed only
once. In the case of direct execution, the query is parsed every time it is executed. Prepared execution also can provide a reduction of
network traffic because for each execution of the prepared statement, it is necessary only to send the data for the parameters.
Prepared statements might not provide a performance increase in some situations. For best results, test your application both with pre-
pared and nonprepared statements and choose whichever yields best performance.
Another advantage of prepared statements is that it uses a binary protocol that makes data transfer between client and server more effi-
cient.
The following statements can be used as prepared statements: CALL, CREATE TABLE, DELETE, DO, INSERT, REPLACE, SELECT,
SET, UPDATE, and most SHOW statements.
As of MySQL 5.1.10, the following additional statements are supported:
ANALYZE TABLE
OPTIMIZE TABLE
REPAIR TABLE
As of MySQL 5.1.12, the following additional statements are supported:
CACHE INDEX
CHANGE MASTER
CHECKSUM {TABLE | TABLES}
{CREATE | RENAME | DROP} DATABASE
{CREATE | RENAME | DROP} USER
FLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES
| LOGS | STATUS | MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES}
GRANT
REVOKE
KILL
LOAD INDEX INTO CACHE
RESET {MASTER | SLAVE | QUERY CACHE}
SHOW BINLOG EVENTS
SHOW CREATE {PROCEDURE | FUNCTION | EVENT | TABLE | VIEW}
SHOW {AUTHORS | CONTRIBUTORS | WARNINGS | ERRORS}
SHOW {MASTER | BINARY} LOGS
SHOW {MASTER | SLAVE} STATUS
Connectors and APIs
2388
SLAVE {START | STOP}
INSTALL PLUGIN
UNINSTALL PLUGIN
Other statements are not yet supported in MySQL 5.1.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about using prepared statements in the Knowledge
Base article, How can I create server-side prepared statements?. Access to the MySQL Knowledge Base col-
lection of articles is one of the advantages of subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.10.5. C API Prepared Statement Data types
Prepared statements use several data structures:
To prepare a statement, pass the statement string to mysql_stmt_init(), which returns a pointer to a MYSQL_STMT data struc-
ture.
To provide input parameters for a prepared statement, set up MYSQL_BIND structures and pass them to
mysql_stmt_bind_param(). To receive output column values, set up MYSQL_BIND structures and pass them to
mysql_stmt_bind_result().
The MYSQL_TIME structure is used to transfer temporal data in both directions.
The following discussion describes the prepared statement data types in detail.
MYSQL_STMT
This structure represents a prepared statement. A statement is created by calling mysql_stmt_init(), which returns a statement
handle (that is, a pointer to a MYSQL_STMT). The handle is used for all subsequent operations with the statement until you close it
with mysql_stmt_close(), at which point the handle becomes invalid.
The MYSQL_STMT structure has no members that are intended for application use. Also, you should not try to make a copy of a
MYSQL_STMT structure. There is no guarantee that such a copy will be usable.
Multiple statement handles can be associated with a single connection. The limit on the number of handles depends on the available
system resources.
MYSQL_BIND
This structure is used both for statement input (data values sent to the server) and output (result values returned from the server):
For input, MYSQL_BIND is used with mysql_stmt_bind_param() to bind parameter data values to buffers for use by
mysql_stmt_execute().
For output, MYSQL_BIND is used with mysql_stmt_bind_result() to bind result set buffers for use in fetching rows
with mysql_stmt_fetch().
To use a MYSQL_BIND structure, you should zero its contents to initialize it, and then set its members appropriately. For example,
to declare and initialize an array of three MYSQL_BIND structures, use this code:
MYSQL_BIND bind[3];
memset(bind, 0, sizeof(bind));
The MYSQL_BIND structure contains the following members for use by application programs. For several of the members, the man-
ner of use depends on whether the structure is used for input or output.
enum enum_field_types buffer_type
The type of the buffer. This member indicates the data type of the C language variable that you are binding to the statement
parameter. The allowable buffer_type values are listed later in this section. For input, buffer_type indicates the type of
Connectors and APIs
2389
the variable containing the value that you will send to the server. For output, it indicates the type of the variable into which you
want a value received from the server to be stored.
void *buffer
A pointer to the buffer to be used for data transfer. This is the address of a variable.
For input, buffer is a pointer to the variable in which a statement parameter's data value is stored. When you call
mysql_stmt_execute(), MySQL takes the value that you have stored in the variable and uses it in place of the corres-
ponding parameter marker in the statement.
For output, buffer is a pointer to the variable in which to return a result set column value. When you call
mysql_stmt_fetch(), MySQL returns a column value and stores it in this variable. You can access the value when the call
returns.
To minimize the need for MySQL to perform type conversions between C language values on the client side and SQL values on
the server side, use variables that have types similar to those of the corresponding SQL values. For numeric data types, buffer
should point to a variable of the proper numeric C type. (For char or integer variables, you should also indicate whether the
variable has the unsigned attribute by setting the is_unsigned member, described later in this list.) For character
(nonbinary) and binary string data types, buffer should point to a character buffer. For date and time data types, buffer
should point to a MYSQL_TIME structure.
See the notes about type conversions later in the section.
unsigned long buffer_length
The actual size of *buffer in bytes. This indicates the maximum amount of data that can be stored in the buffer. For character
and binary C data, the buffer_length value specifies the length of *buffer when used with
mysql_stmt_bind_param() to specify input values, or the maximum number of output data bytes that can be fetched into
the buffer when used with mysql_stmt_bind_result().
unsigned long *length
A pointer to an unsigned long variable that indicates the actual number of bytes of data stored in *buffer. length is
used for character or binary C data.
For input parameter data binding, length points to an unsigned long variable that indicates the actual length of the para-
meter value stored in *buffer; this is used by mysql_stmt_execute().
For output value binding, the return value of mysql_stmt_fetch() determines the interpretation of the length:
If mysql_stmt_fetch() returns 0, *length indicates the actual length of the parameter value.
If mysql_stmt_fetch() returns MYSQL_DATA_TRUNCATED, *length indicates the nontruncated length of the para-
meter value. In this case, the minimum of *length and buffer_length indicates the actual length of the value.
length is ignored for numeric and temporal data types because the length of the data value is determined by the buf-
fer_type value.
If you need to be able to determine the length of a returned value before fetching it with mysql_stmt_fetch(), see Sec-
tion 21.10.7.11, mysql_stmt_fetch(), for some strategies.
my_bool *is_null
This member points to a my_bool variable that is true if a value is NULL, false if it is not NULL. For input, set *is_null to
true to indicate that you are passing a NULL value as a statement parameter.
The reason that is_null is not a boolean scalar but is instead a pointer to a boolean scalar is to provide flexibility in how you
specify NULL values:
If your data values are always NULL, use MYSQL_TYPE_NULL as the buffer_type value when you bind the column.
The other members do not matter.
If your data values are always NOT NULL, set the other members appropriately for the variable you are binding, and set
is_null = (my_bool*) 0.
Connectors and APIs
2390
In all other cases, set the other members appriopriately, and set is_null to the address of a my_bool variable. Set that
variable's value to true or false appropriately between executions to indicate whether data values are NULL or NOT NULL,
respectively.
For output, the value pointed to by is_null is set to true after you fetch a row if the result set column value returned from the
statement is NULL.
my_bool is_unsigned
This member is used for C variables with data types that can be unsigned (char, short int, int, long long int).
Set is_unsigned to true if the variable pointed to by buffer is unsigned and false otherwise. For example, if you bind a
signed char variable to buffer, specify a type code of MYSQL_TYPE_TINY and set is_unsigned to false. If you bind
an unsigned char instead, the type code is the same but is_unsigned should be true. (For char, it is not defined wheth-
er it is signed or unsigned, so it is best to be explicit about signedness by using signed char or unsigned char.)
is_unsigned applies only to the C language variable on the client side. It indicates nothing about the signedness of the cor-
responding SQL value on the server side. For example, if you use an int variable to supply a value for a BIGINT UNSIGNED
column, is_unsigned should be false because int is a signed type. If you use an unsigned int variable to supply a
value for a BIGINT column, is_unsigned should be true because unsigned int is an unsigned type. MySQL performs
the proper conversion between signed and unsigned values in both directions, although a warning occurs if truncation results.
my_bool *error
For output, set this member to point to a my_bool variable to have truncation information for the parameter stored there after a
row fetching operation. (Truncation reporting is enabled by default, but can be controlled by calling mysql_options() with
the MYSQL_REPORT_DATA_TRUNCATION option.) When truncation reporting is enabled, mysql_stmt_fetch() returns
MYSQL_DATA_TRUNCATED and *error is true in the MYSQL_BIND structures for parameters in which truncation occurred.
Truncation indicates loss of sign or significant digits, or that a string was too long to fit in a column.
MYSQL_TIME
This structure is used to send and receive DATE, TIME, DATETIME, and TIMESTAMP data directly to and from the server. Set the
buffer_type member of a MYSQL_BIND structure to one of the temporal types (MYSQL_TYPE_TIME, MYSQL_TYPE_DATE,
MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP), and set the buffer member to point to a MYSQL_TIME structure.
The MYSQL_TIME structure contains the members listed in the following table.
Member Description
unsigned int year The year
unsigned int month The month of the year
unsigned int day The day of the month
unsigned int hour The hour of the day
unsigned int minute The minute of the hour
unsigned int second The second of the minute
my_bool neg A boolean flag to indicate whether the time is negative
unsigned long second_part The fractional part of the second in microseconds; currently unused
Only those parts of a MYSQL_TIME structure that apply to a given type of temporal value are used. The year, month, and day
elements are used for DATE, DATETIME, and TIMESTAMP values. The hour, minute, and second elements are used for TIME,
DATETIME, and TIMESTAMP values. See Section 21.10.14, C API Prepared Statement Handling of Date and Time Values.
The following table shows the allowable values that may be specified in the buffer_type member of MYSQL_BIND structures for
input values. The value should be chosen according to the data type of the C language variable that you are binding. If the variable is
unsigned, you should also set the is_unsigned member to true. The table shows the C variable types that you can use, the corres-
ponding type codes, and the SQL data types for which the supplied value can be used without conversion.
Input Variable C Type buffer_type Value SQL Type of Destination Value
Connectors and APIs
2391
signed char MYSQL_TYPE_TINY TINYINT
short int MYSQL_TYPE_SHORT SMALLINT
int MYSQL_TYPE_LONG INT
long long int MYSQL_TYPE_LONGLONG BIGINT
float MYSQL_TYPE_FLOAT FLOAT
double MYSQL_TYPE_DOUBLE DOUBLE
MYSQL_TIME MYSQL_TYPE_TIME TIME
MYSQL_TIME MYSQL_TYPE_DATE DATE
MYSQL_TIME MYSQL_TYPE_DATETIME DATETIME
MYSQL_TIME MYSQL_TYPE_TIMESTAMP TIMESTAMP
char[] MYSQL_TYPE_STRING (for nonbinary data) TEXT, CHAR, VARCHAR
char[] MYSQL_TYPE_BLOB (for binary data) BLOB, BINARY, VARBINARY
MYSQL_TYPE_NULL NULL
The use of MYSQL_TYPE_NULL is described earlier in connection with the is_null member.
The following table shows the allowable values that may be specified in the buffer_type member of MYSQL_BIND structures for
output values. The value should be chosen according to the data type of the C language variable that you are binding. If the variable is
unsigned, you should also set the is_unsigned member to true. The table shows the SQL types of received values, the corres-
ponding type code that such values have in result set metadata, and the recommended C language data types to bind to the
MYSQL_BIND structure to receive the SQL values without conversion.
If there is a mismatch between the C variable type on the client side and the corresponding SQL value on the server side, MySQL per-
forms implicit type conversions in both directions.
SQL Type of Received Value buffer_type Value Output Variable C Type
TINYINT MYSQL_TYPE_TINY signed char
SMALLINT MYSQL_TYPE_SHORT short int
MEDIUMINT MYSQL_TYPE_INT24 int
INT MYSQL_TYPE_LONG int
BIGINT MYSQL_TYPE_LONGLONG long long int
FLOAT MYSQL_TYPE_FLOAT float
DOUBLE MYSQL_TYPE_DOUBLE double
DECIMAL MYSQL_TYPE_NEWDECIMAL char[]
YEAR MYSQL_TYPE_SHORT short int
TIME MYSQL_TYPE_TIME MYSQL_TIME
DATE MYSQL_TYPE_DATE MYSQL_TIME
DATETIME MYSQL_TYPE_DATETIME MYSQL_TIME
TIMESTAMP MYSQL_TYPE_TIMESTAMP MYSQL_TIME
CHAR, BINARY MYSQL_TYPE_STRING char[]
VARCHAR, VARBINARY MYSQL_TYPE_VAR_STRING char[]
TINYBLOB, TINYTEXT MYSQL_TYPE_TINY_BLOB char[]
BLOB, TEXT MYSQL_TYPE_BLOB char[]
MEDIUMBLOB, MEDIUMTEXT MYSQL_TYPE_MEDIUM_BLOB char[]
LONGBLOB, LONGTEXT MYSQL_TYPE_LONG_BLOB char[]
BIT MYSQL_TYPE_BIT char[]
MySQL knows the type code for the SQL value on the server side. The buffer_type value indicates the MySQL the type code of
Connectors and APIs
2392
the C variable that holds the value on the client side. The two codes together tell MySQL what conversion must be performed, if any.
Here are some examples:
If you use MYSQL_TYPE_LONG with an int variable to pass an integer value to the server that is to be stored into a FLOAT
column, MySQL converts the value to floating-point format before storing it.
If you fetch an SQL MEDIUMINT column value, but specify a buffer_type value of MYSQL_TYPE_LONGLONG and use a C
variable of type long long int as the destination buffer, MySQL will convert the MEDIUMINT value (which requires less than
8 bytes) for storage into the long long int (an 8-byte variable).
If you fetch a numeric column with a value of 255 into a char[4] character array and specify a buffer_type value of
MYSQL_TYPE_STRING, the resulting value in the array will be a 4-byte string containing '255\0'.
DECIMAL values are returned as strings, which is why the corresponding C type is char[]. DECIMAL values returned by the serv-
er correspond to the string representation of the original server-side value. For example, 12.345 is returned to the client as
'12.345'. If you specify MYSQL_TYPE_NEWDECIMAL and bind a string buffer to the MYSQL_BIND structure,
mysql_stmt_fetch() stores the value in the buffer without conversion. If instead you specify a numeric variable and type
code, mysql_stmt_fetch() converts the string-format DECIMAL value to numeric form.
For the MYSQL_TYPE_BIT type code, BIT values are returned into a string buffer (thus, the corresponding C type is char[]
here, too). The value represents a bit string that requires interpretation on the client side. To return the value as a type that is easier
to deal with, you can cause the value to be cast to integer using either of the following types of expressions:
SELECT bit_col + 0 FROM t
SELECT CAST(bit_col AS UNSIGNED) FROM t
To retrieve the value, bind an integer variable large enough to hold the value and specify the appropriate corresponding integer type
code.
Before binding variables to the MYSQL_BIND structures that are to be used for fetching column values, you can check the type codes
for each column of the result set. This might be desirable if you want to determine which variable types would be best to use to avoid
type conversions. To get the type codes, call mysql_stmt_result_metadata() after executing the prepared statement with
mysql_stmt_execute(). The metadata provides access to the type codes for the result set as described in Section 21.10.7.22,
mysql_stmt_result_metadata(), and Section 21.10.1, C API Data Types.
If you cause the max_length member of the MYSQL_FIELD column metadata structures to be set (by calling
mysql_stmt_attr_set()), be aware that the max_length values for the result set indicate the lengths of the longest string rep-
resentation of the result values, not the lengths of the binary representation. That is, max_length does not necessarily correspond to
the size of the buffers needed to fetch the values with the binary protocol used for prepared statements. The size of the buffers should be
chosen according to the types of the variables into which you fetch the values.
For input character (nonbinary) string data (indicated by MYSQL_TYPE_STRING), the value is assumed to be in the character set indic-
ated by the character_set_client system variable. If the value is stored into a column with a different character set, the appro-
priate conversion to that character set occurs. For input binary string data (indicated by MYSQL_TYPE_BLOB), the value is treated as
having the binary character set; that is, it is treated as a byte string and no conversion occurs.
To determine whether output string values in a result set returned from the server contain binary or nonbinary data, check whether the
charsetnr value of the result set metadata is 63 (see Section 21.10.1, C API Data Types). If so, the character set is binary,
which indicates binary rather than nonbinary data. This enables you to distinguish BINARY from CHAR, VARBINARY from VARCHAR,
and the BLOB types from the TEXT types.
As of MySQL 5.1.25, metadata changes to tables or views referred to by prepared statements are detected and cause automatic reprepar-
ation of the statement when it is next executed. For more information, see Section 12.7.4, Automatic Prepared Statement Reprepara-
tion.
21.10.6. C API Prepared Statement Function Overview
The functions available for prepared statement processing are summarized here and described in greater detail in a later section. See
Section 21.10.7, C API Prepared Statement Function Descriptions.
Function Description
mysql_stmt_affected_rows() Returns the number of rows changed, deleted, or inserted by prepared UPDATE, DELETE,
or INSERT statement
Connectors and APIs
2393
mysql_stmt_attr_get() Get value of an attribute for a prepared statement
mysql_stmt_attr_set() Sets an attribute for a prepared statement
mysql_stmt_bind_param() Associates application data buffers with the parameter markers in a prepared SQL state-
ment
mysql_stmt_bind_result() Associates application data buffers with columns in the result set
mysql_stmt_close() Frees memory used by prepared statement
mysql_stmt_data_seek() Seeks to an arbitrary row number in a statement result set
mysql_stmt_errno() Returns the error number for the last statement execution
mysql_stmt_error() Returns the error message for the last statement execution
mysql_stmt_execute() Executes the prepared statement
mysql_stmt_fetch() Fetches the next row of data from the result set and returns data for all bound columns
mysql_stmt_fetch_column() Fetch data for one column of the current row of the result set
mysql_stmt_field_count() Returns the number of result columns for the most recent statement
mysql_stmt_free_result() Free the resources allocated to the statement handle
mysql_stmt_init() Allocates memory for MYSQL_STMT structure and initializes it
mysql_stmt_insert_id() Returns the ID generated for an AUTO_INCREMENT column by prepared statement
mysql_stmt_num_rows() Returns total row count from the buffered statement result set
mysql_stmt_param_count() Returns the number of parameters in a prepared SQL statement
mysql_stmt_param_metadata() (Return parameter metadata in the form of a result set.) Currently, this function does noth-
ing
mysql_stmt_prepare() Prepares an SQL string for execution
mysql_stmt_reset() Reset the statement buffers in the server
mysql_stmt_result_metadata() Returns prepared statement metadata in the form of a result set
mysql_stmt_row_seek() Seeks to a row offset in a statement result set, using value returned from
mysql_stmt_row_tell()
mysql_stmt_row_tell() Returns the statement row cursor position
mysql_stmt_send_long_data() Sends long data in chunks to server
mysql_stmt_sqlstate() Returns the SQLSTATE error code for the last statement execution
mysql_stmt_store_result() Retrieves the complete result set to the client
Call mysql_stmt_init() to create a statement handle, then mysql_stmt_prepare() to prepare it,
mysql_stmt_bind_param() to supply the parameter data, and mysql_stmt_execute() to execute the statement. You can
repeat the mysql_stmt_execute() by changing parameter values in the respective buffers supplied through
mysql_stmt_bind_param().
If the statement is a SELECT or any other statement that produces a result set, mysql_stmt_prepare() also returns the result set
metadata information in the form of a MYSQL_RES result set through mysql_stmt_result_metadata().
You can supply the result buffers using mysql_stmt_bind_result(), so that the mysql_stmt_fetch() automatically re-
turns data to these buffers. This is row-by-row fetching.
You can also send the text or binary data in chunks to server using mysql_stmt_send_long_data(). See Section 21.10.7.25,
mysql_stmt_send_long_data().
When statement execution has been completed, the statement handle must be closed using mysql_stmt_close() so that all re-
sources associated with it can be freed.
If you obtained a SELECT statement's result set metadata by calling mysql_stmt_result_metadata(), you should also free the
metadata using mysql_free_result().
Execution Steps
To prepare and execute a statement, an application follows these steps:
Connectors and APIs
2394
1. Create a prepared statement handle with mysql_stmt_init(). To prepare the statement on the server, call
mysql_stmt_prepare() and pass it a string containing the SQL statement.
2. If the statement produces a result set, call mysql_stmt_result_metadata() to obtain the result set metadata. This
metadata is itself in the form of result set, albeit a separate one from the one that contains the rows returned by the query. The
metadata result set indicates how many columns are in the result and contains information about each column.
3. Set the values of any parameters using mysql_stmt_bind_param(). All parameters must be set. Otherwise, statement execu-
tion returns an error or produces unexpected results.
4. Call mysql_stmt_execute() to execute the statement.
5. If the statement produces a result set, bind the data buffers to use for retrieving the row values by calling
mysql_stmt_bind_result().
6. Fetch the data into the buffers row by row by calling mysql_stmt_fetch() repeatedly until no more rows are found.
7. Repeat steps 3 through 6 as necessary, by changing the parameter values and re-executing the statement.
When mysql_stmt_prepare() is called, the MySQL client/server protocol performs these actions:
The server parses the statement and sends the okay status back to the client by assigning a statement ID. It also sends total number
of parameters, a column count, and its metadata if it is a result set oriented statement. All syntax and semantics of the statement are
checked by the server during this call.
The client uses this statement ID for the further operations, so that the server can identify the statement from among its pool of state-
ments.
When mysql_stmt_execute() is called, the MySQL client/server protocol performs these actions:
The client uses the statement handle and sends the parameter data to the server.
The server identifies the statement using the ID provided by the client, replaces the parameter markers with the newly supplied data,
and executes the statement. If the statement produces a result set, the server sends the data back to the client. Otherwise, it sends an
okay status and total number of rows changed, deleted, or inserted.
When mysql_stmt_fetch() is called, the MySQL client/server protocol performs these actions:
The client reads the data from the packet row by row and places it into the application data buffers by doing the necessary conver-
sions. If the application buffer type is same as that of the field type returned from the server, the conversions are straightforward.
If an error occurs, you can get the statement error code, error message, and SQLSTATE value using mysql_stmt_errno(),
mysql_stmt_error(), and mysql_stmt_sqlstate(), respectively.
Prepared Statement Logging
For prepared statements that are executed with the mysql_stmt_prepare() and mysql_stmt_execute() C API functions,
the server writes Prepare and Execute lines to the general query log so that you can tell when statements are prepared and ex-
ecuted.
Suppose that you prepare and execute a statement as follows:
1. Call mysql_stmt_prepare() to prepare the statement string "SELECT ?".
2. Call mysql_stmt_bind_param() to bind the value 3 to the parameter in the prepared statement.
3. Call mysql_stmt_execute() to execute the prepared statement.
Connectors and APIs
2395
As a result of the preceding calls, the server writes the following lines to the general query log:
Prepare [1] SELECT ?
Execute [1] SELECT 3
Each Prepare and Execute line in the log is tagged with a [N] statement identifier so that you can keep track of which prepared
statement is being logged. N is a positive integer. If there are multiple prepared statements active simultaneously for the client, N may be
greater than 1. Each Execute lines shows a prepared statement after substitution of data values for ? parameters.
Version notes: Prepare lines are displayed without [N] before MySQL 4.1.10. Execute lines are not displayed at all before
MySQL 4.1.10.
21.10.7. C API Prepared Statement Function Descriptions
To prepare and execute queries, use the functions described in detail in the following sections.
All functions that operate with a MYSQL_STMT structure begin with the prefix mysql_stmt_.
To create a MYSQL_STMT handle, use the mysql_stmt_init() function.
21.10.7.1. mysql_stmt_affected_rows()
my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt)
Description
Returns the total number of rows changed, deleted, or inserted by the last executed statement. May be called immediately after
mysql_stmt_execute() for UPDATE, DELETE, or INSERT statements. For SELECT statements,
mysql_stmt_affected_rows() works like mysql_num_rows().
Return Values
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records were updated for an UP-
DATE statement, no rows matched the WHERE clause in the query, or that no query has yet been executed. -1 indicates that the query re-
turned an error or that, for a SELECT query, mysql_stmt_affected_rows() was called prior to calling
mysql_stmt_store_result(). Because mysql_stmt_affected_rows() returns an unsigned value, you can check for -1
by comparing the return value to (my_ulonglong)-1 (or to (my_ulonglong)~0, which is equivalent).
See Section 21.10.3.1, mysql_affected_rows(), for additional information on the return value.
Errors
None.
Example
For the usage of mysql_stmt_affected_rows(), refer to the Example from Section 21.10.7.10, mysql_stmt_execute().
21.10.7.2. mysql_stmt_attr_get()
my_bool mysql_stmt_attr_get(MYSQL_STMT *stmt, enum enum_stmt_attr_type option, void *arg)
Description
Can be used to get the current value for a statement attribute.
The option argument is the option that you want to get; the arg should point to a variable that should contain the option value. If the
option is an integer, then arg should point to the value of the integer.
See Section 21.10.7.3, mysql_stmt_attr_set(), for a list of options and option types.
Note
In MySQL 5.1, mysql_stmt_attr_get() originally used unsigned int *, not my_bool *, for
STMT_ATTR_UPDATE_MAX_LENGTH. This was corrected in MySQL 5.1.7.
Connectors and APIs
2396
Return Values
Zero if successful. Nonzero if option is unknown.
Errors
None.
21.10.7.3. mysql_stmt_attr_set()
my_bool mysql_stmt_attr_set(MYSQL_STMT *stmt, enum enum_stmt_attr_type option, const void
*arg)
Description
Can be used to affect behavior for a prepared statement. This function may be called multiple times to set several options.
The option argument is the option that you want to set. The arg argument is the value for the option. arg should point to a variable
that is set to the desired attribute value. The variable type is as indicated in the following table.
The following table shows the possible option values.
Option Argument Type Function
STMT_ATTR_UPDATE_MAX_LENGTH my_bool * If set to 1, causes
mysql_stmt_store_result() to update
the metadata MYSQL_FIELD->max_length
value.
STMT_ATTR_CURSOR_TYPE unsigned long * Type of cursor to open for statement when
mysql_stmt_execute() is invoked. *arg
can be CURSOR_TYPE_NO_CURSOR (the de-
fault) or CURSOR_TYPE_READ_ONLY.
STMT_ATTR_PREFETCH_ROWS unsigned long * Number of rows to fetch from server at a time
when using a cursor. *arg can be in the range
from 1 to the maximum value of unsigned
long. The default is 1.
If you use the STMT_ATTR_CURSOR_TYPE option with CURSOR_TYPE_READ_ONLY, a cursor is opened for the statement when
you invoke mysql_stmt_execute(). If there is already an open cursor from a previous mysql_stmt_execute() call, it closes
the cursor before opening a new one. mysql_stmt_reset() also closes any open cursor before preparing the statement for re-
execution. mysql_stmt_free_result() closes any open cursor.
If you open a cursor for a prepared statement, mysql_stmt_store_result() is unnecessary, because that function causes the res-
ult set to be buffered on the client side.
Return Values
Zero if successful. Nonzero if option is unknown.
Errors
None.
Example
The following example opens a cursor for a prepared statement and sets the number of rows to fetch at a time to 5:
MYSQL_STMT *stmt;
int rc;
unsigned long type;
unsigned long prefetch_rows = 5;
stmt = mysql_stmt_init(mysql);
type = (unsigned long) CURSOR_TYPE_READ_ONLY;
rc = mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type);
/* ... check return value ... */
rc = mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS,
Connectors and APIs
2397
(void*) &prefetch_rows);
/* ... check return value ... */
21.10.7.4. mysql_stmt_bind_param()
my_bool mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
Description
mysql_stmt_bind_param() is used to bind input data for the parameter markers in the SQL statement that was passed to
mysql_stmt_prepare(). It uses MYSQL_BIND structures to supply the data. bind is the address of an array of MYSQL_BIND
structures. The client library expects the array to contain one element for each ? parameter marker that is present in the query.
Suppose that you prepare the following statement:
INSERT INTO mytbl VALUES(?,?,?)
When you bind the parameters, the array of MYSQL_BIND structures must contain three elements, and can be declared like this:
MYSQL_BIND bind[3];
Section 21.10.5, C API Prepared Statement Data types, describes the members of each MYSQL_BIND element and how they should
be set to provide input values.
Return Values
Zero if the bind operation was successful. Nonzero if an error occurred.
Errors
CR_UNSUPPORTED_PARAM_TYPE
The conversion is not supported. Possibly the buffer_type value is illegal or is not one of the supported types.
CR_OUT_OF_MEMORY
Out of memory.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
For the usage of mysql_stmt_bind_param(), refer to the Example from Section 21.10.7.10, mysql_stmt_execute().
21.10.7.5. mysql_stmt_bind_result()
my_bool mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
Description
mysql_stmt_bind_result() is used to associate (that is, bind) output columns in the result set to data buffers and length buffers.
When mysql_stmt_fetch() is called to fetch data, the MySQL client/server protocol places the data for the bound columns into
the specified buffers.
All columns must be bound to buffers prior to calling mysql_stmt_fetch(). bind is the address of an array of MYSQL_BIND
structures. The client library expects the array to contain one element for each column of the result set. If you do not bind columns to
MYSQL_BIND structures, mysql_stmt_fetch() simply ignores the data fetch. The buffers should be large enough to hold the data
values, because the protocol doesn't return data values in chunks.
A column can be bound or rebound at any time, even after a result set has been partially retrieved. The new binding takes effect the next
time mysql_stmt_fetch() is called. Suppose that an application binds the columns in a result set and calls
Connectors and APIs
2398
mysql_stmt_fetch(). The client/server protocol returns data in the bound buffers. Then suppose that the application binds the
columns to a different set of buffers. The protocol places data into the newly bound buffers when the next call to
mysql_stmt_fetch() occurs.
To bind a column, an application calls mysql_stmt_bind_result() and passes the type, address, and length of the output buffer
into which the value should be stored. Section 21.10.5, C API Prepared Statement Data types, describes the members of each
MYSQL_BIND element and how they should be set to receive output values.
Return Values
Zero if the bind operation was successful. Nonzero if an error occurred.
Errors
CR_UNSUPPORTED_PARAM_TYPE
The conversion is not supported. Possibly the buffer_type value is illegal or is not one of the supported types.
CR_OUT_OF_MEMORY
Out of memory.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
For the usage of mysql_stmt_bind_result(), refer to the Example from Section 21.10.7.11, mysql_stmt_fetch().
21.10.7.6. mysql_stmt_close()
my_bool mysql_stmt_close(MYSQL_STMT *)
Description
Closes the prepared statement. mysql_stmt_close() also deallocates the statement handle pointed to by stmt.
If the current statement has pending or unread results, this function cancels them so that the next query can be executed.
Return Values
Zero if the statement was freed successfully. Nonzero if an error occurred.
Errors
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
For the usage of mysql_stmt_close(), refer to the Example from Section 21.10.7.10, mysql_stmt_execute().
21.10.7.7. mysql_stmt_data_seek()
void mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset)
Description
Connectors and APIs
2399
Seeks to an arbitrary row in a statement result set. The offset value is a row number and should be in the range from 0 to
mysql_stmt_num_rows(stmt)-1.
This function requires that the statement result set structure contains the entire result of the last executed query, so
mysql_stmt_data_seek() may be used only in conjunction with mysql_stmt_store_result().
Return Values
None.
Errors
None.
21.10.7.8. mysql_stmt_errno()
unsigned int mysql_stmt_errno(MYSQL_STMT *stmt)
Description
For the statement specified by stmt, mysql_stmt_errno() returns the error code for the most recently invoked statement API
function that can succeed or fail. A return value of zero means that no error occurred. Client error message numbers are listed in the
MySQL errmsg.h header file. Server error message numbers are listed in mysqld_error.h. Errors also are listed at Appendix B,
Errors, Error Codes, and Common Problems.
Return Values
An error code value. Zero if no error occurred.
Errors
None.
21.10.7.9. mysql_stmt_error()
const char *mysql_stmt_error(MYSQL_STMT *stmt)
Description
For the statement specified by stmt, mysql_stmt_error() returns a null-terminated string containing the error message for the
most recently invoked statement API function that can succeed or fail. An empty string ("") is returned if no error occurred. This means
the following two tests are equivalent:
if(*mysql_stmt_errno(stmt))
{
// an error occurred
}
if (mysql_stmt_error(stmt)[0])
{
// an error occurred
}
The language of the client error messages may be changed by recompiling the MySQL client library. Currently, you can choose error
messages in several different languages.
Return Values
A character string that describes the error. An empty string if no error occurred.
Errors
None.
21.10.7.10. mysql_stmt_execute()
int mysql_stmt_execute(MYSQL_STMT *stmt)
Connectors and APIs
2400
Description
mysql_stmt_execute() executes the prepared query associated with the statement handle. The currently bound parameter marker
values are sent to server during this call, and the server replaces the markers with this newly supplied data.
If the statement is an UPDATE, DELETE, or INSERT, the total number of changed, deleted, or inserted rows can be found by calling
mysql_stmt_affected_rows(). If this is a statement such as SELECT that generates a result set, you must call
mysql_stmt_fetch() to fetch the data prior to calling any other functions that result in query processing. For more information on
how to fetch the results, refer to Section 21.10.7.11, mysql_stmt_fetch().
For statements that generate a result set, you can request that mysql_stmt_execute() open a cursor for the statement by calling
mysql_stmt_attr_set() before executing the statement. If you execute a statement multiple times, mysql_stmt_execute()
closes any open cursor before opening a new one.
As of MySQL 5.1.25, metadata changes to tables or views referred to by prepared statements are detected and cause automatic reprepar-
ation of the statement when it is next executed. For more information, see Section 12.7.4, Automatic Prepared Statement Reprepara-
tion.
Return Values
Zero if execution was successful. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
The following example demonstrates how to create and populate a table using mysql_stmt_init(), mysql_stmt_prepare(),
mysql_stmt_param_count(), mysql_stmt_bind_param(), mysql_stmt_execute(), and
mysql_stmt_affected_rows(). The mysql variable is assumed to be a valid connection handle.
#define STRING_SIZE 50
#define DROP_SAMPLE_TABLE "DROP TABLE IF EXISTS test_table"
#define CREATE_SAMPLE_TABLE "CREATE TABLE test_table(col1 INT,\
col2 VARCHAR(40),\
col3 SMALLINT,\
col4 TIMESTAMP)"
#define INSERT_SAMPLE "INSERT INTO \
test_table(col1,col2,col3) \
VALUES(?,?,?)"
MYSQL_STMT *stmt;
MYSQL_BIND bind[3];
my_ulonglong affected_rows;
int param_count;
short small_data;
int int_data;
char str_data[STRING_SIZE];
unsigned long str_length;
my_bool is_null;
Connectors and APIs
2401
if (mysql_query(mysql, DROP_SAMPLE_TABLE))
{
fprintf(stderr, " DROP TABLE failed\n");
fprintf(stderr, " %s\n", mysql_error(mysql));
exit(0);
}
if (mysql_query(mysql, CREATE_SAMPLE_TABLE))
{
fprintf(stderr, " CREATE TABLE failed\n");
fprintf(stderr, " %s\n", mysql_error(mysql));
exit(0);
}
/* Prepare an INSERT query with 3 parameters */
/* (the TIMESTAMP column is not named; the server */
/* sets it to the current date and time) */
stmt = mysql_stmt_init(mysql);
if (!stmt)
{
fprintf(stderr, " mysql_stmt_init(), out of memory\n");
exit(0);
}
if (mysql_stmt_prepare(stmt, INSERT_SAMPLE, strlen(INSERT_SAMPLE)))
{
fprintf(stderr, " mysql_stmt_prepare(), INSERT failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
fprintf(stdout, " prepare, INSERT successful\n");
/* Get the parameter count from the statement */
param_count= mysql_stmt_param_count(stmt);
fprintf(stdout, " total parameters in INSERT: %d\n", param_count);
if (param_count != 3) /* validate parameter count */
{
fprintf(stderr, " invalid parameter count returned by MySQL\n");
exit(0);
}
/* Bind the data for all 3 parameters */
memset(bind, 0, sizeof(bind));
/* INTEGER PARAM */
/* This is a number type, so there is no need
to specify buffer_length */
bind[0].buffer_type= MYSQL_TYPE_LONG;
bind[0].buffer= (char *)&int_data;
bind[0].is_null= 0;
bind[0].length= 0;
/* STRING PARAM */
bind[1].buffer_type= MYSQL_TYPE_STRING;
bind[1].buffer= (char *)str_data;
bind[1].buffer_length= STRING_SIZE;
bind[1].is_null= 0;
bind[1].length= &str_length;
/* SMALLINT PARAM */
bind[2].buffer_type= MYSQL_TYPE_SHORT;
bind[2].buffer= (char *)&small_data;
bind[2].is_null= &is_null;
bind[2].length= 0;
/* Bind the buffers */
if (mysql_stmt_bind_param(stmt, bind))
{
fprintf(stderr, " mysql_stmt_bind_param() failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Specify the data values for the first row */
int_data= 10; /* integer */
strncpy(str_data, "MySQL", STRING_SIZE); /* string */
str_length= strlen(str_data);
/* INSERT SMALLINT data as NULL */
is_null= 1;
/* Execute the INSERT statement - 1*/
if (mysql_stmt_execute(stmt))
{
fprintf(stderr, " mysql_stmt_execute(), 1 failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
Connectors and APIs
2402
/* Get the total number of affected rows */
affected_rows= mysql_stmt_affected_rows(stmt);
fprintf(stdout, " total affected rows(insert 1): %lu\n",
(unsigned long) affected_rows);
if (affected_rows != 1) /* validate affected rows */
{
fprintf(stderr, " invalid affected rows by MySQL\n");
exit(0);
}
/* Specify data values for second row,
then re-execute the statement */
int_data= 1000;
strncpy(str_data, "
The most popular Open Source database",
STRING_SIZE);
str_length= strlen(str_data);
small_data= 1000; /* smallint */
is_null= 0; /* reset */
/* Execute the INSERT statement - 2*/
if (mysql_stmt_execute(stmt))
{
fprintf(stderr, " mysql_stmt_execute, 2 failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Get the total rows affected */
affected_rows= mysql_stmt_affected_rows(stmt);
fprintf(stdout, " total affected rows(insert 2): %lu\n",
(unsigned long) affected_rows);
if (affected_rows != 1) /* validate affected rows */
{
fprintf(stderr, " invalid affected rows by MySQL\n");
exit(0);
}
/* Close the statement */
if (mysql_stmt_close(stmt))
{
fprintf(stderr, " failed while closing the statement\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
Note
For complete examples on the use of prepared statement functions, refer to the file tests/mysql_client_test.c.
This file can be obtained from a MySQL source distribution or from the Bazaar source repository.
21.10.7.11. mysql_stmt_fetch()
int mysql_stmt_fetch(MYSQL_STMT *stmt)
Description
mysql_stmt_fetch() returns the next row in the result set. It can be called only while the result set exists; that is, after a call to
mysql_stmt_execute() for a statement such as SELECT that creates a result set.
mysql_stmt_fetch() returns row data using the buffers bound by mysql_stmt_bind_result(). It returns the data in those
buffers for all the columns in the current row set and the lengths are returned to the length pointer. All columns must be bound by the
application before it calls mysql_stmt_fetch().
By default, result sets are fetched unbuffered a row at a time from the server. To buffer the entire result set on the client, call
mysql_stmt_store_result() after binding the data buffers and before caling mysql_stmt_fetch().
If a fetched data value is a NULL value, the *is_null value of the corresponding MYSQL_BIND structure contains TRUE (1). Other-
wise, the data and its length are returned in the *buffer and *length elements based on the buffer type specified by the application.
Each numeric and temporal type has a fixed length, as listed in the following table. The length of the string types depends on the length
of the actual data value, as indicated by data_length.
Type Length
MYSQL_TYPE_TINY 1
Connectors and APIs
2403
MYSQL_TYPE_SHORT 2
MYSQL_TYPE_LONG 4
MYSQL_TYPE_LONGLONG 8
MYSQL_TYPE_FLOAT 4
MYSQL_TYPE_DOUBLE 8
MYSQL_TYPE_TIME sizeof(MYSQL_TIME)
MYSQL_TYPE_DATE sizeof(MYSQL_TIME)
MYSQL_TYPE_DATETIME sizeof(MYSQL_TIME)
MYSQL_TYPE_STRING data length
MYSQL_TYPE_BLOB data_length
Return Values
Return Value Description
0 Successful, the data has been fetched to application data buffers.
1 Error occurred. Error code and message can be obtained by calling
mysql_stmt_errno() and mysql_stmt_error().
MYSQL_NO_DATA No more rows/data exists
MYSQL_DATA_TRUNCATED Data truncation occurred
MYSQL_DATA_TRUNCATED is returned when truncation reporting is enabled. (Reporting is enabled by default, but can be controlled
with mysql_options().) To determine which parameters were truncated when this value is returned, check the error members of
the MYSQL_BIND parameter structures.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
CR_UNSUPPORTED_PARAM_TYPE
The buffer type is MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, or MYSQL_TYPE_TIMESTAMP, but
the data type is not DATE, TIME, DATETIME, or TIMESTAMP.
All other unsupported conversion errors are returned from mysql_stmt_bind_result().
Example
Connectors and APIs
2404
The following example demonstrates how to fetch data from a table using mysql_stmt_result_metadata(),
mysql_stmt_bind_result(), and mysql_stmt_fetch(). (This example expects to retrieve the two rows inserted by the ex-
ample shown in Section 21.10.7.10, mysql_stmt_execute().) The mysql variable is assumed to be a valid connection handle.
#define STRING_SIZE 50
#define SELECT_SAMPLE "SELECT col1, col2, col3, col4 \
FROM test_table"
MYSQL_STMT *stmt;
MYSQL_BIND bind[4];
MYSQL_RES *prepare_meta_result;
MYSQL_TIME ts;
unsigned long length[4];
int param_count, column_count, row_count;
short small_data;
int int_data;
char str_data[STRING_SIZE];
my_bool is_null[4];
my_bool error[4];
/* Prepare a SELECT query to fetch data from test_table */
stmt = mysql_stmt_init(mysql);
if (!stmt)
{
fprintf(stderr, " mysql_stmt_init(), out of memory\n");
exit(0);
}
if (mysql_stmt_prepare(stmt, SELECT_SAMPLE, strlen(SELECT_SAMPLE)))
{
fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
fprintf(stdout, " prepare, SELECT successful\n");
/* Get the parameter count from the statement */
param_count= mysql_stmt_param_count(stmt);
fprintf(stdout, " total parameters in SELECT: %d\n", param_count);
if (param_count != 0) /* validate parameter count */
{
fprintf(stderr, " invalid parameter count returned by MySQL\n");
exit(0);
}
/* Fetch result set meta information */
prepare_meta_result = mysql_stmt_result_metadata(stmt);
if (!prepare_meta_result)
{
fprintf(stderr,
" mysql_stmt_result_metadata(), \
returned no meta information\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Get total columns in the query */
column_count= mysql_num_fields(prepare_meta_result);
fprintf(stdout,
" total columns in SELECT statement: %d\n",
column_count);
if (column_count != 4) /* validate column count */
{
fprintf(stderr, " invalid column count returned by MySQL\n");
exit(0);
}
/* Execute the SELECT query */
if (mysql_stmt_execute(stmt))
{
fprintf(stderr, " mysql_stmt_execute(), failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Bind the result buffers for all 4 columns before fetching them */
memset(bind, 0, sizeof(bind));
/* INTEGER COLUMN */
bind[0].buffer_type= MYSQL_TYPE_LONG;
bind[0].buffer= (char *)&int_data;
bind[0].is_null= &is_null[0];
bind[0].length= &length[0];
bind[0].error= &error[0];
Connectors and APIs
2405
/* STRING COLUMN */
bind[1].buffer_type= MYSQL_TYPE_STRING;
bind[1].buffer= (char *)str_data;
bind[1].buffer_length= STRING_SIZE;
bind[1].is_null= &is_null[1];
bind[1].length= &length[1];
bind[1].error= &error[1];
/* SMALLINT COLUMN */
bind[2].buffer_type= MYSQL_TYPE_SHORT;
bind[2].buffer= (char *)&small_data;
bind[2].is_null= &is_null[2];
bind[2].length= &length[2];
bind[2].error= &error[2];
/* TIMESTAMP COLUMN */
bind[3].buffer_type= MYSQL_TYPE_TIMESTAMP;
bind[3].buffer= (char *)&ts;
bind[3].is_null= &is_null[3];
bind[3].length= &length[3];
bind[3].error= &error[3];
/* Bind the result buffers */
if (mysql_stmt_bind_result(stmt, bind))
{
fprintf(stderr, " mysql_stmt_bind_result() failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Now buffer all results to client (optional step) */
if (mysql_stmt_store_result(stmt))
{
fprintf(stderr, " mysql_stmt_store_result() failed\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
/* Fetch all rows */
row_count= 0;
fprintf(stdout, "Fetching results ...\n");
while (!mysql_stmt_fetch(stmt))
{
row_count++;
fprintf(stdout, " row %d\n", row_count);
/* column 1 */
fprintf(stdout, " column1 (integer) : ");
if (is_null[0])
fprintf(stdout, " NULL\n");
else
fprintf(stdout, " %d(%ld)\n", int_data, length[0]);
/* column 2 */
fprintf(stdout, " column2 (string) : ");
if (is_null[1])
fprintf(stdout, " NULL\n");
else
fprintf(stdout, " %s(%ld)\n", str_data, length[1]);
/* column 3 */
fprintf(stdout, " column3 (smallint) : ");
if (is_null[2])
fprintf(stdout, " NULL\n");
else
fprintf(stdout, " %d(%ld)\n", small_data, length[2]);
/* column 4 */
fprintf(stdout, " column4 (timestamp): ");
if (is_null[3])
fprintf(stdout, " NULL\n");
else
fprintf(stdout, " %04d-%02d-%02d %02d:%02d:%02d (%ld)\n",
ts.year, ts.month, ts.day,
ts.hour, ts.minute, ts.second,
length[3]);
fprintf(stdout, "\n");
}
/* Validate rows fetched */
fprintf(stdout, " total rows fetched: %d\n", row_count);
if (row_count != 2)
{
fprintf(stderr, " MySQL failed to return all rows\n");
exit(0);
}
/* Free the prepared result metadata */
mysql_free_result(prepare_meta_result);
Connectors and APIs
2406
/* Close the statement */
if (mysql_stmt_close(stmt))
{
fprintf(stderr, " failed while closing the statement\n");
fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
exit(0);
}
In some cases you might want to determine the length of a column value before fetching it with mysql_stmt_fetch(). For ex-
ample, the value might be a long string or BLOB value for which you want to know how much space must be allocated. To accomplish
this, you can use these strategies:
Before invoking mysql_stmt_fetch() to retrieve individual rows, invoke mysql_stmt_store_result() to buffer the
entire result on the client side. Then the maximal length of column values will be indicated by the max_length member of the
result set metadata returned by mysql_stmt_result_metadata(). This strategy requires that you pass
STMT_ATTR_UPDATE_MAX_LENGTH to mysql_stmt_attr_set() or the max_length values will not be calculated.
Invoke mysql_stmt_fetch() with a zero-length buffer for the column in question and a pointer in which the real length can be
stored. Then use the real length with mysql_stmt_fetch_column().
real_length= 0;
bind[0].buffer= 0;
bind[0].buffer_length= 0;
bind[0].length= &real_length
mysql_stmt_bind_result(stmt, bind);
mysql_stmt_fetch(stmt);
if (real_length > 0)
{
data= malloc(real_length);
bind[0].buffer= data;
bind[0].buffer_length= real_length;
mysql_stmt_fetch_column(stmt, bind, 0, 0);
}
21.10.7.12. mysql_stmt_fetch_column()
int mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind, unsigned int column, un-
signed long offset)
Description
Fetch one column from the current result set row. bind provides the buffer where data should be placed. It should be set up the same
way as for mysql_stmt_bind_result(). column indicates which column to fetch. The first column is numbered 0. offset is
the offset within the data value at which to begin retrieving data. This can be used for fetching the data value in pieces. The beginning
of the value is offset 0.
As of MySQL 5.1.25, metadata changes to tables or views referred to by prepared statements are detected and cause automatic reprepar-
ation of the statement when it is next executed. For more information, see Section 12.7.4, Automatic Prepared Statement Reprepara-
tion.
Return Values
Zero if the value was fetched successfully. Nonzero if an error occurred.
Errors
CR_INVALID_PARAMETER_NO
Invalid column number.
CR_NO_DATA
The end of the result set has already been reached.
Connectors and APIs
2407
21.10.7.13. mysql_stmt_field_count()
unsigned int mysql_stmt_field_count(MYSQL_STMT *stmt)
Description
Returns the number of columns for the most recent statement for the statement handler. This value is zero for statements such as IN-
SERT or DELETE that do not produce result sets.
mysql_stmt_field_count() can be called after you have prepared a statement by invoking mysql_stmt_prepare().
Return Values
An unsigned integer representing the number of columns in a result set.
Errors
None.
21.10.7.14. mysql_stmt_free_result()
my_bool mysql_stmt_free_result(MYSQL_STMT *stmt)
Description
Releases memory associated with the result set produced by execution of the prepared statement. If there is a cursor open for the state-
ment, mysql_stmt_free_result() closes it.
Return Values
Zero if the result set was freed successfully. Nonzero if an error occurred.
Errors
21.10.7.15. mysql_stmt_init()
MYSQL_STMT *mysql_stmt_init(MYSQL *mysql)
Description
Create a MYSQL_STMT handle. The handle should be freed with mysql_stmt_close(MYSQL_STMT *).
Return values
A pointer to a MYSQL_STMT structure in case of success. NULL if out of memory.
Errors
CR_OUT_OF_MEMORY
Out of memory.
21.10.7.16. mysql_stmt_insert_id()
my_ulonglong mysql_stmt_insert_id(MYSQL_STMT *stmt)
Description
Returns the value generated for an AUTO_INCREMENT column by the prepared INSERT or UPDATE statement. Use this function after
you have executed a prepared INSERT statement on a table which contains an AUTO_INCREMENT field.
See Section 21.10.3.37, mysql_insert_id(), for more information.
Connectors and APIs
2408
Return Values
Value for AUTO_INCREMENT column which was automatically generated or explicitly set during execution of prepared statement, or
value generated by LAST_INSERT_ID(expr) function. Return value is undefined if statement does not set AUTO_INCREMENT
value.
Errors
None.
21.10.7.17. mysql_stmt_num_rows()
my_ulonglong mysql_stmt_num_rows(MYSQL_STMT *stmt)
Description
Returns the number of rows in the result set.
The use of mysql_stmt_num_rows() depends on whether you used mysql_stmt_store_result() to buffer the entire result
set in the statement handle.
If you use mysql_stmt_store_result(), mysql_stmt_num_rows() may be called immediately. Otherwise, the row count
is unavailable unless you count the rows as you fetch them.
mysql_stmt_num_rows() is intended for use with statements that return a result set, such as SELECT. For statements such as IN-
SERT, UPDATE, or DELETE, the number of affected rows can be obtained with mysql_stmt_affected_rows().
Return Values
The number of rows in the result set.
Errors
None.
21.10.7.18. mysql_stmt_param_count()
unsigned long mysql_stmt_param_count(MYSQL_STMT *stmt)
Description
Returns the number of parameter markers present in the prepared statement.
Return Values
An unsigned long integer representing the number of parameters in a statement.
Errors
None.
Example
For the usage of mysql_stmt_param_count(), refer to the Example from Section 21.10.7.10, mysql_stmt_execute().
21.10.7.19. mysql_stmt_param_metadata()
MYSQL_RES *mysql_stmt_param_metadata(MYSQL_STMT *stmt)
This function currently does nothing.
Description
Return Values
Errors
Connectors and APIs
2409
21.10.7.20. mysql_stmt_prepare()
int mysql_stmt_prepare(MYSQL_STMT *stmt, const char *stmt_str, unsigned long length)
Description
Given the statement handle returned by mysql_stmt_init(), prepares the SQL statement pointed to by the string stmt_str and
returns a status value. The string length should be given by the length argument. The string must consist of a single SQL statement.
You should not add a terminating semicolon (;) or \g to the statement.
The application can include one or more parameter markers in the SQL statement by embedding question mark (?) characters into the
SQL string at the appropriate positions.
The markers are legal only in certain places in SQL statements. For example, they are allowed in the VALUES() list of an INSERT
statement (to specify column values for a row), or in a comparison with a column in a WHERE clause to specify a comparison value.
However, they are not allowed for identifiers (such as table or column names), or to specify both operands of a binary operator such as
the = equal sign. The latter restriction is necessary because it would be impossible to determine the parameter type. In general, paramet-
ers are legal only in Data Manipulation Language (DML) statements, and not in Data Definition Language (DDL) statements.
The parameter markers must be bound to application variables using mysql_stmt_bind_param() before executing the statement.
Return Values
Zero if the statement was prepared successfully. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query
CR_UNKNOWN_ERROR
An unknown error occurred.
If the prepare operation was unsuccessful (that is, mysql_stmt_prepare() returns nonzero), the error message can be obtained by
calling mysql_stmt_error().
Example
For the usage of mysql_stmt_prepare(), refer to the Example from Section 21.10.7.10, mysql_stmt_execute().
21.10.7.21. mysql_stmt_reset()
my_bool mysql_stmt_reset(MYSQL_STMT *stmt)
Description
Reset the prepared statement on the client and server to state after prepare. This is mainly used to reset data sent with
mysql_stmt_send_long_data(). Any open cursor for the statement is closed.
To re-prepare the statement with another query, use mysql_stmt_prepare().
Connectors and APIs
2410
Return Values
Zero if the statement was reset successfully. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.7.22. mysql_stmt_result_metadata()
MYSQL_RES *mysql_stmt_result_metadata(MYSQL_STMT *stmt)
Description
If a statement passed to mysql_stmt_prepare() is one that produces a result set, mysql_stmt_result_metadata() re-
turns the result set metadata in the form of a pointer to a MYSQL_RES structure that can be used to process the meta information such as
total number of fields and individual field information. This result set pointer can be passed as an argument to any of the field-based
API functions that process result set metadata, such as:
mysql_num_fields()
mysql_fetch_field()
mysql_fetch_field_direct()
mysql_fetch_fields()
mysql_field_count()
mysql_field_seek()
mysql_field_tell()
mysql_free_result()
The result set structure should be freed when you are done with it, which you can do by passing it to mysql_free_result(). This
is similar to the way you free a result set obtained from a call to mysql_store_result().
The result set returned by mysql_stmt_result_metadata() contains only metadata. It does not contain any row results. The
rows are obtained by using the statement handle with mysql_stmt_fetch().
Return Values
A MYSQL_RES result structure. NULL if no meta information exists for the prepared query.
Errors
CR_OUT_OF_MEMORY
Connectors and APIs
2411
Out of memory.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
For the usage of mysql_stmt_result_metadata(), refer to the Example from Section 21.10.7.11, mysql_stmt_fetch().
21.10.7.23. mysql_stmt_row_seek()
MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset)
Description
Sets the row cursor to an arbitrary row in a statement result set. The offset value is a row offset that should be a value returned from
mysql_stmt_row_tell() or from mysql_stmt_row_seek(). This value is not a row number; if you want to seek to a row
within a result set by number, use mysql_stmt_data_seek() instead.
This function requires that the result set structure contains the entire result of the query, so mysql_stmt_row_seek() may be used
only in conjunction with mysql_stmt_store_result().
Return Values
The previous value of the row cursor. This value may be passed to a subsequent call to mysql_stmt_row_seek().
Errors
None.
21.10.7.24. mysql_stmt_row_tell()
MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT *stmt)
Description
Returns the current position of the row cursor for the last mysql_stmt_fetch(). This value can be used as an argument to
mysql_stmt_row_seek().
You should use mysql_stmt_row_tell() only after mysql_stmt_store_result().
Return Values
The current offset of the row cursor.
Errors
None.
21.10.7.25. mysql_stmt_send_long_data()
my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt, unsigned int parameter_number, const
char *data, unsigned long length)
Description
Allows an application to send parameter data to the server in pieces (or chunks). Call this function after
mysql_stmt_bind_param() and before mysql_stmt_execute(). It can be called multiple times to send the parts of a char-
acter or binary data value for a column, which must be one of the TEXT or BLOB data types.
parameter_number indicates which parameter to associate the data with. Parameters are numbered beginning with 0. data is a
pointer to a buffer containing data to be sent, and length indicates the number of bytes in the buffer.
Connectors and APIs
2412
Note
The next mysql_stmt_execute() call ignores the bind buffer for all parameters that have been used with
mysql_stmt_send_long_data() since last mysql_stmt_execute() or mysql_stmt_reset().
If you want to reset/forget the sent data, you can do it with mysql_stmt_reset(). See Section 21.10.7.21,
mysql_stmt_reset().
Return Values
Zero if the data is sent successfully to server. Nonzero if an error occurred.
Errors
CR_INVALID_BUFFER_USE
The parameter does not have a string or binary type.
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_OUT_OF_MEMORY
Out of memory.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
The following example demonstrates how to send the data for a TEXT column in chunks. It inserts the data value 'MySQL - The
most popular Open Source database' into the text_column column. The mysql variable is assumed to be a valid con-
nection handle.
#define INSERT_QUERY "INSERT INTO \
test_long_data(text_column) VALUES(?)"
MYSQL_BIND bind[1];
long length;
stmt = mysql_stmt_init(mysql);
if (!stmt)
{
fprintf(stderr, " mysql_stmt_init(), out of memory\n");
exit(0);
}
if (mysql_stmt_prepare(stmt, INSERT_QUERY, strlen(INSERT_QUERY)))
{
fprintf(stderr, "\n mysql_stmt_prepare(), INSERT failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
memset(bind, 0, sizeof(bind));
bind[0].buffer_type= MYSQL_TYPE_STRING;
bind[0].length= &length;
bind[0].is_null= 0;
/* Bind the buffers */
if (mysql_stmt_bind_param(stmt, bind))
{
fprintf(stderr, "\n param bind failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
/* Supply data in chunks to server */
if (mysql_stmt_send_long_data(stmt,0,"MySQL",5))
Connectors and APIs
2413
{
fprintf(stderr, "\n send_long_data failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
/* Supply the next piece of data */
if (mysql_stmt_send_long_data(stmt,0,
" - The most popular Open Source database",40))
{
fprintf(stderr, "\n send_long_data failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
/* Now, execute the query */
if (mysql_stmt_execute(stmt))
{
fprintf(stderr, "\n mysql_stmt_execute failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
21.10.7.26. mysql_stmt_sqlstate()
const char *mysql_stmt_sqlstate(MYSQL_STMT *stmt)
Description
For the statement specified by stmt, mysql_stmt_sqlstate() returns a null-terminated string containing the SQLSTATE error
code for the most recently invoked prepared statement API function that can succeed or fail. The error code consists of five characters.
"00000" means no error. The values are specified by ANSI SQL and ODBC. For a list of possible values, see Appendix B, Errors,
Error Codes, and Common Problems.
Note that not all MySQL errors are yet mapped to SQLSTATE codes. The value "HY000" (general error) is used for unmapped errors.
Return Values
A null-terminated character string containing the SQLSTATE error code.
21.10.7.27. mysql_stmt_store_result()
int mysql_stmt_store_result(MYSQL_STMT *stmt)
Description
Result sets are produced by executing prepared statements for SQL statements such as SELECT, SHOW, DESCRIBE, and EXPLAIN. By
default, result sets for successfully executed prepared statements are not buffered on the client and mysql_stmt_fetch() fetches
them one at a time from the server. To cause the complete result set to be buffered on the client, call
mysql_stmt_store_result() after binding data buffers with mysql_stmt_bind_result() and before calling
mysql_stmt_fetch() to fetch rows. (For an example, see Section 21.10.7.11, mysql_stmt_fetch().)
mysql_stmt_store_result() is optional for result set processing, unless you will call mysql_stmt_data_seek(),
mysql_stmt_row_seek(), or mysql_stmt_row_tell(). Those functions require a seekable result set.
It is unnecessary to call mysql_stmt_store_result() after executing an SQL statement that does not produce a result set, but if
you do, it does not harm or cause any notable performance problem. You can detect whether the statement produced a result set by
checking if mysql_stmt_result_metadata() returns NULL. For more information, refer to Section 21.10.7.22,
mysql_stmt_result_metadata().
Note
MySQL doesn't by default calculate MYSQL_FIELD->max_length for all columns in
mysql_stmt_store_result() because calculating this would slow down mysql_stmt_store_result()
considerably and most applications doesn't need max_length. If you want max_length to be updated, you can call
mysql_stmt_attr_set(MYSQL_STMT, STMT_ATTR_UPDATE_MAX_LENGTH, &flag) to enable this. See
Section 21.10.7.3, mysql_stmt_attr_set().
Return Values
Connectors and APIs
2414
Zero if the results are buffered successfully. Nonzero if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
21.10.8. C API Threaded Function Descriptions
You need to use the following functions when you want to create a threaded client. See Section 21.10.17, How to Make a Threaded
Client.
21.10.8.1. my_init()
void my_init(void)
Description
my_init() initializes some global variables that MySQL needs. If you are using a thread-safe client library, it also calls
mysql_thread_init() for this thread.
It is necessary for my_init() to be called early in the initialization phase of a program's use of the MySQL library. However,
my_init() is automatically called by mysql_init(), mysql_library_init(), mysql_server_init(), and
mysql_connect(). If you ensure that your program invokes one of those functions before any other MySQL calls, there is no need
to invoke my_init() explicitly.
To access the prototype for my_init(), your program should include these header files:
#include <my_global.h>
#include <my_sys.h>
Return Values
None.
21.10.8.2. mysql_thread_end()
void mysql_thread_end(void)
Description
This function needs to be called before calling pthread_exit() to free memory allocated by mysql_thread_init().
mysql_thread_end() is not invoked automatically by the client library. It must be called explicitly to avoid a memory leak.
Return Values
Connectors and APIs
2415
None.
21.10.8.3. mysql_thread_init()
my_bool mysql_thread_init(void)
Description
This function must be called early within each created thread to initialize thread-specific variables. However, you may not necessarily
need to invoke it explicitly: mysql_thread_init() is automatically called by my_init(), which itself is automatically called by
mysql_init(), mysql_library_init(), mysql_server_init(), and mysql_connect(). If you invoke any of those
functions, mysql_thread_init() will be called for you.
Return Values
Zero if successful. Nonzero if an error occurred.
21.10.8.4. mysql_thread_safe()
unsigned int mysql_thread_safe(void)
Description
This function indicates whether the client library is compiled as thread-safe.
Return Values
1 if the client library is thread-safe, 0 otherwise.
21.10.9. C API Embedded Server Function Descriptions
MySQL applications can be written to use an embedded server. See Section 21.9, libmysqld, the Embedded MySQL Server Library.
To write such an application, you must link it against the libmysqld library by using the -lmysqld flag rather than linking it
against the libmysqlclient client library by using the -lmysqlclient flag. However, the calls to initialize and finalize the lib-
rary are the same whether you write a client application or one that uses the embedded server: Call mysql_library_init() to ini-
tialize the library and mysql_library_end() when you are done with it. See Section 21.10.2, C API Function Overview.
21.10.9.1. mysql_server_init()
int mysql_server_init(int argc, char **argv, char **groups)
Description
This function initializes the MySQL library, which must be done before you call any other MySQL function. However,
mysql_server_init() is deprecated and you should call mysql_library_init() instead. See Section 21.10.3.40,
mysql_library_init().
Return Values
Zero if successful. Nonzero if an error occurred.
21.10.9.2. mysql_server_end()
void mysql_server_end(void)
Description
This function finalizes the MySQL library, which should be done when you are done using the library. However,
mysql_server_end() is deprecated and mysql_library_end() should be used instead. See Section 21.10.3.39,
mysql_library_end().
Return Values
None.
Connectors and APIs
2416
21.10.10. Common Questions and Problems When Using the C API
MySQL Enterprise
Subscribers to MySQL Enterprise will find articles about the C API in the MySQL Knowledge Base. Access to
the Knowledge Base collection of articles is one of the advantages of subscribing to MySQL Enterprise. For
more information, see http://www.mysql.com/products/enterprise/advisors.html.
21.10.10.1. Why mysql_store_result() Sometimes Returns NULL After mysql_query() Re-
turns Success
It is possible for mysql_store_result() to return NULL following a successful call to mysql_query(). When this happens, it
means one of the following conditions occurred:
There was a malloc() failure (for example, if the result set was too large).
The data couldn't be read (an error occurred on the connection).
The query returned no data (for example, it was an INSERT, UPDATE, or DELETE).
You can always check whether the statement should have produced a nonempty result by calling mysql_field_count(). If
mysql_field_count() returns zero, the result is empty and the last query was a statement that does not return values (for example,
an INSERT or a DELETE). If mysql_field_count() returns a nonzero value, the statement should have produced a nonempty
result. See the description of the mysql_field_count() function for an example.
You can test for an error by calling mysql_error() or mysql_errno().
21.10.10.2. What Results You Can Get from a Query
In addition to the result set returned by a query, you can also get the following information:
mysql_affected_rows() returns the number of rows affected by the last query when doing an INSERT, UPDATE, or DE-
LETE.
For a fast re-create, use TRUNCATE TABLE.
mysql_num_rows() returns the number of rows in a result set. With mysql_store_result(), mysql_num_rows() may
be called as soon as mysql_store_result() returns. With mysql_use_result(), mysql_num_rows() may be called
only after you have fetched all the rows with mysql_fetch_row().
mysql_insert_id() returns the ID generated by the last query that inserted a row into a table with an AUTO_INCREMENT in-
dex. See Section 21.10.3.37, mysql_insert_id().
Some queries (LOAD DATA INFILE ..., INSERT INTO ... SELECT ..., UPDATE) return additional information. The
result is returned by mysql_info(). See the description for mysql_info() for the format of the string that it returns.
mysql_info() returns a NULL pointer if there is no additional information.
21.10.10.3. How to Get the Unique ID for the Last Inserted Row
If you insert a record into a table that contains an AUTO_INCREMENT column, you can obtain the value stored into that column by call-
ing the mysql_insert_id() function.
You can check from your C applications whether a value was stored in an AUTO_INCREMENT column by executing the following code
(which assumes that you've checked that the statement succeeded). It determines whether the query was an INSERT with an
AUTO_INCREMENT index:
if ((result = mysql_store_result(&mysql)) == 0 &&
mysql_field_count(&mysql) == 0 &&
mysql_insert_id(&mysql) != 0)
{
used_id = mysql_insert_id(&mysql);
}
Connectors and APIs
2417
When a new AUTO_INCREMENT value has been generated, you can also obtain it by executing a SELECT LAST_INSERT_ID()
statement with mysql_query() and retrieving the value from the result set returned by the statement.
When inserting multiple values, the last automatically incremented value is returned.
For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection basis. It is not changed by
another client. It is not even changed if you update another AUTO_INCREMENT column with a nonmagic value (that is, a value that is
not NULL and not 0). Using LAST_INSERT_ID() and AUTO_INCREMENT columns simultaneously from multiple clients is per-
fectly valid. Each client will receive the last inserted ID for the last statement that client executed.
If you want to use the ID that was generated for one table and insert it into a second table, you can use SQL statements like this:
INSERT INTO foo (auto,text)
VALUES(NULL,'text'); # generate ID by inserting NULL
INSERT INTO foo2 (id,text)
VALUES(LAST_INSERT_ID(),'text'); # use ID in second table
Note that mysql_insert_id() returns the value stored into an AUTO_INCREMENT column, whether that value is automatically
generated by storing NULL or 0 or was specified as an explicit value. LAST_INSERT_ID() returns only automatically generated
AUTO_INCREMENT values. If you store an explicit value other than NULL or 0, it does not affect the value returned by
LAST_INSERT_ID().
For more information on obtaining the last ID in an AUTO_INCREMENT column:
For information on LAST_INSERT_ID(), which can be used within an SQL statement, see Section 11.11.3, Information Func-
tions.
For information on mysql_insert_id(), the function you use from within the C API, see Section 21.10.3.37,
mysql_insert_id().
For information on obtaining the auto-incremented value when using Connector/J, see Section 21.4.5, Connector/J Notes and
Tips.
For information on obtaining the auto-incremented value when using Connector/ODBC, see Section 21.1.7.1.1, Obtaining Auto-
Increment Values.
21.10.10.4. Problems Linking with the C API
When linking with the C API, the following errors may occur on some systems:
gcc -g -o client test.o -L/usr/local/lib/mysql \
-lmysqlclient -lsocket -lnsl
Undefined first referenced
symbol in file
floor /usr/local/lib/mysql/libmysqlclient.a(password.o)
ld: fatal: Symbol referencing errors. No output written to client
If this happens on your system, you must include the math library by adding -lm to the end of the compile/link line.
21.10.11. Controlling Automatic Reconnection Behavior
The MySQL client library can perform an automatic reconnection to the server if it finds that the connection is down when you attempt
to send a statement to the server to be executed. In this case, the library tries once to reconnect to the server and send the statement
again.
If it is important for your application to know that the connection has been dropped (so that is can exit or take action to adjust for the
loss of state information), be sure to disable auto-reconnect. This can be done explicitly by calling mysql_options() with the
MYSQL_OPT_RECONNECT option:
my_bool reconnect = 0;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
In MySQL 5.1, auto-reconnect is disabled by default.
Connectors and APIs
2418
If the connection has gone down, the mysql_ping() function performs a reconnect if auto-reconnect is enabled. If auto-reconnect is
disabled, mysql_ping() returns an error instead.
Some client programs might provide the capability of controlling automatic reconnection. For example, mysql reconnects by default,
but the --skip-reconnect option can be used to suppress this behavior.
If an automatic reconnection does occur (for example, as a result of calling mysql_ping()), there is no explicit indication of it. To
check for reconnection, call mysql_thread_id() to get the original connection identifier before calling mysql_ping(), and then
call mysql_thread_id() again to see whether the identifier has changed.
Automatic reconnection can be convenient because you need not implement your own reconnect code, but if a reconnection does occur,
several aspects of the connection state are reset and your application will not know about it. The connection-related state is affected as
follows:
Any active transactions are rolled back and autocommit mode is reset.
All table locks are released.
All TEMPORARY tables are closed (and dropped).
Session variables are reinitialized to the values of the corresponding variables. This also affects variables that are set implicitly by
statements such as SET NAMES.
User variable settings are lost.
Prepared statements are released.
HANDLER variables are closed.
The value of LAST_INSERT_ID() is reset to 0.
Locks acquired with GET_LOCK() are released.
If the connection drops, it is possible that the session associated with the connection on the server side will still be running if the server
has not yet detected that the client is no longer connected. In this case, any locks held by the original connection still belong to that ses-
sion, so you may want to kill it by calling mysql_kill().
21.10.12. C API Support for Multiple Statement Execution
By default, mysql_query() and mysql_real_query() interpret their statement string argument as a single statement to be ex-
ecuted, and you process the result according to whether the statement produces a result set (a set of rows, as for SELECT) or an af-
fected-rows count (as for INSERT, UPDATE, and so forth).
MySQL 5.1 also supports the execution of a string containing multiple statements separated by semicolon (;) characters. This capab-
ility is enabled by special options that are specified either when you connect to the server with mysql_real_connect() or after
connecting by calling` mysql_set_server_option().
Executing a multiple-statement string can produce multiple result sets or row-count indicators. Processing these results involves a dif-
ferent approach than for the single-statement case: After handling the result from the first statement, it is necessary to check whether
more results exist and process them in turn if so. To support multiple-result processing, the C API includes the
mysql_more_results() and mysql_next_result() functions. These functions are used at the end of a loop that iterates as
long as more results are available. Failure to process the result this way may result in a dropped connection to the server.
Multiple-result processing also is required if you execute CALL statements for stored procedures. Results from a stored procedure have
these characteristics:
Statements within the procedure may produce result sets (for example, if it executes SELECT statements). These result sets are re-
turned in the order that they are produced as the procedure executes.
In general, the caller cannot know how many result sets a procedure will return. Procedure execution may depend on loops or condi-
tional statements that cause the execution path to differ from one call to the next. Therefore, you must be prepared to retrieve mul-
tiple results.
Connectors and APIs
2419
The final result from the procedure is a status result that includes no result set. The status indicates whether the procedure succeeded
or an error occurred.
The multiple statement and result capabilities can be used only with mysql_query() or mysql_real_query(). They cannot be
used with the prepared statement interface. Prepared statement handles are defined to work only with strings that contain a single state-
ment. See Section 21.10.4, C API Prepared Statements.
To enable multiple-statement execution and result processing, the following options may be used:
The mysql_real_connect() function has a flags argument for which two option values are relevent:
CLIENT_MULTI_RESULTS enables the client program to process multiple results. This option must be enabled if you execute
CALL statements for stored procedures that produce result sets. Otherwise, such procedures result in an error Error 1312
(0A000): PROCEDURE proc_name can't return a result set in the given context.
CLIENT_MULTI_STATEMENTS enables mysql_query() and mysql_real_query() to execute statement strings con-
taining multiple statements separated by semicolons. This option also enables CLIENT_MULTI_RESULTS implicitly, so a
flags argument of CLIENT_MULTI_STATEMENTS to mysql_real_connect() is equivalent to an argument of CLI-
ENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS. That is, CLIENT_MULTI_STATEMENTS is sufficient to en-
able multiple-statement execution and all multiple-result processing.
After the connection to the server has been established, you can use the mysql_set_server_option() function to enable or
disable multiple-statement execution by passing it an argument of MYSQL_OPTION_MULTI_STATEMENTS_ON or
MYSQL_OPTION_MULTI_STATEMENTS_OFF. Enabling multiple-statement execution with this function also enables processing
of simple results for a multiple-statement string where each statement produces a single result, but is not sufficient to allow pro-
cessing of stored procedures that produce result sets.
The following procedure outlines a suggested strategy for handling multiple statements:
1. Pass CLIENT_MULTI_STATEMENTS to mysql_real_connect(), to fully enable multiple-statement execution and mul-
tiple-result processing.
2. After calling mysql_query() or mysql_real_query() and verifying that it succeeds, enter a loop within which you pro-
cess statement results.
3. For each iteration of the loop, handle the current statement result, retrieving either a result set or an affected-rows count. If an error
occurs, exit the loop.
4. At the end of the loop, call mysql_next_result() to check whether another result exists and initiate retrieval for it if so. If no
more results are available, exit the loop.
One possible implementation of the preceding strategy is shown following. The final part of the loop can be reduced to a simple test of
whether mysql_next_result() returns nonzero. The code as written distinguishes between no more results and an error, which al-
lows a message to be printed for the latter occurrence.
/* connect to server with the CLIENT_MULTI_STATEMENTS option */
if (mysql_real_connect (mysql, host_name, user_name, password,
db_name, port_num, socket_name, CLIENT_MULTI_STATEMENTS) == NULL)
{
printf("mysql_real_connect() failed\n");
mysql_close(mysql);
exit(1);
}
/* execute multiple statements */
status = mysql_query(mysql,
"DROP TABLE IF EXISTS test_table;\
CREATE TABLE test_table(id INT);\
INSERT INTO test_table VALUES(10);\
UPDATE test_table SET id=20 WHERE id=10;\
SELECT * FROM test_table;\
DROP TABLE test_table");
if (status)
{
printf("Could not execute statement(s)");
mysql_close(mysql);
exit(0);
Connectors and APIs
2420
}
/* process each statement result */
do {
/* did current statement return data? */
result = mysql_store_result(mysql);
if (result)
{
/* yes; process rows and free the result set */
process_result_set(mysql, result);
mysql_free_result(result);
}
else /* no result set or error */
{
if (mysql_field_count(mysql) == 0)
{
printf("%lld rows affected\n",
mysql_affected_rows(mysql));
}
else /* some error occurred */
{
printf("Could not retrieve result set\n");
break;
}
}
/* more results? -1 = no, >0 = error, 0 = yes (keep looping) */
if ((status = mysql_next_result(mysql)) > 0)
printf("Could not execute statement\n");
} while (status == 0);
mysql_close(mysql);
21.10.13. C API Prepared Statement Problems
Here follows a list of the currently known problems with prepared statements:
TIME, TIMESTAMP, and DATETIME do not support parts of seconds (for example, from DATE_FORMAT()).
When converting an integer to string, ZEROFILL is honored with prepared statements in some cases where the MySQL server
doesn't print the leading zeros. (For example, with MIN(number-with-zerofill)).
When converting a floating-point number to a string in the client, the rightmost digits of the converted value may differ slightly
from those of the original value.
Before MySQL 5.1.17, prepared statements do not use the query cache. As of 5.1.17, prepared statements use the query cache under
the conditions described in Section 7.5.5.1, How the Query Cache Operates.
Prepared statements do not support multi-statements (that is, multiple statements within a single string separated by ; characters).
In MySQL 5.1, prepared CALL statements cannot invoke stored procedures that return result sets because prepared statements do
not support multiple result sets. Nor can the calling application access a stored procedure's OUT or INOUT parameters when the pro-
cedure returns. These capabilities are supported beginning with MySQL 6.0.
21.10.14. C API Prepared Statement Handling of Date and Time Values
The binary (prepared statement) protocol allows you to send and receive date and time values (DATE, TIME, DATETIME, and
TIMESTAMP), using the MYSQL_TIME structure. The members of this structure are described in Section 21.10.5, C API Prepared
Statement Data types.
To send temporal data values, create a prepared statement using mysql_stmt_prepare(). Then, before calling
mysql_stmt_execute() to execute the statement, use the following procedure to set up each temporal parameter:
1. In the MYSQL_BIND structure associated with the data value, set the buffer_type member to the type that indicates what kind
of temporal value you're sending. For DATE, TIME, DATETIME, or TIMESTAMP values, set buffer_type to
MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, or MYSQL_TYPE_TIMESTAMP, respectively.
2. Set the buffer member of the MYSQL_BIND structure to the address of the MYSQL_TIME structure in which you pass the tem-
poral value.
Connectors and APIs
2421
3. Fill in the members of the MYSQL_TIME structure that are appropriate for the type of temporal value to be passed.
Use mysql_stmt_bind_param() to bind the parameter data to the statement. Then you can call mysql_stmt_execute().
To retrieve temporal values, the procedure is similar, except that you set the buffer_type member to the type of value you expect to
receive, and the buffer member to the address of a MYSQL_TIME structure into which the returned value should be placed. Use
mysql_stmt_bind_result() to bind the buffers to the statement after calling mysql_stmt_execute() and before fetching
the results.
Here is a simple example that inserts DATE, TIME, and TIMESTAMP data. The mysql variable is assumed to be a valid connection
handle.
MYSQL_TIME ts;
MYSQL_BIND bind[3];
MYSQL_STMT *stmt;
strmov(query, "INSERT INTO test_table(date_field, time_field, \
timestamp_field) VALUES(?,?,?");
stmt = mysql_stmt_init(mysql);
if (!stmt)
{
fprintf(stderr, " mysql_stmt_init(), out of memory\n");
exit(0);
}
if (mysql_stmt_prepare(mysql, query, strlen(query)))
{
fprintf(stderr, "\n mysql_stmt_prepare(), INSERT failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
/* set up input buffers for all 3 parameters */
bind[0].buffer_type= MYSQL_TYPE_DATE;
bind[0].buffer= (char *)&ts;
bind[0].is_null= 0;
bind[0].length= 0;
...
bind[1]= bind[2]= bind[0];
...
mysql_stmt_bind_param(stmt, bind);
/* supply the data to be sent in the ts structure */
ts.year= 2002;
ts.month= 02;
ts.day= 03;
ts.hour= 10;
ts.minute= 45;
ts.second= 20;
mysql_stmt_execute(stmt);
..
21.10.15. C API Support for Prepared CALL Statements
In MySQL 5.1, prepared CALL statements can be used only for stored procedures that produce at most one result set. Nor can the call-
ing application use placeholders for OUT or INOUT parameters.
MySQL 6.0 expands prepared CALL statement support for stored procedures that produce multiple result sets and to provide placehold-
er access to OUT and INOUT parameters.
21.10.16. Building Client Programs
If you compile MySQL clients that you've written yourself or that you obtain from a third-party, they must be linked using the -
lmysqlclient -lz options in the link command. You may also need to specify a -L option to tell the linker where to find the lib-
rary. For example, if the library is installed in /usr/local/mysql/lib, use -L/usr/local/mysql/lib -lmysqlclient
-lz in the link command.
For clients that use MySQL header files, you may need to specify an -I option when you compile them (for example, -
I/usr/local/mysql/include), so that the compiler can find the header files.
Connectors and APIs
2422
To make it simpler to compile MySQL programs on Unix, we have provided the mysql_config script for you. See Section 4.7.2,
mysql_config Get Compile Options for Compiling Clients.
You can use it to compile a MySQL client as follows:
CFG=/usr/local/mysql/bin/mysql_config
sh -c "gcc -o progname `$CFG --cflags` progname.c `$CFG --libs`"
The sh -c is needed to get the shell not to treat the output from mysql_config as one word.
MySQL Enterprise
Subscribers to MySQL Enterprise will find an example client program in the Knowledge Base article, Sample C
program using the embedded MySQL server library . Access to the MySQL Knowledge Base collection of art-
icles is one of the advantages of subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.10.17. How to Make a Threaded Client
The client library is almost thread-safe. The biggest problem is that the subroutines in net.c that read from sockets are not interrupt
safe. This was done with the thought that you might want to have your own alarm that can break a long read to a server. If you install in-
terrupt handlers for the SIGPIPE interrupt, the socket handling should be thread-safe.
To avoid aborting the program when a connection terminates, MySQL blocks SIGPIPE on the first call to
mysql_library_init(), mysql_init(), or mysql_connect(). If you want to use your own SIGPIPE handler, you
should first call mysql_library_init() and then install your handler.
Before MySQL 4.0, binary client libraries that we provided other than those for Windows were not normally compiled with the thread-
safe option. Current binary distributions should have both a normal and a thread-safe client library.
To create a threaded client where you can interrupt the client from other threads and set timeouts when talking with the MySQL server,
you should use the net_serv.o code that the server uses and the -lmysys, -lmystrings, and -ldbug libraries.
If you don't need interrupts or timeouts, you can just compile a thread-safe client library (mysqlclient_r) and use it. In this case,
you don't have to worry about the net_serv.o object file or the other MySQL libraries.
When using a threaded client and you want to use timeouts and interrupts, you can make great use of the routines in the thr_alarm.c
file. If you are using routines from the mysys library, the only thing you must remember is to call my_init() first! See Sec-
tion 21.10.8, C API Threaded Function Descriptions.
In all cases, be sure to initialize the client library by calling mysql_library_init() before calling any other MySQL functions.
When you are done with the library, call mysql_library_end().
mysql_real_connect() is not thread-safe by default. The following notes describe how to compile a thread-safe client library and
use it in a thread-safe manner. (The notes below for mysql_real_connect() also apply to the older mysql_connect() routine
as well, although mysql_connect() is deprecated and should no longer be used.)
To make mysql_real_connect() thread-safe, you must configure your MySQL distribution with this command:
shell> ./configure --enable-thread-safe-client
Then recompile the distribution to create a thread-safe client library, libmysqlclient_r. (Assuming that your operating system has
a thread-safe gethostbyname_r() function.) This library is thread-safe per connection. You can let two threads share the same con-
nection with the following caveats:
Two threads can't send a query to the MySQL server at the same time on the same connection. In particular, you have to ensure that
between calls to mysql_query() and mysql_store_result() no other thread is using the same connection.
Many threads can access different result sets that are retrieved with mysql_store_result().
If you use mysql_use_result(), you must ensure that no other thread is using the same connection until the result set is
closed. However, it really is best for threaded clients that share the same connection to use mysql_store_result().
If you want to use multiple threads on the same connection, you must have a mutex lock around your pair of mysql_query() and
Connectors and APIs
2423
mysql_store_result() calls. Once mysql_store_result() is ready, the lock can be released and other threads may
query the same connection.
If you use POSIX threads, you can use pthread_mutex_lock() and pthread_mutex_unlock() to establish and release a
mutex lock.
You need to know the following if you have a thread that is calling MySQL functions which did not create the connection to the
MySQL database:
When you call mysql_init(), MySQL creates a thread-specific variable for the thread that is used by the debug library (among oth-
er things). If you call a MySQL function before the thread has called mysql_init(), the thread does not have the necessary thread-
specific variables in place and you are likely to end up with a core dump sooner or later. To get things to work smoothly you must do
the following:
1. Call mysql_library_init() before any other MySQL functions. It is not thread-safe, so call it before threads are created, or
protect the call with a mutex.
2. Arrange for mysql_thread_init() to be called early in the thread handler before calling any MySQL function. If you call
mysql_init(), they will call mysql_thread_init() for you.
3. In the thread, call mysql_thread_end() before calling pthread_exit(). This frees the memory used by MySQL thread-
specific variables.
The preceding notes regarding mysql_init() also apply to mysql_connect(), which calls mysql_init().
If undefined symbol errors occur when linking your client with libmysqlclient_r, in most cases this is because you haven't in-
cluded the thread libraries on the link/compile command.
21.11. MySQL PHP API
PHP is a server-side, HTML-embedded scripting language that may be used to create dynamic Web pages. It is available for most oper-
ating systems and Web servers, and can access most common databases, including MySQL. PHP may be run as a separate program or
compiled as a module for use with the Apache Web server.
PHP actually provides two different MySQL API extensions:
mysql: Available for PHP versions 4 and 5, this extension is intended for use with MySQL versions prior to MySQL 4.1. This ex-
tension does not support the improved authentication protocol used in MySQL 4.1, nor does it support prepared statements or mul-
tiple statements. If you wish to use this extension with MySQL 4.1, you will likely want to configure the MySQL server to use the -
-old-passwords option (see Section B.1.2.4, Client does not support authentication protocol). This
extension is documented on the PHP Web site at http://php.net/mysql.
Section 21.11.2, MySQL Improved Extension (Mysqli) - Stands for MySQL, Improved; this extension is available only in
PHP 5. It is intended for use with MySQL 4.1.1 and later. This extension fully supports the authentication protocol used in MySQL
5.0, as well as the Prepared Statements and Multiple Statements APIs. In addition, this extension provides an advanced, object-
oriented programming interface. You can read the documentation for the mysqli extension at http://php.net/mysqli. Helpful article
can be found at http://devzone.zend.com/node/view/id/686 and http://devzone.zend.com/node/view/id/687.
If you're experiencing problems with enabling both the mysql and the mysqli extension when building PHP on Linux yourself, see
Section 21.11.6, Enabling Both mysql and mysqli in PHP.
The PHP distribution and documentation are available from the PHP Web site.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about MySQL and PHP in the Knowledge Base art-
icles found at PHP. Access to the MySQL Knowledge Base collection of articles is one of the advantages of
subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/knowledgebase.html.
Portions of this section are Copyright (c) 1997-2008 the PHP Documentation Group This material may be distributed only subject to
Connectors and APIs
2424
the terms and conditions set forth in the Creative Commons Attribution 3.0 License or later. A copy of the Creative Commons Attribu-
tion 3.0 license is distributed with this manual. The latest version is presently available at This material may be distributed only subject
to the terms and conditio\ ns set forth in the Open Publication License, v1.0.8 or later (the latest version is presently available at ht-
tp://www.opencontent.org/openpub/).
21.11.1. MySQL
Copyright 1997-2008 the PHP Documentation Group.
These functions allow you to access MySQL database servers. More information about MySQL can be found at
http://www.mysql.com/.
Documentation for MySQL can be found at http://dev.mysql.com/doc/.
For an overview of MySQL database connectivity terms and products see Section 21.11.2.2, Overview.
21.11.1.1. Installing/Configuring
Copyright 1997-2008 the PHP Documentation Group.
21.11.1.1.1. Requirements
Copyright 1997-2008 the PHP Documentation Group.
In order to have these functions available, you must compile PHP with MySQL support.
21.11.1.1.2. Installation
Copyright 1997-2008 the PHP Documentation Group.
For compiling, simply use the --with-mysql[=DIR] configuration option where the optional [DIR] points to the MySQL installa-
tion directory.
Although this MySQL extension is compatible with MySQL 4.1.0 and greater, it doesn't support the extra functionality that these ver-
sions provide. For that, use the MySQLi extension.
If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any
conflicts.
21.11.1.1.2.1. Installation on Linux Systems
Copyright 1997-2008 the PHP Documentation Group.
21.11.1.1.2.1.1. PHP 4
Copyright 1997-2008 the PHP Documentation Group.
The option --with-mysql is enabled by default. This default behavior may be disabled with the --without-mysql configure op-
tion. If MySQL is enabled without specifying the path to the MySQL install DIR, PHP will use the bundled MySQL client libraries.
Users who run other applications that use MySQL (for example, auth-mysql) should not use the bundled library, but rather specify
the path to MySQL's install directory, like so: --with-mysql=/path/to/mysql. This will force PHP to use the client libraries in-
stalled by MySQL, thus avoiding any conflicts.
21.11.1.1.2.1.2. PHP 5+
Copyright 1997-2008 the PHP Documentation Group.
MySQL is not enabled by default, nor is the MySQL library bundled with PHP. Read this FAQ for details on why. Use the -
-with-mysql[=DIR] configure option to include MySQL support. You can download headers and libraries from MySQL.
21.11.1.1.2.2. Installation on Windows Systems
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2425
21.11.1.1.2.2.1. PHP 4
Copyright 1997-2008 the PHP Documentation Group.
The PHP MySQL extension is compiled into PHP.
21.11.1.1.2.2.2. PHP 5+
Copyright 1997-2008 the PHP Documentation Group.
MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access
to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk
to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the
PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also
works (because the system directory is by default in the system's PATH), it's not recommended.
As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where
the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is
c:\php\ext
Note
If when starting the web server an error similar to the following occurs: "Unable to load dynamic library
'./php_mysql.dll'", this is because php_mysql.dll and/or libmysql.dll cannot be found by the system.
21.11.1.1.2.3. MySQL Installation Notes
Copyright 1997-2008 the PHP Documentation Group.
Warning
Crashes and startup problems of PHP may be encountered when loading this extension in conjunction with the recode ex-
tension. See the recode extension for more information.
Note
If you need charsets other than latin (default), you have to install external (not bundled) libmysql with compiled charset
support.
21.11.1.1.3. Runtime Configuration
Copyright 1997-2008 the PHP Documentation Group.
The behaviour of these functions is affected by settings in php.ini.
Table 21.4. MySQL Configuration Options
Name Default Changeable Changelog
mysql.allow_persistent "1" PHP_INI_SYSTEM
mysql.max_persistent "-1" PHP_INI_SYSTEM
mysql.max_links "-1" PHP_INI_SYSTEM
mysql.trace_mode "0" PHP_INI_ALL Available since PHP 4.3.0.
mysql.default_port NULL PHP_INI_ALL
mysql.default_socket NULL PHP_INI_ALL Available since PHP 4.0.1.
mysql.default_host NULL PHP_INI_ALL
mysql.default_user NULL PHP_INI_ALL
mysql.default_password NULL PHP_INI_ALL
mysql.connect_timeout "60" PHP_INI_ALL PHP_INI_SYSTEM in PHP <=
4.3.2. Available since PHP
Connectors and APIs
2426
Name Default Changeable Changelog
4.3.0.
For further details and definitions of the PHP_INI_* modes, see the configuration.changes.modes.
Here's a short explanation of the configuration directives.
mysql.allow_persistent
boolean
Whether to allow persistent connections to MySQL.
mysql.max_persistent in-
teger
The maximum number of persistent MySQL connections per process.
mysql.max_links integer The maximum number of MySQL connections per process, including persistent connections.
mysql.trace_mode boolean Trace mode. When mysql.trace_mode is enabled, warnings for table/index scans, non free
result sets, and SQL-Errors will be displayed. (Introduced in PHP 4.3.0)
mysql.default_port string The default TCP port number to use when connecting to the database server if no other port is
specified. If no default is specified, the port will be obtained from the MYSQL_TCP_PORT envir-
onment variable, the mysql-tcp entry in /etc/services or the compile-time
MYSQL_PORT constant, in that order. Win32 will only use the MYSQL_PORT constant.
mysql.default_socket
string
The default socket name to use when connecting to a local database server if no other socket
name is specified.
mysql.default_host string The default server host to use when connecting to the database server if no other host is specified.
Doesn't apply in SQL safe mode.
mysql.default_user string The default user name to use when connecting to the database server if no other name is spe-
cified. Doesn't apply in SQL safe mode.
mysql.default_password
string
The default password to use when connecting to the database server if no other password is spe-
cified. Doesn't apply in SQL safe mode.
mysql.connect_timeout in-
teger
Connect timeout in seconds. On Linux this timeout is also used for waiting for the first answer
from the server.
21.11.1.1.4. Resource Types
Copyright 1997-2008 the PHP Documentation Group.
There are two resource types used in the MySQL module. The first one is the link identifier for a database connection, the second a re-
source which holds the result of a query.
21.11.1.2. Predefined Constants
Copyright 1997-2008 the PHP Documentation Group.
The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or
dynamically loaded at runtime.
Since PHP 4.3.0 it is possible to specify additional client flags for the mysql_connect and mysql_pconnect functions. The fol-
lowing constants are defined:
Table 21.5. MySQL client constants
Constant Description
MYSQL_CLIENT_COMPRESS Use compression protocol
MYSQL_CLIENT_IGNORE_SPACE Allow space after function names
MYSQL_CLIENT_INTERACTIVE Allow interactive_timeout seconds (instead of wait_timeout)
of inactivity before closing the connection.
Connectors and APIs
2427
Constant Description
MYSQL_CLIENT_SSL Use SSL encryption. This flag is only available with version 4.x of
the MySQL client library or newer. Version 3.23.x is bundled both
with PHP 4 and Windows binaries of PHP 5.
The function mysql_fetch_array uses a constant for the different types of result arrays. The following constants are defined:
Table 21.6. MySQL fetch constants
Constant Description
MYSQL_ASSOC Columns are returned into the array having the fieldname as the ar-
ray index.
MYSQL_BOTH Columns are returned into the array having both a numerical index
and the fieldname as the array index.
MYSQL_NUM Columns are returned into the array having a numerical index to
the fields. This index starts with 0, the first field in the result.
21.11.1.3. Examples
Copyright 1997-2008 the PHP Documentation Group.
21.11.1.3.1. Basic
This simple example shows how to connect, execute a query, print resulting rows and disconnect from a MySQL database.
Example 21.13. MySQL extension overview example
Copyright 1997-2008 the PHP Documentation Group.
<?php
// Connecting, selecting database
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?>
21.11.1.4. MySQL Functions
Copyright 1997-2008 the PHP Documentation Group.
Note
Connectors and APIs
2428
Most MySQL functions accept link_identifier as the last optional parameter. If it is not provided, last opened con-
nection is used. If it doesn't exist, connection is tried to establish with default parameters defined in php.ini. If it is not
successful, functions return FALSE .
21.11.1.4.1. mysql_affected_rows
Copyright 1997-2008 the PHP Documentation Group.
mysql_affected_rows
Get number of affected rows in previous MySQL operation
Description
int mysql_affected_rows(resource link_identifier);
Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query associated with link_identifier.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns the number of affected rows on success, and -1 if the last query failed.
If the last query was a DELETE query with no WHERE clause, all of the records will have been deleted from the table but this function
will return zero with MySQL versions prior to 4.1.2.
When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility
that mysql_affected_rows may not actually equal the number of rows matched, only the number of rows that were literally af-
fected by the query.
The REPLACE statement first deletes the record with the same primary key and then inserts the new record. This function returns the
number of deleted records plus the number of inserted records.
Examples
Example 21.14. mysql_affected_rows example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
/* this should return the correct numbers of deleted records */
mysql_query('DELETE FROM mytable WHERE id < 10');
printf("Records deleted: %d\n", mysql_affected_rows());
/* with a where clause that is never true, it should return 0 */
mysql_query('DELETE FROM mytable WHERE 0');
printf("Records deleted: %d\n", mysql_affected_rows());
?>
Connectors and APIs
2429
The above example will output something similar to:
Records deleted: 10
Records deleted: 0
Example 21.15. mysql_affected_rows example using transactions
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
/* Update records */
mysql_query("UPDATE mytable SET used=1 WHERE id < 10");
printf ("Updated records: %d\n", mysql_affected_rows());
mysql_query("COMMIT");
?>
The above example will output something similar to:
Updated Records: 10
Notes
Transactions
If you are using transactions, you need to call mysql_affected_rows after your INSERT, UPDATE, or DELETE
query, not after the COMMIT.
SELECT Statements
To retrieve the number of rows returned by a SELECT, it is possible to use mysql_num_rows.
See Also
mysql_num_rows
mysql_info
21.11.1.4.2. mysql_change_user
Copyright 1997-2008 the PHP Documentation Group.
mysql_change_user
Change logged in user of the active connection
Description
Connectors and APIs
2430
int mysql_change_user(string user,
string password,
string database,
resource link_identifier);
mysql_change_user changes the logged in user of the current active connection, or the connection given by the optional
link_identifier parameter. If a database is specified, this will be the current database after the user has been changed. If the new
user and password authorization fails, the current connected user stays active.
This function is deprecated and no longer exists in PHP.
Parameters
user The new MySQL username.
password The new MySQL password.
database The MySQL database. If not specified, the current selected database is used.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Requirements
This function requires MySQL 3.23.3 or higher.
See Also
mysql_connect
mysql_select_db
mysql_query
21.11.1.4.3. mysql_client_encoding
Copyright 1997-2008 the PHP Documentation Group.
mysql_client_encoding
Returns the name of the character set
Description
string mysql_client_encoding(resource link_identifier);
Retrieves the character_set variable from MySQL.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
Connectors and APIs
2431
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns the default character set name for the current connection.
Examples
Example 21.16. mysql_client_encoding example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$charset = mysql_client_encoding($link);
echo "The current character set is: $charset\n";
?>
The above example will output something similar to:
The current character set is: latin1
See Also
mysql_set_charset
mysql_real_escape_string
21.11.1.4.4. mysql_close
Copyright 1997-2008 the PHP Documentation Group.
mysql_close
Close MySQL connection
Description
bool mysql_close(resource link_identifier);
mysql_close closes the non-persistent connection to the MySQL server that's associated with the specified link identifier. If
link_identifier isn't specified, the last opened link is used.
Using mysql_close isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.
See also freeing resources.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
Connectors and APIs
2432
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.17. mysql_close example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
The above example will output:
Connected successfully
Notes
Note
mysql_close will not close persistent links created by mysql_pconnect.
See Also
mysql_connect
mysql_free_result
21.11.1.4.5. mysql_connect
Copyright 1997-2008 the PHP Documentation Group.
mysql_connect
Open a connection to a MySQL Server
Description
resource mysql_connect(string server= =ini_get("mysql.default_host"),
string username= =ini_get("mysql.default_user"),
string password= =ini_get("mysql.default_password"),
bool new_link= =false,
int client_flags= =0);
Opens or reuses a connection to a MySQL server.
Parameters
Connectors and APIs
2433
server The MySQL server. It can also include a port number. e.g. "hostname:port" or a path to a local
socket e.g. ":/path/to/socket" for the localhost.
If the PHP directive mysql.default_host is undefined (default), then the default value is 'local-
host:3306'. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used.
username The username. Default value is defined by mysql.default_user. In SQL safe mode, this parameter
is ignored and the name of the user that owns the server process is used.
password The password. Default value is defined by mysql.default_password. In SQL safe mode, this para-
meter is ignored and empty password is used.
new_link If a second call is made to mysql_connect with the same arguments, no new link will be es-
tablished, but instead, the link identifier of the already opened link will be returned. The
new_link parameter modifies this behavior and makes mysql_connect always open a new
link, even if mysql_connect was called before with the same parameters. In SQL safe mode,
this parameter is ignored.
client_flags The client_flags parameter can be a combination of the following constants: 128 (enable
LOAD DATA LOCAL handling), MYSQL_CLIENT_SSL , MYSQL_CLIENT_COMPRESS ,
MYSQL_CLIENT_IGNORE_SPACE or MYSQL_CLIENT_INTERACTIVE . Read the section
about Table 21.5, MySQL client constants for further information. In SQL safe mode, this
parameter is ignored.
Return Values
Returns a MySQL link identifier on success, or FALSE on failure.
Changelog
Version Description
4.3.0 Added the client_flags parameter.
4.2.0 Added the new_link parameter.
Examples
Example 21.18. mysql_connect example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
Example 21.19. mysql_connect example using hostname:port syntax
<?php
// we connect to example.com and port 3307
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
Connectors and APIs
2434
}
echo 'Connected successfully';
mysql_close($link);
// we connect to localhost at port 3307
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
Example 21.20. mysql_connect example using ":/path/to/socket" syntax
<?php
// we connect to localhost and socket e.g. /tmp/mysql.sock
//variant 1: ommit localhost
$link = mysql_connect(':/tmp/mysql', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
// variant 2: with localhost
$link = mysql_connect('localhost:/tmp/mysql.sock', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
Notes
Note
Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to con-
nect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead of "localhost". If the
MySQL client library tries to connect to the wrong local socket, you should set the correct path as
mysql.default_host string in your PHP configuration and leave the server field blank.
Note
The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly call-
ing mysql_close.
Note
You can suppress the error message on failure by prepending a @ to the function name.
Note
Error "Can't create TCP/IP socket (10106)" usually means that the variables_order configure directive doesn't contain
character E. On Windows, if the environment is not copied the SYSTEMROOT environment variable won't be available and
PHP will have problems loading Winsock.
See Also
mysql_pconnect
mysql_close
Connectors and APIs
2435
21.11.1.4.6. mysql_create_db
Copyright 1997-2008 the PHP Documentation Group.
mysql_create_db
Create a MySQL database
Description
bool mysql_create_db(string database_name,
resource link_identifier);
mysql_create_db attempts to create a new database on the server associated with the specified link identifier.
Parameters
database_name The name of the database being created.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.21. mysql_create_db alternative example
The function mysql_create_db is deprecated. It is preferable to use mysql_query to issue a sql CREATE DATABASE statement
instead.
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
The above example will output something similar to:
Database my_db created successfully
Connectors and APIs
2436
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_createdb
Note
This function will not be available if the MySQL extension was built against a MySQL 4.x client library.
See Also
mysql_query
mysql_select_db
21.11.1.4.7. mysql_data_seek
Copyright 1997-2008 the PHP Documentation Group.
mysql_data_seek
Move internal result pointer
Description
bool mysql_data_seek(resource result,
int row_number);
mysql_data_seek moves the internal row pointer of the MySQL result associated with the specified result identifier to point to the
specified row number. The next call to a MySQL fetch function, such as mysql_fetch_assoc, would return that row.
row_number starts at 0. The row_number should be a value in the range from 0 to mysql_num_rows - 1. However if the result
set is empty (mysql_num_rows == 0), a seek to 0 will fail with a E_WARNING and mysql_data_seek will return FALSE .
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
row_number The desired row number of the new result pointer.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.22. mysql_data_seek example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('sample_db');
if (!$db_selected) {
die('Could not select database: ' . mysql_error());
}
$query = 'SELECT last_name, first_name FROM friends';
$result = mysql_query($query);
if (!$result) {
die('Query failed: ' . mysql_error());
Connectors and APIs
2437
}
/* fetch rows in reverse order */
for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
if (!mysql_data_seek($result, $i)) {
echo "Cannot seek to row $i: " . mysql_error() . "\n";
continue;
}
if (!($row = mysql_fetch_assoc($result))) {
continue;
}
echo $row['last_name'] . ' ' . $row['first_name'] . "<br />\n";
}
mysql_free_result($result);
?>
Notes
Note
The function mysql_data_seek can be used in conjunction only with mysql_query, not with
mysql_unbuffered_query.
See Also
mysql_query
mysql_num_rows
mysql_fetch_row
mysql_fetch_assoc
mysql_fetch_array
mysql_fetch_object
21.11.1.4.8. mysql_db_name
Copyright 1997-2008 the PHP Documentation Group.
mysql_db_name
Get result data
Description
string mysql_db_name(resource result,
int row,
mixed field);
Retrieve the database name from a call to mysql_list_dbs.
Parameters
result The result pointer from a call to mysql_list_dbs.
row The index into the result set.
field The field name.
Return Values
Returns the database name on success, and FALSE on failure. If FALSE is returned, use mysql_error to determine the nature of the
error.
Connectors and APIs
2438
Examples
Example 21.23. mysql_db_name example
<?php
error_reporting(E_ALL);
$link = mysql_connect('dbhost', 'username', 'password');
$db_list = mysql_list_dbs($link);
$i = 0;
$cnt = mysql_num_rows($db_list);
while ($i < $cnt) {
echo mysql_db_name($db_list, $i) . "\n";
$i++;
}
?>
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_dbname
See Also
mysql_list_dbs
mysql_tablename
21.11.1.4.9. mysql_db_query
Copyright 1997-2008 the PHP Documentation Group.
mysql_db_query
Send a MySQL query
Description
resource mysql_db_query(string database,
string query,
resource link_identifier);
mysql_db_query selects a database, and executes a query on it.
Parameters
database The name of the database that will be selected.
query The MySQL query.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Connectors and APIs
2439
Returns a positive MySQL result resource to the query result, or FALSE on error. The function also returns TRUE / FALSE for
INSERT/UPDATE/DELETE queries to indicate success/failure.
Changelog
Version Description
5.3.0 This function now throws an E_DEPRECATED notice.
4.0.6 This function is deprecated, do not use this function. Use
mysql_select_db and mysql_query instead.
Examples
Example 21.24. mysql_db_query alternative example
<?php
if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('mysql_dbname', $link)) {
echo 'Could not select database';
exit;
}
$sql = 'SELECT foo FROM bar WHERE id = 42';
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row['foo'];
}
mysql_free_result($result);
?>
Notes
Note
Be aware that this function does NOT switch back to the database you were connected before. In other words, you can't use
this function to temporarily run a sql query on another database, you would have to manually switch back. Users are
strongly encouraged to use the database.table syntax in their sql queries or mysql_select_db instead of this
function.
See Also
mysql_query
mysql_select_db
21.11.1.4.10. mysql_drop_db
Copyright 1997-2008 the PHP Documentation Group.
mysql_drop_db
Connectors and APIs
2440
Drop (delete) a MySQL database
Description
bool mysql_drop_db(string database_name,
resource link_identifier);
mysql_drop_db attempts to drop (remove) an entire database from the server associated with the specified link identifier. This func-
tion is deprecated, it is preferable to use mysql_query to issue a sql DROP DATABASE statement instead.
Parameters
database_name The name of the database that will be deleted.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.25. mysql_drop_db alternative example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$sql = 'DROP DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db was successfully dropped\n";
} else {
echo 'Error dropping database: ' . mysql_error() . "\n";
}
?>
Notes
Warning
This function will not be available if the MySQL extension was built against a MySQL 4.x client library.
Note
For backward compatibility, the following deprecated alias may be used: mysql_dropdb
See Also
mysql_query
21.11.1.4.11. mysql_errno
Connectors and APIs
2441
Copyright 1997-2008 the PHP Documentation Group.
mysql_errno
Returns the numerical value of the error message from previous MySQL operation
Description
int mysql_errno(resource link_identifier);
Returns the error number from the last MySQL function.
Errors coming back from the MySQL database backend no longer issue warnings. Instead, use mysql_errno to retrieve the error
code. Note that this function only returns the error code from the most recently executed MySQL function (not including
mysql_error and mysql_errno), so if you want to use it, make sure you check the value before calling another MySQL function.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns the error number from the last MySQL function, or 0 (zero) if no error occurred.
Examples
Example 21.26. mysql_errno example
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
if (!mysql_select_db("nonexistentdb", $link)) {
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
}
mysql_select_db("kossu", $link);
if (!mysql_query("SELECT * FROM nonexistenttable", $link)) {
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
}
?>
The above example will output something similar to:
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
See Also
mysql_error
Connectors and APIs
2442
MySQL error codes
21.11.1.4.12. mysql_error
Copyright 1997-2008 the PHP Documentation Group.
mysql_error
Returns the text of the error message from previous MySQL operation
Description
string mysql_error(resource link_identifier);
Returns the error text from the last MySQL function. Errors coming back from the MySQL database backend no longer issue warnings.
Instead, use mysql_error to retrieve the error text. Note that this function only returns the error text from the most recently executed
MySQL function (not including mysql_error and mysql_errno), so if you want to use it, make sure you check the value before
calling another MySQL function.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns the error text from the last MySQL function, or '' (empty string) if no error occurred.
Examples
Example 21.27. mysql_error example
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("nonexistentdb", $link);
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
mysql_select_db("kossu", $link);
mysql_query("SELECT * FROM nonexistenttable", $link);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
?>
The above example will output something similar to:
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
See Also
mysql_errno
Connectors and APIs
2443
MySQL error codes
21.11.1.4.13. mysql_escape_string
Copyright 1997-2008 the PHP Documentation Group.
mysql_escape_string
Escapes a string for use in a mysql_query
Description
string mysql_escape_string(string unescaped_string);
This function will escape the unescaped_string, so that it is safe to place it in a mysql_query. This function is deprecated.
This function is identical to mysql_real_escape_string except that mysql_real_escape_string takes a connection
handler and escapes the string according to the current character set. mysql_escape_string does not take a connection argument
and does not respect the current charset setting.
Parameters
unescaped_string The string that is to be escaped.
Return Values
Returns the escaped string.
Changelog
Version Description
5.3.0 This function now throws an E_DEPRECATED notice.
4.3.0 This function became deprecated, do not use this function. Instead,
use mysql_real_escape_string.
Examples
Example 21.28. mysql_escape_string example
<?php
$item = "Zak's Laptop";
$escaped_item = mysql_escape_string($item);
printf("Escaped string: %s\n", $escaped_item);
?>
The above example will output:
Escaped string: Zak\'s Laptop
Connectors and APIs
2444
Notes
Note
mysql_escape_string does not escape % and _.
See Also
mysql_real_escape_string
addslashes
The magic_quotes_gpc directive.
21.11.1.4.14. mysql_fetch_array
Copyright 1997-2008 the PHP Documentation Group.
mysql_fetch_array
Fetch a result row as an associative array, a numeric array, or both
Description
array mysql_fetch_array(resource result,
int result_type= =MYSQL_BOTH);
Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
result_type The type of array that is to be fetched. It's a constant and can take the following values:
MYSQL_ASSOC , MYSQL_NUM , and the default value of MYSQL_BOTH .
Return Values
Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The type of returned array depends
on how result_type is defined. By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Us-
ing MYSQL_ASSOC , you only get associative indices (as mysql_fetch_assoc works), using MYSQL_NUM , you only get number
indices (as mysql_fetch_row works).
If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of
the same name, you must use the numeric index of the column or make an alias for the column. For aliased columns, you cannot access
the contents with the original column name.
Examples
Example 21.29. Query with aliased duplicate field names
SELECT table1.field AS foo, table2.field AS bar FROM table1, table2
Example 21.30. mysql_fetch_array with MYSQL_NUM
Connectors and APIs
2445
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s Name: %s", $row[0], $row[1]);
}
mysql_free_result($result);
?>
Example 21.31. mysql_fetch_array with MYSQL_ASSOC
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
printf("ID: %s Name: %s", $row["id"], $row["name"]);
}
mysql_free_result($result);
?>
Example 21.32. mysql_fetch_array with MYSQL_BOTH
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
printf ("ID: %s Name: %s", $row[0], $row["name"]);
}
mysql_free_result($result);
?>
Notes
Performance
An important thing to note is that using mysql_fetch_array is not significantly slower than using
mysql_fetch_row, while it provides a significant added value.
Note
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
Connectors and APIs
2446
See Also
mysql_fetch_row
mysql_fetch_assoc
mysql_data_seek
mysql_query
21.11.1.4.15. mysql_fetch_assoc
Copyright 1997-2008 the PHP Documentation Group.
mysql_fetch_assoc
Fetch a result row as an associative array
Description
array mysql_fetch_assoc(resource result);
Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc is
equivalent to calling mysql_fetch_array with MYSQL_ASSOC for the optional second parameter. It only returns an associative
array.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
Return Values
Returns an associative array of strings that corresponds to the fetched row, or FALSE if there are no more rows.
If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of
the same name, you either need to access the result with numeric indices by using mysql_fetch_row or add alias names. See the ex-
ample at the mysql_fetch_array description about aliases.
Examples
Example 21.33. An expanded mysql_fetch_assoc example
<?php
$conn = mysql_connect("localhost", "mysql_user", "mysql_password");
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("mydbname")) {
echo "Unable to select mydbname: " . mysql_error();
exit;
}
$sql = "SELECT id as userid, fullname, userstatus
FROM sometable
WHERE userstatus = 1";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
Connectors and APIs
2447
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you'll
// then create $userid, $fullname, and $userstatus
while ($row = mysql_fetch_assoc($result)) {
echo $row["userid"];
echo $row["fullname"];
echo $row["userstatus"];
}
mysql_free_result($result);
?>
Notes
Performance
An important thing to note is that using mysql_fetch_assoc is not significantly slower than using
mysql_fetch_row, while it provides a significant added value.
Note
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
See Also
mysql_fetch_row
mysql_fetch_array
mysql_data_seek
mysql_query
mysql_error
21.11.1.4.16. mysql_fetch_field
Copyright 1997-2008 the PHP Documentation Group.
mysql_fetch_field
Get column information from a result and return as an object
Description
object mysql_fetch_field(resource result,
int field_offset= =0);
Returns an object containing field information. This function can be used to obtain information about fields in the provided query result.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. If the field offset is not specified, the next field that was not yet re-
Connectors and APIs
2448
trieved by this function is retrieved. The field_offset starts at 0.
Return Values
Returns an object containing field information. The properties of the object are:
name - column name
table - name of the table the column belongs to
def - default value of the column
max_length - maximum length of the column
not_null - 1 if the column cannot be NULL
primary_key - 1 if the column is a primary key
unique_key - 1 if the column is a unique key
multiple_key - 1 if the column is a non-unique key
numeric - 1 if the column is numeric
blob - 1 if the column is a BLOB
type - the type of the column
unsigned - 1 if the column is unsigned
zerofill - 1 if the column is zero-filled
Examples
Example 21.34. mysql_fetch_field example
<?php
$conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('database');
$result = mysql_query('select * from table');
if (!$result) {
die('Query failed: ' . mysql_error());
}
/* get column metadata */
$i = 0;
while ($i < mysql_num_fields($result)) {
echo "Information for column $i:<br />\n";
$meta = mysql_fetch_field($result, $i);
if (!$meta) {
echo "No information available<br />\n";
}
echo "<pre>
blob: $meta->blob
max_length: $meta->max_length
multiple_key: $meta->multiple_key
name: $meta->name
not_null: $meta->not_null
numeric: $meta->numeric
primary_key: $meta->primary_key
table: $meta->table
type: $meta->type
default: $meta->def
unique_key: $meta->unique_key
unsigned: $meta->unsigned
zerofill: $meta->zerofill
Connectors and APIs
2449
</pre>";
$i++;
}
mysql_free_result($result);
?>
Notes
Note
Field names returned by this function are case-sensitive.
See Also
mysql_field_seek
21.11.1.4.17. mysql_fetch_lengths
Copyright 1997-2008 the PHP Documentation Group.
mysql_fetch_lengths
Get the length of each output in a result
Description
array mysql_fetch_lengths(resource result);
Returns an array that corresponds to the lengths of each field in the last row fetched by MySQL.
mysql_fetch_lengths stores the lengths of each result column in the last row returned by mysql_fetch_row,
mysql_fetch_assoc, mysql_fetch_array, and mysql_fetch_object in an array, starting at offset 0.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
Return Values
An array of lengths on success, or FALSE on failure.
Examples
Example 21.35. A mysql_fetch_lengths example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_assoc($result);
$lengths = mysql_fetch_lengths($result);
print_r($row);
print_r($lengths);
?>
Connectors and APIs
2450
The above example will output something similar to:
Array
(
[id] => 42
[email] => [email protected]
)
Array
(
[0] => 2
[1] => 16
)
See Also
mysql_field_len
mysql_fetch_row
strlen
21.11.1.4.18. mysql_fetch_object
Copyright 1997-2008 the PHP Documentation Group.
mysql_fetch_object
Fetch a result row as an object
Description
object mysql_fetch_object(resource result,
string class_name,
array params);
Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
class_name The name of the class to instantiate, set the properties of and return. If not specified, a
stdClass object is returned.
params An optional array of parameters to pass to the constructor for class_name objects.
Return Values
Returns an object with string properties that correspond to the fetched row, or FALSE if there are no more rows.
mysql_fetch_row fetches one row of data from the result associated with the specified result identifier. The row is returned as an
array. Each result column is stored in an array offset, starting at offset 0.
Changelog
Version Description
5.0.0 Added the ability to return as a different object.
Connectors and APIs
2451
Examples
Example 21.36. mysql_fetch_object example
<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
echo $row->user_id;
echo $row->fullname;
}
mysql_free_result($result);
?>
Example 21.37. mysql_fetch_object example
<?php
class foo {
public $name;
}
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select name from mytable limit 1");
$obj = mysql_fetch_object($result, 'foo');
var_dump($obj);
?>
Notes
Performance
Speed-wise, the function is identical to mysql_fetch_array, and almost as quick as mysql_fetch_row (the dif-
ference is insignificant).
Note
mysql_fetch_object is similar to mysql_fetch_array, with one difference - an object is returned, instead of an
array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are il-
legal property names).
Note
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
See Also
mysql_fetch_array
mysql_fetch_assoc
mysql_fetch_row
mysql_data_seek
mysql_query
Connectors and APIs
2452
21.11.1.4.19. mysql_fetch_row
Copyright 1997-2008 the PHP Documentation Group.
mysql_fetch_row
Get a result row as an enumerated array
Description
array mysql_fetch_row(resource result);
Returns a numerical array that corresponds to the fetched row and moves the internal data pointer ahead.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
Return Values
Returns an numerical array of strings that corresponds to the fetched row, or FALSE if there are no more rows.
mysql_fetch_row fetches one row of data from the result associated with the specified result identifier. The row is returned as an
array. Each result column is stored in an array offset, starting at offset 0.
Examples
Example 21.38. Fetching one row with mysql_fetch_row
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
echo $row[0]; // 42
echo $row[1]; // the email value
?>
Notes
Note
This function sets NULL fields to the PHP NULL value.
See Also
mysql_fetch_array
mysql_fetch_assoc
mysql_fetch_object
mysql_data_seek
mysql_fetch_lengths
mysql_result
Connectors and APIs
2453
21.11.1.4.20. mysql_field_flags
Copyright 1997-2008 the PHP Documentation Group.
mysql_field_flags
Get the flags associated with the specified field in a result
Description
string mysql_field_flags(resource result,
int field_offset);
mysql_field_flags returns the field flags of the specified field. The flags are reported as a single word per flag separated by a
single space, so that you can split the returned value using explode.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist,
an error of level E_WARNING is also issued.
Return Values
Returns a string of flags associated with the result, or FALSE on failure.
The following flags are reported, if your version of MySQL is current enough to support them: "not_null", "primary_key",
"unique_key", "multiple_key", "blob", "unsigned", "zerofill", "binary", "enum", "auto_increment" and
"timestamp".
Examples
Example 21.39. A mysql_field_flags example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$flags = mysql_field_flags($result, 0);
echo $flags;
print_r(explode(' ', $flags));
?>
The above example will output something similar to:
not_null primary_key auto_increment
Array
(
[0] => not_null
[1] => primary_key
[2] => auto_increment
)
Connectors and APIs
2454
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_fieldflags
See Also
mysql_field_type
mysql_field_len
21.11.1.4.21. mysql_field_len
Copyright 1997-2008 the PHP Documentation Group.
mysql_field_len
Returns the length of the specified field
Description
int mysql_field_len(resource result,
int field_offset);
mysql_field_len returns the length of the specified field.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist,
an error of level E_WARNING is also issued.
Return Values
The length of the specified field index on success, or FALSE on failure.
Examples
Example 21.40. mysql_field_len example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
// Will get the length of the id field as specified in the database
// schema.
$length = mysql_field_len($result, 0);
echo $length;
?>
Notes
Note
Connectors and APIs
2455
For backward compatibility, the following deprecated alias may be used: mysql_fieldlen
See Also
mysql_fetch_lengths
strlen
21.11.1.4.22. mysql_field_name
Copyright 1997-2008 the PHP Documentation Group.
mysql_field_name
Get the name of the specified field in a result
Description
string mysql_field_name(resource result,
int field_offset);
mysql_field_name returns the name of the specified field index.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist,
an error of level E_WARNING is also issued.
Return Values
The name of the specified field index on success, or FALSE on failure.
Examples
Example 21.41. mysql_field_name example
<?php
/* The users table consists of three fields:
* user_id
* username
* password.
*/
$link = @mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect to MySQL server: ' . mysql_error());
}
$dbname = 'mydb';
$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
die("Could not set $dbname: " . mysql_error());
}
$res = mysql_query('select * from users', $link);
echo mysql_field_name($res, 0) . "\n";
echo mysql_field_name($res, 2);
?>
The above example will output:
Connectors and APIs
2456
user_id
password
Notes
Note
Field names returned by this function are case-sensitive.
Note
For backward compatibility, the following deprecated alias may be used: mysql_fieldname
See Also
mysql_field_type
mysql_field_len
21.11.1.4.23. mysql_field_seek
Copyright 1997-2008 the PHP Documentation Group.
mysql_field_seek
Set result pointer to a specified field offset
Description
bool mysql_field_seek(resource result,
int field_offset);
Seeks to the specified field offset. If the next call to mysql_fetch_field doesn't include a field offset, the field offset specified in
mysql_field_seek will be returned.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist,
an error of level E_WARNING is also issued.
Return Values
Returns TRUE on success or FALSE on failure.
See Also
mysql_fetch_field
21.11.1.4.24. mysql_field_table
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2457
mysql_field_table
Get name of the table the specified field is in
Description
string mysql_field_table(resource result,
int field_offset);
Returns the name of the table that the specified field is in.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist,
an error of level E_WARNING is also issued.
Return Values
The name of the table on success.
Examples
Example 21.42. A mysql_field_table example
<?php
$query = "SELECT account.*, country.* FROM account, country WHERE country.name = 'Portugal' AND account.country_id = country.id";
// get the result from the DB
$result = mysql_query($query);
// Lists the table name and then the field name
for ($i = 0; $i < mysql_num_fields($result); ++$i) {
$table = mysql_field_table($result, $i);
$field = mysql_field_name($result, $i);
echo "$table: $field\n";
}
?>
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_fieldtable
See Also
mysql_list_tables
21.11.1.4.25. mysql_field_type
Copyright 1997-2008 the PHP Documentation Group.
mysql_field_type
Connectors and APIs
2458
Get the type of the specified field in a result
Description
string mysql_field_type(resource result,
int field_offset);
mysql_field_type is similar to the mysql_field_name function. The arguments are identical, but the field type is returned in-
stead.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
field_offset The numerical field offset. The field_offset starts at 0. If field_offset does not exist,
an error of level E_WARNING is also issued.
Return Values
The returned field type will be one of "int", "real", "string", "blob", and others as detailed in the MySQL documentation.
Examples
Example 21.43. mysql_field_type example
<?php
mysql_connect("localhost", "mysql_username", "mysql_password");
mysql_select_db("mysql");
$result = mysql_query("SELECT * FROM func");
$fields = mysql_num_fields($result);
$rows = mysql_num_rows($result);
$table = mysql_field_table($result, 0);
echo "Your '" . $table . "' table has " . $fields . " fields and " . $rows . " record(s)\n";
echo "The table has the following fields:\n";
for ($i=0; $i < $fields; $i++) {
$type = mysql_field_type($result, $i);
$name = mysql_field_name($result, $i);
$len = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);
echo $type . " " . $name . " " . $len . " " . $flags . "\n";
}
mysql_free_result($result);
mysql_close();
?>
The above example will output something similar to:
Your 'func' table has 4 fields and 1 record(s)
The table has the following fields:
string name 64 not_null primary_key binary
int ret 1 not_null
string dl 128 not_null
string type 9 not_null enum
Notes
Connectors and APIs
2459
Note
For backward compatibility, the following deprecated alias may be used: mysql_fieldtype
See Also
mysql_field_name
mysql_field_len
21.11.1.4.26. mysql_free_result
Copyright 1997-2008 the PHP Documentation Group.
mysql_free_result
Free result memory
Description
bool mysql_free_result(resource result);
mysql_free_result will free all memory associated with the result identifier result.
mysql_free_result only needs to be called if you are concerned about how much memory is being used for queries that return
large result sets. All associated result memory is automatically freed at the end of the script's execution.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
Return Values
Returns TRUE on success or FALSE on failure.
If a non-resource is used for the result, an error of level E_WARNING will be emitted. It's worth noting that mysql_query only
returns a resource for SELECT, SHOW, EXPLAIN, and DESCRIBE queries.
Examples
Example 21.44. A mysql_free_result example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
/* Use the result, assuming we're done with it afterwards */
$row = mysql_fetch_assoc($result);
/* Now we free up the result and continue on with our script */
mysql_free_result($result);
echo $row['id'];
echo $row['email'];
?>
Notes
Connectors and APIs
2460
Note
For backward compatibility, the following deprecated alias may be used: mysql_freeresult
See Also
mysql_query
is_resource
21.11.1.4.27. mysql_get_client_info
Copyright 1997-2008 the PHP Documentation Group.
mysql_get_client_info
Get MySQL client info
Description
string mysql_get_client_info();
mysql_get_client_info returns a string that represents the client library version.
Return Values
The MySQL client version.
Examples
Example 21.45. mysql_get_client_info example
<?php
printf("MySQL client info: %s\n", mysql_get_client_info());
?>
The above example will output something similar to:
MySQL client info: 3.23.39
See Also
mysql_get_host_info
mysql_get_proto_info
mysql_get_server_info
21.11.1.4.28. mysql_get_host_info
Copyright 1997-2008 the PHP Documentation Group.
mysql_get_host_info
Connectors and APIs
2461
Get MySQL host info
Description
string mysql_get_host_info(resource link_identifier);
Describes the type of connection in use for the connection, including the server host name.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns a string describing the type of MySQL connection in use for the connection or FALSE on failure.
Examples
Example 21.46. mysql_get_host_info example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
printf("MySQL host info: %s\n", mysql_get_host_info());
?>
The above example will output something similar to:
MySQL host info: Localhost via UNIX socket
See Also
mysql_get_client_info
mysql_get_proto_info
mysql_get_server_info
21.11.1.4.29. mysql_get_proto_info
Copyright 1997-2008 the PHP Documentation Group.
mysql_get_proto_info
Get MySQL protocol info
Connectors and APIs
2462
Description
int mysql_get_proto_info(resource link_identifier);
Retrieves the MySQL protocol.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns the MySQL protocol on success, or FALSE on failure.
Examples
Example 21.47. mysql_get_proto_info example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
printf("MySQL protocol version: %s\n", mysql_get_proto_info());
?>
The above example will output something similar to:
MySQL protocol version: 10
See Also
mysql_get_client_info
mysql_get_host_info
mysql_get_server_info
21.11.1.4.30. mysql_get_server_info
Copyright 1997-2008 the PHP Documentation Group.
mysql_get_server_info
Get MySQL server info
Description
string mysql_get_server_info(resource link_identifier);
Connectors and APIs
2463
Retrieves the MySQL server version.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns the MySQL server version on success, or FALSE on failure.
Examples
Example 21.48. mysql_get_server_info example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
printf("MySQL server version: %s\n", mysql_get_server_info());
?>
The above example will output something similar to:
MySQL server version: 4.0.1-alpha
See Also
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
phpversion
21.11.1.4.31. mysql_info
Copyright 1997-2008 the PHP Documentation Group.
mysql_info
Get information about the most recent query
Description
string mysql_info(resource link_identifier);
Returns detailed information about the last query.
Parameters
Connectors and APIs
2464
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns information about the statement on success, or FALSE on failure. See the example below for which statements provide inform-
ation, and what the returned value may look like. Statements that are not listed will return FALSE .
Examples
Example 21.49. Relevant MySQL Statements
Statements that return string values. The numbers are only for illustrating purpose; their values will correspond to the query.
INSERT INTO ... SELECT ...
String format: Records: 23 Duplicates: 0 Warnings: 0
INSERT INTO ... VALUES (...),(...),(...)...
String format: Records: 37 Duplicates: 0 Warnings: 0
LOAD DATA INFILE ...
String format: Records: 42 Deleted: 0 Skipped: 0 Warnings: 0
ALTER TABLE
String format: Records: 60 Duplicates: 0 Warnings: 0
UPDATE
String format: Rows matched: 65 Changed: 65 Warnings: 0
Notes
Note
mysql_info returns a non- FALSE value for the INSERT ... VALUES statement only if multiple value lists are spe-
cified in the statement.
See Also
mysql_affected_rows
mysql_insert_id
mysql_stat
21.11.1.4.32. mysql_insert_id
Copyright 1997-2008 the PHP Documentation Group.
mysql_insert_id
Get the ID generated from the previous INSERT operation
Description
int mysql_insert_id(resource link_identifier);
Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
Parameters
Connectors and APIs
2465
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
The ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not
generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established.
Examples
Example 21.50. mysql_insert_id example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf("Last inserted record has id %d\n", mysql_insert_id());
?>
Notes
Caution
mysql_insert_id converts the return type of the native MySQL C API function mysql_insert_id() to a type of
long (named int in PHP). If your AUTO_INCREMENT column has a column type of BIGINT, the value returned by
mysql_insert_id will be incorrect. Instead, use the internal MySQL SQL function LAST_INSERT_ID() in an SQL
query.
Note
Because mysql_insert_id acts on the last performed query, be sure to call mysql_insert_id immediately after
the query that generates the value.
Note
The value of the MySQL SQL function LAST_INSERT_ID() always contains the most recently generated
AUTO_INCREMENT value, and is not reset between queries.
See Also
mysql_query
mysql_info
21.11.1.4.33. mysql_list_dbs
Copyright 1997-2008 the PHP Documentation Group.
mysql_list_dbs
List databases available on a MySQL server
Connectors and APIs
2466
Description
resource mysql_list_dbs(resource link_identifier);
Returns a result pointer containing the databases available from the current mysql daemon.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns a result pointer resource on success, or FALSE on failure. Use the mysql_tablename function to traverse this result pointer,
or any function for result tables, such as mysql_fetch_array.
Examples
Example 21.51. mysql_list_dbs example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$db_list = mysql_list_dbs($link);
while ($row = mysql_fetch_object($db_list)) {
echo $row->Database . "\n";
}
?>
The above example will output something similar to:
database1
database2
database3
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_listdbs
See Also
mysql_db_name
mysql_select_db
21.11.1.4.34. mysql_list_fields
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2467
mysql_list_fields
List MySQL table fields
Description
resource mysql_list_fields(string database_name,
string table_name,
resource link_identifier);
Retrieves information about the given table name.
This function is deprecated. It is preferable to use mysql_query to issue a SQL SHOW COLUMNS FROM table [LIKE
'name'] statement instead.
Parameters
database_name The name of the database that's being queried.
table_name The name of the table that's being queried.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
A result pointer resource on success, or FALSE on failure.
The returned result can be used with mysql_field_flags, mysql_field_len, mysql_field_name and
mysql_field_type.
Examples
Example 21.52. Alternate to deprecated mysql_list_fields
<?php
$result = mysql_query("SHOW COLUMNS FROM sometable");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
print_r($row);
}
}
?>
The above example will output something similar to:
Array
(
[Field] => id
[Type] => int(7)
[Null] =>
[Key] => PRI
[Default] =>
[Extra] => auto_increment
)
Connectors and APIs
2468
Array
(
[Field] => email
[Type] => varchar(100)
[Null] =>
[Key] =>
[Default] =>
[Extra] =>
)
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_listfields
See Also
mysql_field_flags
mysql_info
21.11.1.4.35. mysql_list_processes
Copyright 1997-2008 the PHP Documentation Group.
mysql_list_processes
List MySQL processes
Description
resource mysql_list_processes(resource link_identifier);
Retrieves the current MySQL server threads.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
A result pointer resource on success, or FALSE on failure.
Examples
Example 21.53. mysql_list_processes example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$result = mysql_list_processes($link);
while ($row = mysql_fetch_assoc($result)){
printf("%s %s %s %s %s\n", $row["Id"], $row["Host"], $row["db"],
$row["Command"], $row["Time"]);
}
Connectors and APIs
2469
mysql_free_result($result);
?>
The above example will output something similar to:
1 localhost test Processlist 0
4 localhost mysql sleep 5
See Also
mysql_thread_id
mysql_stat
21.11.1.4.36. mysql_list_tables
Copyright 1997-2008 the PHP Documentation Group.
mysql_list_tables
List tables in a MySQL database
Description
resource mysql_list_tables(string database,
resource link_identifier);
Retrieves a list of table names from a MySQL database.
This function is deprecated. It is preferable to use mysql_query to issue a SQL SHOW TABLES [FROM db_name] [LIKE
'pattern'] statement instead.
Parameters
database The name of the database
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
A result pointer resource on success, or FALSE on failure.
Use the mysql_tablename function to traverse this result pointer, or any function for result tables, such as
mysql_fetch_array.
Changelog
Version Description
4.3.7 This function became deprecated.
Connectors and APIs
2470
Examples
Example 21.54. mysql_list_tables alternative example
<?php
$dbname = 'mysql_dbname';
if (!mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
echo 'Could not connect to mysql';
exit;
}
$sql = "SHOW TABLES FROM $dbname";
$result = mysql_query($sql);
if (!$result) {
echo "DB Error, could not list tables\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_row($result)) {
echo "Table: {$row[0]}\n";
}
mysql_free_result($result);
?>
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_listtables
See Also
mysql_list_dbs
mysql_tablename
21.11.1.4.37. mysql_num_fields
Copyright 1997-2008 the PHP Documentation Group.
mysql_num_fields
Get number of fields in result
Description
int mysql_num_fields(resource result);
Retrieves the number of fields from a query.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
Return Values
Returns the number of fields in the result set resource on success, or FALSE on failure.
Connectors and APIs
2471
Examples
Example 21.55. A mysql_num_fields example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
/* returns 2 because id,email === two fields */
echo mysql_num_fields($result);
?>
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_numfields
See Also
mysql_select_db
mysql_query
mysql_fetch_field
mysql_num_rows
21.11.1.4.38. mysql_num_rows
Copyright 1997-2008 the PHP Documentation Group.
mysql_num_rows
Get number of rows in result
Description
int mysql_num_rows(resource result);
Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual
result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use
mysql_affected_rows.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
Return Values
The number of rows in a result set on success, or FALSE on failure.
Examples
Example 21.56. mysql_num_rows example
Connectors and APIs
2472
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);
$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";
?>
Notes
Note
If you use mysql_unbuffered_query, mysql_num_rows will not return the correct value until all the rows in the
result set have been retrieved.
Note
For backward compatibility, the following deprecated alias may be used: mysql_numrows
See Also
mysql_affected_rows
mysql_connect
mysql_data_seek
mysql_select_db
mysql_query
21.11.1.4.39. mysql_pconnect
Copyright 1997-2008 the PHP Documentation Group.
mysql_pconnect
Open a persistent connection to a MySQL server
Description
resource mysql_pconnect(string server= =ini_get("mysql.default_host"),
string username= =ini_get("mysql.default_user"),
string password= =ini_get("mysql.default_password"),
int client_flags);
Establishes a persistent connection to a MySQL server.
mysql_pconnect acts very much like mysql_connect with two major differences.
First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and pass-
word. If one is found, an identifier for it will be returned instead of opening a new connection.
Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for
future use (mysql_close will not close links established by mysql_pconnect).
This type of link is therefore called 'persistent'.
Parameters
Connectors and APIs
2473
server The MySQL server. It can also include a port number. e.g. "hostname:port" or a path to a local
socket e.g. ":/path/to/socket" for the localhost.
If the PHP directive mysql.default_host is undefined (default), then the default value is 'local-
host:3306'
username The username. Default value is the name of the user that owns the server process.
password The password. Default value is an empty password.
client_flags The client_flags parameter can be a combination of the following constants: 128 (enable
LOAD DATA LOCAL handling), MYSQL_CLIENT_SSL , MYSQL_CLIENT_COMPRESS ,
MYSQL_CLIENT_IGNORE_SPACE or MYSQL_CLIENT_INTERACTIVE .
Return Values
Returns a MySQL persistent link identifier on success, or FALSE on failure.
Changelog
Version Description
4.3.0 Added the client_flags parameter.
Notes
Note
Note, that these kind of links only work if you are using a module version of PHP. See the Persistent Database Connec-
tions section for more information.
Warning
Using persistent connections can require a bit of tuning of your Apache and MySQL configurations to ensure that you do
not exceed the number of connections allowed by MySQL.
Note
You can suppress the error message on failure by prepending a @ to the function name.
See Also
mysql_connect
Persistent Database Connections
21.11.1.4.40. mysql_ping
Copyright 1997-2008 the PHP Documentation Group.
mysql_ping
Ping a server connection or reconnect if there is no connection
Description
bool mysql_ping(resource link_identifier);
Checks whether or not the connection to the server is working. If it has gone down, an automatic reconnection is attempted. This func-
tion can be used by scripts that remain idle for a long while, to check whether or not the server has closed the connection and reconnect
if necessary.
Connectors and APIs
2474
Note
Since MySQL 5.0.13, automatic reconnection feature is disabled.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE if the connection to the server MySQL server is working, otherwise FALSE .
Examples
Example 21.57. A mysql_ping example
<?php
set_time_limit(0);
$conn = mysql_connect('localhost', 'mysqluser', 'mypass');
$db = mysql_select_db('mydb');
/* Assuming this query will take a long time */
$result = mysql_query($sql);
if (!$result) {
echo 'Query #1 failed, exiting.';
exit;
}
/* Make sure the connection is still alive, if not, try to reconnect */
if (!mysql_ping($conn)) {
echo 'Lost connection, exiting after query #1';
exit;
}
mysql_free_result($result);
/* So the connection is still alive, let's run another query */
$result2 = mysql_query($sql2);
?>
See Also
mysql_thread_id
mysql_list_processes
21.11.1.4.41. mysql_query
Copyright 1997-2008 the PHP Documentation Group.
mysql_query
Send a MySQL query
Description
resource mysql_query(string query,
resource link_identifier);
Connectors and APIs
2475
mysql_query sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated
with the specified link_identifier.
Parameters
query A SQL query
The query string should not end with a semicolon.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query returns a resource on success,
or FALSE on error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query returns TRUE on success or FALSE on
error.
The returned result resource should be passed to mysql_fetch_array, and other functions for dealing with result tables, to access
the returned data.
Use mysql_num_rows to find out how many rows were returned for a SELECT statement or mysql_affected_rows to find out
how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.
mysql_query will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.
Examples
Example 21.58. Invalid Query
The following query is syntactically invalid, so mysql_query fails and returns FALSE .
<?php
$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
?>
Example 21.59. Valid Query
The following query is valid, so mysql_query returns a resource.
<?php
// This could be supplied by a user, for example
$firstname = 'fred';
$lastname = 'fox';
// Formulate Query
// This is the best way to perform a SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
Connectors and APIs
2476
// Perform Query
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
See Also
mysql_connect
mysql_error
mysql_real_escape_string
mysql_result
mysql_fetch_assoc
mysql_unbuffered_query
21.11.1.4.42. mysql_real_escape_string
Copyright 1997-2008 the PHP Documentation Group.
mysql_real_escape_string
Escapes special characters in a string for use in a SQL statement
Description
string mysql_real_escape_string(string unescaped_string,
resource link_identifier);
Escapes special characters in the unescaped_string, taking into account the current character set of the connection so that it is safe
to place it in a mysql_query. If binary data is to be inserted, this function must be used.
mysql_real_escape_string calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the fol-
lowing characters: \x00, \n, \r, \, ', " and \x1a.
This function must always (with few exceptions) be used to make data safe before sending a query to MySQL.
Parameters
unescaped_string The string that is to be escaped.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
Connectors and APIs
2477
lished, an E_WARNING level error is generated.
Return Values
Returns the escaped string, or FALSE on error.
Examples
Example 21.60. Simple mysql_real_escape_string example
<?php
// Connect
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
OR die(mysql_error());
// Query
$query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
mysql_real_escape_string($user),
mysql_real_escape_string($password));
?>
Example 21.61. An example SQL Injection Attack
<?php
// Query database to check if there are any matching users
$query = "SELECT * FROM users WHERE user='{$_POST['username']}' AND password='{$_POST['password']}'";
mysql_query($query);
// We didn't check $_POST['password'], it could be anything the user wanted! For example:
$_POST['username'] = 'aidan';
$_POST['password'] = "' OR ''='";
// This means the query sent to MySQL would be:
echo $query;
?>
The query sent to MySQL:
SELECT * FROM users WHERE user='aidan' AND password='' OR ''=''
This would allow anyone to log in without a valid password.
Notes
Note
A MySQL connection is required before using mysql_real_escape_string otherwise an error of level
E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is
used.
Note
If magic_quotes_gpc is enabled, first apply stripslashes to the data. Using this function on data which has already
Connectors and APIs
2478
been escaped will escape the data twice.
Note
If this function is not used to escape data, the query is vulnerable to SQL Injection Attacks.
Note
mysql_real_escape_string does not escape % and _. These are wildcards in MySQL if combined with LIKE,
GRANT, or REVOKE.
See Also
mysql_client_encoding
addslashes
stripslashes
The magic_quotes_gpc directive
The magic_quotes_runtime directive
21.11.1.4.43. mysql_result
Copyright 1997-2008 the PHP Documentation Group.
mysql_result
Get result data
Description
string mysql_result(resource result,
int row,
mixed field= =0);
Retrieves the contents of one cell from a MySQL result set.
When working on large result sets, you should consider using one of the functions that fetch an entire row (specified below). As these
functions return the contents of multiple cells in one function call, they're MUCH quicker than mysql_result. Also, note that spe-
cifying a numeric offset for the field argument is much quicker than specifying a fieldname or tablename.fieldname argument.
Parameters
result The result resource that is being evaluated. This result comes from a call to mysql_query.
row The row number from the result that's being retrieved. Row numbers start at 0.
field The name or offset of the field being retrieved.
It can be the field's offset, the field's name, or the field's table dot field name
(tablename.fieldname). If the column name has been aliased ('select foo as bar from...'), use the
alias instead of the column name. If undefined, the first field is retrieved.
Return Values
The contents of one cell from a MySQL result set on success, or FALSE on failure.
Examples
Example 21.62. mysql_result example
Connectors and APIs
2479
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$result = mysql_query('SELECT name FROM work.employee');
if (!$result) {
die('Could not query:' . mysql_error());
}
echo mysql_result($result, 2); // outputs third employee's name
mysql_close($link);
?>
Notes
Note
Calls to mysql_result should not be mixed with calls to other functions that deal with the result set.
See Also
mysql_fetch_row
mysql_fetch_array
mysql_fetch_assoc
mysql_fetch_object
21.11.1.4.44. mysql_select_db
Copyright 1997-2008 the PHP Documentation Group.
mysql_select_db
Select a MySQL database
Description
bool mysql_select_db(string database_name,
resource link_identifier);
Sets the current active database on the server that's associated with the specified link identifier. Every subsequent call to
mysql_query will be made on the active database.
Parameters
database_name The name of the database that is to be selected.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Connectors and APIs
2480
Example 21.63. mysql_select_db example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Not connected : ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db('foo', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
?>
Notes
Note
For backward compatibility, the following deprecated alias may be used: mysql_selectdb
See Also
mysql_connect
mysql_pconnect
mysql_query
21.11.1.4.45. mysql_set_charset
Copyright 1997-2008 the PHP Documentation Group.
mysql_set_charset
Sets the client character set
Description
bool mysql_set_charset(string charset,
resource link_identifier);
Sets the default character set for the current connection.
Parameters
charset A valid character set name.
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Connectors and APIs
2481
Note
This function requires MySQL 5.0.7 or later.
Note
This is the preferred way to change the charset. Using mysql_query to execute SET NAMES .. is not recommended.
See Also
mysql_client_encoding
List of character sets that MySQL supports
21.11.1.4.46. mysql_stat
Copyright 1997-2008 the PHP Documentation Group.
mysql_stat
Get current system status
Description
string mysql_stat(resource link_identifier);
mysql_stat returns the current server status.
Parameters
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
Returns a string with the status for uptime, threads, queries, open tables, flush tables and queries per second. For a complete list of other
status variables, you have to use the SHOW STATUS SQL command. If link_identifier is invalid, NULL is returned.
Examples
Example 21.64. mysql_stat example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$status = explode(' ', mysql_stat($link));
print_r($status);
?>
The above example will output something similar to:
Array
(
[0] => Uptime: 5380
[1] => Threads: 2
Connectors and APIs
2482
[2] => Questions: 1321299
[3] => Slow queries: 0
[4] => Opens: 26
[5] => Flush tables: 1
[6] => Open tables: 17
[7] => Queries per second avg: 245.595
)
Example 21.65. Alternative mysql_stat example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$result = mysql_query('SHOW VARIABLES', $link);
while ($row = mysql_fetch_assoc($result)) {
echo $row['Variable_name'] . ' = ' . $row['Value'] . "\n";
}
?>
The above example will output something similar to:
back_log = 50
basedir = /usr/local/
bdb_cache_size = 8388600
bdb_log_buffer_size = 32768
bdb_home = /var/db/mysql/
bdb_max_lock = 10000
bdb_logdir =
bdb_shared_data = OFF
bdb_tmpdir = /var/tmp/
...
See Also
mysql_get_server_info
mysql_list_processes
21.11.1.4.47. mysql_tablename
Copyright 1997-2008 the PHP Documentation Group.
mysql_tablename
Get table name of field
Description
string mysql_tablename(resource result,
int i);
Retrieves the table name from a result.
This function deprecated. It is preferable to use mysql_query to issue a SQL SHOW TABLES [FROM db_name] [LIKE 'pat-
tern'] statement instead.
Connectors and APIs
2483
Parameters
result A result pointer resource that's returned from mysql_list_tables.
i The integer index (row/table number)
Return Values
The name of the table on success, or FALSE on failure.
Use the mysql_tablename function to traverse this result pointer, or any function for result tables, such as
mysql_fetch_array.
Examples
Example 21.66. mysql_tablename example
<?php
mysql_connect("localhost", "mysql_user", "mysql_password");
$result = mysql_list_tables("mydb");
$num_rows = mysql_num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
echo "Table: ", mysql_tablename($result, $i), "\n";
}
mysql_free_result($result);
?>
Notes
Note
The mysql_num_rows function may be used to determine the number of tables in the result pointer.
See Also
mysql_list_tables
mysql_field_table
mysql_db_name
21.11.1.4.48. mysql_thread_id
Copyright 1997-2008 the PHP Documentation Group.
mysql_thread_id
Return the current thread ID
Description
int mysql_thread_id(resource link_identifier);
Retrieves the current thread ID. If the connection is lost, and a reconnect with mysql_ping is executed, the thread ID will change.
This means only retrieve the thread ID when needed.
Parameters
Connectors and APIs
2484
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
The thread ID on success, or FALSE on failure.
Examples
Example 21.67. mysql_thread_id example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$thread_id = mysql_thread_id($link);
if ($thread_id){
printf("current thread id is %d\n", $thread_id);
}
?>
The above example will output something similar to:
current thread id is 73
See Also
mysql_ping
mysql_list_processes
21.11.1.4.49. mysql_unbuffered_query
Copyright 1997-2008 the PHP Documentation Group.
mysql_unbuffered_query
Send an SQL query to MySQL, without fetching and buffering the result rows
Description
resource mysql_unbuffered_query(string query,
resource link_identifier);
mysql_unbuffered_query sends a SQL query query to MySQL, without fetching and buffering the result rows automatically,
as mysql_query does. On the one hand, this saves a considerable amount of memory with SQL queries that produce large result sets.
On the other hand, you can start working on the result set immediately after the first row has been retrieved: you don't have to wait until
the complete SQL query has been performed. When using multiple DB-connects, you have to specify the optional parameter
link_identifier.
Parameters
Connectors and APIs
2485
query A SQL query
link_identifier The MySQL connection. If the link identifier is not specified, the last link opened by
mysql_connect is assumed. If no such link is found, it will try to create one as if
mysql_connect was called with no arguments. If by chance no connection is found or estab-
lished, an E_WARNING level error is generated.
Return Values
For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_unbuffered_query returns a resource on success, or FALSE
on error.
For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_unbuffered_query returns TRUE on success or
FALSE on error.
Notes
Note
The benefits of mysql_unbuffered_query come at a cost: You cannot use mysql_num_rows and
mysql_data_seek on a result set returned from mysql_unbuffered_query. You also have to fetch all result
rows from an unbuffered SQL query, before you can send a new SQL query to MySQL.
See Also
mysql_query
21.11.2. MySQL Improved Extension (Mysqli)
Copyright 1997-2008 the PHP Documentation Group.
The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above. More information about the MySQL
Database server can be found at http://www.mysql.com/
An overview of software available for using MySQL from PHP can be found at Section 21.11.2.2, Overview
Documentation for MySQL can be found at http://dev.mysql.com/doc/.
Parts of this documentation included from MySQL manual with permissions of MySQL AB.
21.11.2.1. Examples
Copyright 1997-2008 the PHP Documentation Group.
All Examples in the MySQLI documentation use the world database from MySQL AB. The world database can be found at ht-
tp://dev.mysql.com/get/Downloads/Manual/world.sql.gz/from/pick
21.11.2.2. Overview
Copyright 1997-2008 the PHP Documentation Group.
This section provides an introduction to the options available to you when developing a PHP application that needs to interact with a
MySQL database.
What is an API?
An Application Programming Interface, or API, defines the classes, methods, functions and variables that your application will need to
call in order to carry out its desired task. In the case of PHP applications that need to communicate with databases the necessary APIs
are usually exposed via PHP extensions.
APIs can be procedural or object-oriented. With a procedural API you call functions to carry out tasks, with the object-oriented API you
Connectors and APIs
2486
instantiate classes and then call methods on the resulting objects. Of the two the latter is usually the preferred interface, as it is more
modern and leads to better organised code.
When writing PHP applications that need to connect to the MySQL server there are several API options available. This document dis-
cusses what is available and how to select the best solution for your application.
What is a Connector?
In the MySQL documentation, the term connector refers to a piece of software that allows your application to connect to the MySQL
database server. MySQL provides connectors for a variety of languages, including PHP.
If your PHP application needs to communicate with a database server you will need to write PHP code to perform such activities as con-
necting to the database server, querying the database and other database-related functions. Software is required to provide the API that
your PHP application will use, and also handle the communication between your application and the database server, possibly using
other intermediate libraries where necessary. This software is known generically as a connector, as it allows your application to connect
to a database server.
What is a Driver?
A driver is a piece of software designed to communicate with a specific type of database server. The driver may also call a library, such
as the MySQL Client Library or the MySQL Native Driver. These libraries implement the low-level protocol used to communicate with
the MySQL database server.
By way of an example, the PHP Data Objects (PDO) database abstraction layer may use one of several database-specific drivers. One of
the drivers it has available is the PDO MYSQL driver, which allows it to interface with the MySQL server.
Sometimes people use the terms connector and driver interchangeably, this can be confusing. In the MySQL-related documentation the
term driver is reserved for software that provides the database-specific part of a connector package.
What is an Extension?
In the PHP documentation you will come across another term - extension. The PHP code consists of a core, with optional extensions to
the core functionality. PHP's MySQL-related extensions, such as the mysqli extension, and the mysql extension, are implemented
using the PHP extension framework.
An extension typically exposes an API to the PHP programmer, to allow its facilities to be used programmatically. However, some ex-
tensions which use the PHP extension framework do not expose an API to the PHP programmer.
The PDO MySQL driver extension, for example, does not expose an API to the PHP programmer, but provides an interface to the PDO
layer above it.
The terms API and extension should not be taken to mean the same thing, as an extension may not necessarily expose an API to the pro-
grammer.
What are the main PHP API offerings for using MySQL?
There are three main API options when considering connecting to a MySQL database server:
PHP's MySQL Extension
PHP's mysqli Extension
PHP Data Objects (PDO)
Each has its own advantages and disadvantages. The following discussion aims to give a brief introduction to the key aspects of each
API.
What is PHP's MySQL Extension?
This is the original extension designed to allow you to develop PHP applications that interact with a MySQL database. The mysql ex-
tension provides a procedural interface and is intended for use only with MySQL versions older than 4.1.3. This extension can be used
with versions of MySQL 4.1.3 or newer, but not all of the latest MySQL server features will be available.
Note
Connectors and APIs
2487
If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use the mysqli extension instead.
The mysql extension source code is located in the PHP extension directory ext/mysql.
For further information on the mysql extension, see Section 21.11.1, MySQL.
What is PHP's mysqli Extension?
The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features
found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.
The mysqli extension has a number of benefits, the key enhancements over the mysql extension being:
Object-oriented interface
Support for Prepared Statements
Support for Multiple Statements
Support for Transactions
Enhanced debugging capabilities
Embedded server support
Note
If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use this extension.
As well as the object-oriented interface the extension also provides a procedural interface.
The mysqli extension is built using the PHP extension framework, its source code is located in the directory ext/mysqli.
For further information on the mysqli extension, see Section 21.11.2, MySQL Improved Extension (Mysqli).
What is PDO?
PHP Data Objects, or PDO, is a database abstraction layer specifically for PHP applications. PDO provides a consistent API for your
PHP application regardless of the type of database server your application will connect to. In theory, if you are using the PDO API, you
could switch the database server you used, from say Firebird to MySQL, and only need to make minor changes to your PHP code.
Other examples of database abstraction layers include JDBC for Java applications and DBI for Perl.
While PDO has its advantages, such as a clean, simple, portable API, its main disadvantage is that it doesn't allow you to use all of the
advanced features that are available in the latest versions of MySQL server. For example, PDO does not allow you to use MySQL's sup-
port for Multiple Statements.
PDO is implemented using the PHP extension framework, its source code is located in the directory ext/pdo.
For further information on PDO, see the Section 21.11.3, MySQL Functions (PDO_MYSQL).
What is the PDO MYSQL driver?
The PDO MYSQL driver is not an API as such, at least from the PHP programmer's perspective. In fact the PDO MYSQL driver sits in
the layer below PDO itself and provides MySQL-specific functionality. The programmer still calls the PDO API, but PDO uses the
PDO MYSQL driver to carry out communication with the MySQL server.
The PDO MYSQL driver is one of several available PDO drivers. Other PDO drivers available include those for the Firebird and Post-
greSQL database servers.
The PDO MYSQL driver is implemented using the PHP extension framework. Its source code is located in the directory ext/
pdo_mysql. It does not expose an API to the PHP programmer.
For further information on the PDO MYSQL driver, see Section 21.11.3, MySQL Functions (PDO_MYSQL).
Connectors and APIs
2488
What is PHP's MySQL Native Driver?
In order to communicate with the MySQL database server the mysql extension, mysqli and the PDO MYSQL driver each use a low-
level library that implements the required protocol. In the past, the only available library was the MySQL Client Library, otherwise
known as libmysql.
However, the interface presented by libmysql was not optimized for communication with PHP applications, as libmysql was ori-
ginally designed with C applications in mind. For this reason the MySQL Native Driver, mysqlnd, was developed as an alternative to
libmysql for PHP applications.
The mysql extension, the mysqli extension and the PDO MySQL driver can each be individually configured to use either
libmysql or mysqlnd. As mysqlnd is designed specifically to be utilised in the PHP system it has numerous memory and speed
enhancements over libmysql. You are strongly encouraged to take advantage of these improvements.
Note
The MySQL Native Driver can only be used with MySQL server versions 4.1.3 and later.
The MySQL Native Driver is implemented using the PHP extension framework. The source code is located in ext/mysqlnd. It does
not expose an API to the PHP programmer.
Comparison of Features
The following table compares the functionality of the three main methods of connecting to MySQL from PHP:
PHP's mysqli Extension PDO (Using PDO MySQL
Driver and MySQL Native
Driver)
PHP's MySQL Extension
PHP version introduced 5.0 5.0 Prior to 3.0
Included with PHP 5.x yes yes Yes
Comes with PHP 6.0 Yes Yes Yes
MySQL development status Active development Active development as of PHP
5.3
Maintenance only
Recommended by MySQL for
new projects
Yes - preferred option Yes No
API supports Charsets Yes Yes No
API supports server-side Pre-
pared Statements
Yes Yes No
API supports client-side Pre-
pared Statements
No Yes No
API supports Stored Procedures Yes Yes No
API supports Multiple State-
ments
Yes Most No
Supports all MySQL 4.1+ func-
tionality
Yes Most No
21.11.2.3. The MySQL Native Driver
Copyright 1997-2008 the PHP Documentation Group.
This section of the manual provides an overview of the MySQL Native Driver.
What is it?
MySQL Native Driver is a replacement for the MySQL Client Library (libmysql). MySQL Native Driver is part of the official PHP 5.3
and PHP 6 branches.
The MySQL database extensions MySQL extension, mysqli and PDO MYSQL all communicate with the MySQL server. In the past,
this was done by the extension using the services provided by the MySQL Client Library. The extensions were compiled against the
Connectors and APIs
2489
MySQL Client Library in order to use its client-server protocol.
With MySQL Native Driver there is now an alternative, as the MySQL database extensions can be compiled to use MySQL Native
Driver instead of the MySQL Client Library.
MySQL Native Driver is written in C as a PHP extension.
What it is not
Although MySQL Native Driver is written as a PHP extension, it is important to note that it does not provide a new API to the PHP pro-
grammer. The programmer APIs for MySQL database connectivity are provided by the MySQL extension, mysqli and PDO MYSQL.
These extensions can now use the services of MySQL Native Driver to communicate with the MySQL Server. Therefore, you should
not think of MySQL Native Driver as an API.
Why use it?
Using the MySQL Native Driver offers a number of advantages over using the MySQL Client Library.
The older MySQL Client Library was written by MySQL AB and so was released under the MySQL license. This ultimately led to
MySQL support being disabled by default in PHP. However, the MySQL Native Driver has been developed as part of the PHP project,
and is therefore released under the PHP license. This removes licensing issues that have been problematic in the past.
Also, in the past, you needed to build the MySQL database extensions against a copy of the MySQL Client Library. This typically
meant you needed to have MySQL installed on a machine where you were building the PHP source code. Also, when your PHP applica-
tion was running, the MySQL database extensions would call down to the MySQL Client library file at run time, so the file needed to be
installed on your system. With MySQL Native Driver that is no longer the case as it is included as part of the standard distribution. So
you do not need MySQL installed in order to build PHP or run PHP database applications.
Because MySQL Native Driver is written as a PHP extension, it is tightly coupled to the workings of PHP. This leads to gains in effi-
ciency, especially when it comes to memory usage, as the driver uses the PHP memory management system. It also supports the PHP
memory limit. Using MySQL Native Driver leads to comparable or better performance than using MySQL Client Library, it always en-
sures the most efficient use of memory. One example of the memory efficiency is the fact that when using the MySQL Client Library,
each row is stored in memory twice, whereas with the MySQL Native Driver each row is only stored once in memory.
Special features
MySQL Native Driver also provides some special features not available when the MySQL database extensions use MySQL Client Lib-
rary. These special features are listed below:
Improved persistent connections
The special function mysqli_fetch_all
Performance statistics calls: mysqli_get_cache_stats, mysqli_get_client_stats,
mysqli_get_connection_stats
The performance statistics facility can prove to be very useful in identifying performance bottlenecks.
MySQL Native Driver also allows for persistent connections when used with the mysqli extension.
Installation on Unix
By default the MySQL database extensions are configured to use MySQL Client Library. In order to use the MySQL Native Driver,
PHP needs to be built specifying that the MySQL database extensions are compiled with MySQL Native Driver support. This is done
through configuration options prior to building the PHP source code.
For example, to build the MySQL extension, mysqli and PDO MYSQL using the MySQL Native Driver, the following command
would be given:
Installation on Windows
In the official PHP distributions from 5.3 onwards, MySQL Native Driver is enabled by default, so no additional configuration is re-
quired to use it. All MySQL database extensions will use MySQL Native Driver in this case.
Connectors and APIs
2490
Using Persistent Connections
The MySQL database extensions do not support persistent connections when used with the MySQL Client Library. However, they do
when using MySQL Native Driver. When creating a connection the hostname is prepended with p:. This is demonstrated by the fol-
lowing code snippet, which creates a new connection using mysqli:
Using mysqli_fetch_all
If you are using mysqli with the MySQL Native Driver, you have access to the new API call mysqli_fetch_all.
As mysqli_fetch_all returns all the rows as an array in a single step, it may consume more memory than some similar functions
such as mysqli_fetch_array, which only returns one row at a time from the result set. Further, if you need to iterate over the res-
ult set, you will need a looping construct that will further impact performance. For these reasons mysqli_fetch_all should only be
used in those situations where the fetched result set will be sent to another layer for processing.
Using Statistical Data
MySQL Native Driver contains support for gathering statistics on the communication between the client and the server. The statistics
gathered are of three main types:
Client statistics
Connection statistics
Zval cache statistics
If you are using the mysqli extension, these statistics can be obtained through three API calls:
mysqli_get_client_stats
mysqli_get_connection_stats
mysqli_get_cache_stats
Accessing Client Statistics
To access client statistics, you need to call mysqli_get_client_stats. The function call does not require any parameters.
The function returns an associative array that contains the name of the statistic as the key and the statistical data as the value.
Client statistics can also be accessed by calling the phpinfo function.
Accessing Connection Statistics
To access connection statistics call mysqli_get_connection_stats. This takes the database connection handle as the paramet-
er.
The function returns an associative array that contains the name of the statistic as the key and the statistical data as the value.
Accessing Zval Cache Statistics
The MySQL Native Driver also collects statistics from its internal Zval cache. These statistics can be accessed by calling
mysqli_get_cache_stats.
The Zval cache statistics obtained may lead to a tweaking of php.ini settings related to the Zval cache, resulting in better perform-
ance.
Statistics returned by MySQL Native Driver
The following table shows a list of statistics returned by the mysqli_get_client_stats,
mysqli_get_connections_stats and mysqli_get_cache_stats functions.
Connectors and APIs
2491
Statistic
bytes_sent
bytes_received
packets_sent
packets_received
protocol_overhead_in
protocol_overhead_out
bytes_received_ok_packet
bytes_received_eof_packet
bytes_received_rset_header_packet
bytes_received_rset_field_meta_packet
bytes_received_rset_row_packet
bytes_received_prepare_response_packet
bytes_received_change_user_packet
packets_sent_command
packets_received_ok
packets_received_eof
packets_received_rset_header
packets_received_rset_field_meta
packets_received_rset_row
packets_received_prepare_response
packets_received_change_user
result_set_queries
non_result_set_queries
no_index_used
bad_index_used
slow_queries
buffered_sets
unbuffered_sets
ps_buffered_sets
ps_unbuffered_sets
flushed_normal_sets
flushed_ps_sets
ps_prepared_never_executed
ps_prepared_once_executed
rows_fetched_from_server_normal
rows_fetched_from_server_ps
rows_buffered_from_client_normal
rows_buffered_from_client_ps
rows_fetched_from_client_normal_buffered
rows_fetched_from_client_normal_unbuffered
rows_fetched_from_client_ps_buffered
rows_fetched_from_client_ps_unbuffered
rows_fetched_from_client_ps_cursor
rows_skipped_normal
Connectors and APIs
2492
rows_skipped_ps
copy_on_write_saved
copy_on_write_performed
command_buffer_too_small
connect_success
connect_failure
connection_reused
reconnect
pconnect_success
active_connections
active_persistent_connections
explicit_close
implicit_close
disconnect_close
in_middle_of_command_close
explicit_free_result
implicit_free_result
explicit_stmt_close
implicit_stmt_close
mem_emalloc_count
mem_emalloc_ammount
mem_ecalloc_count
mem_ecalloc_ammount
mem_erealloc_count
mem_erealloc_ammount
mem_efree_count
mem_malloc_count
mem_malloc_ammount
mem_calloc_count
mem_calloc_ammount
mem_realloc_count
mem_realloc_ammount
mem_free_count
proto_text_fetched_null
proto_text_fetched_bit
proto_text_fetched_tinyint
proto_text_fetched_short
proto_text_fetched_int24
proto_text_fetched_int
proto_text_fetched_bigint
proto_text_fetched_decimal
proto_text_fetched_float
proto_text_fetched_double
proto_text_fetched_date
proto_text_fetched_year
Connectors and APIs
2493
proto_text_fetched_time
proto_text_fetched_datetime
proto_text_fetched_timestamp
proto_text_fetched_string
proto_text_fetched_blob
proto_text_fetched_enum
proto_text_fetched_set
proto_text_fetched_geometry
proto_text_fetched_other
proto_binary_fetched_null
proto_binary_fetched_bit
proto_binary_fetched_tinyint
proto_binary_fetched_short
proto_binary_fetched_int24
proto_binary_fetched_int
proto_binary_fetched_bigint
proto_binary_fetched_decimal
proto_binary_fetched_float
proto_binary_fetched_double
proto_binary_fetched_date
proto_binary_fetched_year
proto_binary_fetched_time
proto_binary_fetched_datetime
proto_binary_fetched_timestamp
proto_binary_fetched_string
proto_binary_fetched_blob
proto_binary_fetched_enum
proto_binary_fetched_set
proto_binary_fetched_geometry
proto_binary_fetched_other
21.11.2.4. Installing/Configuring
Copyright 1997-2008 the PHP Documentation Group.
21.11.2.4.1. Requirements
Copyright 1997-2008 the PHP Documentation Group.
In order to have these functions available, you must compile PHP with support for the mysqli extension.
Note
The mysqli extension is designed to work with MySQL version 4.1.13 or newer, or 5.0.7 or newer. For previous versions,
please see the MySQL extension documentation.
21.11.2.4.2. Installation
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2494
As of PHP 5.0, MySQL support is no longer enabled by default with the standard PHP distributions. This means PHP needs to be expli-
citly configured to take advantage of the MySQL extensions.
The common Unix distributions include binary versions of PHP that can be installed. Although these binary versions are typically built
with support for MySQL extensions enabled, the extension libraries themselves may need to be installed using an additional package.
Check the package manager than comes with your chosen distribution for availability.
Unless your Unix distribution comes with a binary package of PHP with the mysqli extension available, you will need to build PHP
from source code. Building PHP from source allows you to specify the MySQL extensions you want to use, as well as your choice of
client library for each extension.
To ensure that the mysqli extension for PHP is enabled, you will need to configure the PHP source code to use mysqli. This is
achieved by running the configure script with the option --with-mysqli=mysql_config_path/mysql_config, prior to
building PHP. This will enable mysqli and it will use the MySQL Client Library (libmysql) to communicate with the MySQL Server.
Note
The mysql_config_path represents the location of the mysql_config program that comes with MySQL Server.
With versions of PHP 5.3 and newer, you can alternatively use the new MySQL Native Driver with mysqli. This gives a number of
benefits over using libmysql.
To use MySQL Native Driver with mysqli you need to configure the PHP source code using the --with-mysqli=mysqlnd op-
tion, prior to building PHP.
This is the recommended option, as using the MySQL Native Driver results in improved performance and gives access to features not
available when using the MySQL Client Library. Refer to What is PHP's MySQL Native Driver? for a brief overview of the advantages
of MySQL Native Driver.
Note that it is possible to freely mix MySQL extensions and client libraries. For example, it is possible to enable the MySQL extension
to use the MySQL Client Library (libmysql), while configuring the mysqli extension to use the MySQL Native Driver. However, all
permutations of extension and client library are possible.
The following example builds the MySQL extension to use the MySQL Client Library, and the mysqli and PDO MYSQL extensions
to use the MySQL Native Driver:
21.11.2.4.2.1. Installation on Windows Systems
Copyright 1997-2008 the PHP Documentation Group.
On Windows, PHP is most commonly installed using the binary installer. Once PHP has been installed, some configuration is required
to enable mysqli and specify the client library you want it to use.
As mentioned earlier, the mysqli extension is not enabled by default, so the php_mysqli.dll DLL must be enabled inside of
php.ini. In order to do this you need to find the php.ini file (typically located in c:\php), and make sure you remove the com-
ment (semi-colon) from the start of the line extension=php_mysqli.dll, in the section marked [PHP_MYSQLI].
Also, if you want to use the MySQL Client Library with mysqli, you need to make sure PHP can access the client library file. The
MySQL Client Library is included as a file named libmysql.dll in the Windows PHP distribution. This file needs to be available in
the Windows system's PATH environment variable, so that it can be successfully loaded. See the FAQ titled "How do I add my PHP dir-
ectory to the PATH on Windows" for information on how to do this. Copying libmysql.dll to the Windows system directory
(typically c:\Windows\system) also works, as the system directory is by default in the system's PATH. However, this practice is
strongly discouraged.
On Windows, for PHP versions 5.3 and newer, the mysqli extension uses the MySQL Native Driver by default. This means you don't
need to worry about configuring access to libmysql.dll, you just need to make sure the extension is enabled in the php.ini file.
As with enabling any PHP extension (such as php_mysqli.dll), the PHP directive extension_dir should be set to the directory
where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value
for PHP 5 is c:\php\ext.
Note
If when starting the web server an error similar to the following occurs: "Unable to load dynamic library
Connectors and APIs
2495
'./php_mysqli.dll'", this is because php_mysqli.dll and/or libmysql.dll cannot be found by the system.
21.11.2.4.3. Runtime Configuration
Copyright 1997-2008 the PHP Documentation Group.
The behaviour of these functions is affected by settings in php.ini.
Table 21.7. MySQLi Configuration Options
Name Default Changeable Changelog
mysqli.allow_persistent "1" PHP_INI_SYSTEM Available since PHP 5.3.0.
mysqli.max_persistent "-1" PHP_INI_SYSTEM Available since PHP 5.3.0.
mysqli.max_links "-1" PHP_INI_SYSTEM Available since PHP 5.0.0.
mysqli.default_port "3306" PHP_INI_ALL Available since PHP 5.0.0.
mysqli.default_socket NULL PHP_INI_ALL Available since PHP 5.0.0.
mysqli.default_host NULL PHP_INI_ALL Available since PHP 5.0.0.
mysqli.default_user NULL PHP_INI_ALL Available since PHP 5.0.0.
mysqli.default_pw NULL PHP_INI_ALL Available since PHP 5.0.0.
For further details and definitions of the above PHP_INI_* constants, see the chapter on configuration changes.
Here's a short explanation of the configuration directives.
mysqli.allow_persistent
integer
Enable the ability to create persistent connections using mysqli_connect.
mysqli.max_persistent in-
teger
Maximum of persistent connections that can be made. Set to 0 for unlimited.
mysqli.max_links integer The maximum number of MySQL connections per process.
mysqli.default_port string The default TCP port number to use when connecting to the database server if no other port is
specified. If no default is specified, the port will be obtained from the MYSQL_TCP_PORT envir-
onment variable, the mysql-tcp entry in /etc/services or the compile-time
MYSQL_PORT constant, in that order. Win32 will only use the MYSQL_PORT constant.
mysqli.default_socket
string
The default socket name to use when connecting to a local database server if no other socket
name is specified.
mysqli.default_host string The default server host to use when connecting to the database server if no other host is specified.
Doesn't apply in safe mode.
mysqli.default_user string The default user name to use when connecting to the database server if no other name is spe-
cified. Doesn't apply in safe mode.
mysqli.default_pw string The default password to use when connecting to the database server if no other password is spe-
cified. Doesn't apply in safe mode.
21.11.2.4.4. Resource Types
Copyright 1997-2008 the PHP Documentation Group.
This extension has no resource types defined.
21.11.2.5. The mysqli Extension and Persistent Connections
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2496
Persistent connection support was introduced in PHP 5.3 for the mysqli extension. Support was already present in PDO MYSQL and
ext/mysql. The idea behind persistent connections is that a connection between a client process and a database can be reused by a client
process, rather than being created and destroyed multiple times. This reduces the overhead of creating fresh connections every time one
is required, as unused connections are cached and ready to be reused.
The problem with persistent connections is that they can be left in unpredictable states by clients. For example, a table lock might be ac-
tivated before a client terminates unexpectedly. A new client process reusing this persistent connection will get the connection as is.
Any cleanup would need to be done by the new client process before it could make good use of the persistent connection, increasing the
burden on the programmer.
The persistent connection of the mysqli extension however provides built-in cleanup handling code. The cleanup carried out by
mysqli includes:
Rollback active transactions
Close and drop temporary tables
Unlock tables
Reset session variables
Close prepared statements (always happens with PHP)
Close handler
Release locks acquired with GET_LOCK
This ensures that persistent connections are in a clean state on return from the connection pool, before the client process uses them.
The mysqli extension does this cleanup by automatically calling the C-API function mysql_change_user().
The automatic cleanup feature has advantages and disadvantages though. The advantage is that the programmer no longer needs to
worry about adding cleanup code, as it is called automatically. However, the disadvantage is that the code could potentially be a little
slower, as the code to perform the cleanup needs to run each time a connection is returned from the connection pool.
It is possible to switch off the automatic cleanup code, by compiling PHP with MYSQLI_NO_CHANGE_USER_ON_PCONNECT
defined.
Note
The mysqli extension supports persistent connections when using either MySQL Native Driver or MySQL Client Lib-
rary.
21.11.2.6. Predefined Constants
Copyright 1997-2008 the PHP Documentation Group.
MYSQLI_READ_DEFAULT_GROU
P
Read options from the named group from my.cnf or the file specified with
MYSQLI_READ_DEFAULT_FILE
MYSQLI_READ_DEFAULT_FILE Read options from the named option file instead of from my.cnf
MYSQLI_OPT_CONNECT_TIMEO
UT
Connect timeout in seconds
MYSQLI_OPT_LOCAL_INFILE Enables command LOAD LOCAL INFILE
MYSQLI_INIT_COMMAND Command to execute when connecting to MySQL server. Will automatically be re-executed
when reconnecting.
MYSQLI_CLIENT_SSL Use SSL (encrypted protocol). This option should not be set by application programs; it is set in-
ternally in the MySQL client library
MYSQLI_CLIENT_COMPRESS Use compression protocol
Connectors and APIs
2497
MYSQLI_CLIENT_INTERACTIV
E
Allow interactive_timeout seconds (instead of wait_timeout seconds) of inactivity
before closing the connection. The client's session wait_timeout variable will be set to the
value of the session interactive_timeout variable.
MYSQLI_CLIENT_IGNORE_SPA
CE
Allow spaces after function names. Makes all functions names reserved words.
MYSQLI_CLIENT_NO_SCHEMA Don't allow the db_name.tbl_name.col_name syntax.
MYSQLI_CLIENT_MULTI_QUER
IES
Allows multiple semicolon-delimited queries in a single mysqli_query call.
MYSQLI_STORE_RESULT For using buffered resultsets
MYSQLI_USE_RESULT For using unbuffered resultsets
MYSQLI_ASSOC Columns are returned into the array having the fieldname as the array index.
MYSQLI_NUM Columns are returned into the array having an enumerated index.
MYSQLI_BOTH Columns are returned into the array having both a numerical index and the fieldname as the asso-
ciative index.
MYSQLI_NOT_NULL_FLAG Indicates that a field is defined as NOT NULL
MYSQLI_PRI_KEY_FLAG Field is part of a primary index
MYSQLI_UNIQUE_KEY_FLAG Field is part of a unique index.
MYSQLI_MULTIPLE_KEY_FLAG Field is part of an index.
MYSQLI_BLOB_FLAG Field is defined as BLOB
MYSQLI_UNSIGNED_FLAG Field is defined as UNSIGNED
MYSQLI_ZEROFILL_FLAG Field is defined as ZEROFILL
MYSQLI_AUTO_INCREMENT_FL
AG
Field is defined as AUTO_INCREMENT
MYSQLI_TIMESTAMP_FLAG Field is defined as TIMESTAMP
MYSQLI_SET_FLAG Field is defined as SET
MYSQLI_NUM_FLAG Field is defined as NUMERIC
MYSQLI_PART_KEY_FLAG Field is part of an multi-index
MYSQLI_GROUP_FLAG Field is part of GROUP BY
MYSQLI_TYPE_DECIMAL Field is defined as DECIMAL
MYSQLI_TYPE_NEWDECIMAL Precision math DECIMAL or NUMERIC field (MySQL 5.0.3 and up)
MYSQLI_TYPE_BIT Field is defined as BIT (MySQL 5.0.3 and up)
MYSQLI_TYPE_TINY Field is defined as TINYINT
MYSQLI_TYPE_SHORT Field is defined as SMALLINT
MYSQLI_TYPE_LONG Field is defined as INT
MYSQLI_TYPE_FLOAT Field is defined as FLOAT
MYSQLI_TYPE_DOUBLE Field is defined as DOUBLE
MYSQLI_TYPE_NULL Field is defined as DEFAULT NULL
MYSQLI_TYPE_TIMESTAMP Field is defined as TIMESTAMP
Connectors and APIs
2498
MYSQLI_TYPE_LONGLONG Field is defined as BIGINT
MYSQLI_TYPE_INT24 Field is defined as MEDIUMINT
MYSQLI_TYPE_DATE Field is defined as DATE
MYSQLI_TYPE_TIME Field is defined as TIME
MYSQLI_TYPE_DATETIME Field is defined as DATETIME
MYSQLI_TYPE_YEAR Field is defined as YEAR
MYSQLI_TYPE_NEWDATE Field is defined as DATE
MYSQLI_TYPE_INTERVAL Field is defined as INTERVAL
MYSQLI_TYPE_ENUM Field is defined as ENUM
MYSQLI_TYPE_SET Field is defined as SET
MYSQLI_TYPE_TINY_BLOB Field is defined as TINYBLOB
MYSQLI_TYPE_MEDIUM_BLOB Field is defined as MEDIUMBLOB
MYSQLI_TYPE_LONG_BLOB Field is defined as LONGBLOB
MYSQLI_TYPE_BLOB Field is defined as BLOB
MYSQLI_TYPE_VAR_STRING Field is defined as VARCHAR
MYSQLI_TYPE_STRING Field is defined as STRING
MYSQLI_TYPE_CHAR Field is defined as CHAR
MYSQLI_TYPE_GEOMETRY Field is defined as GEOMETRY
MYSQLI_NEED_DATA More data available for bind variable
MYSQLI_NO_DATA No more data available for bind variable
MYSQLI_DATA_TRUNCATED Data truncation occurred. Available since PHP 5.1.0 and MySQL 5.0.5.
MYSQLI_ENUM_FLAG Field is defined as ENUM. Available since PHP 5.3.0.
MYSQLI_CURSOR_TYPE_FOR_U
PDATE MYSQLI_CURSOR_TYPE_NO_CU
RSOR MYSQLI_CURSOR_TYPE_READ_
ONLY MYSQLI_CURSOR_TYPE_SCROL
LABLE MYSQLI_STMT_ATTR_CURSOR_
TYPE MYSQLI_STMT_ATTR_PREFETC
H_ROWS MYSQLI_STMT_ATTR_UPDATE_
MAX_LENGTH MYSQLI_SET_CHARSET_NAME
21.11.2.7. The MySQLi Extension Function Summary
Copyright 1997-2008 the PHP Documentation Group.
MySQLi Class
OOP Interface Procedural Interface Alias (Do not use) Description
Properties
$mysqli->affected_rows mysqli_affected_rows N/A Gets the number of affected
rows in a previous MySQL op-
eration
$mysqli->connect_errno mysqli_connect_errno N/A Returns the error code from last
connect call
Connectors and APIs
2499
MySQLi Class
OOP Interface Procedural Interface Alias (Do not use) Description
$mysqli->connect_error mysqli_connect_error N/A Returns a string description of
the last connect error
$mysqli->errno mysqli_errno N/A Returns the error code for the
most recent function call
$mysqli->error mysqli_error N/A Returns a string description of
the last error
$mysqli->field_count mysqli_field_count N/A Returns the number of columns
for the most recent query
$mysqli->host_info mysqli_get_host_info N/A Returns a string representing the
type of connection used
$mysqli->protocol_version mysqli_get_proto_info N/A Returns the version of the
MySQL protocol used
$mysqli->server_info mysqli_get_server_inf
o
N/A Returns the version of the
MySQL server
$mysqli->server_version mysqli_get_server_ver
sion
N/A Returns the version of the
MySQL server as an integer
$mysqli->info mysqli_info N/A Retrieves information about the
most recently executed query
$mysqli->insert_id mysqli_insert_id N/A Returns the auto generated id
used in the last query
$mysqli->sqlstate mysqli_sqlstate N/A Returns the SQLSTATE error
from previous MySQL operation
$mysqli->warning_count mysqli_warning_count N/A Returns the number of warnings
from the last query for the given
link
Methods
mysqli->autocommit mysqli_autocommit N/A Turns on or off auto-commiting
database modifications
mysqli->change_user mysqli_change_user N/A Changes the user of the spe-
cified database connection
mysqli-
>character_set_name,
mysqli->client_encoding
mysqli_character_set_
name
mysqli_client_encodin
g
Returns the default character set
for the database connection
mysqli->close mysqli_close N/A Closes a previously opened data-
base connection
mysqli->commit mysqli_commit N/A Commits the current transaction
mysqli::__construct mysqli_connect N/A Open a new connection to the
MySQL server [Note: static (i.e.
class) method]
mysqli->debug mysqli_debug N/A Performs debugging operations
mysqli-
>dump_debug_info
mysqli_dump_debug_inf
o
N/A Dump debugging information
into the log
mysqli->get_charset mysqli_get_charset N/A Returns a character set object
mysqli-
>get_client_info
mysqli_get_client_inf
o
N/A Returns the MySQL client ver-
sion as a string
mysqli-
>get_client_version
mysqli_get_client_ver
sion
N/A Get MySQL client info
mysqli-
>get_connection_stats
mysqli_get_connection
_stats
N/A Returns client connection statist-
ics. MySQL Native Driver only.
mysqli- mysqli_get_client_sta N/A Returns client per-process stat-
Connectors and APIs
2500
MySQLi Class
OOP Interface Procedural Interface Alias (Do not use) Description
>get_client_stats ts istics. MySQL Native Driver
only.
mysqli-
>get_cache_stats
mysqli_get_cache_stat
s
N/A Returns client Zval cache statist-
ics. MySQL Native Driver only.
mysqli-
>get_server_info
mysqli_get_server_inf
o
N/A NOT DOCUMENTED
mysqli->get_warnings mysqli_get_warnings N/A NOT DOCUMENTED
mysqli_init mysqli_init N/A Initializes MySQLi and returns a
resource for use with
mysqli_real_connect. [Not
called on an object, as it returns
a $mysqli object.]
mysqli->kill mysqli_kill N/A Asks the server to kill a MySQL
thread
mysqli->more_results mysqli_more_results N/A Check if there are any more
query results from a multi query
mysqli->multi_query mysqli_multi_query N/A Performs a query on the data-
base
mysqli->next_result mysqli_next_result N/A Prepare next result from
multi_query
mysqli->options mysqli_options mysqli_set_opt Set options
mysqli->ping mysqli_ping N/A Pings a server connection, or
tries to reconnect if the connec-
tion has gone down
mysqli->prepare mysqli_prepare N/A Prepare a SQL statement for ex-
ecution
mysqli->query mysqli_query N/A Performs a query on the data-
base
mysqli->real_connect mysqli_real_connect N/A Opens a connection to a mysql
server
mysqli-
>real_escape_string,
mysqli->escape_string
mysqli_real_escape_st
ring
mysqli_escape_string Escapes special characters in a
string for use in a SQL state-
ment, taking into account the
current charset of the connection
mysqli->real_query mysqli_real_query N/A Execute an SQL query
mysqli->rollback mysqli_rollback N/A Rolls back current transaction
mysqli->select_db mysqli_select_db N/A Selects the default database for
database queries
mysqli->set_charset mysqli_set_charset N/A Sets the default client character
set
mysqli-
>set_local_infile_def
ault
mysqli_set_local_infi
le_default
N/A Unsets user defined handler for
load local infile command
mysqli-
>set_local_infile_han
dler
mysqli_set_local_infi
le_handler
N/A Set callback function for LOAD
DATA LOCAL INFILE com-
mand
mysqli->ssl_set mysqli_ssl_set N/A Used for establishing secure
connections using SSL
mysqli->stat mysqli_stat N/A Gets the current system status
mysqli->stmt_init mysqli_stmt_init N/A Initializes a statement and re-
turns an object for use with
Connectors and APIs
2501
MySQLi Class
OOP Interface Procedural Interface Alias (Do not use) Description
mysqli_stmt_prepare
mysqli->store_result mysqli_store_result N/A Transfers a result set from the
last query
mysqli->thread_id mysqli_thread_id N/A Returns the thread ID for the
current connection
mysqli->thread_safe mysqli_thread_safe N/A Returns whether thread safety is
given or not
mysqli->use_result mysqli_use_result N/A Initiate a result set retrieval
MySQL_STMT
OOP Interface Procedural Interface Alias (Do not use) Description
Properties
$mysqli_stmt->affected_rows mysqli_stmt_affected_
rows
N/A Returns the total number of rows
changed, deleted, or inserted by
the last executed statement
$mysqli_stmt->errno mysqli_stmt_errno N/A Returns the error code for the
most recent statement call
$mysqli_stmt->error mysqli_stmt_error N/A Returns a string description for
last statement error
$mysqli_stmt->field_count mysqli_stmt_field_cou
nt
N/A Returns the number of field in
the given statement - not docu-
mented
$mysqli_stmt->insert_id mysqli_stmt_insert_id N/A Get the ID generated from the
previous INSERT operation
$mysqli_stmt->num_rows mysqli_stmt_num_rows N/A Return the number of rows in
statements result set
$mysqli_stmt->param_count mysqli_stmt_param_cou
nt
mysqli_param_count Returns the number of parameter
for the given statement
$mysqli_stmt->sqlstate mysqli_stmt_sqlstate N/A Returns SQLSTATE error from
previous statement operation
Methods
mysqli_stmt->attr_get mysqli_stmt_attr_get N/A Used to get the current value of
a statement attribute
mysqli_stmt->attr_set mysqli_stmt_attr_set N/A Used to modify the behavior of a
prepared statement
mysqli_stmt->bind_par
am
mysqli_stmt_bind_para
m
mysqli_bind_param Binds variables to a prepared
statement as parameters
mysqli_stmt->bind_res
ult
mysqli_stmt_bind_resu
lt
mysqli_bind_result Binds variables to a prepared
statement for result storage
mysqli_stmt->close mysqli_stmt_close N/A Closes a prepared statement
mysqli_stmt->data_see
k
mysqli_stmt_data_seek N/A Seeks to an arbitrary row in
statement result set
mysqli_stmt->execute mysqli_stmt_execute mysqli_execute Executes a prepared Query
mysqli_stmt->fetch mysqli_stmt_fetch mysqli_fetch Fetch results from a prepared
statement into the bound vari-
ables
mysqli_stmt->free_res
ult
mysqli_stmt_free_resu
lt
N/A Frees stored result memory for
the given statement handle
$mysqli_stmt->get_result() mysqli_stmt_get_result N/A NOT DOCUMENTED
Connectors and APIs
2502
MySQL_STMT
OOP Interface Procedural Interface Alias (Do not use) Description
[mysqlnd only]
mysqli_stmt->get_warn
ings
mysqli_stmt_get_warni
ngs
N/A NOT DOCUMENTED
$mysqli_stmt->more_results() mysqli_stmt_more_results() N/A NOT DOCUMENTED
[mysqlnd only]
$mysqli_stmt->next_result() mysqli_stmt_next_result() N/A NOT DOCUMENTED
[mysqlnd only]
mysqli_stmt->num_rows mysqli_stmt_num_rows N/A NOT DOCUMENTED [see also
num_rows property]
mysqli_stmt->prepare mysqli_stmt_prepare N/A Prepare a SQL statement for ex-
ecution
mysqli_stmt->reset mysqli_stmt_reset N/A Resets a prepared statement
mysqli_stmt->result_m
etadata
mysqli_stmt_result_me
tadata
mysqli_get_metadata Returns result set metadata from
a prepared statement
mysqli_stmt->send_lon
g_data
mysqli_stmt_send_long
_data
mysqli_send_long_data Send data in blocks
mysqli_stmt->store_re
sult
mysqli_stmt_store_res
ult
N/A Transfers a result set from a pre-
pared statement
MySQLi_RESULT
OOP Interface Procedural Interface Alias (Do not use) Description
Properties
$mysqli_result->current_field mysqli_field_tell N/A Get current field offset of a res-
ult pointer
$mysqli_result->field_count mysqli_num_fields N/A Get the number of fields in a
result
$mysqli_result->lengths mysqli_fetch_lengths N/A Returns the lengths of the
columns of the current row in
the result set
$mysqli_result->num_rows mysqli_num_rows N/A Gets the number of rows in a
result
Methods
mysqli_result->data_s
eek
mysqli_data_seek N/A Adjusts the result pointer to an
arbitary row in the result
mysqli_result->fetch_
all
mysqli_fetch_all N/A Fetches all result rows and re-
turns the result set as an associ-
ative array, a numeric array, or
both. MySQL Native Driver
only
mysqli_result->fetch_
array
mysqli_fetch_array N/A Fetch a result row as an associat-
ive, a numeric array, or both
mysqli_result->fetch_
assoc
mysqli_fetch_assoc N/A Fetch a result row as an associat-
ive array
mysqli_result->fetch_
field_direct
mysqli_fetch_field_di
rect
N/A Fetch meta-data for a single
field
mysqli_result->fetch_
field
mysqli_fetch_field N/A Returns the next field in the res-
ult set
mysqli_result->fetch_
fields
mysqli_fetch_fields N/A Returns an array of objects rep-
resenting the fields in a result set
mysqli_result->fetch_ mysqli_fetch_object N/A Returns the current row of a res-
Connectors and APIs
2503
MySQLi_RESULT
OOP Interface Procedural Interface Alias (Do not use) Description
object ult set as an object
mysqli_result->fetch_
row
mysqli_fetch_row N/A Get a result row as an enumer-
ated array
mysqli_result->field_
seek
mysqli_field_seek N/A Set result pointer to a specified
field offset
mysqli_result->free,
mysqli_result->close,
mysqli_result->free_result
mysqli_free_result N/A Frees the memory associated
with a result
MySQL_Driver
OOP Interface Procedural Interface Alias (Do not use) Description
Properties
N/A
Methods
mysqli_driver->embedd
ed_server_end
mysqli_embedded_serve
r_end
N/A NOT DOCUMENTED
mysqli_driver->embedd
ed_server_start
mysqli_embedded_serve
r_start
N/A NOT DOCUMENTED
Note
Alias functions are provided for backward compatibility purposes only. Do not use them in new projects.
21.11.2.8. The MySQLi class (MySQLi)
Copyright 1997-2008 the PHP Documentation Group.
Represents a connection between PHP and a MySQL database.
MySQLi {
MySQLi
Properties
int affected_rows ;
string connect_errno ;
string connect_error ;
int errno ;
string error ;
int field_count ;
string host_info ;
string protocol_version ;
string server_info ;
int server_version ;
Connectors and APIs
2504
string info ;
mixed insert_id ;
string sqlstate ;
int thread_id ;
int warning_count ;
Methods
int mysqli_affected_rows(mysqli link);
bool mysqli::autocommit(bool mode);
bool mysqli::change_user(string user,
string password,
string database);
string mysqli::character_set_name();
bool mysqli::close();
bool mysqli::commit();
int mysqli_connect_errno();
string mysqli_connect_error();
mysqli mysqli_connect(string host= =ini_get("mysqli.default_host"),
string username= =ini_get("mysqli.default_user"),
string passwd= =ini_get("mysqli.default_pw"),
string dbname= ="",
int port= =ini_get("mysqli.default_port"),
string socket= =ini_get("mysqli.default_socket"));
bool mysqli::debug(string message);
bool mysqli::dump_debug_info();
int mysqli_errno(mysqli link);
string mysqli_error(mysqli link);
int mysqli_field_count(mysqli link);
bool mysqli::get_cache_stats();
object mysqli::get_charset();
string mysqli::get_client_info();
bool mysqli::get_client_stats();
int mysqli::get_client_version();
bool mysqli::get_connection_stats();
Connectors and APIs
2505
string mysqli_get_host_info(mysqli link);
int mysqli_get_proto_info(mysqli link);
string mysqli_get_server_info(mysqli link);
int mysqli_get_server_version(mysqli link);
object mysqli::get_warnings();
string mysqli_info(mysqli link);
mysqli init();
mixed mysqli_insert_id(mysqli link);
bool mysqli::kill(int processid);
bool mysqli::more_results();
bool mysqli::multi_query(string query);
bool mysqli::next_result();
bool mysqli::options(int option,
mixed value);
bool mysqli::ping();
public int mysqli::poll(array read,
array error,
array reject,
int sec,
int usec);
mysqli_stmt prepare(string query);
mixed mysqli::query(string query,
int resultmode);
bool mysqli::real_connect(string host,
string username,
string passwd,
string dbname,
int port,
string socket,
int flags);
string mysqli::escape_string(string escapestr);
bool real_query(string query);
public mysqli_result mysqli::reap_async_query();
bool mysqli::rollback();
bool mysqli::select_db(string dbname);
bool mysqli::set_charset(string charset);
Connectors and APIs
2506
void mysqli_set_local_infile_default(mysqli link);
bool mysqli_set_local_infile_handler(mysqli link,
callback read_func);
string mysqli_sqlstate(mysqli link);
bool mysqli::ssl_set(string key,
string cert,
string ca,
string capath,
string cipher);
string mysqli::stat();
mysqli_stmt stmt_init();
mysqli_result store_result();
int mysqli_thread_id(mysqli link);
bool mysqli_thread_safe();
mysqli_result use_result();
int mysqli_warning_count(mysqli link);
}
21.11.2.8.1. mysqli->affected_rows, mysqli_affected_rows
Copyright 1997-2008 the PHP Documentation Group.
mysqli->affected_rows
mysqli_affected_rows
Gets the number of affected rows in a previous MySQL operation
Description
Object oriented style (property):
mysqli {
int affected_rows ;
}
Procedural style:
int mysqli_affected_rows(mysqli link);
Returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE query.
For SELECT statements mysqli_affected_rows works like mysqli_num_rows.
Parameters
Connectors and APIs
2507
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records where updated for an UP-
DATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query re-
turned an error.
Note
If the number of affected rows is greater than maximal int value, the number of affected rows will be returned as a string.
Examples
Example 21.68. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Insert rows */
$mysqli->query("CREATE TABLE Language SELECT * from CountryLanguage");
printf("Affected rows (INSERT): %d\n", $mysqli->affected_rows);
$mysqli->query("ALTER TABLE Language ADD Status int default 0");
/* update rows */
$mysqli->query("UPDATE Language SET Status=1 WHERE Percentage > 50");
printf("Affected rows (UPDATE): %d\n", $mysqli->affected_rows);
/* delete rows */
$mysqli->query("DELETE FROM Language WHERE Percentage < 50");
printf("Affected rows (DELETE): %d\n", $mysqli->affected_rows);
/* select all rows */
$result = $mysqli->query("SELECT CountryCode FROM Language");
printf("Affected rows (SELECT): %d\n", $mysqli->affected_rows);
$result->close();
/* Delete table Language */
$mysqli->query("DROP TABLE Language");
/* close connection */
$mysqli->close();
?>
Example 21.69. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
if (!$link) {
printf("Can't connect to localhost. Error: %s\n", mysqli_connect_error());
exit();
}
/* Insert rows */
mysqli_query($link, "CREATE TABLE Language SELECT * from CountryLanguage");
printf("Affected rows (INSERT): %d\n", mysqli_affected_rows($link));
mysqli_query($link, "ALTER TABLE Language ADD Status int default 0");
/* update rows */
mysqli_query($link, "UPDATE Language SET Status=1 WHERE Percentage > 50");
printf("Affected rows (UPDATE): %d\n", mysqli_affected_rows($link));
Connectors and APIs
2508
/* delete rows */
mysqli_query($link, "DELETE FROM Language WHERE Percentage < 50");
printf("Affected rows (DELETE): %d\n", mysqli_affected_rows($link));
/* select all rows */
$result = mysqli_query($link, "SELECT CountryCode FROM Language");
printf("Affected rows (SELECT): %d\n", mysqli_affected_rows($link));
mysqli_free_result($result);
/* Delete table Language */
mysqli_query($link, "DROP TABLE Language");
/* close connection */
mysqli_close($link);
?>
The above example will output:
Affected rows (INSERT): 984
Affected rows (UPDATE): 168
Affected rows (DELETE): 815
Affected rows (SELECT): 169
See Also
mysqli_num_rows
mysqli_info
21.11.2.8.2. mysqli::autocommit, mysqli_autocommit
Copyright 1997-2008 the PHP Documentation Group.
mysqli::autocommit
mysqli_autocommit
Turns on or off auto-commiting database modifications
Description
Object oriented style (method)
bool mysqli::autocommit(bool mode);
Procedural style:
bool mysqli_autocommit(mysqli link,
bool mode);
Turns on or off auto-commit mode on queries for the database connection.
To determine the current state of autocommit use the SQL command SELECT @@autocommit.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Connectors and APIs
2509
mode Whether to turn on auto-commit or not.
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Note
This function doesn't work with non transactional table types (like MyISAM or ISAM).
Examples
Example 21.70. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* turn autocommit on */
$mysqli->autocommit(TRUE);
if ($result = $mysqli->query("SELECT @@autocommit")) {
$row = $result->fetch_row();
printf("Autocommit is %s\n", $row[0]);
$result->free();
}
/* close connection */
$mysqli->close();
?>
Example 21.71. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
if (!$link) {
printf("Can't connect to localhost. Error: %s\n", mysqli_connect_error());
exit();
}
/* turn autocommit on */
mysqli_autocommit($link, TRUE);
if ($result = mysqli_query($link, "SELECT @@autocommit")) {
$row = mysqli_fetch_row($result);
printf("Autocommit is %s\n", $row[0]);
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Autocommit is 1
Connectors and APIs
2510
See Also
mysqli_commit
mysqli_rollback
21.11.2.8.3. mysqli::change_user, mysqli_change_user
Copyright 1997-2008 the PHP Documentation Group.
mysqli::change_user
mysqli_change_user
Changes the user of the specified database connection
Description
Object oriented style (method):
bool mysqli::change_user(string user,
string password,
string database);
Procedural style:
bool mysqli_change_user(mysqli link,
string user,
string password,
string database);
Changes the user of the specified database connection and sets the current database.
In order to successfully change users a valid username and password parameters must be provided and that user must have suffi-
cient permissions to access the desired database. If for any reason authorization fails, the current user authentication will remain.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
user The MySQL user name.
password The MySQL password.
database The database to change to.
If desired, the NULL value may be passed resulting in only changing the user and not selecting a
database. To select a database in this case use the mysqli_select_db function.
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Note
Using this command will always cause the current database connection to behave as if was a completely new database
connection, regardless of if the operation was completed successfully. This reset includes performing a rollback on any
Connectors and APIs
2511
active transactions, closing all temporary tables, and unlocking all locked tables.
Examples
Example 21.72. Object oriented style
<?php
/* connect database test */
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Set Variable a */
$mysqli->query("SET @a:=1");
/* reset all and select a new database */
$mysqli->change_user("my_user", "my_password", "world");
if ($result = $mysqli->query("SELECT DATABASE()")) {
$row = $result->fetch_row();
printf("Default database: %s\n", $row[0]);
$result->close();
}
if ($result = $mysqli->query("SELECT @a")) {
$row = $result->fetch_row();
if ($row[0] === NULL) {
printf("Value of variable a is NULL\n");
}
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.73. Procedural style
<?php
/* connect database test */
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Set Variable a */
mysqli_query($link, "SET @a:=1");
/* reset all and select a new database */
mysqli_change_user($link, "my_user", "my_password", "world");
if ($result = mysqli_query($link, "SELECT DATABASE()")) {
$row = mysqli_fetch_row($result);
printf("Default database: %s\n", $row[0]);
mysqli_free_result($result);
}
if ($result = mysqli_query($link, "SELECT @a")) {
$row = mysqli_fetch_row($result);
if ($row[0] === NULL) {
printf("Value of variable a is NULL\n");
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
Connectors and APIs
2512
The above example will output:
Default database: world
Value of variable a is NULL
See Also
mysqli_connect
mysqli_select_db
21.11.2.8.4. mysqli::character_set_name, mysqli_character_set_name
Copyright 1997-2008 the PHP Documentation Group.
mysqli::character_set_name
mysqli_character_set_name
Returns the default character set for the database connection
Description
Object oriented style (method):
string mysqli::character_set_name();
Procedural style:
string mysqli_character_set_name(mysqli link);
Returns the current character set for the database connection.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
The default character set for the current connection
Examples
Example 21.74. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
Connectors and APIs
2513
}
/* Print current character set */
$charset = $mysqli->character_set_name();
printf ("Current character set is %s\n", $charset);
$mysqli->close();
?>
Example 21.75. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Print current character set */
$charset = mysqli_character_set_name($link);
printf ("Current character set is %s\n",$charset);
/* close connection */
mysqli_close($link);
?>
The above example will output:
Current character set is latin1_swedish_ci
See Also
mysqli_client_encoding
mysqli_real_escape_string
21.11.2.8.5. mysqli::close, mysqli_close
Copyright 1997-2008 the PHP Documentation Group.
mysqli::close
mysqli_close
Closes a previously opened database connection
Description
Object oriented style (method):
bool mysqli::close();
Procedural style:
Connectors and APIs
2514
bool mysqli_close(mysqli link);
Closes a previously opened database connection.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Examples
See mysqli_connect.
See Also
mysqli_connect
mysqli_init
mysqli_real_connect
21.11.2.8.6. mysqli::commit, mysqli_commit
Copyright 1997-2008 the PHP Documentation Group.
mysqli::commit
mysqli_commit
Commits the current transaction
Description
Object oriented style (method)
bool mysqli::commit();
Procedural style:
bool mysqli_commit(mysqli link);
Commits the current transaction for the database connection.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.76. Object oriented style
Connectors and APIs
2515
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE Language LIKE CountryLanguage Type=InnoDB");
/* set autocommit to off */
$mysqli->autocommit(FALSE);
/* Insert some values */
$mysqli->query("INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)");
$mysqli->query("INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)");
/* commit transaction */
$mysqli->commit();
/* drop table */
$mysqli->query("DROP TABLE Language");
/* close connection */
$mysqli->close();
?>
Example 21.77. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* set autocommit to off */
mysqli_autocommit($link, FALSE);
mysqli_query($link, "CREATE TABLE Language LIKE CountryLanguage Type=InnoDB");
/* Insert some values */
mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)");
mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)");
/* commit transaction */
mysqli_commit($link);
/* close connection */
mysqli_close($link);
?>
See Also
mysqli_autocommit
mysqli_rollback
21.11.2.8.7. mysqli->connect_errno, mysqli_connect_errno
Copyright 1997-2008 the PHP Documentation Group.
mysqli->connect_errno
mysqli_connect_errno
Connectors and APIs
2516
Returns the error code from last connect call
Description
mysqli {
string connect_errno ;
}
int mysqli_connect_errno();
Returns the last error code number from the last call to mysqli_connect.
Note
Client error message numbers are listed in the MySQL errmsg.h header file, server error message numbers are listed in
mysqld_error.h. In the MySQL source distribution you can find a complete list of error messages and error numbers
in the file Docs/mysqld_error.txt.
Return Values
An error code value for the last call to mysqli_connect, if it failed. zero means no error occurred.
Examples
Example 21.78. Object oriented style
<?php
$mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db');
if ($mysqli->connect_errno) {
die('Connect Error: ' . $mysqli->connect_errno);
}
?>
Example 21.79. Procedural style
<?php
$link = @mysqli_connect('localhost', 'fake_user', 'my_password', 'my_db');
if (!$link) {
die('Connect Error: ' . mysqli_connect_errno());
}
?>
The above example will output:
Connect Error: 1045
See Also
Connectors and APIs
2517
mysqli_connect
mysqli_connect_error
mysqli_errno
mysqli_error
mysqli_sqlstate
21.11.2.8.8. mysqli->connect_error, mysqli_connect_error
Copyright 1997-2008 the PHP Documentation Group.
mysqli->connect_error
mysqli_connect_error
Returns a string description of the last connect error
Description
mysqli {
string connect_error ;
}
string mysqli_connect_error();
Returns the last error message string from the last call to mysqli_connect.
Return Values
A string that describes the error. An empty string if no error occurred.
Examples
Example 21.80. Object oriented style
<?php
$mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db');
// Works as of PHP 5.2.9 and 5.3.0.
if ($mysqli->connect_error) {
die('Connect Error: ' . $mysqli->connect_error);
}
?>
Example 21.81. Procedural style
<?php
$link = @mysqli_connect('localhost', 'fake_user', 'my_password', 'my_db');
if (!$link) {
die('Connect Error: ' . mysqli_connect_error());
}
?>
The above example will output:
Connectors and APIs
2518
Connect Error: Access denied for user 'fake_user'@'localhost' (using password: YES)
Notes
Warning
The mysqli->connect_error property only works properly as of PHP versions 5.2.9 and 5.3.0. Use the
mysqli_connect_error function if compatibility with earlier PHP versions is required.
See Also
mysqli_connect
mysqli_connect_errno
mysqli_errno
mysqli_error
mysqli_sqlstate
21.11.2.8.9. mysqli::__construct, mysqli_connect
Copyright 1997-2008 the PHP Documentation Group.
mysqli::__construct
mysqli_connect
Open a new connection to the MySQL server
Description
Object oriented style (constructor):
mysqli::__construct(string host= =ini_get("mysqli.default_host"),
string username= =ini_get("mysqli.default_user"),
string passwd= =ini_get("mysqli.default_pw"),
string dbname= ="",
int port= =ini_get("mysqli.default_port"),
string socket= =ini_get("mysqli.default_socket"));
Procedural style
mysqli mysqli_connect(string host= =ini_get("mysqli.default_host"),
string username= =ini_get("mysqli.default_user"),
string passwd= =ini_get("mysqli.default_pw"),
string dbname= ="",
int port= =ini_get("mysqli.default_port"),
string socket= =ini_get("mysqli.default_socket"));
Opens a connection to the MySQL Server running on.
Parameters
host Can be either a host name or an IP address. Passing the NULL value or the string "localhost" to
this parameter, the local host is assumed. When possible, pipes will be used instead of the TCP/IP
protocol.
Prepending host by p: opens a persistent connection. mysqli_change_user is automatically
called on connections opened from the connection pool.
Connectors and APIs
2519
username The MySQL user name.
passwd If not provided or NULL , the MySQL server will attempt to authenticate the user against those
user records which have no password only. This allows one username to be used with different
permissions (depending on if a password as provided or not).
dbname If provided will specify the default database to be used when performing queries.
port Specifies the port number to attempt to connect to the MySQL server.
socket Specifies the socket or named pipe that should be used.
Note
Specifying the socket parameter will not explicitly determine the type of connection to be used when connecting to the
MySQL server. How the connection is made to the MySQL database is determined by the host parameter.
Return Values
Returns an object which represents the connection to a MySQL Server.
Changelog
Version Description
5.3.0 Added the ability of persistent connections.
Examples
Example 21.82. Object oriented style
<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
/*
* This is the "official" OO way to do it,
* BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
*/
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
/*
* Use this instead of $connect_error if you need to ensure
* compatibility with PHP versions prior to 5.2.9 and 5.3.0.
*/
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . $mysqli->host_info . "\n";
$mysqli->close();
?>
Example 21.83. Object oriented style when extending mysqli class
<?php
class foo_mysqli extends mysqli {
public function __construct($host, $user, $pass, $db) {
parent::__construct($host, $user, $pass, $db);
Connectors and APIs
2520
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
}
}
$db = new foo_mysqli('localhost', 'my_user', 'my_password', 'my_db');
echo 'Success... ' . $db->host_info . "\n";
$db->close();
?>
Example 21.84. Procedural style
<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
if (!$link) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . mysqli_get_host_info($link) . "\n";
mysqli_close($link);
?>
The above example will output:
Success... MySQL host info: localhost via TCP/IP
Notes
Note
OO syntax only: If a connection fails an object is still returned. To check if the connection failed then use either the
mysqli_connect_error function or the mysqli->connect_error property like in the examples above.
Note
If it is necessary to set options, such as the connection timeout, mysqli_real_connect must be used instead.
Note
Calling the constructor with no parameters is the same as calling mysqli_init.
Note
Error "Can't create TCP/IP socket (10106)" usually means that the variables_order configure directive doesn't contain
character E. On Windows, if the environment is not copied the SYSTEMROOT environment variable won't be available and
PHP will have problems loading Winsock.
See Also
mysqli_real_connect
Connectors and APIs
2521
mysqli_options
mysqli_connect_errno
mysqli_connect_error
mysqli_close
21.11.2.8.10. mysqli::debug, mysqli_debug
Copyright 1997-2008 the PHP Documentation Group.
mysqli::debug
mysqli_debug
Performs debugging operations
Description
Object oriented style (method):
bool mysqli::debug(string message);
Procedural style:
bool mysqli_debug(string message);
Performs debugging operations using the Fred Fish debugging library.
Parameters
message A string representing the debugging operation to perform
Return Values
Returns TRUE .
Notes
Note
To use the mysqli_debug function you must compile the MySQL client library to support debugging.
Examples
Example 21.85. Generating a Trace File
<?php
/* Create a trace file in '/tmp/client.trace' on the local (client) machine: */
mysqli_debug("d:t:0,/tmp/client.trace");
?>
See Also
mysqli_dump_debug_info
mysqli_report
Connectors and APIs
2522
21.11.2.8.11. mysqli::dump_debug_info, mysqli_dump_debug_info
Copyright 1997-2008 the PHP Documentation Group.
mysqli::dump_debug_info
mysqli_dump_debug_info
Dump debugging information into the log
Description
Object oriented style (method):
bool mysqli::dump_debug_info();
Procedural style:
bool mysqli_dump_debug_info(mysqli link);
This function is designed to be executed by an user with the SUPER privilege and is used to dump debugging information into the log
for the MySQL Server relating to the connection.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
See Also
mysqli_debug
21.11.2.8.12. mysqli->errno, mysqli_errno
Copyright 1997-2008 the PHP Documentation Group.
mysqli->errno
mysqli_errno
Returns the error code for the most recent function call
Description
Object oriented style (property):
mysqli {
int errno ;
}
Procedural style:
int mysqli_errno(mysqli link);
Connectors and APIs
2523
Returns the last error code for the most recent MySQLi function call that can succeed or fail.
Client error message numbers are listed in the MySQL errmsg.h header file, server error message numbers are listed in
mysqld_error.h. In the MySQL source distribution you can find a complete list of error messages and error numbers in the file
Docs/mysqld_error.txt.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
An error code value for the last call, if it failed. zero means no error occurred.
Examples
Example 21.86. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if (!$mysqli->query("SET a=1")) {
printf("Errorcode: %d\n", $mysqli->errno);
}
/* close connection */
$mysqli->close();
?>
Example 21.87. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if (!mysqli_query($link, "SET a=1")) {
printf("Errorcode: %d\n", mysqli_errno($link));
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Errorcode: 1193
Connectors and APIs
2524
See Also
mysqli_connect_errno
mysqli_connect_error
mysqli_error
mysqli_sqlstate
21.11.2.8.13. mysqli->error, mysqli_error
Copyright 1997-2008 the PHP Documentation Group.
mysqli->error
mysqli_error
Returns a string description of the last error
Description
Object oriented style (property):
mysqli {
string error ;
}
Procedural style:
string mysqli_error(mysqli link);
Returns the last error message for the most recent MySQLi function call that can succeed or fail.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
A string that describes the error. An empty string if no error occurred.
Examples
Example 21.88. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if (!$mysqli->query("SET a=1")) {
printf("Errormessage: %s\n", $mysqli->error);
}
/* close connection */
$mysqli->close();
?>
Connectors and APIs
2525
Example 21.89. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if (!mysqli_query($link, "SET a=1")) {
printf("Errormessage: %s\n", mysqli_error($link));
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Errormessage: Unknown system variable 'a'
See Also
mysqli_connect_errno
mysqli_connect_error
mysqli_errno
mysqli_sqlstate
21.11.2.8.14. mysqli->field_count, mysqli_field_count
Copyright 1997-2008 the PHP Documentation Group.
mysqli->field_count
mysqli_field_count
Returns the number of columns for the most recent query
Description
Object oriented style (property):
mysqli_result {
int field_count ;
}
Procedural style:
int mysqli_field_count(mysqli link);
Returns the number of columns for the most recent query on the connection represented by the link parameter. This function can be
useful when using the mysqli_store_result function to determine if the query should have produced a non-empty result set or
not without knowing the nature of the query.
Connectors and APIs
2526
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
An integer representing the number of fields in a result set.
Examples
Example 21.90. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
$mysqli->query( "DROP TABLE IF EXISTS friends");
$mysqli->query( "CREATE TABLE friends (id int, name varchar(20))");
$mysqli->query( "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
$mysqli->real_query("SELECT * FROM friends");
if ($mysqli->field_count) {
/* this was a select/show or describe query */
$result = $mysqli->store_result();
/* process resultset */
$row = $result->fetch_row();
/* free resultset */
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.91. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
mysqli_query($link, "DROP TABLE IF EXISTS friends");
mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))");
mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
mysqli_real_query($link, "SELECT * FROM friends");
if (mysqli_field_count($link)) {
/* this was a select/show or describe query */
$result = mysqli_store_result($link);
/* process resultset */
$row = mysqli_fetch_row($result);
/* free resultset */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
Connectors and APIs
2527
21.11.2.8.15. mysqli::get_cache_stats, mysqli_get_cache_stats
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_cache_stats
mysqli_get_cache_stats
Returns client Zval cache statistics
Description
Object oriented style (method):
bool mysqli::get_cache_stats();
Procedural style:
array mysqli_get_cache_stats();
Warning
This function is currently not documented; only its argument list is available.
Returns client Zval cache statistics. Available only with mysqlnd.
Parameters
Return Values
Returns an array with client Zval cache stats if success, FALSE otherwise.
Examples
Example 21.92. A mysqli_get_cache_stats example
<?php
$link = mysqli_connect();
print_r(mysqli_get_cache_stats());
?>
The above example will output something similar to:
Array
(
[bytes_sent] => 43
[bytes_received] => 80
[packets_sent] => 1
[packets_received] => 2
[protocol_overhead_in] => 8
[protocol_overhead_out] => 4
[bytes_received_ok_packet] => 11
[bytes_received_eof_packet] => 0
[bytes_received_rset_header_packet] => 0
[bytes_received_rset_field_meta_packet] => 0
[bytes_received_rset_row_packet] => 0
[bytes_received_prepare_response_packet] => 0
[bytes_received_change_user_packet] => 0
[packets_sent_command] => 0
[packets_received_ok] => 1
[packets_received_eof] => 0
[packets_received_rset_header] => 0
Connectors and APIs
2528
[packets_received_rset_field_meta] => 0
[packets_received_rset_row] => 0
[packets_received_prepare_response] => 0
[packets_received_change_user] => 0
[result_set_queries] => 0
[non_result_set_queries] => 0
[no_index_used] => 0
[bad_index_used] => 0
[slow_queries] => 0
[buffered_sets] => 0
[unbuffered_sets] => 0
[ps_buffered_sets] => 0
[ps_unbuffered_sets] => 0
[flushed_normal_sets] => 0
[flushed_ps_sets] => 0
[ps_prepared_never_executed] => 0
[ps_prepared_once_executed] => 0
[rows_fetched_from_server_normal] => 0
[rows_fetched_from_server_ps] => 0
[rows_buffered_from_client_normal] => 0
[rows_buffered_from_client_ps] => 0
[rows_fetched_from_client_normal_buffered] => 0
[rows_fetched_from_client_normal_unbuffered] => 0
[rows_fetched_from_client_ps_buffered] => 0
[rows_fetched_from_client_ps_unbuffered] => 0
[rows_fetched_from_client_ps_cursor] => 0
[rows_skipped_normal] => 0
[rows_skipped_ps] => 0
[copy_on_write_saved] => 0
[copy_on_write_performed] => 0
[command_buffer_too_small] => 0
[connect_success] => 1
[connect_failure] => 0
[connection_reused] => 0
[reconnect] => 0
[pconnect_success] => 0
[active_connections] => 1
[active_persistent_connections] => 0
[explicit_close] => 0
[implicit_close] => 0
[disconnect_close] => 0
[in_middle_of_command_close] => 0
[explicit_free_result] => 0
[implicit_free_result] => 0
[explicit_stmt_close] => 0
[implicit_stmt_close] => 0
[mem_emalloc_count] => 0
[mem_emalloc_ammount] => 0
[mem_ecalloc_count] => 0
[mem_ecalloc_ammount] => 0
[mem_erealloc_count] => 0
[mem_erealloc_ammount] => 0
[mem_efree_count] => 0
[mem_malloc_count] => 0
[mem_malloc_ammount] => 0
[mem_calloc_count] => 0
[mem_calloc_ammount] => 0
[mem_realloc_count] => 0
[mem_realloc_ammount] => 0
[mem_free_count] => 0
[proto_text_fetched_null] => 0
[proto_text_fetched_bit] => 0
[proto_text_fetched_tinyint] => 0
[proto_text_fetched_short] => 0
[proto_text_fetched_int24] => 0
[proto_text_fetched_int] => 0
[proto_text_fetched_bigint] => 0
[proto_text_fetched_decimal] => 0
[proto_text_fetched_float] => 0
[proto_text_fetched_double] => 0
[proto_text_fetched_date] => 0
[proto_text_fetched_year] => 0
[proto_text_fetched_time] => 0
[proto_text_fetched_datetime] => 0
[proto_text_fetched_timestamp] => 0
[proto_text_fetched_string] => 0
[proto_text_fetched_blob] => 0
[proto_text_fetched_enum] => 0
[proto_text_fetched_set] => 0
[proto_text_fetched_geometry] => 0
[proto_text_fetched_other] => 0
[proto_binary_fetched_null] => 0
[proto_binary_fetched_bit] => 0
[proto_binary_fetched_tinyint] => 0
[proto_binary_fetched_short] => 0
[proto_binary_fetched_int24] => 0
[proto_binary_fetched_int] => 0
[proto_binary_fetched_bigint] => 0
[proto_binary_fetched_decimal] => 0
[proto_binary_fetched_float] => 0
Connectors and APIs
2529
[proto_binary_fetched_double] => 0
[proto_binary_fetched_date] => 0
[proto_binary_fetched_year] => 0
[proto_binary_fetched_time] => 0
[proto_binary_fetched_datetime] => 0
[proto_binary_fetched_timestamp] => 0
[proto_binary_fetched_string] => 0
[proto_binary_fetched_blob] => 0
[proto_binary_fetched_enum] => 0
[proto_binary_fetched_set] => 0
[proto_binary_fetched_geometry] => 0
[proto_binary_fetched_other] => 0
)
21.11.2.8.16. mysqli::get_charset, mysqli_get_charset
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_charset
mysqli_get_charset
Returns a character set object
Description
object mysqli::get_charset();
object mysqli_get_charset(mysqli link);
Returns a character set object providing several properties of the current active character set.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
The function returns a character set object with the following properties:
charset Character set name
collation Collation name
dir Directory the charset description was fetched from (?) or "" for built-in character sets
min_length Minimum character length in bytes
max_length Maximum character length in bytes
number Internal character set number
state Character set status (?)
Examples
Example 21.93. Object oriented style
Connectors and APIs
2530
<?php
$db = mysqli_init();
$db->real_connect("localhost","root","","test");
var_dump($db->get_charset());
?>
Example 21.94. Procedural style
<?php
$db = mysqli_init();
mysqli_real_connect($db, "localhost","root","","test");
var_dump($db->get_charset());
?>
The above example will output:
object(stdClass)#2 (7) {
["charset"]=>
string(6) "latin1"
["collation"]=>
string(17) "latin1_swedish_ci"
["dir"]=>
string(0) ""
["min_length"]=>
int(1)
["max_length"]=>
int(1)
["number"]=>
int(8)
["state"]=>
int(801)
}
See Also
mysqli_character_set_name
mysqli_set_charset
21.11.2.8.17. mysqli::get_client_info, mysqli_get_client_info
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_client_info
mysqli_get_client_info
Returns the MySQL client version as a string
Description
string mysqli::get_client_info();
string mysqli_get_client_info();
The mysqli_get_client_info function is used to return a string representing the client version being used in the MySQLi exten-
Connectors and APIs
2531
sion.
Return Values
A string that represents the MySQL client library version
Examples
Example 21.95. mysqli_get_client_info
<?php
/* We don't need a connection to determine
the version of mysql client library */
printf("Client library version: %s\n", mysqli_get_client_info());
?>
See Also
mysqli_get_client_version
mysqli_get_server_info
mysqli_get_server_version
21.11.2.8.18. mysqli::get_client_stats, mysqli_get_client_stats
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_client_stats
mysqli_get_client_stats
Returns client per-process statistics
Description
Object oriented style (method):
bool mysqli::get_client_stats();
Procedural style:
array mysqli_get_client_stats();
Warning
This function is currently not documented; only its argument list is available.
Returns client per-process statistics. Available only with mysqlnd.
Parameters
Return Values
Returns an array with client stats if success, FALSE otherwise.
Examples
Connectors and APIs
2532
Example 21.96. A mysqli_get_client_stats example
<?php
$link = mysqli_connect();
print_r(mysqli_get_client_stats());
?>
The above example will output something similar to:
Array
(
[bytes_sent] => 43
[bytes_received] => 80
[packets_sent] => 1
[packets_received] => 2
[protocol_overhead_in] => 8
[protocol_overhead_out] => 4
[bytes_received_ok_packet] => 11
[bytes_received_eof_packet] => 0
[bytes_received_rset_header_packet] => 0
[bytes_received_rset_field_meta_packet] => 0
[bytes_received_rset_row_packet] => 0
[bytes_received_prepare_response_packet] => 0
[bytes_received_change_user_packet] => 0
[packets_sent_command] => 0
[packets_received_ok] => 1
[packets_received_eof] => 0
[packets_received_rset_header] => 0
[packets_received_rset_field_meta] => 0
[packets_received_rset_row] => 0
[packets_received_prepare_response] => 0
[packets_received_change_user] => 0
[result_set_queries] => 0
[non_result_set_queries] => 0
[no_index_used] => 0
[bad_index_used] => 0
[slow_queries] => 0
[buffered_sets] => 0
[unbuffered_sets] => 0
[ps_buffered_sets] => 0
[ps_unbuffered_sets] => 0
[flushed_normal_sets] => 0
[flushed_ps_sets] => 0
[ps_prepared_never_executed] => 0
[ps_prepared_once_executed] => 0
[rows_fetched_from_server_normal] => 0
[rows_fetched_from_server_ps] => 0
[rows_buffered_from_client_normal] => 0
[rows_buffered_from_client_ps] => 0
[rows_fetched_from_client_normal_buffered] => 0
[rows_fetched_from_client_normal_unbuffered] => 0
[rows_fetched_from_client_ps_buffered] => 0
[rows_fetched_from_client_ps_unbuffered] => 0
[rows_fetched_from_client_ps_cursor] => 0
[rows_skipped_normal] => 0
[rows_skipped_ps] => 0
[copy_on_write_saved] => 0
[copy_on_write_performed] => 0
[command_buffer_too_small] => 0
[connect_success] => 1
[connect_failure] => 0
[connection_reused] => 0
[reconnect] => 0
[pconnect_success] => 0
[active_connections] => 1
[active_persistent_connections] => 0
[explicit_close] => 0
[implicit_close] => 0
[disconnect_close] => 0
[in_middle_of_command_close] => 0
[explicit_free_result] => 0
[implicit_free_result] => 0
[explicit_stmt_close] => 0
[implicit_stmt_close] => 0
[mem_emalloc_count] => 0
[mem_emalloc_ammount] => 0
[mem_ecalloc_count] => 0
[mem_ecalloc_ammount] => 0
[mem_erealloc_count] => 0
Connectors and APIs
2533
[mem_erealloc_ammount] => 0
[mem_efree_count] => 0
[mem_malloc_count] => 0
[mem_malloc_ammount] => 0
[mem_calloc_count] => 0
[mem_calloc_ammount] => 0
[mem_realloc_count] => 0
[mem_realloc_ammount] => 0
[mem_free_count] => 0
[proto_text_fetched_null] => 0
[proto_text_fetched_bit] => 0
[proto_text_fetched_tinyint] => 0
[proto_text_fetched_short] => 0
[proto_text_fetched_int24] => 0
[proto_text_fetched_int] => 0
[proto_text_fetched_bigint] => 0
[proto_text_fetched_decimal] => 0
[proto_text_fetched_float] => 0
[proto_text_fetched_double] => 0
[proto_text_fetched_date] => 0
[proto_text_fetched_year] => 0
[proto_text_fetched_time] => 0
[proto_text_fetched_datetime] => 0
[proto_text_fetched_timestamp] => 0
[proto_text_fetched_string] => 0
[proto_text_fetched_blob] => 0
[proto_text_fetched_enum] => 0
[proto_text_fetched_set] => 0
[proto_text_fetched_geometry] => 0
[proto_text_fetched_other] => 0
[proto_binary_fetched_null] => 0
[proto_binary_fetched_bit] => 0
[proto_binary_fetched_tinyint] => 0
[proto_binary_fetched_short] => 0
[proto_binary_fetched_int24] => 0
[proto_binary_fetched_int] => 0
[proto_binary_fetched_bigint] => 0
[proto_binary_fetched_decimal] => 0
[proto_binary_fetched_float] => 0
[proto_binary_fetched_double] => 0
[proto_binary_fetched_date] => 0
[proto_binary_fetched_year] => 0
[proto_binary_fetched_time] => 0
[proto_binary_fetched_datetime] => 0
[proto_binary_fetched_timestamp] => 0
[proto_binary_fetched_string] => 0
[proto_binary_fetched_blob] => 0
[proto_binary_fetched_enum] => 0
[proto_binary_fetched_set] => 0
[proto_binary_fetched_geometry] => 0
[proto_binary_fetched_other] => 0
)
21.11.2.8.19. mysqli::get_client_version, mysqli_get_client_version
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_client_version
mysqli_get_client_version
Get MySQL client info
Description
int mysqli::get_client_version();
int mysqli_get_client_version();
Returns client version number as an integer.
Return Values
Connectors and APIs
2534
A number that represents the MySQL client library version in format: main_version*10000 + minor_version *100 +
sub_version. For example, 4.1.0 is returned as 40100.
This is useful to quickly determine the version of the client library to know if some capability exits.
Examples
Example 21.97. mysqli_get_client_version
<?php
/* We don't need a connection to determine
the version of mysql client library */
printf("Client library version: %d\n", mysqli_get_client_version());
?>
See Also
mysqli_get_client_info
mysqli_get_server_info
mysqli_get_server_version
21.11.2.8.20. mysqli::get_connection_stats, mysqli_get_connection_stats
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_connection_stats
mysqli_get_connection_stats
Returns statistics about the client connection
Description
Object oriented style (method):
bool mysqli::get_connection_stats();
Procedural style:
array mysqli_get_connection_stats(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
Returns statistics about the client connection. Available only with mysqlnd.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns an array with connection stats if success, FALSE otherwise.
Connectors and APIs
2535
Examples
Example 21.98. A mysqli_get_connection_stats example
<?php
$link = mysqli_connect();
print_r(mysqli_get_connection_stats($link));
?>
The above example will output something similar to:
Array
(
[bytes_sent] => 43
[bytes_received] => 80
[packets_sent] => 1
[packets_received] => 2
[protocol_overhead_in] => 8
[protocol_overhead_out] => 4
[bytes_received_ok_packet] => 11
[bytes_received_eof_packet] => 0
[bytes_received_rset_header_packet] => 0
[bytes_received_rset_field_meta_packet] => 0
[bytes_received_rset_row_packet] => 0
[bytes_received_prepare_response_packet] => 0
[bytes_received_change_user_packet] => 0
[packets_sent_command] => 0
[packets_received_ok] => 1
[packets_received_eof] => 0
[packets_received_rset_header] => 0
[packets_received_rset_field_meta] => 0
[packets_received_rset_row] => 0
[packets_received_prepare_response] => 0
[packets_received_change_user] => 0
[result_set_queries] => 0
[non_result_set_queries] => 0
[no_index_used] => 0
[bad_index_used] => 0
[slow_queries] => 0
[buffered_sets] => 0
[unbuffered_sets] => 0
[ps_buffered_sets] => 0
[ps_unbuffered_sets] => 0
[flushed_normal_sets] => 0
[flushed_ps_sets] => 0
[ps_prepared_never_executed] => 0
[ps_prepared_once_executed] => 0
[rows_fetched_from_server_normal] => 0
[rows_fetched_from_server_ps] => 0
[rows_buffered_from_client_normal] => 0
[rows_buffered_from_client_ps] => 0
[rows_fetched_from_client_normal_buffered] => 0
[rows_fetched_from_client_normal_unbuffered] => 0
[rows_fetched_from_client_ps_buffered] => 0
[rows_fetched_from_client_ps_unbuffered] => 0
[rows_fetched_from_client_ps_cursor] => 0
[rows_skipped_normal] => 0
[rows_skipped_ps] => 0
[copy_on_write_saved] => 0
[copy_on_write_performed] => 0
[command_buffer_too_small] => 0
[connect_success] => 1
[connect_failure] => 0
[connection_reused] => 0
[reconnect] => 0
[pconnect_success] => 0
[active_connections] => 1
[active_persistent_connections] => 0
[explicit_close] => 0
[implicit_close] => 0
[disconnect_close] => 0
[in_middle_of_command_close] => 0
[explicit_free_result] => 0
[implicit_free_result] => 0
[explicit_stmt_close] => 0
[implicit_stmt_close] => 0
[mem_emalloc_count] => 0
Connectors and APIs
2536
[mem_emalloc_ammount] => 0
[mem_ecalloc_count] => 0
[mem_ecalloc_ammount] => 0
[mem_erealloc_count] => 0
[mem_erealloc_ammount] => 0
[mem_efree_count] => 0
[mem_malloc_count] => 0
[mem_malloc_ammount] => 0
[mem_calloc_count] => 0
[mem_calloc_ammount] => 0
[mem_realloc_count] => 0
[mem_realloc_ammount] => 0
[mem_free_count] => 0
[proto_text_fetched_null] => 0
[proto_text_fetched_bit] => 0
[proto_text_fetched_tinyint] => 0
[proto_text_fetched_short] => 0
[proto_text_fetched_int24] => 0
[proto_text_fetched_int] => 0
[proto_text_fetched_bigint] => 0
[proto_text_fetched_decimal] => 0
[proto_text_fetched_float] => 0
[proto_text_fetched_double] => 0
[proto_text_fetched_date] => 0
[proto_text_fetched_year] => 0
[proto_text_fetched_time] => 0
[proto_text_fetched_datetime] => 0
[proto_text_fetched_timestamp] => 0
[proto_text_fetched_string] => 0
[proto_text_fetched_blob] => 0
[proto_text_fetched_enum] => 0
[proto_text_fetched_set] => 0
[proto_text_fetched_geometry] => 0
[proto_text_fetched_other] => 0
[proto_binary_fetched_null] => 0
[proto_binary_fetched_bit] => 0
[proto_binary_fetched_tinyint] => 0
[proto_binary_fetched_short] => 0
[proto_binary_fetched_int24] => 0
[proto_binary_fetched_int] => 0
[proto_binary_fetched_bigint] => 0
[proto_binary_fetched_decimal] => 0
[proto_binary_fetched_float] => 0
[proto_binary_fetched_double] => 0
[proto_binary_fetched_date] => 0
[proto_binary_fetched_year] => 0
[proto_binary_fetched_time] => 0
[proto_binary_fetched_datetime] => 0
[proto_binary_fetched_timestamp] => 0
[proto_binary_fetched_string] => 0
[proto_binary_fetched_blob] => 0
[proto_binary_fetched_enum] => 0
[proto_binary_fetched_set] => 0
[proto_binary_fetched_geometry] => 0
[proto_binary_fetched_other] => 0
)
21.11.2.8.21. mysqli->host_info, mysqli_get_host_info
Copyright 1997-2008 the PHP Documentation Group.
mysqli->host_info
mysqli_get_host_info
Returns a string representing the type of connection used
Description
Object oriented style (property):
mysqli {
string host_info ;
}
Connectors and APIs
2537
Procedural style:
string mysqli_get_host_info(mysqli link);
Returns a string describing the connection represented by the link parameter (including the server host name).
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
A character string representing the server hostname and the connection type.
Examples
Example 21.99. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print host information */
printf("Host info: %s\n", $mysqli->host_info);
/* close connection */
$mysqli->close();
?>
Example 21.100. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print host information */
printf("Host info: %s\n", mysqli_get_host_info($link));
/* close connection */
mysqli_close($link);
?>
The above example will output:
Host info: Localhost via UNIX socket
Connectors and APIs
2538
See Also
mysqli_get_proto_info
21.11.2.8.22. mysqli->protocol_version, mysqli_get_proto_info
Copyright 1997-2008 the PHP Documentation Group.
mysqli->protocol_version
mysqli_get_proto_info
Returns the version of the MySQL protocol used
Description
Object oriented style (property):
mysqli {
string protocol_version ;
}
Procedural style:
int mysqli_get_proto_info(mysqli link);
Returns an integer representing the MySQL protocol version used by the connection represented by the link parameter.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns an integer representing the protocol version.
Examples
Example 21.101. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print protocol version */
printf("Protocol version: %d\n", $mysqli->protocol_version);
/* close connection */
$mysqli->close();
?>
Connectors and APIs
2539
Example 21.102. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print protocol version */
printf("Protocol version: %d\n", mysqli_get_proto_info($link));
/* close connection */
mysqli_close($link);
?>
The above example will output:
Protocol version: 10
See Also
mysqli_get_host_info
21.11.2.8.23. mysqli->server_info, mysqli_get_server_info
Copyright 1997-2008 the PHP Documentation Group.
mysqli->server_info
mysqli_get_server_info
Returns the version of the MySQL server
Description
Object oriented style (property):
mysqli {
string server_info ;
}
Procedural style:
string mysqli_get_server_info(mysqli link);
Returns a string representing the version of the MySQL server that the MySQLi extension is connected to.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Connectors and APIs
2540
Return Values
A character string representing the server version.
Examples
Example 21.103. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print server version */
printf("Server version: %s\n", $mysqli->server_info);
/* close connection */
$mysqli->close();
?>
Example 21.104. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print server version */
printf("Server version: %s\n", mysqli_get_server_info($link));
/* close connection */
mysqli_close($link);
?>
The above example will output:
Server version: 4.1.2-alpha-debug
See Also
mysqli_get_client_info
mysqli_get_client_version
mysqli_get_server_version
21.11.2.8.24. mysqli->server_version, mysqli_get_server_version
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2541
mysqli->server_version
mysqli_get_server_version
Returns the version of the MySQL server as an integer
Description
Object oriented style (property):
mysqli {
int server_version ;
}
Procedural style:
int mysqli_get_server_version(mysqli link);
The mysqli_get_server_version function returns the version of the server connected to (represented by the link parameter)
as an integer.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
An integer representing the server version.
The form of this version number is main_version * 10000 + minor_version * 100 + sub_version (i.e. version
4.1.0 is 40100).
Examples
Example 21.105. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print server version */
printf("Server version: %d\n", $mysqli->server_version);
/* close connection */
$mysqli->close();
?>
Example 21.106. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
/* check connection */
Connectors and APIs
2542
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print server version */
printf("Server version: %d\n", mysqli_get_server_version($link));
/* close connection */
mysqli_close($link);
?>
The above example will output:
Server version: 40102
See Also
mysqli_get_client_info
mysqli_get_client_version
mysqli_get_server_info
21.11.2.8.25. mysqli::get_warnings, mysqli_get_warnings
Copyright 1997-2008 the PHP Documentation Group.
mysqli::get_warnings
mysqli_get_warnings
Get result of SHOW WARNINGS
Description
object mysqli::get_warnings();
object mysqli_get_warnings(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
21.11.2.8.26. mysqli->info, mysqli_info
Copyright 1997-2008 the PHP Documentation Group.
mysqli->info
mysqli_info
Retrieves information about the most recently executed query
Description
Object oriented style (property)
Connectors and APIs
2543
mysqli {
string info ;
}
Procedural style:
string mysqli_info(mysqli link);
The mysqli_info function returns a string providing information about the last query executed. The nature of this string is provided
below:
Table 21.8. Possible mysqli_info return values
Query type Example result string
INSERT INTO...SELECT... Records: 100 Duplicates: 0 Warnings: 0
INSERT INTO...VALUES (...),(...),(...) Records: 3 Duplicates: 0 Warnings: 0
LOAD DATA INFILE ... Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
ALTER TABLE ... Records: 3 Duplicates: 0 Warnings: 0
UPDATE ... Rows matched: 40 Changed: 40 Warnings: 0
Note
Queries which do not fall into one of the above formats are not supported. In these situations, mysqli_info will return
an empty string.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
A character string representing additional information about the most recently executed query.
Examples
Example 21.107. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TEMPORARY TABLE t1 LIKE City");
/* INSERT INTO .. SELECT */
$mysqli->query("INSERT INTO t1 SELECT * FROM City ORDER BY ID LIMIT 150");
printf("%s\n", $mysqli->info);
/* close connection */
$mysqli->close();
?>
Connectors and APIs
2544
Example 21.108. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TEMPORARY TABLE t1 LIKE City");
/* INSERT INTO .. SELECT */
mysqli_query($link, "INSERT INTO t1 SELECT * FROM City ORDER BY ID LIMIT 150");
printf("%s\n", mysqli_info($link));
/* close connection */
mysqli_close($link);
?>
The above example will output:
Records: 150 Duplicates: 0 Warnings: 0
See Also
mysqli_affected_rows
mysqli_warning_count
mysqli_num_rows
21.11.2.8.27. mysqli::init, mysqli_init
Copyright 1997-2008 the PHP Documentation Group.
mysqli::init
mysqli_init
Initializes MySQLi and returns a resource for use with mysqli_real_connect()
Description
Object oriented style (method):
mysqli init();
Procedural style:
mysqli mysqli_init();
Allocates or initializes a MYSQL object suitable for mysqli_options and mysqli_real_connect.
Note
Any subsequent calls to any mysqli function (except mysqli_options) will fail until mysqli_real_connect was
called.
Connectors and APIs
2545
Return Values
Returns an object.
Examples
See mysqli_real_connect.
See Also
mysqli_options
mysqli_close
mysqli_real_connect
mysqli_connect
21.11.2.8.28. mysqli->insert_id, mysqli_insert_id
Copyright 1997-2008 the PHP Documentation Group.
mysqli->insert_id
mysqli_insert_id
Returns the auto generated id used in the last query
Description
Object oriented style (property):
mysqli {
mixed insert_id ;
}
Procedural style:
mixed mysqli_insert_id(mysqli link);
The mysqli_insert_id function returns the ID generated by a query on a table with a column having the AUTO_INCREMENT at-
tribute. If the last query wasn't an INSERT or UPDATE statement or if the modified table does not have a column with the
AUTO_INCREMENT attribute, this function will return zero.
Note
Performing an INSERT or UPDATE statement using the LAST_INSERT_ID() function will also modify the value re-
turned by the mysqli_insert_id function.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
The value of the AUTO_INCREMENT field that was updated by the previous query. Returns zero if there was no previous query on the
connection or if the query did not update an AUTO_INCREMENT value.
Note
If the number is greater than maximal int value, mysqli_insert_id will return a string.
Connectors and APIs
2546
Examples
Example 21.109. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCity LIKE City");
$query = "INSERT INTO myCity VALUES (NULL, 'Stuttgart', 'DEU', 'Stuttgart', 617000)";
$mysqli->query($query);
printf ("New Record has id %d.\n", $mysqli->insert_id);
/* drop table */
$mysqli->query("DROP TABLE myCity");
/* close connection */
$mysqli->close();
?>
Example 21.110. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCity LIKE City");
$query = "INSERT INTO myCity VALUES (NULL, 'Stuttgart', 'DEU', 'Stuttgart', 617000)";
mysqli_query($link, $query);
printf ("New Record has id %d.\n", mysqli_insert_id($link));
/* drop table */
mysqli_query($link, "DROP TABLE myCity");
/* close connection */
mysqli_close($link);
?>
The above example will output:
New Record has id 1.
21.11.2.8.29. mysqli::kill, mysqli_kill
Copyright 1997-2008 the PHP Documentation Group.
mysqli::kill
Connectors and APIs
2547
mysqli_kill
Asks the server to kill a MySQL thread
Description
Object oriented style (method)
bool mysqli::kill(int processid);
Procedural style:
bool mysqli_kill(mysqli link,
int processid);
This function is used to ask the server to kill a MySQL thread specified by the processid parameter. This value must be retrieved by
calling the mysqli_thread_id function.
To stop a running query you should use the SQL command KILL QUERY processid.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.111. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = $mysqli->thread_id;
/* Kill connection */
$mysqli->kill($thread_id);
/* This should produce an error */
if (!$mysqli->query("CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", $mysqli->error);
exit;
}
/* close connection */
$mysqli->close();
?>
Example 21.112. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
Connectors and APIs
2548
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = mysqli_thread_id($link);
/* Kill connection */
mysqli_kill($link, $thread_id);
/* This should produce an error */
if (!mysqli_query($link, "CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", mysqli_error($link));
exit;
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Error: MySQL server has gone away
See Also
mysqli_thread_id
21.11.2.8.30. mysqli::more_results, mysqli_more_results
Copyright 1997-2008 the PHP Documentation Group.
mysqli::more_results
mysqli_more_results
Check if there are any more query results from a multi query
Description
bool mysqli::more_results();
bool mysqli_more_results(mysqli link);
Indicates if one or more result sets are available from a previous call to mysqli_multi_query.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Connectors and APIs
2549
Examples
See mysqli_multi_query.
See Also
mysqli_multi_query
mysqli_next_result
mysqli_store_result
mysqli_use_result
21.11.2.8.31. mysqli::multi_query, mysqli_multi_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli::multi_query
mysqli_multi_query
Performs a query on the database
Description
Object oriented style (method):
bool mysqli::multi_query(string query);
Procedural style:
bool mysqli_multi_query(mysqli link,
string query);
Executes one or multiple queries which are concatenated by a semicolon.
To retrieve the resultset from the first query you can use mysqli_use_result or mysqli_store_result. All subsequent
query results can be processed using mysqli_more_results and mysqli_next_result.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
query The query, as a string.
Return Values
Returns FALSE if the first statement failed. To retrieve subsequent errors from other statements you have to call
mysqli_next_result first.
Examples
Example 21.113. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
Connectors and APIs
2550
$query = "SELECT CURRENT_USER();";
$query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
/* execute multi query */
if ($mysqli->multi_query($query)) {
do {
/* store first result set */
if ($result = $mysqli->store_result()) {
while ($row = $result->fetch_row()) {
printf("%s\n", $row[0]);
}
$result->free();
}
/* print divider */
if ($mysqli->more_results()) {
printf("-----------------\n");
}
} while ($mysqli->next_result());
}
/* close connection */
$mysqli->close();
?>
Example 21.114. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT CURRENT_USER();";
$query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
/* execute multi query */
if (mysqli_multi_query($link, $query)) {
do {
/* store first result set */
if ($result = mysqli_store_result($link)) {
while ($row = mysqli_fetch_row($result)) {
printf("%s\n", $row[0]);
}
mysqli_free_result($result);
}
/* print divider */
if (mysqli_more_results($link)) {
printf("-----------------\n");
}
} while (mysqli_next_result($link));
}
/* close connection */
mysqli_close($link);
?>
The above example will output something similar to:
my_user@localhost
-----------------
Amersfoort
Maastricht
Dordrecht
Leiden
Haarlemmermeer
Connectors and APIs
2551
See Also
mysqli_use_result
mysqli_store_result
mysqli_next_result
mysqli_more_results
21.11.2.8.32. mysqli::next_result, mysqli_next_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli::next_result
mysqli_next_result
Prepare next result from multi_query
Description
bool mysqli::next_result();
bool mysqli_next_result(mysqli link);
Prepares next result set from a previous call to mysqli_multi_query which can be retrieved by mysqli_store_result or
mysqli_use_result.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Examples
See mysqli_multi_query.
See Also
mysqli_multi_query
mysqli_more_results
mysqli_store_result
mysqli_use_result
21.11.2.8.33. mysqli::options, mysqli_options
Copyright 1997-2008 the PHP Documentation Group.
mysqli::options
mysqli_options
Set options
Description
Connectors and APIs
2552
Object oriented style (method)
bool mysqli::options(int option,
mixed value);
Procedural style:
bool mysqli_options(mysqli link,
int option,
mixed value);
Used to set extra connect options and affect behavior for a connection.
This function may be called multiple times to set several options.
mysqli_options should be called after mysqli_init and before mysqli_real_connect.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
option The option that you want to set. It can be one of the following values:
Table 21.9. Valid options
Name Description
MYSQLI_OPT_CONNECT_TIMEOUT connection timeout in seconds
MYSQLI_OPT_LOCAL_INFILE enable/disable use of LOAD LOCAL INFILE
MYSQLI_INIT_COMMAND command to execute after when connecting to MySQL server
MYSQLI_READ_DEFAULT_FILE Read options from named option file instead of my.cnf
MYSQLI_READ_DEFAULT_GROUP Read options from the named group from my.cnf or the file spe-
cified with MYSQL_READ_DEFAULT_FILE .
value The value for the option.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
See mysqli_real_connect.
See Also
mysqli_init
mysqli_real_connect
21.11.2.8.34. mysqli::ping, mysqli_ping
Copyright 1997-2008 the PHP Documentation Group.
mysqli::ping
mysqli_ping
Pings a server connection, or tries to reconnect if the connection has gone down
Connectors and APIs
2553
Description
Object oriented style (method):
bool mysqli::ping();
Procedural style:
bool mysqli_ping(mysqli link);
Checks whether the connection to the server is working. If it has gone down, and global option mysqli.reconnect is enabled an
automatic reconnection is attempted.
This function can be used by clients that remain idle for a long while, to check whether the server has closed the connection and recon-
nect if necessary.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.115. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* check if server is alive */
if ($mysqli->ping()) {
printf ("Our connection is ok!\n");
} else {
printf ("Error: %s\n", $mysqli->error);
}
/* close connection */
$mysqli->close();
?>
Example 21.116. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* check if server is alive */
if (mysqli_ping($link)) {
printf ("Our connection is ok!\n");
} else {
printf ("Error: %s\n", mysqli_error($link));
Connectors and APIs
2554
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Our connection is ok!
21.11.2.8.35. mysqli::poll, mysqli_poll
Copyright 1997-2008 the PHP Documentation Group.
mysqli::poll
mysqli_poll
Poll connections
Description
public int mysqli::poll(array read,
array error,
array reject,
int sec,
int usec);
int mysqli_poll(array read,
array error,
array reject,
int sec,
int usec);
Warning
This function is currently not documented; only its argument list is available.
Poll connections. Available only with mysqlnd.
Parameters
read
error
reject
sec Number of seconds to wait, must be non-negative.
usec Number of microseconds to wait, must be non-negative.
Return Values
Returns number of ready connections in success, FALSE otherwise.
Examples
Connectors and APIs
2555
Example 21.117. A mysqli_poll example
<?php
$link1 = mysqli_connect();
$link1->query("SELECT 'test'", MYSQLI_ASYNC);
$all_links = array($link1);
$processed = 0;
do {
$links = $errors = $reject = array();
foreach ($all_links as $link) {
$links[] = $errors[] = $reject[] = $link;
}
if (!mysqli_poll($links, $errors, $reject, 1)) {
continue;
}
foreach ($links as $link) {
if ($result = $link->reap_async_query()) {
print_r($result->fetch_row());
mysqli_free_result($result);
$processed++;
}
}
} while ($processed < count($all_links));
?>
The above example will output:
Array
(
[0] => test
)
See Also
21.11.2.8.36. mysqli::prepare, mysqli_prepare
Copyright 1997-2008 the PHP Documentation Group.
mysqli::prepare
mysqli_prepare
Prepare a SQL statement for execution
Description
Object oriented style (method)
mysqli_stmt prepare(string query);
Procedure style:
mysqli_stmt mysqli_prepare(mysqli link,
string query);
Prepares the SQL query pointed to by the null-terminated string query, and returns a statement handle to be used for further operations
on the statement. The query must consist of a single SQL statement.
Connectors and APIs
2556
The parameter markers must be bound to application variables using mysqli_stmt_bind_param and/or
mysqli_stmt_bind_result before executing the statement or fetching rows.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
query The query, as a string.
Note
You should not add a terminating semicolon or \g to the statement.
This parameter can include one or more parameter markers in the SQL statement by embedding
question mark (?) characters at the appropriate positions.
Note
The markers are legal only in certain places in SQL statements. For example, they are allowed in the VALUES() list of an
INSERT statement (to specify column values for a row), or in a comparison with a column in a WHERE clause to specify a
comparison value.
However, they are not allowed for identifiers (such as table or column names), in the select list that names the columns to
be returned by a SELECT statement, or to specify both operands of a binary operator such as the = equal sign. The latter
restriction is necessary because it would be impossible to determine the parameter type. It's not allowed to compare marker
with NULL by ? IS NULL too. In general, parameters are legal only in Data Manipulation Language (DML) statements,
and not in Data Definition Language (DDL) statements.
Return Values
mysqli_prepare returns a statement object or FALSE if an error occurred.
Examples
Example 21.118. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$city = "Amersfoort";
/* create a prepared statement */
if ($stmt = $mysqli->prepare("SELECT District FROM City WHERE Name=?")) {
/* bind parameters for markers */
$stmt->bind_param("s", $city);
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($district);
/* fetch value */
$stmt->fetch();
printf("%s is in district %s\n", $city, $district);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
Connectors and APIs
2557
?>
Example 21.119. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$city = "Amersfoort";
/* create a prepared statement */
if ($stmt = mysqli_prepare($link, "SELECT District FROM City WHERE Name=?")) {
/* bind parameters for markers */
mysqli_stmt_bind_param($stmt, "s", $city);
/* execute query */
mysqli_stmt_execute($stmt);
/* bind result variables */
mysqli_stmt_bind_result($stmt, $district);
/* fetch value */
mysqli_stmt_fetch($stmt);
printf("%s is in district %s\n", $city, $district);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Amersfoort is in district Utrecht
See Also
mysqli_stmt_execute
mysqli_stmt_fetch
mysqli_stmt_bind_param
mysqli_stmt_bind_result
mysqli_stmt_close
21.11.2.8.37. mysqli::query, mysqli_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli::query
mysqli_query
Connectors and APIs
2558
Performs a query on the database
Description
Object oriented style (method):
mixed mysqli::query(string query,
int resultmode);
Procedural style:
mixed mysqli_query(mysqli link,
string query,
int resultmode);
Performs a query against the database.
Functionally, using this function is identical to calling mysqli_real_query followed either by mysqli_use_result or
mysqli_store_result.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
query The query string.
resultmode Either the constant MYSQLI_USE_RESULT or MYSQLI_STORE_RESULT depending on the
desired behavior. By default, MYSQLI_STORE_RESULT is used.
If you use MYSQLI_USE_RESULT all subsequent calls will return error Commands out of
sync unless you call mysqli_free_result
With MYSQLI_ASYNC (available with mysqlnd), it is possible to perform query asynchronously.
mysqli_poll is then used to get results from such queries.
Return Values
Returns TRUE on success or FALSE on failure. For SELECT, SHOW, DESCRIBE or EXPLAIN mysqli_query will return a result
object.
Changelog
Version Description
5.3.0 Added the ability of async queries.
Examples
Example 21.120. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Create table doesn't return a resultset */
if ($mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
Connectors and APIs
2559
printf("Table myCity successfully created.\n");
}
/* Select queries return a resultset */
if ($result = $mysqli->query("SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", $result->num_rows);
/* free result set */
$result->close();
}
/* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */
if ($result = $mysqli->query("SELECT * FROM City", MYSQLI_USE_RESULT)) {
/* Note, that we can't execute any functions which interact with the
server until result set was closed. All calls will return an
'out of sync' error */
if (!$mysqli->query("SET @a:='this will not work'")) {
printf("Error: %s\n", $mysqli->error);
}
$result->close();
}
$mysqli->close();
?>
Example 21.121. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Create table doesn't return a resultset */
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}
/* Select queries return a resultset */
if ($result = mysqli_query($link, "SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));
/* free result set */
mysqli_free_result($result);
}
/* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */
if ($result = mysqli_query($link, "SELECT * FROM City", MYSQLI_USE_RESULT)) {
/* Note, that we can't execute any functions which interact with the
server until result set was closed. All calls will return an
'out of sync' error */
if (!mysqli_query($link, "SET @a:='this will not work'")) {
printf("Error: %s\n", mysqli_error($link));
}
mysqli_free_result($result);
}
mysqli_close($link);
?>
The above example will output:
Table myCity successfully created.
Select returned 10 rows.
Error: Commands out of sync; You can't run this command now
Connectors and APIs
2560
See Also
mysqli_real_query
mysqli_multi_query
mysqli_free_result
21.11.2.8.38. mysqli::real_connect, mysqli_real_connect
Copyright 1997-2008 the PHP Documentation Group.
mysqli::real_connect
mysqli_real_connect
Opens a connection to a mysql server
Description
Object oriented style (method)
bool mysqli::real_connect(string host,
string username,
string passwd,
string dbname,
int port,
string socket,
int flags);
Procedural style
bool mysqli_real_connect(mysqli link,
string host,
string username,
string passwd,
string dbname,
int port,
string socket,
int flags);
Establish a connection to a MySQL database engine.
This function differs from mysqli_connect:
mysqli_real_connect needs a valid object which has to be created by function mysqli_init.
With the mysqli_options function you can set various options for connection.
There is a flags parameter.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
host Can be either a host name or an IP address. Passing the NULL value or the string "localhost" to
this parameter, the local host is assumed. When possible, pipes will be used instead of the TCP/IP
protocol.
username The MySQL user name.
passwd If provided or NULL , the MySQL server will attempt to authenticate the user against those user
records which have no password only. This allows one username to be used with different per-
missions (depending on if a password as provided or not).
Connectors and APIs
2561
dbname If provided will specify the default database to be used when performing queries.
port Specifies the port number to attempt to connect to the MySQL server.
socket Specifies the socket or named pipe that should be used.
Note
Specifying the socket parameter will not explicitly determine the type of connection to be used when connecting to the
MySQL server. How the connection is made to the MySQL database is determined by the host parameter.
flags With the parameter flags you can set different connection options:
Table 21.10. Supported flags
Name Description
MYSQLI_CLIENT_COMPRESS Use compression protocol
MYSQLI_CLIENT_FOUND_ROWS return number of matched rows, not the number of affected rows
MYSQLI_CLIENT_IGNORE_SPACE Allow spaces after function names. Makes all function names re-
served words.
MYSQLI_CLIENT_INTERACTIVE Allow interactive_timeout seconds (instead of
wait_timeout seconds) of inactivity before closing the con-
nection
MYSQLI_CLIENT_SSL Use SSL (encryption)
Note
For security reasons the MULTI_STATEMENT flag is not supported in PHP. If you want to execute multiple queries use
the mysqli_multi_query function.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.122. Object oriented style
<?php
$mysqli = mysqli_init();
if (!$mysqli) {
die('mysqli_init failed');
}
if (!$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!$mysqli->real_connect('localhost', 'my_user', 'my_password', 'my_db')) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . $mysqli->host_info . "\n";
$mysqli->close();
?>
Connectors and APIs
2562
Example 21.123. Object oriented style when extending mysqli class
<?php
class foo_mysqli extends mysqli {
public function __construct($host, $user, $pass, $db) {
parent::init();
if (!parent::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!parent::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!parent::real_connect($host, $user, $pass, $db)) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
}
}
$db = new foo_mysqli('localhost', 'my_user', 'my_password', 'my_db');
echo 'Success... ' . $db->host_info . "\n";
$db->close();
?>
Example 21.124. Procedural style
<?php
$link = mysqli_init();
if (!$link) {
die('mysqli_init failed');
}
if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!mysqli_real_connect($link, 'localhost', 'my_user', 'my_password', 'my_db')) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . mysqli_get_host_info($link) . "\n";
mysqli_close($link);
?>
The above example will output:
Success... MySQL host info: localhost via TCP/IP
See Also
Connectors and APIs
2563
mysqli_connect
mysqli_init
mysqli_options
mysqli_ssl_set
mysqli_close
21.11.2.8.39. mysqli::real_escape_string, mysqli_real_escape_string
Copyright 1997-2008 the PHP Documentation Group.
mysqli::real_escape_string
mysqli_real_escape_string
Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection
Description
Object oriented style (both methods are equivalent):
string mysqli::escape_string(string escapestr);
string real_escape_string(string escapestr);
Procedural style:
string mysqli_real_escape_string(mysqli link,
string escapestr);
This function is used to create a legal SQL string that you can use in an SQL statement. The given string is encoded to an escaped SQL
string, taking into account the current character set of the connection.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
escapestr The string to be escaped.
Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.
Return Values
Returns an escaped string.
Examples
Example 21.125. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City");
$city = "'s Hertogenbosch";
/* this query will fail, cause we didn't escape $city */
Connectors and APIs
2564
if (!$mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) {
printf("Error: %s\n", $mysqli->sqlstate);
}
$city = $mysqli->real_escape_string($city);
/* this query with escaped $city will work */
if ($mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) {
printf("%d Row inserted.\n", $mysqli->affected_rows);
}
$mysqli->close();
?>
Example 21.126. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City");
$city = "'s Hertogenbosch";
/* this query will fail, cause we didn't escape $city */
if (!mysqli_query($link, "INSERT into myCity (Name) VALUES ('$city')")) {
printf("Error: %s\n", mysqli_sqlstate($link));
}
$city = mysqli_real_escape_string($link, $city);
/* this query with escaped $city will work */
if (mysqli_query($link, "INSERT into myCity (Name) VALUES ('$city')")) {
printf("%d Row inserted.\n", mysqli_affected_rows($link));
}
mysqli_close($link);
?>
The above example will output:
Error: 42000
1 Row inserted.
See Also
mysqli_character_set_name
21.11.2.8.40. mysqli::real_query, mysqli_real_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli::real_query
mysqli_real_query
Connectors and APIs
2565
Execute an SQL query
Description
Object oriented style (method):
bool real_query(string query);
Procedural style
bool mysqli_real_query(mysqli link,
string query);
Executes a single query against the database whose result can then be retrieved or stored using the mysqli_store_result or
mysqli_use_result functions.
In order to determine if a given query should return a result set or not, see mysqli_field_count.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
query The query, as a string.
Return Values
Returns TRUE on success or FALSE on failure.
See Also
mysqli_query
mysqli_store_result
mysqli_use_result
21.11.2.8.41. mysqli::reap_async_query, mysqli_reap_async_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli::reap_async_query
mysqli_reap_async_query
Get result from async query
Description
public mysqli_result mysqli::reap_async_query();
mysqli_result mysqli_reap_async_query(mysql link);
Warning
This function is currently not documented; only its argument list is available.
Get result from async query. Available only with mysqlnd.
Parameters
Connectors and APIs
2566
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns mysqli_result in success, FALSE otherwise.
See Also
mysqli_poll
21.11.2.8.42. mysqli::rollback, mysqli_rollback
Copyright 1997-2008 the PHP Documentation Group.
mysqli::rollback
mysqli_rollback
Rolls back current transaction
Description
Object oriented style (method):
bool mysqli::rollback();
Procedural style:
bool mysqli_rollback(mysqli link);
Rollbacks the current transaction for the database.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.127. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* disable autocommit */
$mysqli->autocommit(FALSE);
$mysqli->query("CREATE TABLE myCity LIKE City");
$mysqli->query("ALTER TABLE myCity Type=InnoDB");
$mysqli->query("INSERT INTO myCity SELECT * FROM City LIMIT 50");
Connectors and APIs
2567
/* commit insert */
$mysqli->commit();
/* delete all rows */
$mysqli->query("DELETE FROM myCity");
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) {
$row = $result->fetch_row();
printf("%d rows in table myCity.\n", $row[0]);
/* Free result */
$result->close();
}
/* Rollback */
$mysqli->rollback();
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) {
$row = $result->fetch_row();
printf("%d rows in table myCity (after rollback).\n", $row[0]);
/* Free result */
$result->close();
}
/* Drop table myCity */
$mysqli->query("DROP TABLE myCity");
$mysqli->close();
?>
Example 21.128. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* disable autocommit */
mysqli_autocommit($link, FALSE);
mysqli_query($link, "CREATE TABLE myCity LIKE City");
mysqli_query($link, "ALTER TABLE myCity Type=InnoDB");
mysqli_query($link, "INSERT INTO myCity SELECT * FROM City LIMIT 50");
/* commit insert */
mysqli_commit($link);
/* delete all rows */
mysqli_query($link, "DELETE FROM myCity");
if ($result = mysqli_query($link, "SELECT COUNT(*) FROM myCity")) {
$row = mysqli_fetch_row($result);
printf("%d rows in table myCity.\n", $row[0]);
/* Free result */
mysqli_free_result($result);
}
/* Rollback */
mysqli_rollback($link);
if ($result = mysqli_query($link, "SELECT COUNT(*) FROM myCity")) {
$row = mysqli_fetch_row($result);
printf("%d rows in table myCity (after rollback).\n", $row[0]);
/* Free result */
mysqli_free_result($result);
}
/* Drop table myCity */
mysqli_query($link, "DROP TABLE myCity");
mysqli_close($link);
?>
Connectors and APIs
2568
The above example will output:
0 rows in table myCity.
50 rows in table myCity (after rollback).
See Also
mysqli_commit
mysqli_autocommit
21.11.2.8.43. mysqli::select_db, mysqli_select_db
Copyright 1997-2008 the PHP Documentation Group.
mysqli::select_db
mysqli_select_db
Selects the default database for database queries
Description
Object oriented style (method):
bool mysqli::select_db(string dbname);
Procedural style:
bool mysqli_select_db(mysqli link,
string dbname);
Selects the default database to be used when performing queries against the database connection.
Note
This function should only be used to change the default database for the connection. You can select the default database
with 4th parameter in mysqli_connect.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
dbname The database name.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.129. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
Connectors and APIs
2569
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* return name of current default database */
if ($result = $mysqli->query("SELECT DATABASE()")) {
$row = $result->fetch_row();
printf("Default database is %s.\n", $row[0]);
$result->close();
}
/* change db to world db */
$mysqli->select_db("world");
/* return name of current default database */
if ($result = $mysqli->query("SELECT DATABASE()")) {
$row = $result->fetch_row();
printf("Default database is %s.\n", $row[0]);
$result->close();
}
$mysqli->close();
?>
Example 21.130. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* return name of current default database */
if ($result = mysqli_query($link, "SELECT DATABASE()")) {
$row = mysqli_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
mysqli_free_result($result);
}
/* change db to world db */
mysqli_select_db($link, "world");
/* return name of current default database */
if ($result = mysqli_query($link, "SELECT DATABASE()")) {
$row = mysqli_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
mysqli_free_result($result);
}
mysqli_close($link);
?>
The above example will output:
Default database is test.
Default database is world.
See Also
mysqli_connect
Connectors and APIs
2570
mysqli_real_connect
21.11.2.8.44. mysqli::set_charset, mysqli_set_charset
Copyright 1997-2008 the PHP Documentation Group.
mysqli::set_charset
mysqli_set_charset
Sets the default client character set
Description
Object oriented style (method):
bool mysqli::set_charset(string charset);
Procedural style:
bool mysqli_set_charset(mysqli link,
string charset);
Sets the default character set to be used when sending data from and to the database server.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
charset The charset to be set as default.
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Note
To use this function on a Windows platform you need MySQL client library version 4.1.11 or above (for MySQL 5.0 you
need 5.0.6 or above).
Note
This is the preferred way to change the charset. Using mysqli::query to execute SET NAMES .. is not recommen-
ded.
Examples
Example 21.131. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* change character set to utf8 */
if (!$mysqli->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $mysqli->error);
Connectors and APIs
2571
} else {
printf("Current character set: %s\n", $mysqli->character_set_name());
}
$mysqli->close();
?>
Example 21.132. Procedural style
<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'test');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* change character set to utf8 */
if (!mysqli_set_charset($link, "utf8")) {
printf("Error loading character set utf8: %s\n", mysqli_error($link));
} else {
printf("Current character set: %s\n", mysqli_character_set_name($link));
}
mysqli_close($link);
?>
The above example will output:
Current character set: utf8
See Also
mysqli_character_set_name
mysqli_real_escape_string
List of character sets that MySQL supports
21.11.2.8.45. mysqli::set_local_infile_default, mysqli_set_local_infile_default
Copyright 1997-2008 the PHP Documentation Group.
mysqli::set_local_infile_default
mysqli_set_local_infile_default
Unsets user defined handler for load local infile command
Description
void mysqli_set_local_infile_default(mysqli link);
Deactivates a LOAD DATA INFILE LOCAL handler previously set with mysqli_set_local_infile_handler.
Parameters
Connectors and APIs
2572
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
No value is returned.
Examples
See mysqli_set_local_infile_handler examples
See Also
mysqli_set_local_infile_handler
21.11.2.8.46. mysqli::set_local_infile_handler, mysqli_set_local_infile_handler
Copyright 1997-2008 the PHP Documentation Group.
mysqli::set_local_infile_handler
mysqli_set_local_infile_handler
Set callback function for LOAD DATA LOCAL INFILE command
Description
bool mysqli_set_local_infile_handler(mysqli link,
callback read_func);
Object oriented style (method)
mysqli {
bool set_local_infile_handler(mysqli link,
callback read_func);
}
Set callback function for LOAD DATA LOCAL INFILE command
The callbacks task is to read input from the file specified in the LOAD DATA LOCAL INFILE and to reformat it into the format un-
derstood by LOAD DATA INFILE.
The returned data needs to match the format specified in the LOAD DATA
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
read_func A callback function or object method taking the following parameters:
stream A PHP stream associated with the SQL commands INFILE
&buffer A string buffer to store the rewritten input into
buflen The maximum number of characters to be stored in the
buffer
&errormsg If an error occurs you can store an error message in here
Connectors and APIs
2573
The callback function should return the number of characters stored in the buffer or a negative value if an error occurred.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.133. Object oriented style
<?php
$db = mysqli_init();
$db->real_connect("localhost","root","","test");
function callme($stream, &$buffer, $buflen, &$errmsg)
{
$buffer = fgets($stream);
echo $buffer;
// convert to upper case and replace "," delimiter with [TAB]
$buffer = strtoupper(str_replace(",", "\t", $buffer));
return strlen($buffer);
}
echo "Input:\n";
$db->set_local_infile_handler("callme");
$db->query("LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
$db->set_local_infile_default();
$res = $db->query("SELECT * FROM t1");
echo "\nResult:\n";
while ($row = $res->fetch_assoc()) {
echo join(",", $row)."\n";
}
?>
Example 21.134. Procedural style
<?php
$db = mysqli_init();
mysqli_real_connect($db, "localhost","root","","test");
function callme($stream, &$buffer, $buflen, &$errmsg)
{
$buffer = fgets($stream);
echo $buffer;
// convert to upper case and replace "," delimiter with [TAB]
$buffer = strtoupper(str_replace(",", "\t", $buffer));
return strlen($buffer);
}
echo "Input:\n";
mysqli_set_local_infile_handler($db, "callme");
mysqli_query($db, "LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
mysqli_set_local_infile_default($db);
$res = mysqli_query($db, "SELECT * FROM t1");
echo "\nResult:\n";
while ($row = mysqli_fetch_assoc($res)) {
echo join(",", $row)."\n";
}
?>
Connectors and APIs
2574
The above example will output:
Input:
23,foo
42,bar
Output:
23,FOO
42,BAR
See Also
mysqli_set_local_infile_default
21.11.2.8.47. mysqli->sqlstate, mysqli_sqlstate
Copyright 1997-2008 the PHP Documentation Group.
mysqli->sqlstate
mysqli_sqlstate
Returns the SQLSTATE error from previous MySQL operation
Description
Object oriented style (property):
mysqli {
string sqlstate ;
}
Procedural style:
string mysqli_sqlstate(mysqli link);
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
error. The values are specified by ANSI SQL and ODBC. For a list of possible values, see ht-
tp://dev.mysql.com/doc/mysql/en/error-handling.html.
Note
Note that not all MySQL errors are yet mapped to SQLSTATE's. The value HY000 (general error) is used for unmapped
errors.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
Connectors and APIs
2575
error.
Examples
Example 21.135. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Table City already exists, so we should get an error */
if (!$mysqli->query("CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.\n", $mysqli->sqlstate);
}
$mysqli->close();
?>
Example 21.136. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Table City already exists, so we should get an error */
if (!mysqli_query($link, "CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.\n", mysqli_sqlstate($link));
}
mysqli_close($link);
?>
The above example will output:
Error - SQLSTATE 42S01.
See Also
mysqli_errno
mysqli_error
21.11.2.8.48. mysqli::ssl_set, mysqli_ssl_set
Copyright 1997-2008 the PHP Documentation Group.
mysqli::ssl_set
mysqli_ssl_set
Connectors and APIs
2576
Used for establishing secure connections using SSL
Description
Object oriented style (method):
bool mysqli::ssl_set(string key,
string cert,
string ca,
string capath,
string cipher);
Procedural style:
bool mysqli_ssl_set(mysqli link,
string key,
string cert,
string ca,
string capath,
string cipher);
Used for establishing secure connections using SSL. It must be called before mysqli_real_connect. This function does nothing
unless OpenSSL support is enabled.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
key The path name to the key file.
cert The path name to the certificate file.
ca The path name to the certificate authority file.
capath The pathname to a directory that contains trusted SSL CA certificates in PEM format.
cipher A list of allowable ciphers to use for SSL encryption.
Any unused SSL parameters may be given as NULL
Return Values
This function always returns TRUE value. If SSL setup is incorrect mysqli_real_connect will return an error when you attempt to
connect.
See Also
mysqli_options
mysqli_real_connect
21.11.2.8.49. mysqli::stat, mysqli_stat
Copyright 1997-2008 the PHP Documentation Group.
mysqli::stat
mysqli_stat
Gets the current system status
Connectors and APIs
2577
Description
Object oriented style (method):
string mysqli::stat();
Procedural style:
string mysqli_stat(mysqli link);
mysqli_stat returns a string containing information similar to that provided by the 'mysqladmin status' command. This includes up-
time in seconds and the number of running threads, questions, reloads, and open tables.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
A string describing the server status. FALSE if an error occurred.
Examples
Example 21.137. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf ("System status: %s\n", $mysqli->stat());
$mysqli->close();
?>
Example 21.138. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("System status: %s\n", mysqli_stat($link));
mysqli_close($link);
?>
The above example will output:
Connectors and APIs
2578
System status: Uptime: 272 Threads: 1 Questions: 5340 Slow queries: 0
Opens: 13 Flush tables: 1 Open tables: 0 Queries per second avg: 19.632
Memory in use: 8496K Max memory used: 8560K
See Also
mysqli_get_server_info
21.11.2.8.50. mysqli::stmt_init, mysqli_stmt_init
Copyright 1997-2008 the PHP Documentation Group.
mysqli::stmt_init
mysqli_stmt_init
Initializes a statement and returns an object for use with mysqli_stmt_prepare
Description
Object oriented style (property):
mysqli {
mysqli_stmt stmt_init();
}
Procedural style :
mysqli_stmt mysqli_stmt_init(mysqli link);
Allocates and initializes a statement object suitable for mysqli_stmt_prepare.
Note
Any subsequent calls to any mysqli_stmt function will fail until mysqli_stmt_prepare was called.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns an object.
See Also
mysqli_stmt_prepare
21.11.2.8.51. mysqli::store_result, mysqli_store_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli::store_result
Connectors and APIs
2579
mysqli_store_result
Transfers a result set from the last query
Description
Object oriented style (method):
mysqli_result store_result();
Procedural style:
mysqli_result mysqli_store_result(mysqli link);
Transfers the result set from the last query on the database connection represented by the link parameter to be used with the
mysqli_data_seek function.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns a buffered result object or FALSE if an error occurred.
Note
mysqli_store_result returns FALSE in case the query didn't return a result set (if the query was, for example an
INSERT statement). This function also returns FALSE if the reading of the result set failed. You can check if you have got
an error by checking if mysqli_error doesn't return an empty string, if mysqli_errno returns a non zero value, or
if mysqli_field_count returns a non zero value. Also possible reason for this function returning FALSE after suc-
cessful call to mysqli_query can be too large result set (memory for it cannot be allocated). If
mysqli_field_count returns a non-zero value, the statement should have produced a non-empty result set.
Notes
Note
Although it is always good practice to free the memory used by the result of a query using the mysqli_free_result
function, when transferring large result sets using the mysqli_store_result this becomes particularly important.
Examples
See mysqli_multi_query.
See Also
mysqli_real_query
mysqli_use_result
21.11.2.8.52. mysqli::thread_id, mysqli_thread_id
Copyright 1997-2008 the PHP Documentation Group.
mysqli::thread_id
mysqli_thread_id
Connectors and APIs
2580
Returns the thread ID for the current connection
Description
Object oriented style (property):
mysqli {
int thread_id ;
}
Procedural style:
int mysqli_thread_id(mysqli link);
The mysqli_thread_id function returns the thread ID for the current connection which can then be killed using the
mysqli_kill function. If the connection is lost and you reconnect with mysqli_ping, the thread ID will be other. Therefore you
should get the thread ID only when you need it.
Note
The thread ID is assigned on a connection-by-connection basis. Hence, if the connection is broken and then re-established
a new thread ID will be assigned.
To kill a running query you can use the SQL command KILL QUERY processid.
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Returns the Thread ID for the current connection.
Examples
Example 21.139. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = $mysqli->thread_id;
/* Kill connection */
$mysqli->kill($thread_id);
/* This should produce an error */
if (!$mysqli->query("CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", $mysqli->error);
exit;
}
/* close connection */
$mysqli->close();
?>
Connectors and APIs
2581
Example 21.140. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = mysqli_thread_id($link);
/* Kill connection */
mysqli_kill($link, $thread_id);
/* This should produce an error */
if (!mysqli_query($link, "CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", mysqli_error($link));
exit;
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Error: MySQL server has gone away
See Also
mysqli_kill
21.11.2.8.53. mysqli::thread_safe, mysqli_thread_safe
Copyright 1997-2008 the PHP Documentation Group.
mysqli::thread_safe
mysqli_thread_safe
Returns whether thread safety is given or not
Description
Procedural style:
bool mysqli_thread_safe();
Tells whether the client library is compiled as thread-safe.
Return Values
TRUE if the client library is thread-safe, otherwise FALSE .
21.11.2.8.54. mysqli::use_result, mysqli_use_result
Connectors and APIs
2582
Copyright 1997-2008 the PHP Documentation Group.
mysqli::use_result
mysqli_use_result
Initiate a result set retrieval
Description
Object oriented style (method):
mysqli_result use_result();
Procedural style:
mysqli_result mysqli_use_result(mysqli link);
Used to initiate the retrieval of a result set from the last query executed using the mysqli_real_query function on the database
connection.
Either this or the mysqli_store_result function must be called before the results of a query can be retrieved, and one or the other
must be called to prevent the next query on that database connection from failing.
Note
The mysqli_use_result function does not transfer the entire result set from the database and hence cannot be used
functions such as mysqli_data_seek to move to a particular row within the set. To use this functionality, the result set
must be stored using mysqli_store_result. One should not use mysqli_use_result if a lot of processing on
the client side is performed, since this will tie up the server and prevent other threads from updating any tables from which
the data is being fetched.
Return Values
Returns an unbuffered result object or FALSE if an error occurred.
Examples
Example 21.141. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT CURRENT_USER();";
$query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
/* execute multi query */
if ($mysqli->multi_query($query)) {
do {
/* store first result set */
if ($result = $mysqli->use_result()) {
while ($row = $result->fetch_row()) {
printf("%s\n", $row[0]);
}
$result->close();
}
/* print divider */
if ($mysqli->more_results()) {
printf("-----------------\n");
}
} while ($mysqli->next_result());
}
Connectors and APIs
2583
/* close connection */
$mysqli->close();
?>
Example 21.142. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT CURRENT_USER();";
$query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
/* execute multi query */
if (mysqli_multi_query($link, $query)) {
do {
/* store first result set */
if ($result = mysqli_use_result($link)) {
while ($row = mysqli_fetch_row($result)) {
printf("%s\n", $row[0]);
}
mysqli_free_result($result);
}
/* print divider */
if (mysqli_more_results($link)) {
printf("-----------------\n");
}
} while (mysqli_next_result($link));
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
my_user@localhost
-----------------
Amersfoort
Maastricht
Dordrecht
Leiden
Haarlemmermeer
See Also
mysqli_real_query
mysqli_store_result
21.11.2.8.55. mysqli::warning_count, mysqli_warning_count
Copyright 1997-2008 the PHP Documentation Group.
mysqli::warning_count
mysqli_warning_count
Connectors and APIs
2584
Returns the number of warnings from the last query for the given link
Description
Object oriented style (property):
mysqli {
int warning_count ;
}
Procedural style:
int mysqli_warning_count(mysqli link);
Returns the number of warnings from the last query in the connection.
Note
For retrieving warning messages you can use the SQL command SHOW WARNINGS [limit row_count].
Parameters
link Procedural style only: A link identifier returned by mysqli_connect or mysqli_init
Return Values
Number of warnings or zero if there are no warnings.
Examples
Example 21.143. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCity LIKE City");
/* a remarkable city in Wales */
$query = "INSERT INTO myCity (CountryCode, Name) VALUES('GBR',
'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')";
$mysqli->query($query);
if ($mysqli->warning_count) {
if ($result = $mysqli->query("SHOW WARNINGS")) {
$row = $result->fetch_row();
printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
$result->close();
}
}
/* close connection */
$mysqli->close();
?>
Connectors and APIs
2585
Example 21.144. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCity LIKE City");
/* a remarkable long city name in Wales */
$query = "INSERT INTO myCity (CountryCode, Name) VALUES('GBR',
'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')";
mysqli_query($link, $query);
if (mysqli_warning_count($link)) {
if ($result = mysqli_query($link, "SHOW WARNINGS")) {
$row = mysqli_fetch_row($result);
printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
mysqli_free_result($result);
}
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Warning (1264): Data truncated for column 'Name' at row 1
See Also
mysqli_errno
mysqli_error
mysqli_sqlstate
21.11.2.9. The MySQLi_STMT class (MySQLi_STMT)
Copyright 1997-2008 the PHP Documentation Group.
Represents a prepared statement.
MySQLi_STMT {
MySQLi_STMT
Properties
int affected_rows ;
int errno ;
string error ;
int field_count ;
int insert_id ;
Connectors and APIs
2586
int num_rows ;
int param_count ;
string sqlstate ;
Methods
int mysqli_stmt_affected_rows(mysqli_stmt stmt);
int mysqli_stmt::attr_get(int attr);
bool mysqli_stmt::attr_set(int attr,
int mode);
bool mysqli_stmt::bind_param(string types,
mixed var1,
mixed ...);
bool mysqli_stmt::bind_result(mixed var1,
mixed ...);
bool mysqli_stmt::close();
void mysqli_stmt::data_seek(int offset);
int mysqli_stmt_errno(mysqli_stmt stmt);
string mysqli_stmt_error(mysqli_stmt stmt);
bool mysqli_stmt::execute();
bool mysqli_stmt::fetch();
int mysqli_stmt_field_count(mysqli_stmt stmt);
void mysqli_stmt::free_result();
object mysqli_stmt::get_warnings(mysqli_stmt stmt);
mixed mysqli_stmt_insert_id(mysqli_stmt stmt);
int mysqli_stmt_num_rows(mysqli_stmt stmt);
int mysqli_stmt_param_count(mysqli_stmt stmt);
mixed mysqli_stmt::prepare(string query);
bool mysqli_stmt::reset();
mysqli_result mysqli_stmt::result_metadata();
bool mysqli_stmt::send_long_data(int param_nr,
string data);
string mysqli_stmt_sqlstate(mysqli_stmt stmt);
bool mysqli_stmt::store_result();
Connectors and APIs
2587
}
21.11.2.9.1. mysqli_stmt->affected_rows, mysqli_stmt_affected_rows
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt->affected_rows
mysqli_stmt_affected_rows
Returns the total number of rows changed, deleted, or inserted by the last executed statement
Description
Object oriented style (property):
mysqli_stmt {
int affected_rows ;
}
Procedural style :
int mysqli_stmt_affected_rows(mysqli_stmt stmt);
Returns the number of rows affected by INSERT, UPDATE, or DELETE query.
This function only works with queries which update a table. In order to get the number of rows from a SELECT query, use
mysqli_stmt_num_rows instead.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records where updated for an UP-
DATE/DELETE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that
the query has returned an error. NULL indicates an invalid argument was supplied to the function.
Note
If the number of affected rows is greater than maximal PHP int value, the number of affected rows will be returned as a
string value.
Examples
Example 21.145. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* create temp table */
$mysqli->query("CREATE TEMPORARY TABLE myCountry LIKE Country");
$query = "INSERT INTO myCountry SELECT * FROM Country WHERE Code LIKE ?";
Connectors and APIs
2588
/* prepare statement */
if ($stmt = $mysqli->prepare($query)) {
/* Bind variable for placeholder */
$code = 'A%';
$stmt->bind_param("s", $code);
/* execute statement */
$stmt->execute();
printf("rows inserted: %d\n", $stmt->affected_rows);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.146. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* create temp table */
mysqli_query($link, "CREATE TEMPORARY TABLE myCountry LIKE Country");
$query = "INSERT INTO myCountry SELECT * FROM Country WHERE Code LIKE ?";
/* prepare statement */
if ($stmt = mysqli_prepare($link, $query)) {
/* Bind variable for placeholder */
$code = 'A%';
mysqli_stmt_bind_param($stmt, "s", $code);
/* execute statement */
mysqli_stmt_execute($stmt);
printf("rows inserted: %d\n", mysqli_stmt_affected_rows($stmt));
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
rows inserted: 17
See Also
mysqli_stmt_num_rows
mysqli_prepare
Connectors and APIs
2589
21.11.2.9.2. mysqli_stmt::attr_get, mysqli_stmt_attr_get
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::attr_get
mysqli_stmt_attr_get
Used to get the current value of a statement attribute
Description
Object oriented style (method):
int mysqli_stmt::attr_get(int attr);
Procedural style:
int mysqli_stmt_attr_get(mysqli_stmt stmt,
int attr);
Gets the current value of a statement attribute.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
attr The attribute that you want to get.
Return Values
Returns FALSE if the attribute is not found, otherwise returns the value of the attribute.
21.11.2.9.3. mysqli_stmt::attr_set, mysqli_stmt_attr_set
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::attr_set
mysqli_stmt_attr_set
Used to modify the behavior of a prepared statement
Description
Object oriented style (method):
bool mysqli_stmt::attr_set(int attr,
int mode);
Procedural style:
bool mysqli_stmt_attr_set(mysqli_stmt stmt,
int attr,
int mode);
Used to modify the behavior of a prepared statement. This function may be called multiple times to set several attributes.
Parameters
Connectors and APIs
2590
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
attr The attribute that you want to set. It can have one of the following values:
Table 21.11. Attribute values
Character Description
MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH If set to 1, causes mysqli_stmt_store_result to update
the metadata MYSQL_FIELD->max_length value.
MYSQLI_STMT_ATTR_CURSOR_TYPE Type of cursor to open for statement when
mysqli_stmt_execute is invoked. mode can be
MYSQLI_CURSOR_TYPE_NO_CURSOR (the default) or
MYSQLI_CURSOR_TYPE_READ_ONLY.
MYSQLI_STMT_ATTR_PREFETCH_ROWS Number of rows to fetch from server at a time when using a curs-
or. mode can be in the range from 1 to the maximum value of un-
signed long. The default is 1.
If you use the MYSQLI_STMT_ATTR_CURSOR_TYPE option with
MYSQLI_CURSOR_TYPE_READ_ONLY, a cursor is opened for the statement when you invoke
mysqli_stmt_execute. If there is already an open cursor from a previous
mysqli_stmt_execute call, it closes the cursor before opening a new one.
mysqli_stmt_reset also closes any open cursor before preparing the statement for re-
execution. mysqli_stmt_free_result closes any open cursor.
If you open a cursor for a prepared statement, mysqli_stmt_store_result is unnecessary.
mode The value to assign to the attribute.
21.11.2.9.4. mysqli_stmt::bind_param, mysqli_stmt_bind_param
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::bind_param
mysqli_stmt_bind_param
Binds variables to a prepared statement as parameters
Description
Object oriented style (method):
bool mysqli_stmt::bind_param(string types,
mixed var1,
mixed ...);
Procedural style:
bool mysqli_stmt_bind_param(mysqli_stmt stmt,
string types,
mixed var1,
mixed ...);
Bind variables for the parameter markers in the SQL statement that was passed to mysqli_prepare.
Note
If data size of a variable exceeds max. allowed packet size (max_allowed_packet), you have to specify b in types and
Connectors and APIs
2591
use mysqli_stmt_send_long_data to send the data in packets.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
types A string that contains one or more characters which specify the types for the corresponding bind
variables:
Table 21.12. Type specification chars
Character Description
i corresponding variable has type integer
d corresponding variable has type double
s corresponding variable has type string
b corresponding variable is a blob and will be sent in packets
var1 The number of variables and length of string types must match the parameters in the statement.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.147. Object oriented style
<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt = $mysqli->prepare("INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)");
$stmt->bind_param('sssd', $code, $language, $official, $percent);
$code = 'DEU';
$language = 'Bavarian';
$official = "F";
$percent = 11.2;
/* execute prepared statement */
$stmt->execute();
printf("%d Row inserted.\n", $stmt->affected_rows);
/* close statement and connection */
$stmt->close();
/* Clean up table CountryLanguage */
$mysqli->query("DELETE FROM CountryLanguage WHERE Language='Bavarian'");
printf("%d Row deleted.\n", $mysqli->affected_rows);
/* close connection */
$mysqli->close();
?>
Example 21.148. Procedural style
Connectors and APIs
2592
<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'world');
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt = mysqli_prepare($link, "INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, 'sssd', $code, $language, $official, $percent);
$code = 'DEU';
$language = 'Bavarian';
$official = "F";
$percent = 11.2;
/* execute prepared statement */
mysqli_stmt_execute($stmt);
printf("%d Row inserted.\n", mysqli_stmt_affected_rows($stmt));
/* close statement and connection */
mysqli_stmt_close($stmt);
/* Clean up table CountryLanguage */
mysqli_query($link, "DELETE FROM CountryLanguage WHERE Language='Bavarian'");
printf("%d Row deleted.\n", mysqli_affected_rows($link));
/* close connection */
mysqli_close($link);
?>
The above example will output:
1 Row inserted.
1 Row deleted.
See Also
mysqli_stmt_bind_result
mysqli_stmt_execute
mysqli_stmt_fetch
mysqli_prepare
mysqli_stmt_send_long_data
mysqli_stmt_errno
mysqli_stmt_error
21.11.2.9.5. mysqli_stmt::bind_result, mysqli_stmt_bind_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::bind_result
mysqli_stmt_bind_result
Binds variables to a prepared statement for result storage
Description
Object oriented style (method):
bool mysqli_stmt::bind_result(mixed var1,
mixed ...);
Connectors and APIs
2593
Procedural style:
bool mysqli_stmt_bind_result(mysqli_stmt stmt,
mixed var1,
mixed ...);
Binds columns in the result set to variables.
When mysqli_stmt_fetch is called to fetch data, the MySQL client/server protocol places the data for the bound columns into the
specified variables var1, ....
Note
Note that all columns must be bound after mysqli_stmt_execute and prior to calling mysqli_stmt_fetch. De-
pending on column types bound variables can silently change to the corresponding PHP type.
A column can be bound or rebound at any time, even after a result set has been partially retrieved. The new binding takes
effect the next time mysqli_stmt_fetch is called.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
var1 The variable to be bound.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.149. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* prepare statement */
if ($stmt = $mysqli->prepare("SELECT Code, Name FROM Country ORDER BY Name LIMIT 5")) {
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($col1, $col2);
/* fetch values */
while ($stmt->fetch()) {
printf("%s %s\n", $col1, $col2);
}
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.150. Procedural style
Connectors and APIs
2594
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* prepare statement */
if ($stmt = mysqli_prepare($link, "SELECT Code, Name FROM Country ORDER BY Name LIMIT 5")) {
mysqli_stmt_execute($stmt);
/* bind variables to prepared statement */
mysqli_stmt_bind_result($stmt, $col1, $col2);
/* fetch values */
while (mysqli_stmt_fetch($stmt)) {
printf("%s %s\n", $col1, $col2);
}
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
AFG Afghanistan
ALB Albania
DZA Algeria
ASM American Samoa
AND Andorra
See Also
mysqli_stmt_bind_param
mysqli_stmt_execute
mysqli_stmt_fetch
mysqli_prepare
mysqli_stmt_prepare
mysqli_stmt_init
mysqli_stmt_errno
mysqli_stmt_error
21.11.2.9.6. mysqli_stmt::close, mysqli_stmt_close
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::close
mysqli_stmt_close
Closes a prepared statement
Description
Object oriented style (method):
bool mysqli_stmt::close();
Connectors and APIs
2595
Procedural style:
bool mysqli_stmt_close(mysqli_stmt stmt);
Closes a prepared statement. mysqli_stmt_close also deallocates the statement handle. If the current statement has pending or un-
read results, this function cancels them so that the next query can be executed.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns TRUE on success or FALSE on failure.
See Also
mysqli_prepare
21.11.2.9.7. mysqli_stmt::data_seek, mysqli_stmt_data_seek
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::data_seek
mysqli_stmt_data_seek
Seeks to an arbitrary row in statement result set
Description
Object oriented style (method):
void mysqli_stmt::data_seek(int offset);
Procedural style:
void mysqli_stmt_data_seek(mysqli_stmt stmt,
int offset);
Seeks to an arbitrary result pointer in the statement result set.
mysqli_stmt_store_result must be called prior to mysqli_stmt_data_seek.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
offset Must be between zero and the total number of rows minus one (0.. mysqli_stmt_num_rows
- 1).
Return Values
No value is returned.
Examples
Connectors and APIs
2596
Example 21.151. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($name, $code);
/* store result */
$stmt->store_result();
/* seek to row no. 400 */
$stmt->data_seek(399);
/* fetch values */
$stmt->fetch();
printf ("City: %s Countrycode: %s\n", $name, $code);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.152. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($stmt = mysqli_prepare($link, $query)) {
/* execute query */
mysqli_stmt_execute($stmt);
/* bind result variables */
mysqli_stmt_bind_result($stmt, $name, $code);
/* store result */
mysqli_stmt_store_result($stmt);
/* seek to row no. 400 */
mysqli_stmt_data_seek($stmt, 399);
/* fetch values */
mysqli_stmt_fetch($stmt);
printf ("City: %s Countrycode: %s\n", $name, $code);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
Connectors and APIs
2597
?>
The above example will output:
City: Benin City Countrycode: NGA
See Also
mysqli_prepare
21.11.2.9.8. mysqli_stmt->errno, mysqli_stmt_errno
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt->errno
mysqli_stmt_errno
Returns the error code for the most recent statement call
Description
Object oriented style (property):
mysqli_stmt {
int errno ;
}
Procedural style :
int mysqli_stmt_errno(mysqli_stmt stmt);
Returns the error code for the most recently invoked statement function that can succeed or fail.
Client error message numbers are listed in the MySQL errmsg.h header file, server error message numbers are listed in
mysqld_error.h. In the MySQL source distribution you can find a complete list of error messages and error numbers in the file
Docs/mysqld_error.txt.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
An error code value. Zero means no error occurred.
Examples
Example 21.153. Object oriented style
Connectors and APIs
2598
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCountry LIKE Country");
$mysqli->query("INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
/* drop table */
$mysqli->query("DROP TABLE myCountry");
/* execute query */
$stmt->execute();
printf("Error: %d.\n", $stmt->errno);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.154. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCountry LIKE Country");
mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = mysqli_prepare($link, $query)) {
/* drop table */
mysqli_query($link, "DROP TABLE myCountry");
/* execute query */
mysqli_stmt_execute($stmt);
printf("Error: %d.\n", mysqli_stmt_errno($stmt));
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Error: 1146.
Connectors and APIs
2599
See Also
mysqli_stmt_error
mysqli_stmt_sqlstate
21.11.2.9.9. mysqli_stmt->error, mysqli_stmt_error
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt->error
mysqli_stmt_error
Returns a string description for last statement error
Description
Object oriented style (property):
mysqli_stmt {
string error ;
}
Procedural style:
string mysqli_stmt_error(mysqli_stmt stmt);
Returns a containing the error message for the most recently invoked statement function that can succeed or fail.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
A string that describes the error. An empty string if no error occurred.
Examples
Example 21.155. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCountry LIKE Country");
$mysqli->query("INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
Connectors and APIs
2600
/* drop table */
$mysqli->query("DROP TABLE myCountry");
/* execute query */
$stmt->execute();
printf("Error: %s.\n", $stmt->error);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.156. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCountry LIKE Country");
mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = mysqli_prepare($link, $query)) {
/* drop table */
mysqli_query($link, "DROP TABLE myCountry");
/* execute query */
mysqli_stmt_execute($stmt);
printf("Error: %s.\n", mysqli_stmt_error($stmt));
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Error: Table 'world.myCountry' doesn't exist.
See Also
mysqli_stmt_errno
mysqli_stmt_sqlstate
21.11.2.9.10. mysqli_stmt::execute, mysqli_stmt_execute
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2601
mysqli_stmt::execute
mysqli_stmt_execute
Executes a prepared Query
Description
Object oriented style (method):
bool mysqli_stmt::execute();
Procedural style:
bool mysqli_stmt_execute(mysqli_stmt stmt);
Executes a query that has been previously prepared using the mysqli_prepare function. When executed any parameter markers
which exist will automatically be replaced with the appropriate data.
If the statement is UPDATE, DELETE, or INSERT, the total number of affected rows can be determined by using the
mysqli_stmt_affected_rows function. Likewise, if the query yields a result set the mysqli_stmt_fetch function is used.
Note
When using mysqli_stmt_execute, the mysqli_stmt_fetch function must be used to fetch the data prior to
performing any additional queries.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.157. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCity LIKE City");
/* Prepare an insert statement */
$query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("sss", $val1, $val2, $val3);
$val1 = 'Stuttgart';
$val2 = 'DEU';
$val3 = 'Baden-Wuerttemberg';
/* Execute the statement */
$stmt->execute();
$val1 = 'Bordeaux';
$val2 = 'FRA';
$val3 = 'Aquitaine';
Connectors and APIs
2602
/* Execute the statement */
$stmt->execute();
/* close statement */
$stmt->close();
/* retrieve all rows from myCity */
$query = "SELECT Name, CountryCode, District FROM myCity";
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_row()) {
printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]);
}
/* free result set */
$result->close();
}
/* remove table */
$mysqli->query("DROP TABLE myCity");
/* close connection */
$mysqli->close();
?>
Example 21.158. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCity LIKE City");
/* Prepare an insert statement */
$query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)";
$stmt = mysqli_prepare($link, $query);
mysqli_stmt_bind_param($stmt, "sss", $val1, $val2, $val3);
$val1 = 'Stuttgart';
$val2 = 'DEU';
$val3 = 'Baden-Wuerttemberg';
/* Execute the statement */
mysqli_stmt_execute($stmt);
$val1 = 'Bordeaux';
$val2 = 'FRA';
$val3 = 'Aquitaine';
/* Execute the statement */
mysqli_stmt_execute($stmt);
/* close statement */
mysqli_stmt_close($stmt);
/* retrieve all rows from myCity */
$query = "SELECT Name, CountryCode, District FROM myCity";
if ($result = mysqli_query($link, $query)) {
while ($row = mysqli_fetch_row($result)) {
printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]);
}
/* free result set */
mysqli_free_result($result);
}
/* remove table */
mysqli_query($link, "DROP TABLE myCity");
/* close connection */
mysqli_close($link);
?>
Connectors and APIs
2603
The above example will output:
Stuttgart (DEU,Baden-Wuerttemberg)
Bordeaux (FRA,Aquitaine)
See Also
mysqli_prepare
mysqli_stmt_bind_param
21.11.2.9.11. mysqli_stmt::fetch, mysqli_stmt_fetch
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::fetch
mysqli_stmt_fetch
Fetch results from a prepared statement into the bound variables
Description
Object oriented style (method):
bool mysqli_stmt::fetch();
Procedural style:
bool mysqli_stmt_fetch(mysqli_stmt stmt);
Fetch the result from a prepared statement into the variables bound by mysqli_stmt_bind_result.
Note
Note that all columns must be bound by the application before calling mysqli_stmt_fetch.
Note
Data are transferred unbuffered without calling mysqli_stmt_store_result which can decrease performance (but
reduces memory cost).
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Table 21.13. Return Values
Value Description
TRUE Success. Data has been fetched
FALSE Error occurred
NULL No more rows/data exists or data truncation occurred
Connectors and APIs
2604
Examples
Example 21.159. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 150,5";
if ($stmt = $mysqli->prepare($query)) {
/* execute statement */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($name, $code);
/* fetch values */
while ($stmt->fetch()) {
printf ("%s (%s)\n", $name, $code);
}
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.160. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 150,5";
if ($stmt = mysqli_prepare($link, $query)) {
/* execute statement */
mysqli_stmt_execute($stmt);
/* bind result variables */
mysqli_stmt_bind_result($stmt, $name, $code);
/* fetch values */
while (mysqli_stmt_fetch($stmt)) {
printf ("%s (%s)\n", $name, $code);
}
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Connectors and APIs
2605
Rockford (USA)
Tallahassee (USA)
Salinas (USA)
Santa Clarita (USA)
Springfield (USA)
See Also
mysqli_prepare
mysqli_stmt_errno
mysqli_stmt_error
mysqli_stmt_bind_result
21.11.2.9.12. mysqli_stmt->field_count, mysqli_stmt_field_count
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt->field_count
mysqli_stmt_field_count
Returns the number of field in the given statement
Description
mysqli_stmt {
int field_count ;
}
int mysqli_stmt_field_count(mysqli_stmt stmt);
Warning
This function is currently not documented; only its argument list is available.
21.11.2.9.13. mysqli_stmt::free_result, mysqli_stmt_free_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::free_result
mysqli_stmt_free_result
Frees stored result memory for the given statement handle
Description
Object oriented style (method):
void mysqli_stmt::free_result();
Procedural style:
void mysqli_stmt_free_result(mysqli_stmt stmt);
Connectors and APIs
2606
Frees the result memory associated with the statement, which was allocated by mysqli_stmt_store_result.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
No value is returned.
See Also
mysqli_stmt_store_result
21.11.2.9.14. mysqli_stmt::get_warnings, mysqli_stmt_get_warnings
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::get_warnings
mysqli_stmt_get_warnings
Get result of SHOW WARNINGS
Description
object mysqli_stmt::get_warnings(mysqli_stmt stmt);
object mysqli_stmt_get_warnings(mysqli_stmt stmt);
Warning
This function is currently not documented; only its argument list is available.
21.11.2.9.15. mysqli_stmt->insert_id, mysqli_stmt_insert_id
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt->insert_id
mysqli_stmt_insert_id
Get the ID generated from the previous INSERT operation
Description
mysqli_stmt {
int insert_id ;
}
mixed mysqli_stmt_insert_id(mysqli_stmt stmt);
Warning
This function is currently not documented; only its argument list is available.
Connectors and APIs
2607
21.11.2.9.16. mysqli_stmt::num_rows, mysqli_stmt_num_rows
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::num_rows
mysqli_stmt_num_rows
Return the number of rows in statements result set
Description
Object oriented style (property):
mysqli_stmt {
int num_rows ;
}
Procedural style :
int mysqli_stmt_num_rows(mysqli_stmt stmt);
Returns the number of rows in the result set. The use of mysqli_stmt_num_rows depends on whether or not you used
mysqli_stmt_store_result to buffer the entire result set in the statement handle.
If you use mysqli_stmt_store_result, mysqli_stmt_num_rows may be called immediately.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
An integer representing the number of rows in result set.
Examples
Example 21.161. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20";
if ($stmt = $mysqli->prepare($query)) {
/* execute query */
$stmt->execute();
/* store result */
$stmt->store_result();
printf("Number of rows: %d.\n", $stmt->num_rows);
/* close statement */
$stmt->close();
}
Connectors and APIs
2608
/* close connection */
$mysqli->close();
?>
Example 21.162. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20";
if ($stmt = mysqli_prepare($link, $query)) {
/* execute query */
mysqli_stmt_execute($stmt);
/* store result */
mysqli_stmt_store_result($stmt);
printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt));
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Number of rows: 20.
See Also
mysqli_stmt_affected_rows
mysqli_prepare
mysqli_stmt_store_result
21.11.2.9.17. mysqli_stmt->param_count, mysqli_stmt_param_count
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt->param_count
mysqli_stmt_param_count
Returns the number of parameter for the given statement
Description
Object oriented style (property):
Connectors and APIs
2609
mysqli_stmt {
int param_count ;
}
Procedural style:
int mysqli_stmt_param_count(mysqli_stmt stmt);
Returns the number of parameter markers present in the prepared statement.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns an integer representing the number of parameters.
Examples
Example 21.163. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Name=? OR Code=?")) {
$marker = $stmt->param_count;
printf("Statement has %d markers.\n", $marker);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.164. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = mysqli_prepare($link, "SELECT Name FROM Country WHERE Name=? OR Code=?")) {
$marker = mysqli_stmt_param_count($stmt);
printf("Statement has %d markers.\n", $marker);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
Connectors and APIs
2610
mysqli_close($link);
?>
The above example will output:
Statement has 2 markers.
See Also
mysqli_prepare
21.11.2.9.18. mysqli_stmt::prepare, mysqli_stmt_prepare
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::prepare
mysqli_stmt_prepare
Prepare a SQL statement for execution
Description
Object oriented style (method)
mixed mysqli_stmt::prepare(string query);
Procedure style:
bool mysqli_stmt_prepare(mysqli_stmt stmt,
string query);
Prepares the SQL query pointed to by the null-terminated string query.
The parameter markers must be bound to application variables using mysqli_stmt_bind_param and/or
mysqli_stmt_bind_result before executing the statement or fetching rows.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
query The query, as a string. It must consist of a single SQL statement.
You can include one or more parameter markers in the SQL statement by embedding question
mark (?) characters at the appropriate positions.
Note
You should not add a terminating semicolon or \g to the statement.
Note
The markers are legal only in certain places in SQL statements. For example, they are allowed in the VALUES() list of an
Connectors and APIs
2611
INSERT statement (to specify column values for a row), or in a comparison with a column in a WHERE clause to specify
a comparison value.
However, they are not allowed for identifiers (such as table or column names), in the select list that names the columns to
be returned by a SELECT statement), or to specify both operands of a binary operator such as the = equal sign. The latter
restriction is necessary because it would be impossible to determine the parameter type. In general, parameters are legal
only in Data Manipulation Language (DML) statements, and not in Data Definition Language (DDL) statements.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.165. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$city = "Amersfoort";
/* create a prepared statement */
$stmt = $mysqli->stmt_init();
if ($stmt->prepare("SELECT District FROM City WHERE Name=?")) {
/* bind parameters for markers */
$stmt->bind_param("s", $city);
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($district);
/* fetch value */
$stmt->fetch();
printf("%s is in district %s\n", $city, $district);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.166. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$city = "Amersfoort";
/* create a prepared statement */
$stmt = mysqli_stmt_init($link);
if (mysqli_stmt_prepare($stmt, 'SELECT District FROM City WHERE Name=?')) {
Connectors and APIs
2612
/* bind parameters for markers */
mysqli_stmt_bind_param($stmt, "s", $city);
/* execute query */
mysqli_stmt_execute($stmt);
/* bind result variables */
mysqli_stmt_bind_result($stmt, $district);
/* fetch value */
mysqli_stmt_fetch($stmt);
printf("%s is in district %s\n", $city, $district);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Amersfoort is in district Utrecht
See Also
mysqli_stmt_init, mysqli_stmt_execute, mysqli_stmt_fetch, mysqli_stmt_bind_param,
mysqli_stmt_bind_result mysqli_stmt_close.
21.11.2.9.19. mysqli_stmt::reset, mysqli_stmt_reset
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::reset
mysqli_stmt_reset
Resets a prepared statement
Description
Object oriented style (method):
bool mysqli_stmt::reset();
Procedural style:
bool mysqli_stmt_reset(mysqli_stmt stmt);
Resets a prepared statement on client and server to state after prepare.
For now this is mainly used to reset data sent with mysqli_stmt_send_long_data.
To prepare a statement with another query use function mysqli_stmt_prepare.
Parameters
Connectors and APIs
2613
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns TRUE on success or FALSE on failure.
See Also
mysqli_prepare
21.11.2.9.20. mysqli_stmt::result_metadata, mysqli_stmt_result_metadata
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::result_metadata
mysqli_stmt_result_metadata
Returns result set metadata from a prepared statement
Description
Object oriented style (method):
mysqli_result mysqli_stmt::result_metadata();
Procedural style:
mysqli_result mysqli_stmt_result_metadata(mysqli_stmt stmt);
If a statement passed to mysqli_prepare is one that produces a result set, mysqli_stmt_result_metadata returns the result
object that can be used to process the meta information such as total number of fields and individual field information.
Note
This result set pointer can be passed as an argument to any of the field-based functions that process result set metadata,
such as:
mysqli_num_fields
mysqli_fetch_field
mysqli_fetch_field_direct
mysqli_fetch_fields
mysqli_field_count
mysqli_field_seek
mysqli_field_tell
mysqli_free_result
The result set structure should be freed when you are done with it, which you can do by passing it to mysqli_free_result
Note
The result set returned by mysqli_stmt_result_metadata contains only metadata. It does not contain any row res-
ults. The rows are obtained by using the statement handle with mysqli_stmt_fetch.
Connectors and APIs
2614
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns a result object or FALSE if an error occurred.
Examples
Example 21.167. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
$mysqli->query("DROP TABLE IF EXISTS friends");
$mysqli->query("CREATE TABLE friends (id int, name varchar(20))");
$mysqli->query("INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
$stmt = $mysqli->prepare("SELECT id, name FROM friends");
$stmt->execute();
/* get resultset for metadata */
$result = $stmt->result_metadata();
/* retrieve field information from metadata result set */
$field = $result->fetch_field();
printf("Fieldname: %s\n", $field->name);
/* close resultset */
$result->close();
/* close connection */
$mysqli->close();
?>
Example 21.168. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
mysqli_query($link, "DROP TABLE IF EXISTS friends");
mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))");
mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
$stmt = mysqli_prepare($link, "SELECT id, name FROM friends");
mysqli_stmt_execute($stmt);
/* get resultset for metadata */
$result = mysqli_stmt_result_metadata($stmt);
/* retrieve field information from metadata result set */
$field = mysqli_fetch_field($result);
printf("Fieldname: %s\n", $field->name);
/* close resultset */
mysqli_free_result($result);
/* close connection */
mysqli_close($link);
?>
Connectors and APIs
2615
See Also
mysqli_prepare
mysqli_free_result
21.11.2.9.21. mysqli_stmt::send_long_data, mysqli_stmt_send_long_data
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::send_long_data
mysqli_stmt_send_long_data
Send data in blocks
Description
Object oriented style (method)
bool mysqli_stmt::send_long_data(int param_nr,
string data);
Procedural style:
bool mysqli_stmt_send_long_data(mysqli_stmt stmt,
int param_nr,
string data);
Allows to send parameter data to the server in pieces (or chunks), e.g. if the size of a blob exceeds the size of
max_allowed_packet. This function can be called multiple times to send the parts of a character or binary data value for a column,
which must be one of the TEXT or BLOB datatypes.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
param_nr Indicates which parameter to associate the data with. Parameters are numbered beginning with 0.
data A string containing data to be sent.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.169. Object oriented style
<?php
$stmt = $mysqli->prepare("INSERT INTO messages (message) VALUES (?)");
$null = NULL;
$stmt->bind_param("b", $null);
$fp = fopen("messages.txt", "r");
while (!feof($fp)) {
$stmt->send_long_data(0, fread($fp, 8192));
}
fclose($fp);
$stmt->execute();
?>
Connectors and APIs
2616
See Also
mysqli_prepare
mysqli_stmt_bind_param
21.11.2.9.22. mysqli_stmt::sqlstate, mysqli_stmt_sqlstate
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::sqlstate
mysqli_stmt_sqlstate
Returns SQLSTATE error from previous statement operation
Description
Object oriented style (property):
mysqli_stmt {
string sqlstate ;
}
Procedural style:
string mysqli_stmt_sqlstate(mysqli_stmt stmt);
Returns a string containing the SQLSTATE error code for the most recently invoked prepared statement function that can succeed or
fail. The error code consists of five characters. '00000' means no error. The values are specified by ANSI SQL and ODBC. For a list
of possible values, see http://dev.mysql.com/doc/mysql/en/error-handling.html.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
error.
Notes
Note
Note that not all MySQL errors are yet mapped to SQLSTATE's. The value HY000 (general error) is used for unmapped
errors.
Examples
Example 21.170. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
Connectors and APIs
2617
exit();
}
$mysqli->query("CREATE TABLE myCountry LIKE Country");
$mysqli->query("INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
/* drop table */
$mysqli->query("DROP TABLE myCountry");
/* execute query */
$stmt->execute();
printf("Error: %s.\n", $stmt->sqlstate);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.171. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCountry LIKE Country");
mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = mysqli_prepare($link, $query)) {
/* drop table */
mysqli_query($link, "DROP TABLE myCountry");
/* execute query */
mysqli_stmt_execute($stmt);
printf("Error: %s.\n", mysqli_stmt_sqlstate($stmt));
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Error: 42S02.
See Also
Connectors and APIs
2618
mysqli_stmt_errno
mysqli_stmt_error
21.11.2.9.23. mysqli_stmt::store_result, mysqli_stmt_store_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli_stmt::store_result
mysqli_stmt_store_result
Transfers a result set from a prepared statement
Description
Object oriented style (method):
bool mysqli_stmt::store_result();
Procedural style:
bool mysqli_stmt_store_result(mysqli_stmt stmt);
You must call mysqli_stmt_store_result for every query that successfully produces a result set (SELECT, SHOW, DE-
SCRIBE, EXPLAIN), and only if you want to buffer the complete result set by the client, so that the subsequent
mysqli_stmt_fetch call returns buffered data.
Note
It is unnecessary to call mysqli_stmt_store_result for other queries, but if you do, it will not harm or cause any
notable performance in all cases. You can detect whether the query produced a result set by checking if
mysqli_stmt_result_metadata returns NULL.
Parameters
stmt Procedural style only: A statement identifier returned by mysqli_stmt_init.
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.172. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20";
if ($stmt = $mysqli->prepare($query)) {
/* execute query */
$stmt->execute();
/* store result */
$stmt->store_result();
Connectors and APIs
2619
printf("Number of rows: %d.\n", $stmt->num_rows);
/* free result */
$stmt->free_result();
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.173. Procedural style
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 20";
if ($stmt = mysqli_prepare($link, $query)) {
/* execute query */
mysqli_stmt_execute($stmt);
/* store result */
mysqli_stmt_store_result($stmt);
printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt));
/* free result */
mysqli_stmt_free_result($stmt);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Number of rows: 20.
See Also
mysqli_prepare
mysqli_stmt_result_metadata
mysqli_stmt_fetch
21.11.2.10. The MySQLi_Result class (MySQLi_Result)
Copyright 1997-2008 the PHP Documentation Group.
Represents the result set obtained from a query against the database.
Connectors and APIs
2620
MySQLi_Result {
MySQLi_Result
Properties
int current_field ;
int field_count ;
array lengths ;
int num_rows ;
Methods
int mysqli_field_tell(mysqli_result result);
bool mysqli_result::data_seek(int offset);
mixed mysqli_result::fetch_all(int resulttype);
mixed mysqli_result::fetch_array(int resulttype);
array mysqli_result::fetch_assoc();
object mysqli_result::fetch_field_direct(int fieldnr);
object mysqli_result::fetch_field();
array mysqli_result::fetch_fields();
object mysqli_result::fetch_object(string class_name,
array params);
mixed mysqli_result::fetch_row();
int mysqli_num_fields(mysqli_result result);
bool mysqli_result::field_seek(int fieldnr);
void mysqli_result::free();
array mysqli_fetch_lengths(mysqli_result result);
int mysqli_num_rows(mysqli_result result);
}
21.11.2.10.1. mysqli_result->current_field, mysqli_field_tell
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result->current_field
mysqli_field_tell
Get current field offset of a result pointer
Description
Connectors and APIs
2621
Object oriented style (property):
mysqli_result {
int current_field ;
}
Procedural style:
int mysqli_field_tell(mysqli_result result);
Returns the position of the field cursor used for the last mysqli_fetch_field call. This value can be used as an argument to
mysqli_field_seek.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
Returns current offset of field cursor.
Examples
Example 21.174. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for all columns */
while ($finfo = $result->fetch_field()) {
/* get fieldpointer offset */
$currentfield = $result->current_field;
printf("Column %d:\n", $currentfield);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.175. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
Connectors and APIs
2622
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for all fields */
while ($finfo = mysqli_fetch_field($result)) {
/* get fieldpointer offset */
$currentfield = mysqli_field_tell($result);
printf("Column %d:\n", $currentfield);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Column 1:
Name: Name
Table: Country
max. Len: 11
Flags: 1
Type: 254
Column 2:
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
See Also
mysqli_fetch_field
mysqli_field_seek
21.11.2.10.2. mysqli_result::data_seek, mysqli_data_seek
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::data_seek
mysqli_data_seek
Adjusts the result pointer to an arbitary row in the result
Description
Object oriented style (method):
Connectors and APIs
2623
bool mysqli_result::data_seek(int offset);
Procedural style:
bool mysqli_data_seek(mysqli_result result,
int offset);
The mysqli_data_seek function seeks to an arbitrary result pointer specified by the offset in the result set.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
offset The field offset. Must be between zero and the total number of rows minus one
(0..mysqli_num_rows - 1).
Return Values
Returns TRUE on success or FALSE on failure.
Notes
Note
This function can only be used with buffered results attained from the use of the mysqli_store_result or
mysqli_query functions.
Examples
Example 21.176. Object oriented style
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($result = $mysqli->query( $query)) {
/* seek to row no. 400 */
$result->data_seek(399);
/* fetch row */
$row = $result->fetch_row();
printf ("City: %s Countrycode: %s\n", $row[0], $row[1]);
/* free result set*/
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.177. Procedural style
Connectors and APIs
2624
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($result = mysqli_query($link, $query)) {
/* seek to row no. 400 */
mysqli_data_seek($result, 399);
/* fetch row */
$row = mysqli_fetch_row($result);
printf ("City: %s Countrycode: %s\n", $row[0], $row[1]);
/* free result set*/
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
City: Benin City Countrycode: NGA
See Also
mysqli_store_result
mysqli_fetch_row
mysqli_fetch_array
mysqli_fetch_assoc
mysqli_fetch_object
mysqli_query
mysqli_num_rows
21.11.2.10.3. mysqli_result::fetch_all, mysqli_fetch_all
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_all
mysqli_fetch_all
Fetches all result rows as an associative array, a numeric array, or both
Description
Object oriented style (method):
mixed mysqli_result::fetch_all(int resulttype);
Procedural style:
mixed mysqli_fetch_all(mysqli_result result,
Connectors and APIs
2625
int resulttype);
Available only with mysqlnd.
mysqli_fetch_all fetches all result rows and returns the result set as an associative array, a numeric array, or both.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
resulttype This optional parameter is a constant indicating what type of array should be produced from the
current row data. The possible values for this parameter are the constants MYSQLI_ASSOC ,
MYSQLI_NUM , or MYSQLI_BOTH . Defaults to MYSQLI_NUM .
Return Values
Returns an array of associative or numeric arrays holding result rows.
See Also
mysqli_fetch_array
mysqli_query
21.11.2.10.4. mysqli_result::fetch_array, mysqli_fetch_array
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_array
mysqli_fetch_array
Fetch a result row as an associative, a numeric array, or both
Description
Object oriented style (method):
mixed mysqli_result::fetch_array(int resulttype);
Procedural style:
mixed mysqli_fetch_array(mysqli_result result,
int resulttype);
Returns an array that corresponds to the fetched row or NULL if there are no more rows for the resultset represented by the result
parameter.
mysqli_fetch_array is an extended version of the mysqli_fetch_row function. In addition to storing the data in the numeric
indices of the result array, the mysqli_fetch_array function can also store the data in associative indices, using the field names of
the result set as keys.
Note
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
Connectors and APIs
2626
If two or more columns of the result have the same field names, the last column will take precedence and overwrite the earlier data. In
order to access multiple columns with the same name, the numerically indexed version of the row must be used.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
resulttype This optional parameter is a constant indicating what type of array should be produced from the
current row data. The possible values for this parameter are the constants MYSQLI_ASSOC ,
MYSQLI_NUM , or MYSQLI_BOTH . Defaults to MYSQLI_BOTH .
By using the MYSQLI_ASSOC constant this function will behave identically to the
mysqli_fetch_assoc, while MYSQLI_NUM will behave identically to the
mysqli_fetch_row function. The final option MYSQLI_BOTH will create a single array with
the attributes of both.
Return Values
Returns an array of strings that corresponds to the fetched row or NULL if there are no more rows in resultset.
Examples
Example 21.178. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID LIMIT 3";
$result = $mysqli->query($query);
/* numeric array */
$row = $result->fetch_array(MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);
/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
/* associative and numeric array */
$row = $result->fetch_array(MYSQLI_BOTH);
printf ("%s (%s)\n", $row[0], $row["CountryCode"]);
/* free result set */
$result->close();
/* close connection */
$mysqli->close();
?>
Example 21.179. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
Connectors and APIs
2627
$query = "SELECT Name, CountryCode FROM City ORDER by ID LIMIT 3";
$result = mysqli_query($link, $query);
/* numeric array */
$row = mysqli_fetch_array($result, MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);
/* associative array */
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
/* associative and numeric array */
$row = mysqli_fetch_array($result, MYSQLI_BOTH);
printf ("%s (%s)\n", $row[0], $row["CountryCode"]);
/* free result set */
mysqli_free_result($result);
/* close connection */
mysqli_close($link);
?>
The above example will output:
Kabul (AFG)
Qandahar (AFG)
Herat (AFG)
See Also
mysqli_fetch_assoc
mysqli_fetch_row
mysqli_fetch_object
mysqli_query
mysqli_data_seek
21.11.2.10.5. mysqli_result::fetch_assoc, mysqli_fetch_assoc
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_assoc
mysqli_fetch_assoc
Fetch a result row as an associative array
Description
Object oriented style (method):
array mysqli_result::fetch_assoc();
Procedural style:
array mysqli_fetch_assoc(mysqli_result result);
Returns an associative array that corresponds to the fetched row or NULL if there are no more rows.
Note
Connectors and APIs
2628
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
Returns an associative array of strings representing the fetched row in the result set, where each key in the array represents the name of
one of the result set's columns or NULL if there are no more rows in resultset.
If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of
the same name, you either need to access the result with numeric indices by using mysqli_fetch_row or add alias names.
Examples
Example 21.180. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
if ($result = $mysqli->query($query)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
/* free result set */
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.181. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
if ($result = mysqli_query($link, $query)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
Connectors and APIs
2629
}
/* free result set */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
See Also
mysqli_fetch_array
mysqli_fetch_row
mysqli_fetch_object
mysqli_query
mysqli_data_seek
21.11.2.10.6. mysqli_result::fetch_field_direct, mysqli_fetch_field_direct
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_field_direct
mysqli_fetch_field_direct
Fetch meta-data for a single field
Description
Object oriented style (method):
object mysqli_result::fetch_field_direct(int fieldnr);
Procedural style:
object mysqli_fetch_field_direct(mysqli_result result,
int fieldnr);
Returns an object which contains field definition information from the specified result set.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
fieldnr The field number. This value must be in the range from 0 to number of fields - 1.
Connectors and APIs
2630
Return Values
Returns an object which contains field definition information or FALSE if no field information for specified fieldnr is available.
Table 21.14. Object attributes
Attribute Description
name The name of the column
orgname Original column name if an alias was specified
table The name of the table this field belongs to (if not calculated)
orgtable Original table name if an alias was specified
def The default value for this field, represented as a string
max_length The maximum width of the field for the result set.
length The width of the field, as specified in the table definition.
charsetnr The character set number for the field.
flags An integer representing the bit-flags for the field.
type The data type used for this field
decimals The number of decimals used (for integer fields)
Examples
Example 21.182. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Name LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for column 'SurfaceArea' */
$finfo = $result->fetch_field_direct(1);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n", $finfo->type);
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.183. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
Connectors and APIs
2631
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Name LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for column 'SurfaceArea' */
$finfo = mysqli_fetch_field_direct($result, 1);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n", $finfo->type);
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
See Also
mysqli_num_fields
mysqli_fetch_field
mysqli_fetch_fields
21.11.2.10.7. mysqli_result::fetch_field, mysqli_fetch_field
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_field
mysqli_fetch_field
Returns the next field in the result set
Description
Object oriented style (method):
object mysqli_result::fetch_field();
Procedural style:
object mysqli_fetch_field(mysqli_result result);
Returns the definition of one column of a result set as an object. Call this function repeatedly to retrieve information about all columns
in the result set.
Parameters
Connectors and APIs
2632
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
Returns an object which contains field definition information or FALSE if no field information is available.
Table 21.15. Object properties
Property Description
name The name of the column
orgname Original column name if an alias was specified
table The name of the table this field belongs to (if not calculated)
orgtable Original table name if an alias was specified
def The default value for this field, represented as a string
max_length The maximum width of the field for the result set.
length The width of the field, as specified in the table definition.
charsetnr The character set number for the field.
flags An integer representing the bit-flags for the field.
type The data type used for this field
decimals The number of decimals used (for integer fields)
Examples
Example 21.184. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for all columns */
while ($finfo = $result->fetch_field()) {
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.185. Procedural style
Connectors and APIs
2633
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for all fields */
while ($finfo = mysqli_fetch_field($result)) {
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Name: Name
Table: Country
max. Len: 11
Flags: 1
Type: 254
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
See Also
mysqli_num_fields
mysqli_fetch_field_direct
mysqli_fetch_fields
mysqli_field_seek
21.11.2.10.8. mysqli_result::fetch_fields, mysqli_fetch_fields
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_fields
mysqli_fetch_fields
Returns an array of objects representing the fields in a result set
Description
Object oriented style (method):
Connectors and APIs
2634
array mysqli_result::fetch_fields();
Procedural Style:
array mysqli_fetch_fields(mysqli_result result);
This function serves an identical purpose to the mysqli_fetch_field function with the single difference that, instead of returning
one object at a time for each field, the columns are returned as an array of objects.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
Returns an array of objects which contains field definition information or FALSE if no field information is available.
Table 21.16. Object properties
Property Description
name The name of the column
orgname Original column name if an alias was specified
table The name of the table this field belongs to (if not calculated)
orgtable Original table name if an alias was specified
def The default value for this field, represented as a string
max_length The maximum width of the field for the result set.
length The width of the field, as specified in the table definition.
charsetnr The character set number for the field.
flags An integer representing the bit-flags for the field.
type The data type used for this field
decimals The number of decimals used (for integer fields)
Examples
Example 21.186. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for all columns */
$finfo = $result->fetch_fields();
foreach ($finfo as $val) {
printf("Name: %s\n", $val->name);
printf("Table: %s\n", $val->table);
printf("max. Len: %d\n", $val->max_length);
printf("Flags: %d\n", $val->flags);
Connectors and APIs
2635
printf("Type: %d\n\n", $val->type);
}
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.187. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for all columns */
$finfo = mysqli_fetch_fields($result);
foreach ($finfo as $val) {
printf("Name: %s\n", $val->name);
printf("Table: %s\n", $val->table);
printf("max. Len: %d\n", $val->max_length);
printf("Flags: %d\n", $val->flags);
printf("Type: %d\n\n", $val->type);
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Name: Name
Table: Country
max. Len: 11
Flags: 1
Type: 254
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
See Also
mysqli_num_fields
mysqli_fetch_field_direct
mysqli_fetch_field
21.11.2.10.9. mysqli_result::fetch_object, mysqli_fetch_object
Connectors and APIs
2636
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_object
mysqli_fetch_object
Returns the current row of a result set as an object
Description
Object oriented style (method):
object mysqli_result::fetch_object(string class_name,
array params);
Procedural style:
object mysqli_fetch_object(mysqli_result result,
string class_name,
array params);
The mysqli_fetch_object will return the current row result set as an object where the attributes of the object represent the names
of the fields found within the result set.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
class_name The name of the class to instantiate, set the properties of and return. If not specified, a
stdClass object is returned.
params An optional array of parameters to pass to the constructor for class_name objects.
Return Values
Returns an object with string properties that corresponds to the fetched row or NULL if there are no more rows in resultset.
Note
Field names returned by this function are case-sensitive.
Note
This function sets NULL fields to the PHP NULL value.
Changelog
Version Description
5.0.0 Added the ability to return as a different object.
Examples
Example 21.188. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
Connectors and APIs
2637
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
if ($result = $mysqli->query($query)) {
/* fetch object array */
while ($obj = $result->fetch_object()) {
printf ("%s (%s)\n", $obj->Name, $obj->CountryCode);
}
/* free result set */
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.189. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
if ($result = mysqli_query($link, $query)) {
/* fetch associative array */
while ($obj = mysqli_fetch_object($result)) {
printf ("%s (%s)\n", $obj->Name, $obj->CountryCode);
}
/* free result set */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
See Also
mysqli_fetch_array
mysqli_fetch_assoc
mysqli_fetch_row
Connectors and APIs
2638
mysqli_query
mysqli_data_seek
21.11.2.10.10. mysqli_result::fetch_row, mysqli_fetch_row
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::fetch_row
mysqli_fetch_row
Get a result row as an enumerated array
Description
Object oriented style (method):
mixed mysqli_result::fetch_row();
Procedural style:
mixed mysqli_fetch_row(mysqli_result result);
Fetches one row of data from the result set and returns it as an enumerated array, where each column is stored in an array offset starting
from 0 (zero). Each subsequent call to this function will return the next row within the result set, or NULL if there are no more rows.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
mysqli_fetch_row returns an array of strings that corresponds to the fetched row or NULL if there are no more rows in result set.
Note
This function sets NULL fields to the PHP NULL value.
Examples
Example 21.190. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
if ($result = $mysqli->query($query)) {
/* fetch object array */
while ($row = $result->fetch_row()) {
printf ("%s (%s)\n", $row[0], $row[1]);
}
/* free result set */
$result->close();
}
Connectors and APIs
2639
/* close connection */
$mysqli->close();
?>
Example 21.191. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5";
if ($result = mysqli_query($link, $query)) {
/* fetch associative array */
while ($row = mysqli_fetch_row($result)) {
printf ("%s (%s)\n", $row[0], $row[1]);
}
/* free result set */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
See Also
mysqli_fetch_array
mysqli_fetch_assoc
mysqli_fetch_object
mysqli_query
mysqli_data_seek
21.11.2.10.11. mysqli_result->field_count, mysqli_num_fields
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result->field_count
mysqli_num_fields
Get the number of fields in a result
Connectors and APIs
2640
Description
Object oriented style (property):
mysqli_result {
int field_count ;
}
Procedural style:
int mysqli_num_fields(mysqli_result result);
Returns the number of fields from specified result set.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
The number of fields from a result set.
Examples
Example 21.192. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($result = $mysqli->query("SELECT * FROM City ORDER BY ID LIMIT 1")) {
/* determine number of fields in result set */
$field_cnt = $result->field_count;
printf("Result set has %d fields.\n", $field_cnt);
/* close result set */
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.193. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($result = mysqli_query($link, "SELECT * FROM City ORDER BY ID LIMIT 1")) {
Connectors and APIs
2641
/* determine number of fields in result set */
$field_cnt = mysqli_num_fields($result);
printf("Result set has %d fields.\n", $field_cnt);
/* close result set */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Result set has 5 fields.
See Also
mysqli_fetch_field
21.11.2.10.12. mysqli_result::field_seek, mysqli_field_seek
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::field_seek
mysqli_field_seek
Set result pointer to a specified field offset
Description
Object oriented style (method):
bool mysqli_result::field_seek(int fieldnr);
Procedural style:
bool mysqli_field_seek(mysqli_result result,
int fieldnr);
Sets the field cursor to the given offset. The next call to mysqli_fetch_field will retrieve the field definition of the column asso-
ciated with that offset.
Note
To seek to the beginning of a row, pass an offset value of zero.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
fieldnr The field number. This value must be in the range from 0 to number of fields - 1.
Connectors and APIs
2642
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.194. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for 2nd column */
$result->field_seek(1);
$finfo = $result->fetch_field();
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.195. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for 2nd column */
mysqli_field_seek($result, 1);
$finfo = mysqli_fetch_field($result);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Connectors and APIs
2643
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
See Also
mysqli_fetch_field
21.11.2.10.13. mysqli_result::free, mysqli_free_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result::free
mysqli_free_result
Frees the memory associated with a result
Description
Object oriented style (all methods are equivalent):
void mysqli_result::free();
void mysqli_result::close();
void mysqli_result::free_result();
Procedural style:
void mysqli_free_result(mysqli_result result);
Frees the memory associated with the result.
Note
You should always free your result with mysqli_free_result, when your result object is not needed anymore.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
No value is returned.
See Also
mysqli_query
mysqli_stmt_store_result
Connectors and APIs
2644
mysqli_store_result
mysqli_use_result
21.11.2.10.14. mysqli_result->lengths, mysqli_fetch_lengths
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result->lengths
mysqli_fetch_lengths
Returns the lengths of the columns of the current row in the result set
Description
Object oriented style (property):
mysqli_result {
array lengths ;
}
Procedural style:
array mysqli_fetch_lengths(mysqli_result result);
The mysqli_fetch_lengths function returns an array containing the lengths of every column of the current row within the result
set.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
An array of integers representing the size of each column (not including any terminating null characters). FALSE if an error occurred.
mysqli_fetch_lengths is valid only for the current row of the result set. It returns FALSE if you call it before calling
mysqli_fetch_row/array/object or after retrieving all rows in the result.
Examples
Example 21.196. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT * from Country ORDER BY Code LIMIT 1";
if ($result = $mysqli->query($query)) {
$row = $result->fetch_row();
/* display column lengths */
foreach ($result->lengths as $i => $val) {
printf("Field %2d has Length %2d\n", $i+1, $val);
}
Connectors and APIs
2645
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.197. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT * from Country ORDER BY Code LIMIT 1";
if ($result = mysqli_query($link, $query)) {
$row = mysqli_fetch_row($result);
/* display column lengths */
foreach (mysqli_fetch_lengths($result) as $i => $val) {
printf("Field %2d has Length %2d\n", $i+1, $val);
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Field 1 has Length 3
Field 2 has Length 5
Field 3 has Length 13
Field 4 has Length 9
Field 5 has Length 6
Field 6 has Length 1
Field 7 has Length 6
Field 8 has Length 4
Field 9 has Length 6
Field 10 has Length 6
Field 11 has Length 5
Field 12 has Length 44
Field 13 has Length 7
Field 14 has Length 3
Field 15 has Length 2
21.11.2.10.15. mysqli_result->num_rows, mysqli_num_rows
Copyright 1997-2008 the PHP Documentation Group.
mysqli_result->num_rows
mysqli_num_rows
Gets the number of rows in a result
Connectors and APIs
2646
Description
Object oriented style (property):
mysqli_result {
int num_rows ;
}
Procedural style:
int mysqli_num_rows(mysqli_result result);
Returns the number of rows in the result set.
The use of mysqli_num_rows depends on whether you use buffered or unbuffered result sets. In case you use unbuffered resultsets
mysqli_num_rows will not correct the correct number of rows until all the rows in the result have been retrieved.
Parameters
result Procedural style only: A result set identifier returned by mysqli_query,
mysqli_store_result or mysqli_use_result.
Return Values
Returns number of rows in the result set.
Note
If the number of rows is greater than maximal int value, the number will be returned as a string.
Examples
Example 21.198. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($result = $mysqli->query("SELECT Code, Name FROM Country ORDER BY Name")) {
/* determine number of rows result set */
$row_cnt = $result->num_rows;
printf("Result set has %d rows.\n", $row_cnt);
/* close result set */
$result->close();
}
/* close connection */
$mysqli->close();
?>
Example 21.199. Procedural style
Connectors and APIs
2647
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($result = mysqli_query($link, "SELECT Code, Name FROM Country ORDER BY Name")) {
/* determine number of rows result set */
$row_cnt = mysqli_num_rows($result);
printf("Result set has %d rows.\n", $row_cnt);
/* close result set */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
The above example will output:
Result set has 239 rows.
See Also
mysqli_affected_rows
mysqli_store_result
mysqli_use_result
mysqli_query
21.11.2.11. The MySQLi_Driver class (MySQLi_Driver)
Copyright 1997-2008 the PHP Documentation Group.
MySQLi Driver.
MySQLi_Driver {
MySQLi_Driver
Properties
public readonly string client_info ;
public readonly string client_version ;
public readonly string driver_version ;
public readonly string embedded ;
public bool reconnect ;
public int report-mode ;
Methods
void mysqli_driver::embedded_server_end();
Connectors and APIs
2648
bool mysqli_driver::embedded_server_start(bool start,
array arguments,
array groups);
}
client_info The Client API header version
client_version The Client version
driver_version The MySQLi Driver version
embedded Wether MySQLi Embedded support is enabled
reconnect Allow or prevent reconnect (see the mysqli.reconnect INI directive)
report_mode Set to MYSQLI_REPORT_STRICT to throw Exceptions for errors
21.11.2.11.1. mysqli_driver::embedded_server_end, mysqli_embedded_server_end
Copyright 1997-2008 the PHP Documentation Group.
mysqli_driver::embedded_server_end
mysqli_embedded_server_end
Stop embedded server
Description
void mysqli_driver::embedded_server_end();
void mysqli_embedded_server_end();
Warning
This function is currently not documented; only its argument list is available.
21.11.2.11.2. mysqli_driver::embedded_server_start, mysqli_embedded_server_start
Copyright 1997-2008 the PHP Documentation Group.
mysqli_driver::embedded_server_start
mysqli_embedded_server_start
Initialize and start embedded server
Description
bool mysqli_driver::embedded_server_start(bool start,
array arguments,
array groups);
bool mysqli_embedded_server_start(bool start,
array arguments,
array groups);
Warning
Connectors and APIs
2649
This function is currently not documented; only its argument list is available.
21.11.2.12. Aliases and deprecated Mysqli Functions
Copyright 1997-2008 the PHP Documentation Group.
21.11.2.12.1. mysqli_bind_param
Copyright 1997-2008 the PHP Documentation Group.
mysqli_bind_param
Alias for mysqli_stmt_bind_param
Description
This function is an alias of mysqli_stmt_bind_param.
Notes
Note
mysqli_bind_param is deprecated and will be removed.
See Also
mysqli_stmt_bind_param
21.11.2.12.2. mysqli_bind_result
Copyright 1997-2008 the PHP Documentation Group.
mysqli_bind_result
Alias for mysqli_stmt_bind_result
Description
This function is an alias of mysqli_stmt_bind_result.
Notes
Note
mysqli_bind_result is deprecated and will be removed.
See Also
mysqli_stmt_bind_result
21.11.2.12.3. mysqli_client_encoding
Copyright 1997-2008 the PHP Documentation Group.
mysqli_client_encoding
Alias of mysqli_character_set_name
Connectors and APIs
2650
Description
This function is an alias of mysqli_character_set_name.
See Also
mysqli_real_escape_string
21.11.2.12.4. mysqli_disable_reads_from_master, mysqli->disable_reads_from_master
Copyright 1997-2008 the PHP Documentation Group.
mysqli_disable_reads_from_master
mysqli->disable_reads_from_master
Disable reads from master
Description
Procedural style:
bool mysqli_disable_reads_from_master(mysqli link);
Object oriented style (method):
mysqli {
void disable_reads_from_master();
}
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.5. mysqli_disable_rpl_parse
Copyright 1997-2008 the PHP Documentation Group.
mysqli_disable_rpl_parse
Disable RPL parse
Description
bool mysqli_disable_rpl_parse(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
Connectors and APIs
2651
21.11.2.12.6. mysqli_enable_reads_from_master
Copyright 1997-2008 the PHP Documentation Group.
mysqli_enable_reads_from_master
Enable reads from master
Description
bool mysqli_enable_reads_from_master(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.7. mysqli_enable_rpl_parse
Copyright 1997-2008 the PHP Documentation Group.
mysqli_enable_rpl_parse
Enable RPL parse
Description
bool mysqli_enable_rpl_parse(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.8. mysqli_escape_string
Copyright 1997-2008 the PHP Documentation Group.
mysqli_escape_string
Alias of mysqli_real_escape_string
Description
This function is an alias of mysqli_real_escape_string.
See Also
mysqli_real_escape_string
21.11.2.12.9. mysqli_execute
Connectors and APIs
2652
Copyright 1997-2008 the PHP Documentation Group.
mysqli_execute
Alias for mysqli_stmt_execute
Description
This function is an alias of mysqli_stmt_execute.
Notes
Note
mysqli_execute is deprecated and will be removed.
See Also
mysqli_stmt_execute
21.11.2.12.10. mysqli_fetch
Copyright 1997-2008 the PHP Documentation Group.
mysqli_fetch
Alias for mysqli_stmt_fetch
Description
This function is an alias of mysqli_stmt_fetch.
Notes
Note
mysqli_fetch is deprecated and will be removed.
See Also
mysqli_stmt_fetch
21.11.2.12.11. mysqli_get_metadata
Copyright 1997-2008 the PHP Documentation Group.
mysqli_get_metadata
Alias for mysqli_stmt_result_metadata
Description
This function is an alias of mysqli_stmt_result_metadata.
Notes
Note
Connectors and APIs
2653
mysqli_get_metadata is deprecated and will be removed.
See Also
mysqli_stmt_result_metadata
21.11.2.12.12. mysqli_master_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli_master_query
Enforce execution of a query on the master in a master/slave setup
Description
bool mysqli_master_query(mysqli link,
string query);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.13. mysqli_param_count
Copyright 1997-2008 the PHP Documentation Group.
mysqli_param_count
Alias for mysqli_stmt_param_count
Description
This function is an alias of mysqli_stmt_param_count.
Notes
Note
mysqli_param_count is deprecated and will be removed.
See Also
mysqli_stmt_param_count
21.11.2.12.14. mysqli_report
Copyright 1997-2008 the PHP Documentation Group.
mysqli_report
Enables or disables internal report functions
Description
Connectors and APIs
2654
bool mysqli_report(int flags);
mysqli_report is a powerful function to improve your queries and code during development and testing phase. Depending on the
flags it reports errors from mysqli function calls or queries which don't use an index (or use a bad index).
Parameters
flags
Table 21.17. Supported flags
Name Description
MYSQLI_REPORT_OFF Turns reporting off
MYSQLI_REPORT_ERROR Report errors from mysqli function calls
MYSQLI_REPORT_STRICT Report warnings from mysqli function calls
MYSQLI_REPORT_INDEX Report if no index or bad index was used in a query
MYSQLI_REPORT_ALL Set all options (report all)
Return Values
Returns TRUE on success or FALSE on failure.
Examples
Example 21.200. Object oriented style
<?php
/* activate reporting */
mysqli_report(MYSQLI_REPORT_ALL);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* this query should report an error */
$result = $mysqli->query("SELECT Name FROM Nonexistingtable WHERE population > 50000");
/* this query should report a warning */
$result = $mysqli->query("SELECT Name FROM City WHERE population > 50000");
$result->close();
$mysqli->close();
?>
See Also
mysqli_debug
mysqli_dump_debug_info
21.11.2.12.15. mysqli_rpl_parse_enabled
Copyright 1997-2008 the PHP Documentation Group.
Connectors and APIs
2655
mysqli_rpl_parse_enabled
Check if RPL parse is enabled
Description
int mysqli_rpl_parse_enabled(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.16. mysqli_rpl_probe
Copyright 1997-2008 the PHP Documentation Group.
mysqli_rpl_probe
RPL probe
Description
bool mysqli_rpl_probe(mysqli link);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.17. mysqli_rpl_query_type, mysqli->rpl_query_type
Copyright 1997-2008 the PHP Documentation Group.
mysqli_rpl_query_type
mysqli->rpl_query_type
Returns RPL query type
Description
Procedural style:
int mysqli_rpl_query_type(mysqli link,
string query);
Object oriented style (method)
mysqli {
int rpl_query_type(string query);
}
Connectors and APIs
2656
Returns MYSQLI_RPL_MASTER , MYSQLI_RPL_SLAVE or MYSQLI_RPL_ADMIN depending on a query type. INSERT, UPDATE
and similar are master queries, SELECT is slave, and FLUSH, REPAIR and similar are admin.
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.18. mysqli_send_long_data
Copyright 1997-2008 the PHP Documentation Group.
mysqli_send_long_data
Alias for mysqli_stmt_send_long_data
Description
This function is an alias of mysqli_stmt_send_long_data.
Notes
Note
mysqli_send_long_data is deprecated and will be removed.
See Also
mysqli_stmt_send_long_data
21.11.2.12.19. mysqli_send_query, mysqli->send_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli_send_query
mysqli->send_query
Send the query and return
Description
Procedural style:
bool mysqli_send_query(mysqli link,
string query);
Object oriented style (method)
mysqli {
bool send_query(string query);
}
Warning
This function is currently not documented; only its argument list is available.
Connectors and APIs
2657
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.2.12.20. mysqli_set_opt
Copyright 1997-2008 the PHP Documentation Group.
mysqli_set_opt
Alias of mysqli_options
Description
This function is an alias of mysqli_options.
21.11.2.12.21. mysqli_slave_query
Copyright 1997-2008 the PHP Documentation Group.
mysqli_slave_query
Force execution of a query on a slave in a master/slave setup
Description
bool mysqli_slave_query(mysqli link,
string query);
Warning
This function is currently not documented; only its argument list is available.
Warning
This function has been DEPRECATED and REMOVED as of PHP 5.3.0.
21.11.3. MySQL Functions (PDO_MYSQL)
Copyright 1997-2008 the PHP Documentation Group.
PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x
databases.
PDO_MYSQL will take advantage of native prepared statement support present in MySQL 4.1 and higher. If you're using an older ver-
sion of the mysql client libraries, PDO will emulate them for you.
Warning
Beware: Some MySQL table types (storage engines) do not support transactions. When writing transactional database
code using a table type that does not support transactions, MySQL will pretend that a transaction was initiated success-
fully. In addition, any DDL queries issued will implicitly commit any pending transactions.
The constants below are defined by this driver, and will only be available when the extension has been either compiled into PHP or dy-
namically loaded at runtime. In addition, these driver-specific constants should only be used if you are using this driver. Using mysql-
specific attributes with the postgres driver may result in unexpected behaviour. PDO::getAttribute may be used to obtain the
PDO_ATTR_DRIVER_NAME attribute to check the driver, if your code can run against multiple drivers.
PDO::MYSQL_ATTR_USE_BUFF
ERED_QUERY (integer)
If this attribute is set to TRUE on a PDOStatement, the MySQL driver will use the buffered
versions of the MySQL API. If you're writing portable code, you should use PDOState-
Connectors and APIs
2658
ment::fetchAll instead.
Example 21.201. Forcing queries to be buffered in mysql
<?php
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
$stmt = $db->prepare('select * from foo',
array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
} else {
die("my application only works with mysql; I should use \$stmt->fetchAll() instead");
}
?>
PDO::MYSQL_ATTR_LOCAL_IN
FILE (integer)
Enable LOAD LOCAL INFILE.
PDO::MYSQL_ATTR_INIT_COM
MAND (integer)
Command to execute when connecting to the MySQL server. Will automatically be re-executed
when reconnecting.
PDO::MYSQL_ATTR_READ_DEF
AULT_FILE (integer)
Read options from the named option file instead of from my.cnf.
PDO::MYSQL_ATTR_READ_DEF
AULT_GROUP (integer)
Read options from the named group from my.cnf or the file specified with
MYSQL_READ_DEFAULT_FILE .
PDO::MYSQL_ATTR_MAX_BUFF
ER_SIZE (integer)
Maximum buffer size. Defaults to 1 MiB.
PDO::MYSQL_ATTR_DIRECT_Q
UERY (integer)
Perform direct queries, don't use prepared statements.
21.11.3.1. PDO_MYSQL DSN
Copyright 1997-2008 the PHP Documentation Group.
PDO_MYSQL DSN
Connecting to MySQL databases
Description
The PDO_MYSQL Data Source Name (DSN) is composed of the following elements:
DSN prefix The DSN prefix is mysql:.
host The hostname on which the database server resides.
port The port number where the database server is listening.
dbname The name of the database.
unix_socket The MySQL Unix socket (shouldn't be used with host or port).
Examples
Example 21.202. PDO_MYSQL DSN examples
The following example shows a PDO_MYSQL DSN for connecting to MySQL databases:
Connectors and APIs
2659
mysql:host=localhost;dbname=testdb
More complete examples:
mysql:host=localhost;port=3307;dbname=testdb
mysql:unix_socket=/tmp/mysql.sock;dbname=testdb
21.11.4. Connector/PHP
The MySQL Connector/PHP is a version of the mysql and mysqli extensions for PHP optimized for the Windows operating system.
Later versions of the main PHP mysql/mysqli drivers are compatible with Windows and a separate, Windows specific driver is no
longer required.
For PHP for all platforms, including Windows, you should use the mysql or mysqli extensions shipped with the PHP sources. See
Section 21.11, MySQL PHP API.
21.11.5. Common Problems with MySQL and PHP
Error: Maximum Execution Time Exceeded: This is a PHP limit; go into the php.ini file and set the maximum exe-
cution time up from 30 seconds to something higher, as needed. It is also not a bad idea to double the RAM allowed per script to
16MB instead of 8MB.
Fatal error: Call to unsupported or undefined function mysql_connect() in ...: This means that
your PHP version isn't compiled with MySQL support. You can either compile a dynamic MySQL module and load it into PHP or
recompile PHP with built-in MySQL support. This process is described in detail in the PHP manual.
Error: Undefined reference to 'uncompress': This means that the client library is compiled with support for a
compressed client/server protocol. The fix is to add -lz last when linking with -lmysqlclient.
Error: Client does not support authentication protocol: This is most often encountered when trying to use
the older mysql extension with MySQL 4.1.1 and later. Possible solutions are: downgrade to MySQL 4.0; switch to PHP 5 and the
newer mysqli extension; or configure the MySQL server with --old-passwords. (See Section B.1.2.4, Client does
not support authentication protocol, for more information.)
Those with PHP4 legacy code can make use of a compatibility layer for the old and new MySQL libraries, such as this one: ht-
tp://www.coggeshall.org/oss/mysql2i.
21.11.6. Enabling Both mysql and mysqli in PHP
If you're experiencing problems with enabling both the mysql and the mysqli extension when building PHP on Linux yourself, you
should try the following procedure.
1. Configure PHP like this:
./configure --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr
2. Edit the Makefile and search for a line that starts with EXTRA_LIBS. It might look like this (all on one line):
EXTRA_LIBS = -lcrypt -lcrypt -lmysqlclient -lz -lresolv -lm -ldl -lnsl
-lxml2 -lz -lm -lxml2 -lz -lm -lmysqlclient -lz -lcrypt -lnsl -lm
-lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lcrypt
Remove all duplicates, so that the line looks like this (all on one line):
EXTRA_LIBS = -lcrypt -lcrypt -lmysqlclient -lz -lresolv -lm -ldl -lnsl
-lxml2
Connectors and APIs
2660
3. Build and install PHP:
make
make install
MySQL Enterprise
MySQL Enterprise subscribers will find more information about the mysqli extension in the Knowledge Base art-
icles found at mysqli. Access to the MySQL Knowledge Base collection of articles is one of the advantages of
subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.12. MySQL Perl API
The Perl DBI module provides a generic interface for database access. You can write a DBI script that works with many different data-
base engines without change. To use DBI, you must install the DBI module, as well as a DataBase Driver (DBD) module for each type
of server you want to access. For MySQL, this driver is the DBD::mysql module.
Perl DBI is the recommended Perl interface. It replaces an older interface called mysqlperl, which should be considered obsolete.
Installation instructions for Perl DBI support are given in Section 2.15, Perl Installation Notes.
DBI information is available at the command line, online, or in printed form:
Once you have the DBI and DBD::mysql modules installed, you can get information about them at the command line with the
perldoc command:
shell> perldoc DBI
shell> perldoc DBI::FAQ
shell> perldoc DBD::mysql
You can also use pod2man, pod2html, and so forth to translate this information into other formats.
For online information about Perl DBI, visit the DBI Web site, http://dbi.perl.org/. That site hosts a general DBI mailing list. Sun
Microsystems, Inc. hosts a list specifically about DBD::mysql; see Section 1.5.1, MySQL Mailing Lists.
For printed information, the official DBI book is Programming the Perl DBI (Alligator Descartes and Tim Bunce, O'Reilly & Asso-
ciates, 2000). Information about the book is available at the DBI Web site, http://dbi.perl.org/.
For information that focuses specifically on using DBI with MySQL, see MySQL and Perl for the Web (Paul DuBois, New Riders,
2001). This book's Web site is http://www.kitebird.com/mysql-perl/.
21.13. MySQL C++ API
MySQL++ is a MySQL API for C++. Warren Young has taken over this project. More information can be found at ht-
tp://tangentsoft.net/mysql++/doc.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about using C++ with the MySQL API in the MySQL
Knowledge Base. articles found at C++. Access to the MySQL Knowledge Base collection of articles is one of
the advantages of subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.14. MySQL Python API
MySQLdb provides MySQL support for Python, compliant with the Python DB API version 2.0. It can be found at ht-
tp://sourceforge.net/projects/mysql-python/.
MySQL Enterprise
MySQL Enterprise subscribers will find more information about using Python with the MySQL API in the MySQL
Knowledge Base articles found at Python. Access to the MySQL Knowledge Base collection of articles is one of
Connectors and APIs
2661
the advantages of subscribing to MySQL Enterprise. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
21.15. MySQL Ruby APIs
Two APIs available for Ruby programmers. The MySQL/Ruby API is based on the libmysql API library. The Ruby/MySQL API is
written to use the native MySQL network protocol (a native driver).
For more information on Ruby, see Ruby Programming Language.
For information on installing and using the MySQL/Ruby API, see Section 21.15.1, The MySQL/Ruby API.
For information on installing and using the Ruby/MySQL API, see Section 21.15.2, The Ruby/MySQL API.
21.15.1. The MySQL/Ruby API
The MySQL/Ruby module provides access to MySQL databases using Ruby through libmysql.
For information on installing the module, and the functions exposed, see MySQL/Ruby.
21.15.2. The Ruby/MySQL API
The Ruby/MySQL module provides access to MySQL databases using Ruby through a native driver interface using the MySQL net-
work protocol.
For information on installing the module, and the functions exposed, see Ruby/MySQL.
21.16. MySQL Tcl API
MySQLtcl is a simple API for accessing a MySQL database server from the Tcl programming language. It can be found at ht-
tp://www.xdobry.de/mysqltcl/.
21.17. MySQL Eiffel Wrapper
Eiffel MySQL is an interface to the MySQL database server using the Eiffel programming language, written by Michael Ravits. It can
be found at http://efsa.sourceforge.net/archive/ravits/mysql.htm.
Connectors and APIs
2662
Chapter 22. Extending MySQL
22.1. MySQL Internals
This chapter describes a lot of things that you need to know when working on the MySQL code. If you plan to contribute to MySQL de-
velopment, want to have access to the bleeding-edge versions of the code, or just want to keep track of development, follow the instruc-
tions in Section 2.10.3, Installing from the Development Source Tree. If you are interested in MySQL internals, you should also sub-
scribe to our internals mailing list. This list has relatively low traffic. For details on how to subscribe, please see Section 1.5.1,
MySQL Mailing Lists. All developers at MySQL AB are on the internals list and we help other people who are working on the
MySQL code. Feel free to use this list both to ask questions about the code and to send patches that you would like to contribute to the
MySQL project!
22.1.1. MySQL Threads
The MySQL server creates the following threads:
Connection manager threads handle client connection requests on the network interfaces that the server listens to. On all platforms,
one manager thread handles TCP/IP connection requests. On Unix, this manager thread also handles Unix socket file connection re-
quests. On Windows, a manager thread handles shared-memory connection requests, and another handles named-pipe connection re-
quests. The server does not create threads to handle interfaces that it does not listen to. For example, a Windows server that does not
have support for named-pipe connections enabled does not create a thread to handle them.
Connection manager threads associate each client connection with a thread dedicated to it that handles authentication and request
processing for that connection. Manager threads create a new thread when necessary but try to avoid doing so by consulting the
thread cache first to see whether it contains a thread that can be used for the connection. When a connection ends, its thread is re-
turned to the thread cache if the cache is not full.
For information about tuning the parameters that control thread resources, see Section 7.5.7, How MySQL Uses Threads for Client
Connections.
On a master replication server, connections from slave servers are handled like client connections: There is one thread per connected
slave.
On a slave replication server, an I/O thread is started to connect to the master server and read updates from it. An SQL thread is star-
ted to apply updates read from the master. These two threads run independently and can be started and stopped independently.
A signal thread handles all signals. This thread also normally handles alarms and calls process_alarm() to force timeouts on
connections that have been idle too long.
If InnoDB is used, there will be 4 additional threads by default. Those are file I/O threads, controlled by the in-
nodb_file_io_threads parameter. See Section 13.6.3, InnoDB Startup Options and System Variables.
If mysqld is compiled with -DUSE_ALARM_THREAD, a dedicated thread that handles alarms is created. This is only used on
some systems where there are problems with sigwait() or if you want to use the thr_alarm() code in your application
without a dedicated signal handling thread.
If the server is started with the --flush_time=val option, a dedicated thread is created to flush all tables every val seconds.
Each table for which INSERT DELAYED statements are issued gets its own thread. See Section 12.2.5.2, INSERT DELAYED
Syntax.
If the event scheduler is active, there is one thread for the scheduler, and a thread for each event currently running. See Sec-
tion 19.4.1, Event Scheduler Overview.
mysqladmin processlist only shows the connection, INSERT DELAYED, replication, and event threads.
MySQL Enterprise
For expert advice on thread management subscribe to the MySQL Enterprise Monitor. For more information,
see http://www.mysql.com/products/enterprise/advisors.html.
22.1.2. MySQL Test Suite
2663
The test system that is included in Unix source and binary distributions makes it possible for users and developers to perform regression
tests on the MySQL code. These tests can be run on Unix.
You can also write your own test cases. For information about the MySQL Test Framework, including system requirements, see the
manual available at http://dev.mysql.com/doc/.
The current set of test cases doesn't test everything in MySQL, but it should catch most obvious bugs in the SQL processing code, oper-
ating system or library issues, and is quite thorough in testing replication. Our goal is to have the tests cover 100% of the code. We wel-
come contributions to our test suite. You may especially want to contribute tests that examine the functionality critical to your system
because this ensures that all future MySQL releases work well with your applications.
The test system consists of a test language interpreter (mysqltest), a Perl script to run all tests (mysql-test-run.pl), the actual
test cases written in a special test language, and their expected results. To run the test suite on your system after a build, type make
test from the source root directory, or change location to the mysql-test directory and type ./mysql-test-run.pl. If you
have installed a binary distribution, change location to the mysql-test directory under the installation root directory (for example, /
usr/local/mysql/mysql-test), and run ./mysql-test-run.pl. All tests should succeed. If any do not, feel free to try to
find out why and report the problem if it indicates a bug in MySQL. See Section 1.6, How to Report Bugs or Problems.
If one test fails, you should run mysql-test-run.pl with the --force option to check whether any other tests fail.
If you have a copy of mysqld running on the machine where you want to run the test suite, you do not have to stop it, as long as it is
not using ports 9306 or 9307. If either of those ports is taken, you should set the MTR_BUILD_THREAD environment variable to an
appropriate value, and the test suite will use a different set of ports for master, slave, NDB, and Instance Manager). For example:
shell> export MTR_BUILD_THREAD=31
shell> ./mysql-test-run.pl [options] [test_name]
In the mysql-test directory, you can run an individual test case with ./mysql-test-run.pl test_name.
If you have a question about the test suite, or have a test case to contribute, send an email message to the MySQL internals mailing
list. See Section 1.5.1, MySQL Mailing Lists. This list does not accept attachments, so you should FTP all the relevant files to:
ftp://ftp.mysql.com/pub/mysql/upload/
22.2. The MySQL Plugin Interface
MySQL 5.1 and up supports a plugin API that allows the loading and unloading of server components at runtime, without restarting the
server. The components supported by this operation include, but are not limited to, full-text parser plugins, storage-engines and server
extensions. In MySQL 5.1, the storage engines can be included in the server as oplugins.
Full-text parser plugins can be used to replace or augment the built-in full-text parser. For example, a plugin can parse text into words
using rules that differ from those used by the built-in parser. This can be useful if you need to parse text with characteristics different
from those expected by the built-in parser.
The plugin interface is intended as the successor to the older user-defined function (UDF) interface. The plugin interface eventually will
include an API for creating UDFs, and it is intended this plugin UDF API will replace the older nonplugin UDF API. After that point, it
will be possible for UDFs to be revised for use as plugin UDFs so that they can take advantage of the better security and versioning cap-
abilities of the plugin API. Eventually, support for the older UDF API will be phased out.
The plugin interface requires the plugin table in the mysql database. This table is created as part of the MySQL installation process.
If you are upgrading from a version older than MySQL 5.1, you should run the mysql_upgrade command to create this table. See
Section 4.4.8, mysql_upgrade Check Tables for MySQL Upgrade.
For more information on the Plugin API and how it can be used with storage engines, see MySQL Internals: Custom Engine.
22.2.1. Characteristics of the Plugin Interface
In some respects, the plugin API is similar to the older user-defined function (UDF) API that it supersedes, but the plugin API has sev-
eral advantages over the older interface:
The plugin framework is extendable to accommodate different kinds of plugins.
Some aspects of the plugin API are common to all types of plugins, but the API also allows for type-specific interface elements so
that different types of plugins can be created. A plugin with one purpose can have an interface most appropriate to its own require-
Extending MySQL
2664
ments and not the requirements of some other plugin type.
Although only the interface for full-text parser plugins is implemented currently, others can be added, such as an interface for UDF
plugins.
The plugin API includes versioning information.
The version information included in the plugin API enables a plugin library and each plugin that it contains to be self-identifying
with respect to the API version that was used to build the library. If the API changes over time, the version numbers will change, but
a server can examine a given plugin library's version information to determine whether it supports the plugins in the library.
There are two types of version numbers. The first is the version for the general plugin framework itself. Each plugin library includes
this kind of version number. The second type of version applies to individual plugins. Each specific type of plugin has a version for
its interface, so each plugin in a library has a type-specific version number. For example, library containing a full-text parsing plugin
has a general plugin API version number, and the plugin has a version number specific to the full-text plugin interface.
Plugin security is improved relative to the UDF interface.
The older interface for writing nonplugin UDFs allowed libraries to be loaded from any directory searched by the system's dynamic
linker, and the symbols that identified the UDF library were relatively nonspecific. The newer rules are more strict. A plugin library
must be installed in a specific dedicated directory for which the location is controlled by the server and cannot be changed at
runtime. Also, the library must contain specific symbols that identify it as a plugin library. The server will not load something as a
plugin if it was not built as a plugin.
The newer plugin interface eliminates the security issues of the older UDF interface. When a UDF plugin type is implemented, that
will allow nonplugin UDFs to be brought into the plugin framework and the older interface to be phased out.
The plugin implementation includes the following components:
Source files (the locations given indicate where the files are found in a MySQL source distribution):
include/mysql/plugin.h exposes the public plugin API. This file should be examined by anyone who wants to write a plu-
gin library.
sql/sql_plugin.h and sql/sql_plugin.cc comprise the internal plugin implementation. These files need not be consul-
ted by plugin writers. They may be of interest for those who want to know more about how the server handles plugins.
System table:
The plugin table in the mysql database lists each installed plugin and is required for plugin use. For new MySQL installations,
this table is created during the installation process. If you are upgrading from a version older than MySQL 5.1, you should run
mysql_upgrade to update your system tables and create the plugin table (see Section 4.4.8, mysql_upgrade Check
Tables for MySQL Upgrade).
SQL statements:
INSTALL PLUGIN registers a plugin in the plugin table and loads the plugin code.
UNINSTALL PLUGIN unregisters a plugin from the plugin table and unloads the plugin code.
The WITH PARSER clause for full-text index creation associates a full-text parser plugin with a given FULLTEXT index.
SHOW PLUGINS displays information about known plugins. The PLUGINS table in INFORMATION_SCHEMA also contains plu-
gin information.
System variable:
plugin_dir indicates the location of the directory where all plugins must be installed. The value of this variable can be specified
Extending MySQL
2665
at server startup with a --plugin_dir=path option.
22.2.2. Full-Text Parser Plugins
MySQL has a built-in parser that it uses by default for full-text operations (parsing text to be indexed, or parsing a query string to de-
termine the terms to be used for a search). For full-text processing, parsing means extracting words from text or a query string based
on rules that define which character sequences make up a word and where word boundaries lie.
When parsing for indexing purposes, the parser passes each word to the server, which adds it to a full-text index. When parsing a query
string, the parser passes each word to the server, which accumulates the words for use in a search.
The parsing properties of the built-in full-text parser are described in Section 11.8, Full-Text Search Functions. These properties in-
clude rules for determining how to extract words from text. The parser is influenced by certain system variables such as
ft_min_word_len and ft_max_word_len that cause words shorter or longer to be excluded, and by the stopword list that identi-
fies common words to be ignored.
The plugin API enables you to provide a full-text parser of your own so that you have control over the basic duties of a parser. A parser
plugin can operate in either of two roles:
The plugin can replace the built-in parser. In this role, the plugin reads the input to be parsed, splits it up into words, and passes the
words to the server (either for indexing or for word accumulation).
One reason to use a parser this way is that you need to use different rules from those of the built-in parser for determining how to
split up input into words. For example, the built-in parser considers the text case-sensitive to consist of two words case and
sensitive, whereas an application might need to treat the text as a single word.
The plugin can act in conjunction with the built-in parser by serving as a front end for it. In this role, the plugin extracts text from
the input and passes the text to the parser, which splits up the text into words using its normal parsing rules. In particular, this pars-
ing will be affected by the ft_xxx system variables and the stopword list.
One reason to use a parser this way is that you need to index content such as PDF documents, XML documents, or .doc files. The
built-in parser is not intended for those types of input but a plugin can pull out the text from these input sources and pass it to the
built-in parser.
It is also possible for a parser plugin to operate in both roles. That is, it could extract text from nonplaintext input (the front end role),
and also parse the text into words (thus replacing the built-in parser).
A full-text plugin is associated with full-text indexes on a per-index basis. That is, when you install a parser plugin initially, that does
not cause it to be used for any full-text operations. It simply becomes available. For example, a full-text parser plugin becomes available
to be named in a WITH PARSER clause when creating individual FULLTEXT indexes. To create such an index at table-creation time,
do this:
CREATE TABLE t
(
doc CHAR(255),
FULLTEXT INDEX (doc) WITH PARSER my_parser
);
Or you can add the index after the table has been created:
ALTER TABLE t ADD FULLTEXT INDEX (doc) WITH PARSER my_parser;
The only SQL change for associating the parser with the index is the WITH PARSER clause. Searches are specified as before, with no
changes needed for queries.
When you associate a parser plugin with a FULLTEXT index, the plugin is required for using the index. If the parser plugin is dropped,
any index associated with it becomes unusable. Any attempt to use it a table for which a plugin is not available results in an error, al-
though DROP TABLE is still possible.
22.2.3. Writing Plugins
This section describes the general and type-specific parts of the plugin API. It also provides a step-by-step guide to creating a plugin lib-
Extending MySQL
2666
rary. For example plugin source code, see the plugin/fulltext directory of a MySQL source distribution.
You can write plugins in C or C++ (or another language that can use C calling conventions). Plugins are loaded and unloaded dynamic-
ally, so your operating system must support dynamic loading and you must have compiled mysqld dynamically (not statically).
A plugin contains code that becomes part of the running server, so when you write a plugin, you are bound by any and all constraints
that otherwise apply to writing server code. For example, you may have problems if you attempt to use functions from the libstdc++
library. These constraints may change in future versions of the server, so it is possible that server upgrades will require revisions to plu-
gins that were originally written for older servers. For information about these constraints, see Section 2.10.2, Typical configure
Options, and Section 2.10.4, Dealing with Problems Compiling MySQL.
22.2.3.1. General Plugin Structures and Functions
Every plugin must have a general plugin declaration. The declaration corresponds to the st_mysql_plugin structure in the plu-
gin.h file:
struct st_mysql_plugin
{
int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
void *info; /* pointer to type-specific plugin descriptor */
const char *name; /* plugin name */
const char *author; /* plugin author (for SHOW PLUGINS) */
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
int (*init)(void *); /* the function to invoke when plugin is loaded */
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
unsigned int version; /* plugin version (for SHOW PLUGINS) */
struct st_mysql_show_var *status_vars;
void * __reserved1; /* placeholder for system variables */
void * __reserved2; /* placeholder for config options */
};
The st_mysql_plugin structure is common to every type of plugin. Its members should be filled in as follows:
type
The plugin type. This must be one of the plugin-type values from plugin.h. For a full-text parser plugin, the type value is
MYSQL_FTPARSER_PLUGIN.
info
A pointer to the descriptor for the plugin. Unlike the general plugin declaration structure, this descriptor's structure depends on the
particular type of plugin. Each descriptor has a version number that indicates the API version for that type of plugin, plus any other
members needed. The descriptor for full-text plugins is described in Section 22.2.3.2, Type-Specific Plugin Structures and Func-
tions.
name
The plugin name. This is the name that will be listed in the plugin table and by which you refer to the plugin in SQL statements
such as INSTALL PLUGIN and UNINSTALL PLUGIN.
author
The plugin author. This can be whatever you like.
desc
A general description of the plugin. This can be whatever you like.
license
The plugin license type. The value can be one of PLUGIN_LICENSE_PROPRIETARY, PLUGIN_LICENSE_GPL, or PLU-
GIN_LICENSE_BSD.
init
A once-only initialization function. This is executed when the plugin is loaded, which happens for INSTALL PLUGIN or, for plu-
gins listed in the plugin table, at server startup. The function takes no arguments. It returns zero for success and nonzero for fail-
Extending MySQL
2667
ure. If an init function is unneeded for a plugin, it can be specified as 0.
deinit
A once-only deinitialization function. This is executed when the plugin is unloaded, which happens for UNINSTALL PLUGIN or,
for plugins listed in the plugin table, at server shutdown. The function takes no arguments. It returns zero for success and nonzero
for failure. If a deinit function is unneeded for a plugin, it can be specified as 0.
version
The plugin version number. When the plugin is installed, this value can be retrieved from the INFORMATION_SCHEMA.PLUGINS
table. The value includes major and minor numbers. If you write the value as a hex constant, the format is 0xMMNN, where MM and
NN are the major and minor numbers, respectively. For example, 0x0302 represents version 3.2.
status_vars
A pointer to a structure for status variables associated with the plugin, or 0 if there are no such variables. When the plugin is in-
stalled, these variables are displayed in the output of the SHOW STATUS statement.
__reserved1, __reserved2
These are placeholders for the future. Currently, they should be set to NULL.
The init and deinit functions in the general plugin declaration are invoked only when loading and unloading the plugin. They have
nothing to do with use of the plugin such as happens when an SQL statement causes the plugin to be invoked.
The status_vars member, if not 0, points to an array of st_mysql_show_var structures, each of which describes one status
variable, followed by a structure with all members set to 0. The st_mysql_show_var structure has this definition:
struct st_mysql_show_var {
const char *name;
char *value;
enum enum_mysql_show_type type;
};
When the plugin is installed, the plugin name and the name value are joined with an underscore to form the name displayed by SHOW
STATUS.
The following table shows the allowable status variable type values and what the corresponding variable should be.
Type Meaning
SHOW_BOOL Pointer to a boolean variable
SHOW_INT Pointer to an integer variable
SHOW_LONG Pointer to a long integer variable
SHOW_LONGLONG Pointer to a longlong integer variable
SHOW_CHAR A string
SHOW_CHAR_PTR Pointer to a string
SHOW_ARRAY Pointer to another st_mysql_show_var array
SHOW_FUNC Pointer to a function
For the SHOW_FUNC type, the function is called and fills in its out parameter, which then provides information about the variable to be
displayed. The function has this signature:
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
typedef int (*mysql_show_var_func) (void *thd,
struct st_mysql_show_var *out,
char *buf);
Plugins should consider the thd parameter to be read only.
Extending MySQL
2668
22.2.3.2. Type-Specific Plugin Structures and Functions
In the st_mysql_plugin structure that defines a plugin's general declaration, the info member points to a type-specific plugin
descriptor. For a full-text parser plugin, the descriptor corresponds to the st_mysql_ftparser structure in the plugin.h file:
struct st_mysql_ftparser
{
int interface_version;
int (*parse)(MYSQL_FTPARSER_PARAM *param);
int (*init)(MYSQL_FTPARSER_PARAM *param);
int (*deinit)(MYSQL_FTPARSER_PARAM *param);
};
As shown by the structure definition, the descriptor has a version number (MYSQL_FTPARSER_INTERFACE_VERSION for full-text
parser plugins) and contains pointers to three functions. The init and deinit members should point to a function or be set to 0 if the
function is not needed. The parse member must point to the function that performs the parsing.
A full-text parser plugin is used in two different contexts, indexing and searching. In both contexts, the server calls the initialization and
deinitialization functions at the beginning and end of processing each SQL statement that causes the plugin to be invoked. However,
during statement processing, the server calls the main parsing function in context-specific fashion:
For indexing, the server calls the parser for each column value to be indexed.
For searching, the server calls the parser to parse the search string. The parser might also be called for rows processed by the state-
ment. In natural language mode, there is no need for the server to call the parser. For boolean mode phrase searches or natural lan-
guage searches with query expansion, the parser is used to parse column values for information that is not in the index. Also, if a
boolean mode search is done for a column that has no FULLTEXT index, the built-in parser will be called. (Plugins are associated
with specific indexes. If there is no index, no plugin is used.)
Note that the plugin declaration in the plugin library descriptor has initialization and deinitialization functions, and so does the plugin
descriptor to which it points. These pairs of functions have different purposes and are invoked for different reasons:
For the plugin declaration in the plugin library descriptor, the initialization and deinitialization functions are invoked when the plu-
gin is loaded and unloaded.
For the plugin descriptor, the initialization and deinitialization functions are invoked per SQL statement for which the plugin is
used.
Each interface function named in the plugin descriptor should return zero for success or nonzero for failure, and each of them receives
an argument that points to a MYSQL_FTPARSER_PARAM structure containing the parsing context. The structure has this definition:
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
char *doc, int doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
char *word, int word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
char *doc;
int length;
int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
Note
The definition shown is current as of MySQL 5.1.12. It is incompatible with versions of MySQL 5.1 older than 5.1.12.
The structure members are used as follows:
mysql_parse
Extending MySQL
2669
A pointer to a callback function that invokes the server's built-in parser. Use this callback when the plugin acts as a front end to the
built-in parser. That is, when the plugin parsing function is called, it should process the input to extract the text and pass the text to
the mysql_parse callback.
The first parameter for this callback function should be the param value itself:
param->mysql_parse(param, ...);
A front end plugin can extract text and pass it all at once to the built-in parser, or it can extract and pass text to the built-in parser a
piece at a time. However, in this case, the built-in parser treats the pieces of text as though there are implicit word breaks between
them.
mysql_add_word
A pointer to a callback function that adds a word to a full-text index or to the list of search terms. Use this callback when the parser
plugin replaces the built-in parser. That is, when the plugin parsing function is called, it should parse the input into words and in-
voke the mysql_add_word callback for each word.
The first parameter for this callback function should be the param value itself:
param->mysql_add_word(param, ...);
ftparser_state
This is a generic pointer. The plugin can set it to point to information to be used internally for its own purposes.
mysql_ftparam
This is set by the server. It is passed as the first argument to the mysql_parse or mysql_add_word callback.
cs
A pointer to information about the character set of the text, or 0 if no information is available.
doc
A pointer to the text to be parsed.
length
The length of the text to be parsed, in bytes.
flags
Parser flags. This is zero if there are no special flags. Currently, the only nonzero flag is MYSQL_FTFLAGS_NEED_COPY, which
means that mysql_add_word() must save a copy of the word (that is, it cannot use a pointer to the word because the word is in a
buffer that will be overwritten.) This member was added in MySQL 5.1.12.
This flag might be set or reset by MySQL before calling the parser plugin, by the parser plugin itself, or by the mysql_parse()
function.
mode
The parsing mode. This value will be one of the folowing constants:
MYSQL_FTPARSER_SIMPLE_MODE
Parse in fast and simple mode, which is used for indexing and for natural language queries. The parser should pass to the server
only those words that should be indexed. If the parser uses length limits or a stopword list to determine which words to ignore, it
should not pass such words to the server.
MYSQL_FTPARSER_WITH_STOPWORDS
Parse in stopword mode. This is used in boolean searches for phrase matching. The parser should pass all words to the server,
Extending MySQL
2670
even stopwords or words that are outside any normal length limits.
MYSQL_FTPARSER_FULL_BOOLEAN_INFO
Parse in boolean mode. This is used for parsing boolean query strings. The parser should recognize not only words but also
boolean-mode operators and pass them to the server as tokens via the mysql_add_word callback. To tell the server what kind
of token is being passed, the plugin needs to fill in a MYSQL_FTPARSER_BOOLEAN_INFO structure and pass a pointer to it.
If the parser is called in boolean mode, the param->mode value will be MYSQL_FTPARSER_FULL_BOOLEAN_INFO. The
MYSQL_FTPARSER_BOOLEAN_INFO structure that the parser uses for passing token information to the server looks like this:
typedef struct st_mysql_ftparser_boolean_info
{
enum enum_ft_token_type type;
int yesno;
int weight_adjust;
bool wasign;
bool trunc;
/* These are parser state and must be removed. */
byte prev;
byte *quot;
} MYSQL_FTPARSER_BOOLEAN_INFO;
The parser should fill in the structure members as follows:
type
The token type. This should be one of values shown in the following table.
Type Meaning
FT_TOKEN_EOF End of data
FT_TOKEN_WORD A regular word
FT_TOKEN_LEFT_PAREN The beginning of a group or subexpression
FT_TOKEN_RIGHT_PAREN The end of a group or subexpression
FT_TOKEN_STOPWORD A stopword
yesno
Whether the word must be present for a match to occur. 0 means that the word is optional but increases the match relevance if it is
present. Values larger than 0 mean that the word must be present. Values smaller than 0 mean that the word must not be present.
weight_adjust
A weighting factor that determines how much a match for the word counts. It can be used to increase or decrease the word's import-
ance in relevance calculations. A value of zero indicates no weight adjustment. Values greater than or less than zero mean higher or
lower weight, respectively. The examples at Section 11.8.2, Boolean Full-Text Searches, that use the < and > operators illustrate
how weighting works.
wasign
The sign of the weighting factor. A negative value acts like the ~ boolean-search operator, which causes the word's contribution to
the relevance to be negative.
trunc
Whether matching should be done as if the boolean-mode * truncation operator had been given.
Plugins should not use the prev and quot members of the MYSQL_FTPARSER_BOOLEAN_INFO structure.
Extending MySQL
2671
22.2.3.3. Creating a Plugin Library
This section provides a step-by-step procedure for creating a plugin library. It shows how to develop a library that contains a full-text
parsing plugin named simple_parser. This plugin performs parsing based on simpler rules than those used by the MySQL built-in
full-text parser: Words are nonempty runs of whitespace characters.
Each plugin library has the following contents:
A plugin library descriptor that indicates the version number of the general plugin API that the library uses and that contains a gen-
eral declaration for each plugin in the library.
Each plugin general declaration contains information that is common to all types of plugin: A value that indicates the plugin type;
the plugin name, author, description, and license type; and pointers to the initialization and deinitialization functions that the server
invokes when it loads and unloads the plugin.
The plugin general declaration also contains a pointer to a type-specific plugin descriptor. The structure of these descriptors can vary
from one plugin type to another, because each type of plugin can have its own API. A plugin descriptor contains a type-specific API
version number and pointers to the functions that are needed to implement that plugin type. For example, a full-text parser plugin
has initialization and deinitialization functions, and a main parsing function. The server invokes these functions when it uses the plu-
gin to parse text.
The plugin library contains the interface functions that are referenced by the library descriptor and by the plugin descriptors.
The easiest way to follow the instructions in this section is to use the source code in the plugin/fulltext directory of a MySQL
source distribution. The instructions assume that you make a copy of that directory and use it to build the plugin library. To make a copy
of the directory, use the following commands, which assume that the MySQL source tree is in a directory named mysql-5.1 under
your current directory:
shell> mkdir fulltext_plugin
shell> cp mysql-5.1/plugin/fulltext/* fulltext_plugin
After copying the source files, use the following procedure to create a plugin library:
1. Change location into the fulltext_plugin directory:
shell> cd fulltext_plugin
2. The plugin source file should include the header files that the plugin library needs. The plugin.h file is required, and the library
might require other files as well. For example:
#include <stdlib.h>
#include <ctype.h>
#include <mysql/plugin.h>
3. Set up the plugin library file descriptor.
Every plugin library must include a library descriptor that must define two symbols:
_mysql_plugin_interface_version_ specifies the version number of the general plugin framework. This is given by
the MYSQL_PLUGIN_INTERFACE_VERSION symbol, which is defined in the plugin.h file.
_mysql_plugin_declarations_ defines an array of plugin declarations, terminated by a declaration with all members
set to 0. Each declaration is an instance of the st_mysql_plugin structure (also defined in plugin.h). There must be one
of these for each plugin in the library.
If the server does not find these two symbols in a library, it does not accept it as a legal plugin library and rejects it with an error.
This prevents use of a library for plugin purposes unless it was built specifically as a plugin library.
The standard (and most convenient) way to define the two required symbols is by using the mysql_declare_plugin and
mysql_declare_plugin_end macros from the plugin.h file:
mysql_declare_plugin
... one or more plugin declarations here ...
Extending MySQL
2672
mysql_declare_plugin_end;
For example, the library descriptor for a library that contains a single plugin named simple_parser looks like this:
mysql_declare_plugin
{
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
"simple_parser", /* name */
"MySQL AB", /* author */
"Simple Full-Text Parser", /* description */
PLUGIN_LICENSE_GPL, /* plugin license */
simple_parser_plugin_init, /* init function (when loaded) */
simple_parser_plugin_deinit,/* deinit function (when unloaded) */
0x0001, /* version */
simple_status /* status variables */
}
mysql_declare_plugin_end;
For a full-text parser plugin, the type must be MYSQL_FTPARSER_PLUGIN. This is the value that identifies the plugin as being
legal for use in a WITH PARSER clause when creating a FULLTEXT index. (No other plugin type is legal for this clause.)
The mysql_declare_plugin and mysql_declare_plugin_end macros are defined in plugin.h like this:
#ifndef MYSQL_DYNAMIC_PLUGIN
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \
int PSIZE= sizeof(struct st_mysql_plugin); \
struct st_mysql_plugin DECLS[]= {
#else
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
#endif
#define mysql_declare_plugin(NAME) \
__MYSQL_DECLARE_PLUGIN(NAME, \
builtin_ ## NAME ## _plugin_interface_version, \
builtin_ ## NAME ## _sizeof_struct_st_plugin, \
builtin_ ## NAME ## _plugin)
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0}}
One point to note about those definitions is that the _mysql_plugin_interface_version_ symbol is defined only if the
MYSQL_DYNAMIC_PLUGIN symbol is defined. This means that you'll need to provide -DMYSQL_DYNAMIC_PLUGIN as part of
the compilation command when you build the plugin.
When the macros are used as just shown, they expand to the following code, which defines both of the required symbols
(_mysql_plugin_interface_version_ and _mysql_plugin_declarations_):
int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION;
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
{
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
"simple_parser", /* name */
"MySQL AB", /* author */
"Simple Full-Text Parser", /* description */
PLUGIN_LICENSE_GPL, /* plugin license */
simple_parser_plugin_init, /* init function (when loaded) */
simple_parser_plugin_deinit,/* deinit function (when unloaded) */
0x0001, /* version */
simple_status /* status variables */
}
,{0,0,0,0,0,0,00,0}
};
The preceding example declares a single plugin in the library descriptor, but it is possible to declare multiple plugins. List the de-
clarations one after the other between mysql_declare_plugin and mysql_declare_plugin_end, separated by com-
mas.
MySQL plugins can be written in C or C++ (or another language that can use C calling conventions). One feature of C++ is that
you can use nonconstant variables to initialize global structures. However, if you write a C++ plugin, you should not use this fea-
ture. Members of structures such as the st_mysql_plugin structure should be initialized with constant variables. See the dis-
cussion at the end of this section that describes some legal and illegal initializers for plugins.
Extending MySQL
2673
4. Set up the plugin descriptor.
Each plugin declaration in the library descriptor points to a type-specific descriptor for the corresponding plugin. In the
simple_parser declaration, that descriptor is indicated by &simple_parser_descriptor. The descriptor specifies the
version number for the full-text plugin interface (as given by MYSQL_FTPARSER_INTERFACE_VERSION), and the plugin's
parsing, initialization, and deinitialization functions:
static struct st_mysql_ftparser simple_parser_descriptor=
{
MYSQL_FTPARSER_INTERFACE_VERSION, /* interface version */
simple_parser_parse, /* parsing function */
simple_parser_init, /* parser init function */
simple_parser_deinit /* parser deinit function */
};
5. Set up the plugin interface functions.
The general plugin declaration in the library descriptor names the initialization and deinitialization functions that the server should
invoke when it loads and unloads the plugin. For simple_parser, these functions do nothing but return zero to indicate that
they succeeded:
static int simple_parser_plugin_init(void)
{
return(0);
}
static int simple_parser_plugin_deinit(void)
{
return(0);
}
Because those functions do not actually do anything, you could omit them and specify 0 for each of them in the plugin declaration.
The type-specific plugin descriptor for simple_parser names the initialization, deinitialization, and parsing functions that the
server invokes when the plugin is used. For simple_parser, the initialization and deinitialization functions do nothing:
static int simple_parser_init(MYSQL_FTPARSER_PARAM *param)
{
return(0);
}
static int simple_parser_deinit(MYSQL_FTPARSER_PARAM *param)
{
return(0);
}
Here too, because those functions do nothing, you could omit them and specify 0 for each of them in the plugin descriptor.
The main parsing function, simple_parser_parse(), acts as a replacement for the built-in full-text parser, so it needs to split
text into words and pass each word to the server. The parsing function's first argument is a pointer to a structure that contains the
parsing context. This structure has a doc member that points to the text to be parsed, and a length member that indicates how
long the text is. The simple parsing done by the plugin considers nonempty runs of whitespace characters to be words, so it identi-
fies words like this:
static int simple_parser_parse(MYSQL_FTPARSER_PARAM *param)
{
char *end, *start, *docend= param->doc + param->length;
for (end= start= param->doc;; end++)
{
if (end == docend)
{
if (end > start)
add_word(param, start, end - start);
break;
}
else if (isspace(*end))
{
if (end > start)
add_word(param, start, end - start);
start= end + 1;
}
}
return(0);
}
Extending MySQL
2674
As the parser finds each word, it invokes a function add_word() to pass the word to the server. add_word() is a helper func-
tion only; it is not part of the plugin interface. The parser passes the parsing context pointer to add_word(), as well as a pointer
to the word and a length value:
static void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
{
MYSQL_FTPARSER_BOOLEAN_INFO bool_info=
{ FT_TOKEN_WORD, 0, 0, 0, 0, ' ', 0 };
param->mysql_add_word(param, word, len, &bool_info);
}
For boolean-mode parsing, add_word() fills in the members of the bool_info structure as described in Section 22.2.3.2,
Type-Specific Plugin Structures and Functions.
6. Set up the status variables, if there are any. For the simple_parser plugin, the following status variable array sets up one status
variable with a value that is static text, and another with a value that is stored in a long integer variable:
long number_of_calls= 0;
struct st_mysql_show_var simple_status[]=
{
{"static", (char *)"just a static text", SHOW_CHAR},
{"called", (char *)&number_of_calls, SHOW_LONG},
{0,0,0}
};
When the plugin is installed, the plugin name and the name value are joined with an underscore to form the name displayed by
SHOW STATUS. For the array just shown, the resulting status variable names are simple_parser_static and
simple_parser_called. This convention means that you can easily display the variables for a plugin using its name:
mysql> SHOW STATUS LIKE 'simple_parser%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| simple_parser_static | just a static text |
| simple_parser_called | 0 |
+----------------------+--------------------+
7. Compile the plugin library as a shared library and install it in the plugin directory.
Note
As mentioned earlier, be sure to specify -DMYSQL_DYNAMIC_PLUGIN as part of the compilation command when you
build the plugin.
The procedure for compiling shared objects varies from system to system. If you build your library using the GNU autotools,
libtool should be able to generate the correct compilation commands for your system. If the library is named mypluglib, you
should end up with a shared object file that has a name something like libmypluglib.so. (The file name might have a differ-
ent extension on your system.)
To use the autotools, you'll need to make a few changes to the configuration files at this point to enable the plugin to be compiled
and installed. Assume that your MySQL distribution is installed at a base directory of /usr/local/mysql and that its header
files are located in the include directory under the base directory.
Edit Makefile.am, which should look something like this:
#Makefile.am example for a plugin
pkglibdir=$(libdir)/mysql
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include
#noinst_LTLIBRARIES= mypluglib.la
pkglib_LTLIBRARIES= mypluglib.la
mypluglib_la_SOURCES= plugin_example.c
mypluglib_la_LDFLAGS= -module -rpath $(pkglibdir)
mypluglib_la_CFLAGS= -DMYSQL_DYNAMIC_PLUGIN
The mypluglib_la_CFLAGS line takes care of passing the -DMYSQL_DYNAMIC_PLUGIN flag to the compilation command.
Adjust the INCLUDES line to specify the path name to the installed MySQL header files. Edit it to look like this:
Extending MySQL
2675
INCLUDES= -I/usr/local/mysql/include
Make sure that the noinst_LTLIBRARIES line is commented out or remove it. Make sure that the pkglib_LTLIBRARIES
line is not commented out; it enables the make install command.
Set up the files needed for the configure command, invoke it, and run make:
shell> autoreconf --force --install --symlink
shell> ./configure --prefix=/usr/local/mysql
shell> make
The --prefix option to configure indicates the MySQL base directory under which the plugin should be installed. You can
see what value to use for this option with SHOW VARIABLES:
mysql> SHOW VARIABLES LIKE 'basedir';
+---------------+------------------+
| Variable_name | Value |
+---------------+------------------+
| base | /usr/local/mysql |
+---------------+------------------+
The location of the plugin directory where you should install the library is given by the plugin_dir system variable. For ex-
ample:
mysql> SHOW VARIABLES LIKE 'plugin_dir';
+---------------+-----------------------------------+
| Variable_name | Value |
+---------------+-----------------------------------+
| plugin_dir | /usr/local/mysql/lib/mysql/plugin |
+---------------+-----------------------------------+
To install the plugin library, use make:
shell> make install
Verify that make install installed the plugin library in the proper directory. After installing it, make sure that the library per-
missions allow it to be executed by the server.
8. Register the plugin with the server.
The INSTALL PLUGIN statement causes the server to list the plugin in the plugin table and to load the plugin code from the
library file. Use that statement to register simple_parser with the server, and then verify that the plugin is listed in the plu-
gin table:
mysql> INSTALL PLUGIN simple_parser SONAME 'libmypluglib.so';
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT * FROM mysql.plugin;
+---------------+-----------------+
| name | dl |
+---------------+-----------------+
| simple_parser | libmypluglib.so |
+---------------+-----------------+
1 row in set (0.00 sec)
9. Try the plugin.
Create a table that contains a string column and associate the parser plugin with a FULLTEXT index on the column:
mysql> CREATE TABLE t (c VARCHAR(255),
-> FULLTEXT (c) WITH PARSER simple_parser);
Query OK, 0 rows affected (0.01 sec)
Insert some text into the table and try some searches. These should verify that the parser plugin treats all nonwhitespace characters
as word characters:
mysql> INSERT INTO t VALUES
-> ('latin1_general_cs is a case-sensitive collation'),
-> ('I\'d like a case of oranges'),
Extending MySQL
2676
-> ('this is sensitive information'),
-> ('another row'),
-> ('yet another row');
Query OK, 5 rows affected (0.02 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> SELECT c FROM t;
+-------------------------------------------------+
| c |
+-------------------------------------------------+
| latin1_general_cs is a case-sensitive collation |
| I'd like a case of oranges |
| this is sensitive information |
| another row |
| yet another row |
+-------------------------------------------------+
5 rows in set (0.00 sec)
mysql> SELECT MATCH(c) AGAINST('case') FROM t;
+--------------------------+
| MATCH(c) AGAINST('case') |
+--------------------------+
| 0 |
| 1.2968142032623 |
| 0 |
| 0 |
| 0 |
+--------------------------+
5 rows in set (0.00 sec)
mysql> SELECT MATCH(c) AGAINST('sensitive') FROM t;
+-------------------------------+
| MATCH(c) AGAINST('sensitive') |
+-------------------------------+
| 0 |
| 0 |
| 1.3253291845322 |
| 0 |
| 0 |
+-------------------------------+
5 rows in set (0.01 sec)
mysql> SELECT MATCH(c) AGAINST('case-sensitive') FROM t;
+------------------------------------+
| MATCH(c) AGAINST('case-sensitive') |
+------------------------------------+
| 1.3109166622162 |
| 0 |
| 0 |
| 0 |
| 0 |
+------------------------------------+
5 rows in set (0.01 sec)
mysql> SELECT MATCH(c) AGAINST('I\'d') FROM t;
+--------------------------+
| MATCH(c) AGAINST('I\'d') |
+--------------------------+
| 0 |
| 1.2968142032623 |
| 0 |
| 0 |
| 0 |
+--------------------------+
5 rows in set (0.01 sec)
Note how neither case nor insensitive match case-insensitive the way that they would for the built-in parser.
MySQL plugins can be written in C or C++ (or another language that can use C calling conventions). One feature of C++ is that you can
use nonconstant variables to initialize global structures. However, if you write a C++ plugin, you should not use this feature. Members
of structures such as the st_mysql_plugin structure should be initialized with constant variables. The simple_parser
descriptor shown earlier is allowable in a C++ plugin because it satisfies that requirement:
mysql_declare_plugin
{
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
"simple_parser", /* name */
"MySQL AB", /* author */
"Simple Full-Text Parser", /* description */
PLUGIN_LICENSE_GPL, /* plugin license */
simple_parser_plugin_init, /* init function (when loaded) */
simple_parser_plugin_deinit,/* deinit function (when unloaded) */
0x0001, /* version */
Extending MySQL
2677
simple_status /* status variables */
}
mysql_declare_plugin_end;
Here is another valid way to write the descriptor. It uses constant variables to indicate the plugin name, author, and description:
const char *simple_parser_name = "simple_parser";
const char *simple_parser_author = "MySQL AB";
const char *simple_parser_description = "Simple Full-Text Parser";
mysql_declare_plugin
{
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
simple_parser_name, /* name */
simple_parser_author, /* author */
simple_parser_description, /* description */
PLUGIN_LICENSE_GPL, /* plugin license */
simple_parser_plugin_init, /* init function (when loaded) */
simple_parser_plugin_deinit,/* deinit function (when unloaded) */
0x0001, /* version */
simple_status /* status variables */
}
mysql_declare_plugin_end;
However, the following descriptor is invalid. It uses structure members to indicate the plugin name, author, and description, but struc-
tures are not considered constant initializers in C++:
typedef struct
{
const char *name;
const char *author;
const char *description;
} plugin_info;
plugin_info parser_info = {
"simple_parser",
"MySQL AB",
"Simple Full-Text Parser"
};
mysql_declare_plugin
{
MYSQL_FTPARSER_PLUGIN, /* type */
&simple_parser_descriptor, /* descriptor */
parser_info.name, /* name */
parser_info.author, /* author */
parser_info.description, /* description */
PLUGIN_LICENSE_GPL, /* plugin license */
simple_parser_plugin_init, /* init function (when loaded) */
simple_parser_plugin_deinit,/* deinit function (when unloaded) */
0x0001, /* version */
simple_status /* status variables */
}
mysql_declare_plugin_end;
22.3. Adding New Functions to MySQL
There are three ways to add new functions to MySQL:
You can add functions through the user-defined function (UDF) interface. User-defined functions are compiled as object files and
then added to and removed from the server dynamically using the CREATE FUNCTION and DROP FUNCTION statements. See
Section 12.5.3.1, CREATE FUNCTION Syntax.
You can add functions as native (built-in) MySQL functions. Native functions are compiled into the mysqld server and become
available on a permanent basis.
Another way to add functions is by creating stored functions. These are written using SQL statements rather than by compiling ob-
ject code. The syntax for writing stored functions is not covered here. See Section 19.2, Using Stored Routines (Procedures and
Functions).
Each method of creating compiled functions has advantages and disadvantages:
Extending MySQL
2678
If you write user-defined functions, you must install object files in addition to the server itself. If you compile your function into the
server, you don't need to do that.
Native functions require you to modify a source distribution. UDFs do not. You can add UDFs to a binary MySQL distribution. No
access to MySQL source is necessary.
If you upgrade your MySQL distribution, you can continue to use your previously installed UDFs, unless you upgrade to a newer
version for which the UDF interface changes. For native functions, you must repeat your modifications each time you upgrade.
Whichever method you use to add new functions, they can be invoked in SQL statements just like native functions such as ABS() or
SOUNDEX().
See Section 8.2.4, Function Name Parsing and Resolution, for the rules describing how the server interprets references to different
kinds of functions.
The following sections describe features of the UDF interface, provide instructions for writing UDFs, discuss security precautions that
MySQL takes to prevent UDF misuse, and describe how to add native MySQL functions.
For example source code that illustrates how to write UDFs, take a look at the sql/udf_example.c file that is provided in MySQL
source distributions.
22.3.1. Features of the User-Defined Function Interface
The MySQL interface for user-defined functions provides the following features and capabilities:
Functions can return string, integer, or real values and can accept arguments of those same types.
You can define simple functions that operate on a single row at a time, or aggregate functions that operate on groups of rows.
Information is provided to functions that enables them to check the number, types, and names of the arguments passed to them.
You can tell MySQL to coerce arguments to a given type before passing them to a function.
You can indicate that a function returns NULL or that an error occurred.
22.3.2. Adding a New User-Defined Function
For the UDF mechanism to work, functions must be written in C or C++ and your operating system must support dynamic loading. The
MySQL source distribution includes a file sql/udf_example.c that defines 5 new functions. Consult this file to see how UDF call-
ing conventions work. UDF-related symbols and data structures are defined in the include/mysql_com.h header file. (You need
not include this header file directly because it is included by mysql.h.)
A UDF contains code that becomes part of the running server, so when you write a UDF, you are bound by any and all constraints that
otherwise apply to writing server code. For example, you may have problems if you attempt to use functions from the libstdc++ lib-
rary. These constraints may change in future versions of the server, so it is possible that server upgrades will require revisions to UDFs
that were originally written for older servers. For information about these constraints, see Section 2.10.2, Typical configure Op-
tions, and Section 2.10.4, Dealing with Problems Compiling MySQL.
To be able to use UDFs, you need to link mysqld dynamically. Don't configure MySQL using -
-with-mysqld-ldflags=-all-static. If you want to use a UDF that needs to access symbols from mysqld (for example,
the metaphone function in sql/udf_example.c that uses default_charset_info), you must link the program with -
rdynamic (see man dlopen). If you plan to use UDFs, the rule of thumb is to configure MySQL with -
-with-mysqld-ldflags=-rdynamic unless you have a very good reason not to.
For each function that you want to use in SQL statements, you should define corresponding C (or C++) functions. In the following dis-
cussion, the name xxx is used for an example function name. To distinguish between SQL and C/C++ usage, XXX() (uppercase) in-
dicates an SQL function call, and xxx() (lowercase) indicates a C/C++ function call.
The C/C++ functions that you write to implement the interface for XXX() are:
xxx() (required)
Extending MySQL
2679
The main function. This is where the function result is computed. The correspondence between the SQL function data type and the
return type of your C/C++ function is shown here.
SQL Type C/C++ Type
STRING char *
INTEGER long long
REAL double
It is also possible to declare a DECIMAL function, but currently the value is returned as a string, so you should write the UDF as
though it were a STRING function. ROW functions are not implemented.
xxx_init() (optional)
The initialization function for xxx(). It can be used for the following purposes:
To check the number of arguments to XXX().
To check that the arguments are of a required type or, alternatively, to tell MySQL to coerce arguments to the types you want
when the main function is called.
To allocate any memory required by the main function.
To specify the maximum length of the result.
To specify (for REAL functions) the maximum number of decimal places in the result.
To specify whether the result can be NULL.
xxx_deinit() (optional)
The deinitialization function for xxx(). It should deallocate any memory allocated by the initialization function.
When an SQL statement invokes XXX(), MySQL calls the initialization function xxx_init() to let it perform any required setup,
such as argument checking or memory allocation. If xxx_init() returns an error, MySQL aborts the SQL statement with an error
message and does not call the main or deinitialization functions. Otherwise, MySQL calls the main function xxx() once for each row.
After all rows have been processed, MySQL calls the deinitialization function xxx_deinit() so that it can perform any required
cleanup.
For aggregate functions that work like SUM(), you must also provide the following functions:
xxx_clear()
Reset the current aggregate value but do not insert the argument as the initial aggregate value for a new group.
xxx_add()
Add the argument to the current aggregate value.
MySQL handles aggregate UDFs as follows:
1. Call xxx_init() to let the aggregate function allocate any memory it needs for storing results.
2. Sort the table according to the GROUP BY expression.
3. Call xxx_clear() for the first row in each new group.
4. Call xxx_add() for each row that belongs in the same group.
5. Call xxx() to get the result for the aggregate when the group changes or after the last row has been processed.
Extending MySQL
2680
6. Repeat 3-5 until all rows has been processed
7. Call xxx_deinit() to let the UDF free any memory it has allocated.
All functions must be thread-safe. This includes not just the main function, but the initialization and deinitialization functions as well,
and also the additional functions required by aggregate functions. A consequence of this requirement is that you are not allowed to al-
locate any global or static variables that change! If you need memory, you should allocate it in xxx_init() and free it in
xxx_deinit().
22.3.2.1. UDF Calling Sequences for Simple Functions
This section describes the different functions that you need to define when you create a simple UDF. Section 22.3.2, Adding a New
User-Defined Function, describes the order in which MySQL calls these functions.
The main xxx() function should be declared as shown in this section. Note that the return type and parameters differ, depending on
whether you declare the SQL function XXX() to return STRING, INTEGER, or REAL in the CREATE FUNCTION statement:
For STRING functions:
char *xxx(UDF_INIT *initid, UDF_ARGS *args,
char *result, unsigned long *length,
char *is_null, char *error);
For INTEGER functions:
long long xxx(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error);
For REAL functions:
double xxx(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error);
DECIMAL functions return string values and should be declared the same way as STRING functions. ROW functions are not implemen-
ted.
The initialization and deinitialization functions are declared like this:
my_bool xxx_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
void xxx_deinit(UDF_INIT *initid);
The initid parameter is passed to all three functions. It points to a UDF_INIT structure that is used to communicate information
between functions. The UDF_INIT structure members follow. The initialization function should fill in any members that it wishes to
change. (To use the default for a member, leave it unchanged.)
my_bool maybe_null
xxx_init() should set maybe_null to 1 if xxx() can return NULL. The default value is 1 if any of the arguments are de-
clared maybe_null.
unsigned int decimals
The number of decimal digits to the right of the decimal point. The default value is the maximum number of decimal digits in the ar-
guments passed to the main function. For example, if the function is passed 1.34, 1.345, and 1.3, the default would be 3, be-
cause 1.345 has 3 decimal digits.
For arguments that have no fixed number of decimals, the decimals value is set to 31, which is 1 more than the maximum number
of decimals allowed for the DECIMAL, FLOAT, and DOUBLE data types.
A decimals value of 31 is used for arguments in cases such as a FLOAT or DOUBLE column declared without an explicit number
of decimals (for example, FLOAT rather than FLOAT(10,3)) and for floating-point constants such as 1345E-3. It is also used for
string and other nonnumber arguments that might be converted within the function to numeric form.
Extending MySQL
2681
The value to which the decimals member is initialized is only a default. It can be changed within the function to reflect the actual
calculation performed. The default is determined such that the largest number of decimals of the arguments is used. If the number of
decimals is 31 for even one of the arguments, that is the value used for decimals.
unsigned int max_length
The maximum length of the result. The default max_length value differs depending on the result type of the function. For string
functions, the default is the length of the longest argument. For integer functions, the default is 21 digits. For real functions, the de-
fault is 13 plus the number of decimal digits indicated by initid->decimals. (For numeric functions, the length includes any
sign or decimal point characters.)
If you want to return a blob value, you can set max_length to 65KB or 16MB. This memory is not allocated, but the value is used
to decide which data type to use if there is a need to temporarily store the data.
char *ptr
A pointer that the function can use for its own purposes. For example, functions can use initid->ptr to communicate allocated
memory among themselves. xxx_init() should allocate the memory and assign it to this pointer:
initid->ptr = allocated_memory;
In xxx() and xxx_deinit(), refer to initid->ptr to use or deallocate the memory.
my_bool const_item
xxx_init() should set const_item to 1 if xxx() always returns the same value and to 0 otherwise.
22.3.2.2. UDF Calling Sequences for Aggregate Functions
This section describes the different functions that you need to define when you create an aggregate UDF. Section 22.3.2, Adding a
New User-Defined Function, describes the order in which MySQL calls these functions.
xxx_reset()
This function is called when MySQL finds the first row in a new group. It should reset any internal summary variables and then use
the given UDF_ARGS argument as the first value in your internal summary value for the group. Declare xxx_reset() as follows:
void xxx_reset(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error);
xxx_reset() is not needed or used in MySQL 5.1, in which the UDF interface uses xxx_clear() instead. However, you can
define both xxx_reset() and xxx_clear() if you want to have your UDF work with older versions of the server. (If you do
include both functions, the xxx_reset() function in many cases can be implemented internally by calling xxx_clear() to re-
set all variables, and then calling xxx_add() to add the UDF_ARGS argument as the first value in the group.)
xxx_clear()
This function is called when MySQL needs to reset the summary results. It is called at the beginning for each new group but can
also be called to reset the values for a query where there were no matching rows. Declare xxx_clear() as follows:
void xxx_clear(UDF_INIT *initid, char *is_null, char *error);
is_null is set to point to CHAR(0) before calling xxx_clear().
If something went wrong, you can store a value in the variable to which the error argument points. error points to a single-byte
variable, not to a string buffer.
xxx_clear() is required by MySQL 5.1.
xxx_add()
This function is called for all rows that belong to the same group. You should use it to add the value in the UDF_ARGS argument to
Extending MySQL
2682
your internal summary variable.
void xxx_add(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error);
The xxx() function for an aggregate UDF should be declared the same way as for a nonaggregate UDF. See Section 22.3.2.1, UDF
Calling Sequences for Simple Functions.
For an aggregate UDF, MySQL calls the xxx() function after all rows in the group have been processed. You should normally never
access its UDF_ARGS argument here but instead return a value based on your internal summary variables.
Return value handling in xxx() should be done the same way as for a nonaggregate UDF. See Section 22.3.2.4, UDF Return Values
and Error Handling.
The xxx_reset() and xxx_add() functions handle their UDF_ARGS argument the same way as functions for nonaggregate UDFs.
See Section 22.3.2.3, UDF Argument Processing.
The pointer arguments to is_null and error are the same for all calls to xxx_reset(), xxx_clear(), xxx_add() and
xxx(). You can use this to remember that you got an error or whether the xxx() function should return NULL. You should not store a
string into *error! error points to a single-byte variable, not to a string buffer.
*is_null is reset for each group (before calling xxx_clear()). *error is never reset.
If *is_null or *error are set when xxx() returns, MySQL returns NULL as the result for the group function.
22.3.2.3. UDF Argument Processing
The args parameter points to a UDF_ARGS structure that has the members listed here:
unsigned int arg_count
The number of arguments. Check this value in the initialization function if you require your function to be called with a particular
number of arguments. For example:
if (args->arg_count != 2)
{
strcpy(message,"XXX() requires two arguments");
return 1;
}
For other UDF_ARGS member values that are arrays, array references are zero-based. That is, refer to array members using index
values from 0 to args->arg_count 1.
enum Item_result *arg_type
A pointer to an array containing the types for each argument. The possible type values are STRING_RESULT, INT_RESULT,
REAL_RESULT, and DECIMAL_RESULT.
To make sure that arguments are of a given type and return an error if they are not, check the arg_type array in the initialization
function. For example:
if (args->arg_type[0] != STRING_RESULT ||
args->arg_type[1] != INT_RESULT)
{
strcpy(message,"XXX() requires a string and an integer");
return 1;
}
Arguments of type DECIMAL_RESULT are passed as strings, so you should handle them the same way as STRING_RESULT val-
ues.
As an alternative to requiring your function's arguments to be of particular types, you can use the initialization function to set the
arg_type elements to the types you want. This causes MySQL to coerce arguments to those types for each call to xxx(). For ex-
ample, to specify that the first two arguments should be coerced to string and integer, respectively, do this in xxx_init():
args->arg_type[0] = STRING_RESULT;
Extending MySQL
2683
args->arg_type[1] = INT_RESULT;
Exact-value decimal arguments such as 1.3 or DECIMAL column values are passed with a type of DECIMAL_RESULT. However,
the values are passed as strings. If you want to receive a number, use the initialization function to specify that the argument should
be coerced to a REAL_RESULT value:
args->arg_type[2] = REAL_RESULT;
char **args
args->args communicates information to the initialization function about the general nature of the arguments passed to your
function. For a constant argument i, args->args[i] points to the argument value. (See below for instructions on how to access
the value properly.) For a nonconstant argument, args->args[i] is 0. A constant argument is an expression that uses only con-
stants, such as 3 or 4*7-2 or SIN(3.14). A nonconstant argument is an expression that refers to values that may change from
row to row, such as column names or functions that are called with nonconstant arguments.
For each invocation of the main function, args->args contains the actual arguments that are passed for the row currently being
processed.
If argument i represents NULL, args->args[i] is a null pointer (0). If the argument is not NULL, functions can refer to it as fol-
lows:
An argument of type STRING_RESULT is given as a string pointer plus a length, to allow handling of binary data or data of ar-
bitrary length. The string contents are available as args->args[i] and the string length is args->lengths[i]. Do not
assume that the string is null-terminated.
For an argument of type INT_RESULT, you must cast args->args[i] to a long long value:
long long int_val;
int_val = *((long long*) args->args[i]);
For an argument of type REAL_RESULT, you must cast args->args[i] to a double value:
double real_val;
real_val = *((double*) args->args[i]);
For an argument of type DECIMAL_RESULT, the value is passed as a string and should be handled like a STRING_RESULT
value.
ROW_RESULT arguments are not implemented.
unsigned long *lengths
For the initialization function, the lengths array indicates the maximum string length for each argument. You should not change
these. For each invocation of the main function, lengths contains the actual lengths of any string arguments that are passed for the
row currently being processed. For arguments of types INT_RESULT or REAL_RESULT, lengths still contains the maximum
length of the argument (as for the initialization function).
char *maybe_null
For the initialization function, the maybe_null array indicates for each argument whether the argument value might be null (0 if
no, 1 if yes).
char **attributes
args->attributes communicates information about the names of the UDF arguments. For argument i, the attribute name is
available as a string in args->attributes[i] and the attribute length is args->attribute_lengths[i]. Do not as-
sume that the string is null-terminated.
By default, the name of a UDF argument is the text of the expression used to specify the argument. For UDFs, an argument may
also have an optional [AS] alias_name clause, in which case the argument name is alias_name. The attributes value
for each argument thus depends on whether an alias was given.
Suppose that a UDF my_udf() is invoked as follows:
Extending MySQL
2684
SELECT my_udf(expr1, expr2 AS alias1, expr3 alias2);
In this case, the attributes and attribute_lengths arrays will have these values:
args->attributes[0] = "expr1"
args->attribute_lengths[0] = 5
args->attributes[1] = "alias1"
args->attribute_lengths[1] = 6
args->attributes[2] = "alias2"
args->attribute_lengths[2] = 6
unsigned long *attribute_lengths
The attribute_lengths array indicates the length of each argument name.
22.3.2.4. UDF Return Values and Error Handling
The initialization function should return 0 if no error occurred and 1 otherwise. If an error occurs, xxx_init() should store a null-
terminated error message in the message parameter. The message is returned to the client. The message buffer is
MYSQL_ERRMSG_SIZE characters long, but you should try to keep the message to less than 80 characters so that it fits the width of a
standard terminal screen.
The return value of the main function xxx() is the function value, for long long and double functions. A string function should
return a pointer to the result and set *length to the length (in bytes) of the return value. For example:
memcpy(result, "result string", 13);
*length = 13;
MySQL passes a buffer to the xxx() function via the result parameter. This buffer is sufficiently long to hold 255 characters, which
can be multi-byte characters. The xxx() function can store the result in this buffer if it fits, in which case the return value should be a
pointer to the buffer. If the function stores the result in a different buffer, it should return a pointer to that buffer.
If your string function does not use the supplied buffer (for example, if it needs to return a string longer than 255 characters), you must
allocate the space for your own buffer with malloc() in your xxx_init() function or your xxx() function and free it in your
xxx_deinit() function. You can store the allocated memory in the ptr slot in the UDF_INIT structure for reuse by future xxx()
calls. See Section 22.3.2.1, UDF Calling Sequences for Simple Functions.
To indicate a return value of NULL in the main function, set *is_null to 1:
*is_null = 1;
To indicate an error return in the main function, set *error to 1:
*error = 1;
If xxx() sets *error to 1 for any row, the function value is NULL for the current row and for any subsequent rows processed by the
statement in which XXX() was invoked. (xxx() is not even called for subsequent rows.)
22.3.2.5. Compiling and Installing User-Defined Functions
Files implementing UDFs must be compiled and installed on the host where the server runs. This process is described below for the ex-
ample UDF file sql/udf_example.c that is included in the MySQL source distribution.
The immediately following instructions are for Unix. Instructions for Windows are given later in this section.
The udf_example.c file contains the following functions:
metaphon() returns a metaphon string of the string argument. This is something like a soundex string, but it is more tuned for
English.
Extending MySQL
2685
myfunc_double() returns the sum of the ASCII values of the characters in its arguments, divided by the sum of the length of its
arguments.
myfunc_int() returns the sum of the length of its arguments.
sequence([const int]) returns a sequence starting from the given number or 1 if no number has been given.
lookup() returns the IP number for a host name.
reverse_lookup() returns the host name for an IP number. The function may be called either with a single string argument of
the form 'xxx.xxx.xxx.xxx' or with four numbers.
A dynamically loadable file should be compiled as a sharable object file, using a command something like this:
shell> gcc -shared -o udf_example.so udf_example.c
If you are using gcc with configure and libtool (which is how MySQL is configured), you should be able to create
udf_example.so with a simpler command:
shell> make udf_example.la
After you compile a shared object containing UDFs, you must install it and tell MySQL about it. Compiling a shared object from
udf_example.c using gcc directly produces a file named udf_example.so. Compiling the shared object using make produces
a file named something like udf_example.so.0.0.0 in the .libs directory (the exact name may vary from platform to plat-
form). Copy the shared object to the server's plugin directory and name it udf_example.so. This directory is given by the value of
the plugin_dir system variable.
Note
This is a change in MySQL 5.1. For earlier versions of MySQL, the shared object can be located in any directory that is
searched by your system's dynamic linker.
On some systems, the ldconfig program that configures the dynamic linker does not recognize a shared object unless its name begins
with lib. In this case you should rename a file such as udf_example.so to libudf_example.so.
On Windows, you can compile user-defined functions by using the following procedure:
1. You need to obtain the Bazaar source repository for MySQL 5.1. See Section 2.10.3, Installing from the Development Source
Tree.
2. You must obtain the CMake build utility from http://www.cmake.org. (Version 2.4.2 or later is required).
3. In the source repository, look in the sql directory. There are files named udf_example.def udf_example.c there. Copy
both files from this directory to your working directory.
4. Create a CMake makefile (CMakeLists.txt) with these contents:
PROJECT(udf_example)
# Path for MySQL include directory
INCLUDE_DIRECTORIES("c:/mysql/include")
ADD_DEFINITIONS("-DHAVE_DLOPEN")
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
TARGET_LINK_LIBRARIES(udf_example wsock32)
5. Create the VC project and solution files:
cmake -G "<Generator>"
Invoking cmake --help shows you a list of valid Generators.
6. Create udf_example.dll:
devenv udf_example.sln /build Release
Extending MySQL
2686
After the shared object file has been installed, notify mysqld about the new functions with these statements:
mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.dll';
mysql> CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.dll';
mysql> CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.dll';
mysql> CREATE FUNCTION sequence RETURNS INTEGER SONAME 'udf_example.dll';
mysql> CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.dll';
mysql> CREATE FUNCTION reverse_lookup
-> RETURNS STRING SONAME 'udf_example.dll';
mysql> CREATE AGGREGATE FUNCTION avgcost
-> RETURNS REAL SONAME 'udf_example.dll';
Functions can be deleted using DROP FUNCTION:
mysql> DROP FUNCTION metaphon;
mysql> DROP FUNCTION myfunc_double;
mysql> DROP FUNCTION myfunc_int;
mysql> DROP FUNCTION sequence;
mysql> DROP FUNCTION lookup;
mysql> DROP FUNCTION reverse_lookup;
mysql> DROP FUNCTION avgcost;
The CREATE FUNCTION and DROP FUNCTION statements update the func system table in the mysql database. The function's
name, type and shared library name are saved in the table. You must have the INSERT and DELETE privileges for the mysql database
to create and drop functions.
You should not use CREATE FUNCTION to add a function that has previously been created. If you need to reinstall a function, you
should remove it with DROP FUNCTION and then reinstall it with CREATE FUNCTION. You would need to do this, for example, if
you recompile a new version of your function, so that mysqld gets the new version. Otherwise, the server continues to use the old ver-
sion.
An active function is one that has been loaded with CREATE FUNCTION and not removed with DROP FUNCTION. All active func-
tions are reloaded each time the server starts, unless you start mysqld with the --skip-grant-tables option. In this case, UDF
initialization is skipped and UDFs are unavailable.
If the new function will be referred to in statements that will be replicated to slave servers, you must ensure that every slave server also
has the function available. Otherwise, replication will fail on the slaves when they attempt to invoke the function.
22.3.2.6. User-Defined Function Security Precautions
MySQL takes the following measures to prevent misuse of user-defined functions.
You must have the INSERT privilege to be able to use CREATE FUNCTION and the DELETE privilege to be able to use DROP
FUNCTION. This is necessary because these statements add and delete rows from the mysql.func table.
UDFs should have at least one symbol defined in addition to the xxx symbol that corresponds to the main xxx() function. These aux-
iliary symbols correspond to the xxx_init(), xxx_deinit(), xxx_reset(), xxx_clear(), and xxx_add() functions.
mysqld also supports an --allow-suspicious-udfs option that controls whether UDFs that have only an xxx symbol can be
loaded. By default, the option is off, to prevent attempts at loading functions from shared object files other than those containing legit-
imate UDFs. If you have older UDFs that contain only the xxx symbol and that cannot be recompiled to include an auxiliary symbol, it
may be necessary to specify the --allow-suspicious-udfs option. Otherwise, you should avoid enabling this capability.
UDF object files cannot be placed in arbitrary directories. They must be located in the server's plugin directory. This directory is given
by the value of the plugin_dir system variable.
Note
This is a change in MySQL 5.1. For earlier versions of MySQL, the shared object can be located in any directory that is
searched by your system's dynamic linker.
22.3.3. Adding a New Native Function
To add a new native MySQL function, use the procedure described here, which requires that you use a source distribution. You cannot
add native functions to a binary distribution because it is necessary to modify MySQL source code and compile MySQL from the modi-
Extending MySQL
2687
fied source. If you migrate to another version of MySQL (for example, when a new version is released), you must repeat the procedure
with the new version.
If the new native function will be referred to in statements that will be replicated to slave servers, you must ensure that every slave serv-
er also has the function available. Otherwise, replication will fail on the slaves when they attempt to invoke the function.
To add a new native function, follow these steps to modify source files in the sql directory. For MySQL 5.1, the first two steps apply
only as of 5.1.13. For older versions, see the instructions in the corresponding section of the MySQL 5.0 manual.
1. Create a subclass for the function in item_create.cc:
If the function takes a fixed number of arguments, create a subclass of Create_func_arg0, Create_func_arg1, Cre-
ate_func_arg2, or Create_func_arg3, respectively, depending on whether the function takes zero, one, two, or three
arguments. For examples, see the Create_func_uuid, Create_func_abs, Create_func_pow, and Cre-
ate_func_lpad classes.
If the function takes a variable number of arguments, create a subclass of Create_native_func. For an example, see
Create_func_concat.
2. To provide a name by which the function can be referred to in SQL statements, register the name in item_create.cc by
adding a line to this array:
static Native_func_registry func_array[]
You can register several names for the same function. For example, see the lines for "LCASE" and "LOWER", which are aliases
for Create_func_lcase.
3. In item_func.h, declare a class inheriting from Item_num_func or Item_str_func, depending on whether your function
returns a number or a string.
4. In item_func.cc, add one of the following declarations, depending on whether you are defining a numeric or string function:
double Item_func_newname::val()
longlong Item_func_newname::val_int()
String *Item_func_newname::Str(String *str)
If you inherit your object from any of the standard items (like Item_num_func), you probably only have to define one of these
functions and let the parent object take care of the other functions. For example, the Item_str_func class defines a val()
function that executes atof() on the value returned by ::str().
5. If the function is nondeterministic, include the following statement in the item constructor to indicate that function results should
not be cached:
current_thd->lex->safe_to_cache_query=0;
A function is nondeterministic if, given fixed values for its arguments, it can return different results for different invocations.
6. You should probably also define the following object function:
void Item_func_newname::fix_length_and_dec()
This function should at least calculate max_length based on the given arguments. max_length is the maximum number of
characters the function may return. This function should also set maybe_null = 0 if the main function can't return a NULL
value. The function can check whether any of the function arguments can return NULL by checking the arguments' maybe_null
variable. Look at Item_func_mod::fix_length_and_dec for a typical example of how to do this.
All functions must be thread-safe. In other words, do not use any global or static variables in the functions without protecting them with
mutexes.
If you want to return NULL from ::val(), ::val_int(), or ::str(), you should set null_value to 1 and return 0.
For ::str() object functions, there are additional considerations to be aware of:
Extending MySQL
2688
The String *str argument provides a string buffer that may be used to hold the result. (For more information about the
String type, take a look at the sql_string.h file.)
The ::str() function should return the string that holds the result, or (char*) 0 if the result is NULL.
All current string functions try to avoid allocating any memory unless absolutely necessary!
22.4. Adding New Procedures to MySQL
In MySQL, you can define a procedure in C++ that can access and modify the data in a query before it is sent to the client. The modific-
ation can be done on a row-by-row or GROUP BY level.
We have created an example procedure to show you what can be done.
Additionally, it is a good idea to take a look at mylua. With this you can use the LUA language to load a procedure at runtime into
mysqld.
22.4.1. PROCEDURE ANALYSE
analyse([max_elements[,max_memory]])
This procedure is defined in the sql/sql_analyse.cc file. It examines the result from a query and returns an analysis of the results
that suggests optimal data types for each column. To obtain this analysis, append PROCEDURE ANALYSE to the end of a SELECT
statement:
SELECT ... FROM ... WHERE ... PROCEDURE ANALYSE([max_elements,[max_memory]])
For example:
SELECT col1, col2 FROM table1 PROCEDURE ANALYSE(10, 2000);
The results show some statistics for the values returned by the query, and propose an optimal data type for the columns. This can be
helpful for checking your existing tables, or after importing new data. You may need to try different settings for the arguments so that
PROCEDURE ANALYSE() does not suggest the ENUM data type when it is not appropriate.
The arguments are optional and are used as follows:
max_elements (default 256) is the maximum number of distinct values that analyse notices per column. This is used by ana-
lyse to check whether the optimal data type should be of type ENUM; if there are more than max_elements distinct values, then
ENUM is not a suggested type.
max_memory (default 8192) is the maximum amount of memory that analyse should allocate per column while trying to find all
distinct values.
22.4.2. Writing a Procedure
For the moment, the only documentation for this is the source.
You can find all information about procedures by examining the following files:
sql/sql_analyse.cc
sql/procedure.h
sql/procedure.cc
sql/sql_select.cc
Extending MySQL
2689
22.5. Debugging and Porting MySQL
This appendix helps you port MySQL to other operating systems. Do check the list of currently supported operating systems first. See
Section 2.1.1, Operating Systems Supported by MySQL Community Server. If you have created a new port of MySQL, please let us
know so that we can list it here and on our Web site (http://www.mysql.com/), recommending it to other users.
Note: If you create a new port of MySQL, you are free to copy and distribute it under the GPL license, but it does not make you a copy-
right holder of MySQL.
A working POSIX thread library is needed for the server. On Solaris 2.5 we use Sun PThreads (the native thread support in 2.4 and
earlier versions is not good enough), on Linux we use LinuxThreads by Xavier Leroy, <[email protected]>.
The hard part of porting to a new Unix variant without good native thread support is probably to port MIT-pthreads. See mit-
pthreads/README and Programming POSIX Threads (http://www.humanfactor.com/pthreads/).
Up to MySQL 4.0.2, the MySQL distribution included a patched version of Chris Provenzano's Pthreads from MIT (see the MIT
Pthreads Web page at http://www.mit.edu/afs/sipb/project/pthreads/ and a programming introduction at ht-
tp://www.mit.edu:8001/people/proven/IAP_2000/). These can be used for some operating systems that do not have POSIX threads. See
Section 2.10.5, MIT-pthreads Notes.
It is also possible to use another user level thread package named FSU Pthreads (see http://moss.csc.ncsu.edu/~mueller/pthreads/). This
implementation is being used for the SCO port.
See the thr_lock.c and thr_alarm.c programs in the mysys directory for some tests/examples of these problems.
Both the server and the client need a working C++ compiler. We use gcc on many platforms. Other compilers that are known to work
are SPARCworks, Sun Forte, Irix cc, HP-UX aCC, IBM AIX xlC_r), Intel ecc/icc and Compaq cxx).
Important
If you are trying to build MySQL 5.1 with icc on the IA64 platform, and need support for MySQL Cluster, you should
first ensure that you are using icc version 9.1.043 or later. (For details, see Bug#21875.)
To compile only the client use ./configure --without-server.
There is currently no support for only compiling the server, nor is it likely to be added unless someone has a good reason for it.
If you want/need to change any Makefile or the configure script you also need GNU Automake and Autoconf. See Section 2.10.3,
Installing from the Development Source Tree.
All steps needed to remake everything from the most basic files.
/bin/rm */.deps/*.P
/bin/rm -f config.cache
aclocal
autoheader
aclocal
automake
autoconf
./configure --with-debug=full --prefix='your installation directory'
# The makefiles generated above need GNU make 3.75 or newer.
# (called gmake below)
gmake clean all install init-db
If you run into problems with a new port, you may have to do some debugging of MySQL! See Section 22.5.1, Debugging a MySQL
Server.
Note
Before you start debugging mysqld, first get the test programs mysys/thr_alarm and mysys/thr_lock to work.
This ensures that your thread installation has even a remote chance to work!
22.5.1. Debugging a MySQL Server
If you are using some functionality that is very new in MySQL, you can try to run mysqld with the --skip-new (which disables all
new, potentially unsafe functionality) or with --safe-mode which disables a lot of optimization that may cause problems. See Sec-
tion B.1.4.2, What to Do If MySQL Keeps Crashing.
Extending MySQL
2690
If mysqld doesn't want to start, you should verify that you don't have any my.cnf files that interfere with your setup! You can check
your my.cnf arguments with mysqld --print-defaults and avoid using them by starting with mysqld --no-defaults
....
If mysqld starts to eat up CPU or memory or if it hangs, you can use mysqladmin processlist status to find out if
someone is executing a query that takes a long time. It may be a good idea to run mysqladmin -i10 processlist status in
some window if you are experiencing performance problems or problems when new clients can't connect.
The command mysqladmin debug dumps some information about locks in use, used memory and query usage to the MySQL log
file. This may help solve some problems. This command also provides some useful information even if you haven't compiled MySQL
for debugging!
If the problem is that some tables are getting slower and slower you should try to optimize the table with OPTIMIZE TABLE or my-
isamchk. See Chapter 5, MySQL Server Administration. You should also check the slow queries with EXPLAIN.
You should also read the OS-specific section in this manual for problems that may be unique to your environment. See Section 2.13,
Operating System-Specific Notes.
22.5.1.1. Compiling MySQL for Debugging
If you have some very specific problem, you can always try to debug MySQL. To do this you must configure MySQL with the -
-with-debug or the --with-debug=full option. You can check whether MySQL was compiled with debugging by doing:
mysqld --help. If the --debug flag is listed with the options then you have debugging enabled. mysqladmin ver also lists the
mysqld version as mysql ... --debug in this case.
If you are using gcc, the recommended configure line is:
CC=gcc CFLAGS="-O2" CXX=gcc CXXFLAGS="-O2 -felide-constructors \
-fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql \
--with-debug --with-extra-charsets=complex
This avoids problems with the libstdc++ library and with C++ exceptions (many compilers have problems with C++ exceptions in
threaded code) and compile a MySQL version with support for all character sets.
If you suspect a memory overrun error, you can configure MySQL with --with-debug=full, which installs a memory allocation
(SAFEMALLOC) checker. However, running with SAFEMALLOC is quite slow, so if you get performance problems you should start
mysqld with the --skip-safemalloc option. This disables the memory overrun checks for each call to malloc() and free().
If mysqld stops crashing when you compile it with --with-debug, you probably have found a compiler bug or a timing bug within
MySQL. In this case, you can try to add -g to the CFLAGS and CXXFLAGS variables above and not use --with-debug. If mysqld
dies, you can at least attach to it with gdb or use gdb on the core file to find out what happened.
When you configure MySQL for debugging you automatically enable a lot of extra safety check functions that monitor the health of
mysqld. If they find something unexpected, an entry is written to stderr, which mysqld_safe directs to the error log! This also
means that if you are having some unexpected problems with MySQL and are using a source distribution, the first thing you should do
is to configure MySQL for debugging! (The second thing is to send mail to a MySQL mailing list and ask for help. See Section 1.5.1,
MySQL Mailing Lists. If you believe that you have found a bug, please use the instructions at Section 1.6, How to Report Bugs or
Problems.
In the Windows MySQL distribution, mysqld.exe is by default compiled with support for trace files.
22.5.1.2. Creating Trace Files
If the mysqld server doesn't start or if you can cause it to crash quickly, you can try to create a trace file to find the problem.
To do this, you must have a mysqld that has been compiled with debugging support. You can check this by executing mysqld -V. If
the version number ends with -debug, it is compiled with support for trace files. (On Windows, the debugging server is named
mysqld-debug rather than mysqld as of MySQL 4.1.)
Start the mysqld server with a trace log in /tmp/mysqld.trace on Unix or C:\mysqld.trace on Windows:
shell> mysqld --debug
On Windows, you should also use the --standalone flag to not start mysqld as a service. In a console window, use this command:
Extending MySQL
2691
C:\> mysqld-debug --debug --standalone
After this, you can use the mysql.exe command-line tool in a second console window to reproduce the problem. You can stop the
mysqld server with mysqladmin shutdown.
Note that the trace file become very big! If you want to generate a smaller trace file, you can use debugging options something like this:
mysqld --debug=d,info,error,query,general,where:O,/tmp/mysqld.trace
This only prints information with the most interesting tags to the trace file.
If you make a bug report about this, please only send the lines from the trace file to the appropriate mailing list where something seems
to go wrong! If you can't locate the wrong place, you can ftp the trace file, together with a full bug report, to
ftp://ftp.mysql.com/pub/mysql/upload/ so that a MySQL developer can take a look at it.
The trace file is made with the DBUG package by Fred Fish. See Section 22.5.3, The DBUG Package.
22.5.1.3. Using pdb to create a Windows crashdump
Starting with MySQL 5.1.12 the Program Database files (extension pdb) are included in the Noinstall distribution of MySQL. These
files provide information for debugging your MySQL installation in the event of a problem.
The PDB file contains more detailed information about mysqld and other tools that enables more detailed trace and dump files to be
created. You can use these with Dr Watson, WinDbg and Visual Studio to debug mysqld.
For more information on PDB files, see Microsoft Knowledge Base Article 121366. For more information on the debugging options
available, see Debugging Tools for Windows.
Dr Watson is installed with all Windows distributions, but if you have installed Windows development tools, Dr Watson may have been
replaced with WinDbg, the debugger included with Visual Studio, or the debugging tools provided with Borland or Delphi.
To generate a crash file using Dr Watson, follow these steps:
1. Start Dr Watson by running drwtsn32.exe interactively using the -i option:
C:\> drwtsn32 -i
2. Set the LOG FILE PATH to the directory where you want to store trace files.
3. Make sure DUMP ALL THREAD CONTEXTS and APPEND TO EXISTING LOG FILE.
4. Uncheck DUMP SUMBOL TABLE, VISUAL NOTIFICATION, SOUND NOTIFICATION and CREATE CRASH DUMP FILE.
5. Set the NUMBER OF INSTRUCTIONS to a suitable value to capture enough calls in the stacktrace. A value of at 25 should be
enough.
Note that the file generated can be very large.
22.5.1.4. Debugging mysqld under gdb
On most systems you can also start mysqld from gdb to get more information if mysqld crashes.
With some older gdb versions on Linux you must use run --one-thread if you want to be able to debug mysqld threads. In this
case, you can only have one thread active at a time. It is best to upgrade to gdb 5.1 because thread debugging works much better with
this version!
NPTL threads (the new thread library on Linux) may cause problems while running mysqld under gdb. Some symptoms are:
mysqld hangs during startup (before it writes ready for connections).
mysqld crashes during a pthread_mutex_lock() or pthread_mutex_unlock() call.
Extending MySQL
2692
In this case, you should set the following environment variable in the shell before starting gdb:
LD_ASSUME_KERNEL=2.4.1
export LD_ASSUME_KERNEL
When running mysqld under gdb, you should disable the stack trace with --skip-stack-trace to be able to catch segfaults
within gdb.
In MySQL 4.0.14 and above you should use the --gdb option to mysqld. This installs an interrupt handler for SIGINT (needed to
stop mysqld with ^C to set breakpoints) and disable stack tracing and core file handling.
It is very hard to debug MySQL under gdb if you do a lot of new connections the whole time as gdb doesn't free the memory for old
threads. You can avoid this problem by starting mysqld with thread_cache_size set to a value equal to max_connections +
1. In most cases just using --thread_cache_size=5' helps a lot!
If you want to get a core dump on Linux if mysqld dies with a SIGSEGV signal, you can start mysqld with the --core-file op-
tion. This core file can be used to make a backtrace that may help you find out why mysqld died:
shell> gdb mysqld core
gdb> backtrace full
gdb> quit
See Section B.1.4.2, What to Do If MySQL Keeps Crashing.
If you are using gdb 4.17.x or above on Linux, you should install a .gdb file, with the following information, in your current direct-
ory:
set print sevenbit off
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint
handle SIGWAITING nostop noprint
handle SIGLWP nostop noprint
handle SIGPIPE nostop
handle SIGALRM nostop
handle SIGHUP nostop
handle SIGTERM nostop noprint
If you have problems debugging threads with gdb, you should download gdb 5.x and try this instead. The new gdb version has very
improved thread handling!
Here is an example how to debug mysqld:
shell> gdb /usr/local/libexec/mysqld
gdb> run
...
backtrace full # Do this when mysqld crashes
Include the above output in a bug report, which you can file using the instructions in Section 1.6, How to Report Bugs or Problems.
If mysqld hangs you can try to use some system tools like strace or /usr/proc/bin/pstack to examine where mysqld has
hung.
strace /tmp/log libexec/mysqld
If you are using the Perl DBI interface, you can turn on debugging information by using the trace method or by setting the
DBI_TRACE environment variable.
22.5.1.5. Using a Stack Trace
On some operating systems, the error log contains a stack trace if mysqld dies unexpectedly. You can use this to find out where (and
maybe why) mysqld died. See Section 5.2.2, The Error Log. To get a stack trace, you must not compile mysqld with the -
fomit-frame-pointer option to gcc. See Section 22.5.1.1, Compiling MySQL for Debugging.
A stack trace in the error log looks something like this:
mysqld got signal 11;
Attempting backtrace. You can use the following information
to find out where mysqld died. If you see no messages after
Extending MySQL
2693
this, something went terribly wrong...
stack_bottom = 0x41fd0110 thread_stack 0x40000
mysqld(my_print_stacktrace+0x32)[0x9da402]
mysqld(handle_segfault+0x28a)[0x6648e9]
/lib/libpthread.so.0[0x7f1a5af000f0]
/lib/libc.so.6(strcmp+0x2)[0x7f1a5a10f0f2]
mysqld(_Z21check_change_passwordP3THDPKcS2_Pcj+0x7c)[0x7412cb]
mysqld(_ZN16set_var_password5checkEP3THD+0xd0)[0x688354]
mysqld(_Z17sql_set_variablesP3THDP4ListI12set_var_baseE+0x68)[0x688494]
mysqld(_Z21mysql_execute_commandP3THD+0x41a0)[0x67a170]
mysqld(_Z11mysql_parseP3THDPKcjPS2_+0x282)[0x67f0ad]
mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xbb7[0x67fdf8]
mysqld(_Z10do_commandP3THD+0x24d)[0x6811b6]
mysqld(handle_one_connection+0x11c)[0x66e05e]
If resolution of function names for the trace fails, the trace contains less information:
mysqld got signal 11;
Attempting backtrace. You can use the following information
to find out where mysqld died. If you see no messages after
this, something went terribly wrong...
stack_bottom = 0x41fd0110 thread_stack 0x40000
[0x9da402]
[0x6648e9]
[0x7f1a5af000f0]
[0x7f1a5a10f0f2]
[0x7412cb]
[0x688354]
[0x688494]
[0x67a170]
[0x67f0ad]
[0x67fdf8]
[0x6811b6]
[0x66e05e]
In the latter case, you can use the resolve_stack_dump utility to determine where mysqld died by using the following procedure:
1. Copy the numbers from the stack trace to a file, for example mysqld.stack. The numbers should not include the surrounding
square brackets:
0x9da402
0x6648e9
0x7f1a5af000f0
0x7f1a5a10f0f2
0x7412cb
0x688354
0x688494
0x67a170
0x67f0ad
0x67fdf8
0x6811b6
0x66e05e
2. Make a symbol file for the mysqld server:
shell> nm -n libexec/mysqld > /tmp/mysqld.sym
If mysqld is not linked statically, use the following command instead:
shell> nm -D -n libexec/mysqld > /tmp/mysqld.sym
If you want to decode C++ symbols, use the --demangle, if available, to nm. If your version of nm does not have this option,
you will need to use the c++filt command after the stack dump has been produced to demangle the C++ names.
3. Execute the following command:
shell> resolve_stack_dump -s /tmp/mysqld.sym -n mysqld.stack
If you were not able to include demangled C++ names in your symbol file, process the resolve_stack_dump output using
c++filt:
shell> resolve_stack_dump -s /tmp/mysqld.sym -n mysqld.stack | c++filt
Extending MySQL
2694
This prints out where mysqld died. If that does not help you find out why mysqld died, you should create a bug report and in-
clude the output from the preceding command with the bug report.
However, in most cases it does not help us to have just a stack trace to find the reason for the problem. To be able to locate the bug
or provide a workaround, in most cases we need to know the statement that killed mysqld and preferably a test case so that we
can repeat the problem! See Section 1.6, How to Report Bugs or Problems.
22.5.1.6. Using Server Logs to Find Causes of Errors in mysqld
Note that before starting mysqld with the general query log enabled, you should check all your tables with myisamchk. See
Chapter 5, MySQL Server Administration.
If mysqld dies or hangs, you should start mysqld with the general query log enabled. See Section 5.2.3, The General Query Log.
When mysqld dies again, you can examine the end of the log file for the query that killed mysqld.
If you use the default general query log file, the log is stored in the database directory as host_name.log In most cases it is the last
query in the log file that killed mysqld, but if possible you should verify this by restarting mysqld and executing the found query
from the mysql command-line tools. If this works, you should also test all complicated queries that didn't complete.
You can also try the command EXPLAIN on all SELECT statements that takes a long time to ensure that mysqld is using indexes
properly. See Section 12.3.2, EXPLAIN Syntax.
You can find the queries that take a long time to execute by starting mysqld with the slow query log enabled. See Section 5.2.5, The
Slow Query Log.
If you find the text mysqld restarted in the error log file (normally named hostname.err) you probably have found a query
that causes mysqld to fail. If this happens, you should check all your tables with myisamchk (see Chapter 5, MySQL Server Adminis-
tration), and test the queries in the MySQL log files to see whether one fails. If you find such a query, try first upgrading to the newest
MySQL version. If this doesn't help and you can't find anything in the mysql mail archive, you should report the bug to a MySQL
mailing list. The mailing lists are described at http://lists.mysql.com/, which also has links to online list archives.
If you have started mysqld with --myisam-recover, MySQL automatically checks and tries to repair MyISAM tables if they are
marked as 'not closed properly' or 'crashed'. If this happens, MySQL writes an entry in the hostname.err file 'Warning:
Checking table ...' which is followed by Warning: Repairing table if the table needs to be repaired. If you get a lot
of these errors, without mysqld having died unexpectedly just before, then something is wrong and needs to be investigated further.
See Section 5.1.2, Server Command Options.
It is not a good sign if mysqld did die unexpectedly, but in this case, you should not investigate the Checking table... mes-
sages, but instead try to find out why mysqld died.
22.5.1.7. Making a Test Case If You Experience Table Corruption
If you get corrupted tables or if mysqld always fails after some update commands, you can test whether this bug is reproducible by do-
ing the following:
Take down the MySQL daemon (with mysqladmin shutdown).
Make a backup of the tables (to guard against the very unlikely case that the repair does something bad).
Check all tables with myisamchk -s database/*.MYI. Repair any wrong tables with myisamchk -r database/ta-
ble.MYI.
Make a second backup of the tables.
Remove (or move away) any old log files from the MySQL data directory if you need more space.
Start mysqld with the binary log enabled. If you want to find a query that crashes mysqld, you should start the server with both
the general query log enabled as well. See Section 5.2.3, The General Query Log, and Section 5.2.4, The Binary Log.
When you have gotten a crashed table, stop the mysqld server.
Extending MySQL
2695
Restore the backup.
Restart the mysqld server without the binary log enabled.
Re-execute the commands with mysqlbinlog binary-log-file | mysql. The binary log is saved in the MySQL data-
base directory with the name hostname-bin.NNNNNN.
If the tables are corrupted again or you can get mysqld to die with the above command, you have found reproducible bug that
should be easy to fix! FTP the tables and the binary log to ftp://ftp.mysql.com/pub/mysql/upload/ and report it in our bugs database
using the instructions given in Section 1.6, How to Report Bugs or Problems. (Please note that the /pub/mysql/upload/ FTP
directory is not listable, so you'll not see what you've uploaded in your FTP client.) If you are a support customer, you can use the
MySQL Customer Support Center https://support.mysql.com/ to alert the MySQL team about the problem and have it fixed as soon
as possible.
You can also use the script mysql_find_rows to just execute some of the update statements if you want to narrow down the prob-
lem.
22.5.2. Debugging a MySQL Client
To be able to debug a MySQL client with the integrated debug package, you should configure MySQL with --with-debug or -
-with-debug=full. See Section 2.10.2, Typical configure Options.
Before running a client, you should set the MYSQL_DEBUG environment variable:
shell> MYSQL_DEBUG=d:t:O,/tmp/client.trace
shell> export MYSQL_DEBUG
This causes clients to generate a trace file in /tmp/client.trace.
If you have problems with your own client code, you should attempt to connect to the server and run your query using a client that is
known to work. Do this by running mysql in debugging mode (assuming that you have compiled MySQL with debugging on):
shell> mysql --debug=d:t:O,/tmp/client.trace
This provides useful information in case you mail a bug report. See Section 1.6, How to Report Bugs or Problems.
If your client crashes at some 'legal' looking code, you should check that your mysql.h include file matches your MySQL library file.
A very common mistake is to use an old mysql.h file from an old MySQL installation with new MySQL library.
22.5.3. The DBUG Package
The MySQL server and most MySQL clients are compiled with the DBUG package originally created by Fred Fish. When you have
configured MySQL for debugging, this package makes it possible to get a trace file of what the program is debugging. See Sec-
tion 22.5.1.2, Creating Trace Files.
This section summaries the argument values that you can specify in debug options on the command line for MySQL programs that have
been built with debugging support. For more information about programming with the DBUG package, see the DBUG manual in the
dbug directory of MySQL source distributions. It is best to use a recent distribution to get the most updated DBUG manual.
You use the debug package by invoking a program with the --debug="..." or the -#... option.
Most MySQL programs have a default debug string that is used if you don't specify an option to --debug. The default trace file is usu-
ally /tmp/program_name.trace on Unix and \program_name.trace on Windows.
The debug control string is a sequence of colon-separated fields as follows:
<field_1>:<field_2>:...:<field_N>
Each field consists of a mandatory flag character followed by an optional , and comma-separated list of modifiers:
flag[,modifier,modifier,...,modifier]
Extending MySQL
2696
The following table shows the currently recognized flag characters.
Flag Description
d Enable output from DBUG_<N> macros for the current state. May be followed by a list of keywords which selects output only
for the DBUG macros with that keyword. An empty list of keywords implies output for all macros.
D Delay after each debugger output line. The argument is the number of tenths of seconds to delay, subject to machine capabilit-
ies. For example, -#D,20 specifies a delay of two seconds.
f Limit debugging, tracing, and profiling to the list of named functions. Note that a null list disables all functions. The appropriate
d or t flags must still be given; this flag only limits their actions if they are enabled.
F Identify the source file name for each line of debug or trace output.
i Identify the process with the PID or thread ID for each line of debug or trace output.
g Enable profiling. Create a file called dbugmon.out containing information that can be used to profile the program. May be
followed by a list of keywords that select profiling only for the functions in that list. A null list implies that all functions are
considered.
L Identify the source file line number for each line of debug or trace output.
n Print the current function nesting depth for each line of debug or trace output.
N Number each line of debug output.
o Redirect the debugger output stream to the specified file. The default output is stderr.
O Like o, but the file is really flushed between each write. When needed, the file is closed and reopened between each write.
p Limit debugger actions to specified processes. A process must be identified with the DBUG_PROCESS macro and match one in
the list for debugger actions to occur.
P Print the current process name for each line of debug or trace output.
r When pushing a new state, do not inherit the previous state's function nesting level. Useful when the output is to start at the left
margin.
S Do function _sanity(_file_,_line_) at each debugged function until _sanity() returns something that differs from
0. (Mostly used with safemalloc to find memory leaks)
t Enable function call/exit trace lines. May be followed by a list (containing only one modifier) giving a numeric maximum trace
level, beyond which no output occurs for either debugging or tracing macros. The default is a compile time option.
Some examples of debug control strings that might appear on a shell command line (the -# is typically used to introduce a control
string to an application program) are:
-#d:t
-#d:f,main,subr1:F:L:t,20
-#d,input,output,files:n
-#d:t:i:O,\\mysqld.trace
In MySQL, common tags to print (with the d option) are enter, exit, error, warning, info, and loop.
22.5.4. Comments about RTS Threads
I have tried to use the RTS thread packages with MySQL but stumbled on the following problems:
They use old versions of many POSIX calls and it is very tedious to make wrappers for all functions. I am inclined to think that it would
be easier to change the thread libraries to the newest POSIX specification.
Some wrappers are currently written. See mysys/my_pthread.c for more info.
At least the following should be changed:
pthread_get_specific should use one argument. sigwait should take two arguments. A lot of functions (at least
pthread_cond_wait, pthread_cond_timedwait()) should return the error code on error. Now they return -1 and set er-
rno.
Another problem is that user-level threads use the ALRM signal and this aborts a lot of functions (read, write, open...). MySQL
should do a retry on interrupt on all of these but it is not that easy to verify it.
Extending MySQL
2697
The biggest unsolved problem is the following:
To get thread-level alarms I changed mysys/thr_alarm.c to wait between alarms with pthread_cond_timedwait(), but
this aborts with error EINTR. I tried to debug the thread library as to why this happens, but couldn't find any easy solution.
If someone wants to try MySQL with RTS threads I suggest the following:
Change functions MySQL uses from the thread library to POSIX. This shouldn't take that long.
Compile all libraries with the -DHAVE_rts_threads.
Compile thr_alarm.
If there are some small differences in the implementation, they may be fixed by changing my_pthread.h and my_pthread.c.
Run thr_alarm. If it runs without any warning, error, or aborted messages, you are on the right track. Here is a successful
run on Solaris:
Main thread: 1
Thread 0 (5) started
Thread: 5 Waiting
process_alarm
Thread 1 (6) started
Thread: 6 Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6 Slept for 1 (1) sec
Thread: 6 Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6 Slept for 2 (2) sec
Thread: 6 Simulation of no alarm needed
Thread: 6 Slept for 0 (3) sec
Thread: 6 Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6 Slept for 4 (4) sec
Thread: 6 Waiting
process_alarm
thread_alarm
Thread: 5 Slept for 10 (10) sec
Thread: 5 Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6 Slept for 5 (5) sec
Thread: 6 Waiting
process_alarm
process_alarm
...
thread_alarm
Thread: 5 Slept for 0 (1) sec
end
22.5.5. Differences Between Thread Packages
MySQL is very dependent on the thread package used. So when choosing a good platform for MySQL, the thread package is very im-
portant.
There are at least three types of thread packages:
User threads in a single process. Thread switching is managed with alarms and the threads library manages all nonthread-safe func-
tions with locks. Read, write and select operations are usually managed with a thread-specific select that switches to another thread
if the running threads have to wait for data. If the user thread packages are integrated in the standard libs (FreeBSD and BSDI
threads) the thread package requires less overhead than thread packages that have to map all unsafe calls (MIT-pthreads, FSU
Pthreads and RTS threads). In some environments (for example, SCO), all system calls are thread-safe so the mapping can be done
very easily (FSU Pthreads on SCO). Downside: All mapped calls take a little time and it is quite tricky to be able to handle all situ-
ations. There are usually also some system calls that are not handled by the thread package (like MIT-pthreads and sockets). Thread
Extending MySQL
2698
scheduling isn't always optimal.
User threads in separate processes. Thread switching is done by the kernel and all data are shared between threads. The thread pack-
age manages the standard thread calls to allow sharing data between threads. LinuxThreads is using this method. Downside: Lots of
processes. Thread creating is slow. If one thread dies the rest are usually left hanging and you must kill them all before restarting.
Thread switching is somewhat expensive.
Kernel threads. Thread switching is handled by the thread library or the kernel and is very fast. Everything is done in one process,
but on some systems, ps may show the different threads. If one thread aborts, the whole process aborts. Most system calls are
thread-safe and should require very little overhead. Solaris, HP-UX, AIX and OSF/1 have kernel threads.
In some systems kernel threads are managed by integrating user level threads in the system libraries. In such cases, the thread switching
can only be done by the thread library and the kernel isn't really thread aware.
Extending MySQL
2699
Appendix A. MySQL 5.1 Frequently Asked Questions
A.1. MySQL 5.1 FAQ General
Questions
23.1.1: Which version of MySQL is production-ready (GA)?
23.1.2: Can MySQL 5.1 do subqueries?
23.1.3: Can MySQL 5.1 perform multiple-table inserts, updates, and deletes?
23.1.4: Does MySQL 5.1 have a Query Cache? Does it work on Server, Instance or Database?
23.1.5: Does MySQL 5.1 have Sequences?
23.1.6: Does MySQL 5.1 have a NOW() function with fractions of seconds?
23.1.7: Does MySQL 5.1 work with multi-core processors?
23.1.8: Is there a hot backup tool for MyISAM like InnoDB Hot Backup?
23.1.9: Have there been there any improvements in error reporting when foreign keys fail? Does MySQL now report which column
and reference failed?
23.1.10: Can MySQL 5.1 perform ACID transactions?
Questions and Answers
23.1.1: Which version of MySQL is production-ready (GA)?
Currently, both MySQL 5.0 and MySQL 5.1 are supported for production use.
MySQL 5.0 achieved General Availability (GA) status with MySQL 5.0.15, which was released for production use on 19 October 2005.
MySQL 5.1 achieved General Availability (GA) status with MySQL 5.1.30, which was released for production use on 14 November
2008.
Development work on MySQL 5.4 has started; currently, MySQL 5.4 is in beta status.
Development work on MySQL 6.0 has started; currently, MySQL 6.0 is in alpha status.
23.1.2: Can MySQL 5.1 do subqueries?
Yes. See Section 12.2.9, Subquery Syntax.
23.1.3: Can MySQL 5.1 perform multiple-table inserts, updates, and deletes?
Yes. For the syntax required to perform multiple-table updates, see Section 12.2.11, UPDATE Syntax; for that required to perform
multiple-table deletes, see Section 12.2.2, DELETE Syntax.
A multiple-table insert can be accomplished using a trigger whose FOR EACH ROW clause contains multiple INSERT statements with-
in a BEGIN ... END block. See Section 19.3, Using Triggers.
23.1.4: Does MySQL 5.1 have a Query Cache? Does it work on Server, Instance or Database?
Yes. The query cache operates on the server level, caching complete result sets matched with the original query string. If an exactly
identical query is made (which often happens, particularly in web applications), no parsing or execution is necessary; the result is sent
directly from the cache. Various tuning options are available. See Section 7.5.5, The MySQL Query Cache.
23.1.5: Does MySQL 5.1 have Sequences?
No. However, MySQL has an AUTO_INCREMENT system, which in MySQL 5.1 can also handle inserts in a multi-master replication
2700
setup. With the auto_increment_increment and auto_increment_offset system variables, you can set each server to
generate auto-increment values that don't conflict with other servers. The auto_increment_increment value should be greater
than the number of servers, and each server should have a unique offset.
23.1.6: Does MySQL 5.1 have a NOW() function with fractions of seconds?
No. This is on the MySQL roadmap as a rolling feature. This means that it is not a flagship feature, but will be implemented, develop-
ment time permitting. Specific customer demand may change this scheduling.
However, MySQL does parse time strings with a fractional component. See Section 10.3.2, The TIME Type.
23.1.7: Does MySQL 5.1 work with multi-core processors?
Yes. MySQL is fully multi-threaded, and will make use of multiple CPUs, provided that the operating system supports them.
23.1.8: Is there a hot backup tool for MyISAM like InnoDB Hot Backup?
This is currently under development for a future MySQL release.
23.1.9: Have there been there any improvements in error reporting when foreign keys fail? Does MySQL now report which
column and reference failed?
The foreign key support in InnoDB has seen improvements in each major version of MySQL. Foreign key support generic to all stor-
age engines is scheduled for MySQL 6.x; this should resolve any inadequacies in the current storage engine specific implementation.
23.1.10: Can MySQL 5.1 perform ACID transactions?
Yes. All current MySQL versions support transactions. The InnoDB storage engine offers full ACID transactions with row-level lock-
ing, multi-versioning, nonlocking repeatable reads, and all four SQL standard isolation levels.
The NDB storage engine supports the READ COMMITTED transaction isolation level only.
A.2. MySQL 5.1 FAQ Storage Engines
Questions
23.2.1: Where can I obtain complete documentation for MySQL storage engines and the pluggable storage engine architecture?
23.2.2: Are there any new storage engines in MySQL 5.1?
23.2.3: Have any storage engines been removed in MySQL 5.1?
23.2.4: What are the unique benefits of the ARCHIVE storage engine?
23.2.5: Do the new features in MySQL 5.1 apply to all storage engines?
Questions and Answers
23.2.1: Where can I obtain complete documentation for MySQL storage engines and the pluggable storage engine architecture?
See Chapter 13, Storage Engines. That chapter contains information about all MySQL storage engines except for the NDB storage en-
gine used for MySQL Cluster; NDB is covered in Chapter 17, MySQL Cluster NDB 6.X/7.X.
MySQL Enterprise
For expert advice about the storage engine(s) most suitable to your circumstances subscribe to the MySQL En-
terprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
23.2.2: Are there any new storage engines in MySQL 5.1?
Yes, the IBMDB2I storage engine is included in the IBM i5/OS (TAR packages) and IBM i5/OS (SAVF packages). Also, there have
been significant improvements in existing storage engines, in particular for the NDB storage engine that forms the basis for MySQL
Cluster.
The Falcon storage engine is available in MySQL 6.0. See MySQL 6.0 Reference Manual.
MySQL 5.1 Frequently Asked Questions
2701
23.2.3: Have any storage engines been removed in MySQL 5.1?
Yes. MySQL 5.1 no longer supports the BDB storage engine. Any existing BDB tables should be converted to another storage engine be-
fore upgrading to MySQL 5.1.
23.2.4: What are the unique benefits of the ARCHIVE storage engine?
The ARCHIVE storage engine is ideally suited for storing large amounts of data without indexes; it has a very small footprint, and per-
forms selects using table scans. See Section 13.12, The ARCHIVE Storage Engine, for details.
23.2.5: Do the new features in MySQL 5.1 apply to all storage engines?
The general new features such as views, stored procedures, triggers, INFORMATION_SCHEMA, precision math (DECIMAL column
type), and the BIT column type, apply to all storage engines. There are also additions and changes for specific storage engines.
A.3. MySQL 5.1 FAQ Server SQL Mode
Questions
23.3.1: What are server SQL modes?
23.3.2: How many server SQL modes are there?
23.3.3: How do you determine the server SQL mode?
23.3.4: Is the mode dependent on the database or connection?
23.3.5: Can the rules for strict mode be extended?
23.3.6: Does strict mode impact performance?
23.3.7: What is the default server SQL mode when My SQL 5.1 is installed?
Questions and Answers
23.3.1: What are server SQL modes?
Server SQL modes define what SQL syntax MySQL should support and what kind of data validation checks it should perform. This
makes it easier to use MySQL in different environments and to use MySQL together with other database servers. The MySQL Server
apply these modes individually to different clients. For more information, see Section 5.1.8, Server SQL Modes.
23.3.2: How many server SQL modes are there?
Each mode can be independently switched on and off. See Section 5.1.8, Server SQL Modes, for a complete list of available modes.
23.3.3: How do you determine the server SQL mode?
You can set the default SQL mode (for mysqld startup) with the --sql-mode option. Using the statement SET
[GLOBAL|SESSION] sql_mode='modes', you can change the settings from within a connection, either locally to the connec-
tion, or to take effect globally. You can retrieve the current mode by issuing a SELECT @@sql_mode statement.
23.3.4: Is the mode dependent on the database or connection?
A mode is not linked to a particular database. Modes can be set locally to the session (connection), or globally for the server. you can
change these settings using SET [GLOBAL|SESSION] sql_mode='modes'.
23.3.5: Can the rules for strict mode be extended?
When we refer to strict mode, we mean a mode where at least one of the modes TRADITIONAL, STRICT_TRANS_TABLES, or
STRICT_ALL_TABLES is enabled. Options can be combined, so you can add additional restrictions to a mode. See Section 5.1.8,
Server SQL Modes, for more information.
23.3.6: Does strict mode impact performance?
MySQL 5.1 Frequently Asked Questions
2702
The intensive validation of input data that some settings requires more time than if the validation is not done. While the performance
impact is not that great, if you do not require such validation (perhaps your application already handles all of this), then MySQL gives
you the option of leaving strict mode disabled. However if you do require it strict mode can provide such validation.
23.3.7: What is the default server SQL mode when My SQL 5.1 is installed?
By default, no special modes are enabled. See Section 5.1.8, Server SQL Modes, for information about all available modes and
MySQL's default behavior.
A.4. MySQL 5.1 FAQ Stored Procedures and Functions
Questions
23.4.1: Does MySQL 5.1 support stored procedures and functions?
23.4.2: Where can I find documentation for MySQL stored procedures and stored functions?
23.4.3: Is there a discussion forum for MySQL stored procedures?
23.4.4: Where can I find the ANSI SQL 2003 specification for stored procedures?
23.4.5: How do you manage stored routines?
23.4.6: Is there a way to view all stored procedures and stored functions in a given database?
23.4.7: Where are stored procedures stored?
23.4.8: Is it possible to group stored procedures or stored functions into packages?
23.4.9: Can a stored procedure call another stored procedure?
23.4.10: Can a stored procedure call a trigger?
23.4.11: Can a stored procedure access tables?
23.4.12: Do stored procedures have a statement for raising application errors?
23.4.13: Do stored procedures provide exception handling?
23.4.14: Can MySQL 5.1 stored routines return result sets?
23.4.15: Is WITH RECOMPILE supported for stored procedures?
23.4.16: Is there a MySQL equivalent to using mod_plsql as a gateway on Apache to talk directly to a stored procedure in the
database?
23.4.17: Can I pass an array as input to a stored procedure?
23.4.18: Can I pass a cursor as an IN parameter to a stored procedure?
23.4.19: Can I return a cursor as an OUT parameter from a stored procedure?
23.4.20: Can I print out a variable's value within a stored routine for debugging purposes?
23.4.21: Can I commit or roll back transactions inside a stored procedure?
23.4.22: Do MySQL 5.1 stored procedures and functions work with replication?
23.4.23: Are stored procedures and functions created on a master server replicated to a slave?
23.4.24: How are actions that take place inside stored procedures and functions replicated?
23.4.25: Are there special security requirements for using stored procedures and functions together with replication?
23.4.26: What limitations exist for replicating stored procedure and function actions?
MySQL 5.1 Frequently Asked Questions
2703
23.4.27: Do the preceding limitations affect MySQL's ability to do point-in-time recovery?
23.4.28: What is being done to correct the aforementioned limitations?
Questions and Answers
23.4.1: Does MySQL 5.1 support stored procedures and functions?
Yes. MySQL 5.1 supports two types of stored routines stored procedures and stored functions.
23.4.2: Where can I find documentation for MySQL stored procedures and stored functions?
See Section 19.2, Using Stored Routines (Procedures and Functions).
23.4.3: Is there a discussion forum for MySQL stored procedures?
Yes. See http://forums.mysql.com/list.php?98.
23.4.4: Where can I find the ANSI SQL 2003 specification for stored procedures?
Unfortunately, the official specifications are not freely available (ANSI makes them available for purchase). However, there are books
such as SQL-99 Complete, Really by Peter Gulutzan and Trudy Pelzer which give a comprehensive overview of the standard, in-
cluding coverage of stored procedures.
23.4.5: How do you manage stored routines?
It is always good practice to use a clear naming scheme for your stored routines. You can manage stored procedures with CREATE
[FUNCTION|PROCEDURE], ALTER [FUNCTION|PROCEDURE], DROP [FUNCTION|PROCEDURE], and SHOW CREATE
[FUNCTION|PROCEDURE]. You can obtain information about existing stored procedures using the ROUTINES table in the IN-
FORMATION_SCHEMA database (see Section 20.14, The INFORMATION_SCHEMA ROUTINES Table).
23.4.6: Is there a way to view all stored procedures and stored functions in a given database?
Yes. For a database named dbname, use this query on the INFORMATION_SCHEMA.ROUTINES table:
SELECT ROUTINE_TYPE, ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='dbname';
For more information, see Section 20.14, The INFORMATION_SCHEMA ROUTINES Table.
The body of a stored routine can be viewed using SHOW CREATE FUNCTION (for a stored function) or SHOW CREATE PROCED-
URE (for a stored procedure). See Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax, for more information.
23.4.7: Where are stored procedures stored?
In the proc table of the mysql system database. However, you should not access the tables in the system database directly. Instead,
use SHOW CREATE FUNCTION to obtain information about stored functions, and SHOW CREATE PROCEDURE to obtain informa-
tion about stored procedures. See Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax, for more information about these state-
ments.
You can also query the ROUTINES table in the INFORMATION_SCHEMA database see Section 20.14, The INFORMA-
TION_SCHEMA ROUTINES Table, for information about this table.
23.4.8: Is it possible to group stored procedures or stored functions into packages?
No. This is not supported in MySQL 5.1.
23.4.9: Can a stored procedure call another stored procedure?
Yes.
23.4.10: Can a stored procedure call a trigger?
A stored procedure can execute an SQL statement, such as an UPDATE, that causes a trigger to activate.
MySQL 5.1 Frequently Asked Questions
2704
23.4.11: Can a stored procedure access tables?
Yes. A stored procedure can access one or more tables as required.
23.4.12: Do stored procedures have a statement for raising application errors?
Not in MySQL 5.1. The SQL standard SIGNAL and RESIGNAL statements are implemented in MySQL 6.0.
23.4.13: Do stored procedures provide exception handling?
MySQL implements HANDLER definitions according to the SQL standard. See Section 12.8.4.2, DECLARE for Handlers, for details.
23.4.14: Can MySQL 5.1 stored routines return result sets?
Stored procedures can, but stored functions cannot. If you perform an ordinary SELECT inside a stored procedure, the result set is re-
turned directly to the client. You need to use the MySQL 4.1 (or above) client-server protocol for this to work. This means that for
instance in PHP, you need to use the mysqli extension rather than the old mysql extension.
23.4.15: Is WITH RECOMPILE supported for stored procedures?
Not in MySQL 5.1.
23.4.16: Is there a MySQL equivalent to using mod_plsql as a gateway on Apache to talk directly to a stored procedure in the
database?
There is no equivalent in MySQL 5.1.
23.4.17: Can I pass an array as input to a stored procedure?
Not in MySQL 5.1.
23.4.18: Can I pass a cursor as an IN parameter to a stored procedure?
In MySQL 5.1, cursors are available inside stored procedures only.
23.4.19: Can I return a cursor as an OUT parameter from a stored procedure?
In MySQL 5.1, cursors are available inside stored procedures only. However, if you do not open a cursor on a SELECT, the result will
be sent directly to the client. You can also SELECT INTO variables. See Section 12.2.8, SELECT Syntax.
23.4.20: Can I print out a variable's value within a stored routine for debugging purposes?
Yes, you can do this in a stored procedure, but not in a stored function. If you perform an ordinary SELECT inside a stored procedure,
the result set is returned directly to the client. You will need to use the MySQL 4.1 (or above) client-server protocol for this to work.
This means that for instance in PHP, you need to use the mysqli extension rather than the old mysql extension.
23.4.21: Can I commit or roll back transactions inside a stored procedure?
Yes. However, you cannot perform transactional operations within a stored function.
23.4.22: Do MySQL 5.1 stored procedures and functions work with replication?
Yes, standard actions carried out in stored procedures and functions are replicated from a master MySQL server to a slave server. There
are a few limitations that are described in detail in Section 19.6, Binary Logging of Stored Programs.
23.4.23: Are stored procedures and functions created on a master server replicated to a slave?
Yes, creation of stored procedures and functions carried out through normal DDL statements on a master server are replicated to a slave,
so the objects will exist on both servers. ALTER and DROP statements for stored procedures and functions are also replicated.
23.4.24: How are actions that take place inside stored procedures and functions replicated?
MySQL records each DML event that occurs in a stored procedure and replicates those individual actions to a slave server. The actual
calls made to execute stored procedures are not replicated.
Stored functions that change data are logged as function invocations, not as the DML events that occur inside each function.
MySQL 5.1 Frequently Asked Questions
2705
23.4.25: Are there special security requirements for using stored procedures and functions together with replication?
Yes. Because a slave server has authority to execute any statement read from a master's binary log, special security constraints exist for
using stored functions with replication. If replication or binary logging in general (for the purpose of point-in-time recovery) is active,
then MySQL DBAs have two security options open to them:
1. Any user wishing to create stored functions must be granted the SUPER privilege.
2. Alternatively, a DBA can set the log_bin_trust_function_creators system variable to 1, which enables anyone with
the standard CREATE ROUTINE privilege to create stored functions.
23.4.26: What limitations exist for replicating stored procedure and function actions?
Nondeterministic (random) or time-based actions embedded in stored procedures may not replicate properly. By their very nature, ran-
domly produced results are not predictable and cannot be exactly reproduced, and therefore, random actions replicated to a slave will
not mirror those performed on a master. Note that declaring stored functions to be DETERMINISTIC or setting the
log_bin_trust_function_creators system variable to 0 will not allow random-valued operations to be invoked.
In addition, time-based actions cannot be reproduced on a slave because the timing of such actions in a stored procedure is not reprodu-
cible through the binary log used for replication. It records only DML events and does not factor in timing constraints.
Finally, nontransactional tables for which errors occur during large DML actions (such as bulk inserts) may experience replication is-
sues in that a master may be partially updated from DML activity, but no updates are done to the slave because of the errors that oc-
curred. A workaround is for a function's DML actions to be carried out with the IGNORE keyword so that updates on the master that
cause errors are ignored and updates that do not cause errors are replicated to the slave.
23.4.27: Do the preceding limitations affect MySQL's ability to do point-in-time recovery?
The same limitations that affect replication do affect point-in-time recovery.
23.4.28: What is being done to correct the aforementioned limitations?
As of MySQL 5.1.5, you can choose either statement-based replication or row-based replication. The original replication implementa-
tion is based on statement-based binary logging. Row-based binary logging resolves the limitations mentioned earlier.
Beginning with MySQL 5.1.8, mixed replication is also available (by starting the server with --binlog-format=mixed). This hy-
brid, smart form of replication knows whether statement-level replication can safely be used, or row-level replication is required.
For additional information, see Section 16.1.2, Replication Formats.
A.5. MySQL 5.1 FAQ Triggers
Questions
23.5.1: Where can I find the documentation for MySQL 5.1 triggers?
23.5.2: Is there a discussion forum for MySQL Triggers?
23.5.3: Does MySQL 5.1 have statement-level or row-level triggers?
23.5.4: Are there any default triggers?
23.5.5: How are triggers managed in MySQL?
23.5.6: Is there a way to view all triggers in a given database?
23.5.7: Where are triggers stored?
23.5.8: Can a trigger call a stored procedure?
23.5.9: Can triggers access tables?
23.5.10: Can triggers call an external application through a UDF?
MySQL 5.1 Frequently Asked Questions
2706
23.5.11: Is it possible for a trigger to update tables on a remote server?
23.5.12: Do triggers work with replication?
23.5.13: How are actions carried out through triggers on a master replicated to a slave?
Questions and Answers
23.5.1: Where can I find the documentation for MySQL 5.1 triggers?
See Section 19.3, Using Triggers.
23.5.2: Is there a discussion forum for MySQL Triggers?
Yes. It is available at http://forums.mysql.com/list.php?99.
23.5.3: Does MySQL 5.1 have statement-level or row-level triggers?
In MySQL 5.1, all triggers are FOR EACH ROW that is, the trigger is activated for each row that is inserted, updated, or deleted.
MySQL 5.1 does not support triggers using FOR EACH STATEMENT.
23.5.4: Are there any default triggers?
Not explicitly. MySQL does have specific special behavior for some TIMESTAMP columns, as well as for columns which are defined
using AUTO_INCREMENT.
23.5.5: How are triggers managed in MySQL?
In MySQL 5.1, triggers can be created using the CREATE TRIGGER statement, and dropped using DROP TRIGGER. See Sec-
tion 12.1.19, CREATE TRIGGER Syntax, and Section 12.1.30, DROP TRIGGER Syntax, for more about these statements.
Information about triggers can be obtained by querying the INFORMATION_SCHEMA.TRIGGERS table. See Section 20.16, The IN-
FORMATION_SCHEMA TRIGGERS Table.
23.5.6: Is there a way to view all triggers in a given database?
Yes. You can obtain a listing of all triggers defined on database dbname using a query on the INFORMATION_SCHEMA.TRIGGERS
table such as the one shown here:
SELECT TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_STATEMENT
FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA='dbname';
For more information about this table, see Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table.
You can also use the SHOW TRIGGERS statement, which is specific to MySQL. See Section 12.5.5.40, SHOW TRIGGERS Syntax.
23.5.7: Where are triggers stored?
Triggers for a table are currently stored in .TRG files, with one such file one per table.
23.5.8: Can a trigger call a stored procedure?
Yes.
23.5.9: Can triggers access tables?
A trigger can access both old and new data in its own table. A trigger can also affect other tables, but it is not permitted to modify a ta-
ble that is already being used (for reading or writing) by the statement that invoked the function or trigger.
23.5.10: Can triggers call an external application through a UDF?
Yes. For example, a trigger could invoke the sys_exec() UDF available at MySQL Forge here: ht-
tp://forge.mysql.com/projects/project.php?id=211
23.5.11: Is it possible for a trigger to update tables on a remote server?
MySQL 5.1 Frequently Asked Questions
2707
Yes. A table on a remote server could be updated using the FEDERATED storage engine. (See Section 13.11, The FEDERATED Stor-
age Engine).
23.5.12: Do triggers work with replication?
Yes. However, the way in which they work depends whether you are using MySQL's classic statement-based replication available in
all versions of MySQL, or the row-based replication format introduced in MySQL 5.1.
When using statement-based replication, triggers on the slave are executed by statements that are executed on the master (and replicated
to the slave).
When using row-based replication, triggers are not executed on the slave due to statements that were run on the master and then replic-
ated to the slave. Instead, when using row-based replication, the changes caused by executing the trigger on the master are applied on
the slave.
For more information, see Section 16.3.1.26, Replication and Triggers.
23.5.13: How are actions carried out through triggers on a master replicated to a slave?
Again, this depends on whether you are using statement-based or row-based replication.
Statement-based replication. First, the triggers that exist on a master must be re-created on the slave server. Once this is done, the
replication flow works as any other standard DML statement that participates in replication. For example, consider a table EMP that has
an AFTER insert trigger, which exists on a master MySQL server. The same EMP table and AFTER insert trigger exist on the slave serv-
er as well. The replication flow would be:
1. An INSERT statement is made to EMP.
2. The AFTER trigger on EMP activates.
3. The INSERT statement is written to the binary log.
4. The replication slave picks up the INSERT statement to EMP and executes it.
5. The AFTER trigger on EMP that exists on the slave activates.
Row-based replication. When you use row-based replication, the changes caused by executing the trigger on the master are applied on
the slave. However, the triggers themselves are not actually executed on the slave under row-based replication. This is because, if both
the master and the slave applied the changes from the master and in addition the trigger causing these changes were applied on the
slave, the changes would in effect be applied twice on the slave, leading to different data on the master and the slave.
In most cases, the outcome is the same for both row-based and statement-based replication. However, if you use different triggers on the
master and slave, you cannot use row-based replication. (This is because the row-based format replicates the changes made by triggers
executing on the master to the slaves, rather than the statements that caused the triggers to execute, and the corresponding triggers on
the slave are not executed.) Instead, any statements causing such triggers to be executed must be replicated using statement-based rep-
lication.
For more information, see Section 16.3.1.26, Replication and Triggers.
A.6. MySQL 5.1 FAQ Views
Questions
23.6.1: Where can I find documentation covering MySQL Views?
23.6.2: Is there a discussion forum for MySQL Views?
23.6.3: What happens to a view if an underlying table is dropped or renamed?
23.6.4: Does MySQL 5.1 have table snapshots?
23.6.5: Does MySQL 5.1 have materialized views?
MySQL 5.1 Frequently Asked Questions
2708
23.6.6: Can you insert into views that are based on joins?
Questions and Answers
23.6.1: Where can I find documentation covering MySQL Views?
See Section 19.5, Using Views.
23.6.2: Is there a discussion forum for MySQL Views?
Yes. See http://forums.mysql.com/list.php?100
23.6.3: What happens to a view if an underlying table is dropped or renamed?
After a view has been created, it is possible to drop or alter a table or view to which the definition refers. To check a view definition for
problems of this kind, use the CHECK TABLE statement. (See Section 12.5.2.3, CHECK TABLE Syntax.)
23.6.4: Does MySQL 5.1 have table snapshots?
No.
23.6.5: Does MySQL 5.1 have materialized views?
No.
23.6.6: Can you insert into views that are based on joins?
It is possible, provided that your INSERT statement has a column list that makes it clear there is only one table involved.
You cannot insert into multiple tables with a single insert on a view.
A.7. MySQL 5.0 FAQ INFORMATION_SCHEMA
Questions
23.7.1: Where can I find documentation for the MySQL INFORMATION_SCHEMA database?
23.7.2: Is there a discussion forum for INFORMATION_SCHEMA?
23.7.3: Where can I find the ANSI SQL 2003 specification for INFORMATION_SCHEMA?
23.7.4: What is the difference between the Oracle Data Dictionary and MySQL's INFORMATION_SCHEMA?
23.7.5: Can I add to or otherwise modify the tables found in the INFORMATION_SCHEMA database?
Questions and Answers
23.7.1: Where can I find documentation for the MySQL INFORMATION_SCHEMA database?
See Chapter 20, INFORMATION_SCHEMA Tables
23.7.2: Is there a discussion forum for INFORMATION_SCHEMA?
See http://forums.mysql.com/list.php?101.
23.7.3: Where can I find the ANSI SQL 2003 specification for INFORMATION_SCHEMA?
Unfortunately, the official specifications are not freely available. (ANSI makes them available for purchase.) However, there are books
available such as SQL-99 Complete, Really by Peter Gulutzan and Trudy Pelzer which give a comprehensive overview of the
standard, including INFORMATION_SCHEMA.
23.7.4: What is the difference between the Oracle Data Dictionary and MySQL's INFORMATION_SCHEMA?
MySQL 5.1 Frequently Asked Questions
2709
Both Oracle and MySQL provide metadata in tables. However, Oracle and MySQL use different table names and column names.
MySQL's implementation is more similar to those found in DB2 and SQL Server, which also support INFORMATION_SCHEMA as
defined in the SQL standard.
23.7.5: Can I add to or otherwise modify the tables found in the INFORMATION_SCHEMA database?
No. Since applications may rely on a certain standard structure, this should not be modified. For this reason, we cannot support bugs or
other issues which result from modifying INFORMATION_SCHEMA tables or data.
A.8. MySQL 5.1 FAQ Migration
Questions
23.8.1: Where can I find information on how to migrate from MySQL 5.0 to MySQL 5.1?
23.8.2: How has storage engine (table type) support changed in MySQL 5.1 from previous versions?
Questions and Answers
23.8.1: Where can I find information on how to migrate from MySQL 5.0 to MySQL 5.1?
For detailed upgrade information, see Section 2.12.1, Upgrading MySQL. Do not skip a major version when upgrading, but rather
complete the process in steps, upgrading from one major version to the next in each step. This may seem more complicated, but it will
you save time and trouble if you encounter problems during the upgrade, their origin will be easier to identify, either by you or if
you have a MySQL Network subscription by MySQL support.
23.8.2: How has storage engine (table type) support changed in MySQL 5.1 from previous versions?
Storage engine support has changed as follows:
Support for ISAM tables was removed in MySQL 5.0 and you should now use the MyISAM storage engine in place of ISAM. To
convert a table tblname from ISAM to MyISAM, simply issue a statement such as this one:
ALTER TABLE tblname ENGINE=MYISAM;
Internal RAID for MyISAM tables was also removed in MySQL 5.0. This was formerly used to allow large tables in file systems that
did not support file sizes greater than 2GB. All modern file systems allow for larger tables; in addition, there are now other solutions
such as MERGE tables and views.
The VARCHAR column type now retains trailing spaces in all storage engines.
MEMORY tables (formerly known as HEAP tables) can also contain VARCHAR columns.
A.9. MySQL 5.1 FAQ Security
Questions
23.9.1: Where can I find documentation that addresses security issues for MySQL?
23.9.2: Does MySQL 5.1 have native support for SSL?
23.9.3: Is SSL support be built into MySQL binaries, or must I recompile the binary myself to enable it?
23.9.4: Does MySQL 5.1 have built-in authentication against LDAP directories?
23.9.5: Does MySQL 5.1 include support for Roles Based Access Control (RBAC)?
Questions and Answers
MySQL 5.1 Frequently Asked Questions
2710
23.9.1: Where can I find documentation that addresses security issues for MySQL?
The best place to start is Section 5.3, General Security Issues.
Other portions of the MySQL Documentation which you may find useful with regard to specific security concerns include the follow-
ing:
Section 5.3.1, General Security Guidelines.
Section 5.3.2, Making MySQL Secure Against Attackers.
Section B.1.4.1, How to Reset the Root Password.
Section 5.3.5, How to Run MySQL as a Normal User.
Section 22.3.2.6, User-Defined Function Security Precautions.
Section 5.3.3, Security-Related mysqld Options.
Section 5.3.4, Security Issues with LOAD DATA LOCAL.
Section 2.11, Post-Installation Setup and Testing.
Section 2.13.1.11, SELinux Notes.
Section 5.5.7.1, Basic SSL Concepts.
MySQL Enterprise
The MySQL Enterprise Monitor enforces best practices for maximizing the security of your servers. For more
information, see http://www.mysql.com/products/enterprise/advisors.html.
23.9.2: Does MySQL 5.1 have native support for SSL?
Most 5.1 binaries have support for SSL connections between the client and server. We can't currently build with the new YaSSL library
everywhere, as it is still quite new and does not compile on all platforms yet. See Section 5.5.7, Using SSL for Secure Connections.
You can also tunnel a connection via SSH, if (for instance) if the client application doesn't support SSL connections. For an example,
see Section 5.5.8, Connecting to MySQL Remotely from Windows with SSH.
23.9.3: Is SSL support be built into MySQL binaries, or must I recompile the binary myself to enable it?
Most 5.1 binaries have SSL enabled for client-server connections that are secured, authenticated, or both. However, the YaSSL library
currently does not compile on all platforms. See Section 5.5.7, Using SSL for Secure Connections, for a complete listing of supported
and unsupported platforms.
23.9.4: Does MySQL 5.1 have built-in authentication against LDAP directories?
No. Support for external authentication methods is on the MySQL roadmap as a rolling feature, which means that we plan to imple-
ment it in the future, but we have not yet determined when this will be done.
23.9.5: Does MySQL 5.1 include support for Roles Based Access Control (RBAC)?
No. Support for roles is on the MySQL roadmap as a rolling feature, which means that we plan to implement it in the future, but we
have not yet determined when this will be done.
A.10. MySQL 5.1 FAQ MySQL Cluster
In the following section, we answer questions that are frequently asked about MySQL Cluster and the NDBCLUSTER storage engine.
Questions
23.10.1: Which versions of the MySQL software support Cluster? Do I have to compile from source?
MySQL 5.1 Frequently Asked Questions
2711
23.10.2: What happened to MySQL Cluster NDB 6.4?
23.10.3: What do NDB and NDBCLUSTER mean?
23.10.4: What is the difference between using MySQL Cluster vs using MySQL replication?
23.10.5: Do I need to do any special networking to run MySQL Cluster? How do computers in a cluster communicate?
23.10.6: How many computers do I need to run a MySQL Cluster, and why?
23.10.7: What do the different computers do in a MySQL Cluster?
23.10.8: When I run the SHOW command in the MySQL Cluster management client, I see a line of output that looks like this:
id=2 @10.100.10.32 (Version: 5.1.35-ndb-6.3.26, Nodegroup: 0, Master)
What is a master node, and what does it do? How do I configure a node so that it is the master?
23.10.9: With which operating systems can I use Cluster?
23.10.10: What are the hardware requirements for running MySQL Cluster?
23.10.11: How much RAM do I need to use MySQL Cluster? Is it possible to use disk memory at all?
23.10.12: What file systems can I use with MySQL Cluster? What about network file systems or network shares?
23.10.13: Can I run MySQL Cluster nodes inside virtual machines (such as those created by VirtualBox, VMWare, Parallels, or
Xen)?
23.10.14: I am trying to populate a MySQL Cluster database. The loading process terminates prematurely and I get an error message
like this one: ERROR 1114: THE TABLE 'MY_CLUSTER_TABLE' IS FULL Why is this happening?
23.10.15: MySQL Cluster uses TCP/IP. Does this mean that I can run it over the Internet, with one or more nodes in remote loca-
tions?
23.10.16: Do I have to learn a new programming or query language to use MySQL Cluster?
23.10.17: How do I find out what an error or warning message means when using MySQL Cluster?
23.10.18: Is MySQL Cluster transaction-safe? What isolation levels are supported?
23.10.19: What storage engines are supported by MySQL Cluster?
23.10.20: In the event of a catastrophic failure say, for instance, the whole city loses power and my UPS fails would I lose all
my data?
23.10.21: Is it possible to use FULLTEXT indexes with MySQL Cluster?
23.10.22: Can I run multiple nodes on a single computer?
23.10.23: Can I add data nodes to a MySQL Cluster without restarting it?
23.10.24: Are there any limitations that I should be aware of when using MySQL Cluster?
23.10.25: How do I import an existing MySQL database into a MySQL Cluster?
23.10.26: How do cluster nodes communicate with one another?
23.10.27: What is an arbitrator?
23.10.28: What data types are supported by MySQL Cluster?
23.10.29: How do I start and stop MySQL Cluster?
23.10.30: What happens to MySQL Cluster data when the cluster is shut down?
23.10.31: Is it a good idea to have more than one management node for a MySQL Cluster?
MySQL 5.1 Frequently Asked Questions
2712
23.10.32: Can I mix different kinds of hardware and operating systems in one MySQL Cluster?
23.10.33: Can I run two data nodes on a single host? Two SQL nodes?
23.10.34: Can I use host names with MySQL Cluster?
23.10.35: Does MySQL Cluster support IPv6?
23.10.36: How do I handle MySQL users in a MySQL Cluster having multiple MySQL servers?
23.10.37: How do I continue to send queries in the event that one of the SQL nodes fails?
Questions and Answers
23.10.1: Which versions of the MySQL software support Cluster? Do I have to compile from source?
Beginning with MySQL 5.1.24, MySQL Cluster is no longer supported in standard MySQL Server 5.1 releases. Instead, MySQL
Cluster is now released as a separate product. Currently, two MySQL Cluster release series are available:
MySQL Cluster NDB 6.2. This series is Generally Available (GA) and can be used in production. However, MySQL Cluster NDB
6.3 is also now available as GA, so you are encouraged to upgrade existing deployments and to use MySQL Cluster NDB 6.3 for
new MySQL Cluster deployments. The latest MySQL Cluster NDB 6.2 sources and binaries can be obtained from ht-
tp://dev.mysql.com/downloads/cluster6.2.html.
MySQL Cluster NDB 6.3. This series is now Generally Available (GA) for use in production. The latest MySQL Cluster NDB 6.3
sources and binaries can be obtained from http://dev.mysql.com/downloads/cluster.
MySQL Cluster NDB 7.0. This series is now in Beta development phase. It is not yet certified for use in production, but is avail-
able if you wish to preview and test new features. The latest MySQL Cluster NDB 7.0 sources can be obtained from ht-
tp://dev.mysql.com/downloads/cluster.
We encourage you to use MySQL Cluster NDB 6.3 for new MySQL Cluster deployments, and to upgrade to this release series if you
are using a previous version of MySQL with clustering support. For an overview of improvements in MySQL Cluster NDB 6.3, see
Section 17.13.4, Features Added in MySQL Cluster NDB 6.3.
For information about new features and other improvements made in MySQL Cluster NDB 7.0, see Section 17.13.5, Features Added in
MySQL Cluster NDB 7.0.
You can determine whether your MySQL Server has NDBCLUSTER support using either of the statements SHOW VARIABLES LIKE
'have_%' or SHOW ENGINES.
23.10.2: What happened to MySQL Cluster NDB 6.4?
Because of the number and impact of new features introduced into MySQL Cluster following the General Availability of MySQL
Cluster NDB 6.3, it was decided that the following release series represented a major new release series rather than a minor one,
and should be known as MySQL Cluster 7.0.
The earliest development versions of MySQL Cluster NDB 7.0 were originally designated MySQL Cluster 6.4, and the first four re-
leases in this series were identified as MySQL Cluster NDB 6.4.0 through NDB 6.4.3. MySQL Cluster NDB 7.0.4 is the fifth MySQL
Cluster NDB 7.0 release; it is the successor to MySQL Cluster NDB 6.4.3.
For more information about MySQL Cluster NDB 7.0, see Section 17.13.5, Features Added in MySQL Cluster NDB 7.0, and Sec-
tion 17.15.1, Changes in MySQL Cluster NDB 7.0.
23.10.3: What do NDB and NDBCLUSTER mean?
NDB stands for Network Database. NDB and NDBCLUSTER are both names for the storage engine that enables clustering support
in MySQL. Either name is equally correct; both names appear in our documentation, and either name can be used in the ENGINE option
of a CREATE TABLE statement for creating a MySQL Cluster table.
23.10.4: What is the difference between using MySQL Cluster vs using MySQL replication?
In traditional MySQL replication, a master MySQL server updates one or more slaves. Transactions are committed sequentially, and a
slow transaction can cause the slave to lag behind the master. This means that if the master fails, it is possible that the slave might not
MySQL 5.1 Frequently Asked Questions
2713
have recorded the last few transactions. If a transaction-safe engine such as InnoDB is being used, a transaction will either be complete
on the slave or not applied at all, but replication does not guarantee that all data on the master and the slave will be consistent at all
times. In MySQL Cluster, all data nodes are kept in synchrony, and a transaction committed by any one data node is committed for all
data nodes. In the event of a data node failure, all remaining data nodes remain in a consistent state.
In short, whereas standard MySQL replication is asynchronous, MySQL Cluster is synchronous.
We have implemented (asynchronous) replication for MySQL Cluster in MySQL 5.1 and MySQL Cluster NDB 6.x. MySQL Cluster
Replication (also sometimes known as geo-replication) includes the capability to replicate both between two MySQL Clusters, and
from a MySQL Cluster to a non-Cluster MySQL server. See Section 17.9, MySQL Cluster Replication, for more information.
23.10.5: Do I need to do any special networking to run MySQL Cluster? How do computers in a cluster communicate?
MySQL Cluster is intended to be used in a high-bandwidth environment, with computers connecting via TCP/IP. Its performance de-
pends directly upon the connection speed between the cluster's computers. The minimum connectivity requirements for MySQL Cluster
include a typical 100-megabit Ethernet network or the equivalent. We recommend you use gigabit Ethernet whenever available.
The faster SCI protocol is also supported, but requires special hardware. See Section 17.11, Using High-Speed Interconnects with
MySQL Cluster, for more information about SCI.
23.10.6: How many computers do I need to run a MySQL Cluster, and why?
A minimum of three computers is required to run a viable cluster. However, the minimum recommended number of computers in a
MySQL Cluster is four: one each to run the management and SQL nodes, and two computers to serve as data nodes. The purpose of the
two data nodes is to provide redundancy; the management node must run on a separate machine to guarantee continued arbitration ser-
vices in the event that one of the data nodes fails.
To provide increased throughput and high availability, you should use multiple SQL nodes (MySQL Servers connected to the cluster). It
is also possible (although not strictly necessary) to run multiple management servers.
23.10.7: What do the different computers do in a MySQL Cluster?
A MySQL Cluster has both a physical and logical organization, with computers being the physical elements. The logical or functional
elements of a cluster are referred to as nodes, and a computer housing a cluster node is sometimes referred to as a cluster host. There are
three types of nodes, each corresponding to a specific role within the cluster. These are:
Management node. This node provides management services for the cluster as a whole, including startup, shutdown, backups, and
configuration data for the other nodes. The management node server is implemented as the application ndb_mgmd; the manage-
ment client used to control MySQL Cluster is ndb_mgm.
Data node. This type of node stores and replicates data. Data node functionality is handled by instances of the NDB data node pro-
cess ndbd.
SQL node. This is simply an instance of MySQL Server (mysqld) that is built with support for the NDBCLUSTER storage engine
and started with the --ndb-cluster option to enable the engine and the --ndb-connectstring option to enable it to con-
nect to a MySQL Cluster management server. For more about these options, see Section 17.4.2, mysqld Command Options for
MySQL Cluster.
Note
An API node is any application that makes direct use of Cluster data nodes for data storage and retrieval. An SQL node
can thus be considered a type of API node that uses a MySQL Server to provide an SQL interface to the Cluster. You can
write such applications (that do not depend on a MySQL Server) using the NDB API, which supplies a direct, object-ori-
ented transaction and scanning interface to MySQL Cluster data; see The NDB API, for more information.
23.10.8: When I run the SHOW command in the MySQL Cluster management client, I see a line of output that looks like this:
id=2 @10.100.10.32 (Version: 5.1.35-ndb-6.3.26, Nodegroup: 0, Master)
What is a master node, and what does it do? How do I configure a node so that it is the master?
The simplest answer is, It's not something you can control, and it's nothing that you need to worry about in any case, unless you're a
software engineer writing or analyzing the MySQL Cluster source code.
MySQL 5.1 Frequently Asked Questions
2714
If you don't find that answer satisfactory, here's a longer and more technical version:
A number of mechanisms in MySQL Cluster require distributed coordination among the data nodes. These distributed algorithms and
protocols include global checkpointing, DDL (schema) changes, and node restart handling. To make this coordination simpler, the data
nodes elect one of their number to be a master. There is no user-facing mechanism for influencing this selection, which is is com-
pletely automatic; the fact that it is automatic is a key part of MySQL Cluster's internal architecture.
When a node acts as a master for any of these mechanisms, it is usually the point of coordination for the activity, and the other nodes act
as servants, carrying out their parts of the activity as directed by the master. If the node acting as master fails, then the remaining
nodes elect a new master. Tasks in progress that were being coordinated by the old master may either fail or be continued by the new
master, depending on the actual mechanism involved.
It is possible for some of these different mechanisms and protocols to have different master nodes, but in general the same master is
chosen for all of them. The node indicated as the master in the output of SHOW in the management client is actually the DICT master
(see The DBDICT Block, in the MySQL Cluster API Developer Guide, for more information), responsible for coordinating DDL and
metadata activity.
MySQL Cluster is designed in such a way that the choice of master has no discernable effect outside the cluster itself. For example, the
current master does not have significantly higher CPU or resource usage than the other data nodes, and failure of the master should not
have a significantly different impact on the cluster than the failure of any other data node.
23.10.9: With which operating systems can I use Cluster?
MySQL Cluster is supported on most Unix-like operating systems, including Linux, Mac OS X, Solaris, and HP-UX. Beginning with
MySQL Cluster NDB 6.4, it is also possible to run MySQL Cluster on Windows platforms. We are continuing to work on providing
MySQL Cluster support for additional platforms; eventually we intend to offer MySQL Cluster on all platforms for which MySQL itself
is supported.
For more detailed information concerning the level of support which is offered for MySQL Cluster on various operating system ver-
sions, OS distributions, and hardware platforms, please refer to http://www.mysql.com/support/supportedplatforms/cluster.html.
23.10.10: What are the hardware requirements for running MySQL Cluster?
MySQL Cluster should run on any platform for which NDBCLUSTER-enabled binaries are available. For data nodes, faster CPUs and
more memory are likely to improve performance, and 64-bit CPUs are likely to be more effective than 32-bit processors. There must be
sufficient memory on machines used for data nodes to hold each node's share of the database (see How much RAM do I Need? for more
information). Nodes can communicate via a standard TCP/IP network and hardware. For SCI support, special networking hardware is
required (see Section 17.11, Using High-Speed Interconnects with MySQL Cluster).
23.10.11: How much RAM do I need to use MySQL Cluster? Is it possible to use disk memory at all?
In MySQL 5.0 and earlier, MySQL Cluster was in-memory only. This meant that all table data (including indexes) was stored in RAM.
If your data took up 1 GB of space and you wanted to replicate it once in the cluster, you needed 2 GB of memory to do so (1 GB per
replica). This was in addition to the memory required by the operating system and any applications running on the cluster computers.
This is still true of in-memory tables.
If a data node's memory usage exceeds what is available in RAM, then the system will attempt to use swap space up to the limit set for
DataMemory. However, this will at best result in severely degraded performance, and may cause the node to be dropped due to slow
response time (missed heartbeats). We do not recommend on relying on disk swapping in a production environment for this reason. In
any case, once the DataMemory limit is reached, any operations requiring additional memory (such as inserts) will fail.
NDBCLUSTER in MySQL Cluster NDB 6.x includes support for Disk Data, which helps to alleviate these issues. See Section 17.10,
MySQL Cluster Disk Data Tables, for more information.
You can use the following formula for obtaining a rough estimate of how much RAM is needed for each data node in the cluster:
(SizeofDatabase NumberOfReplicas 1.1 ) / NumberOfDataNodes
To calculate the memory requirements more exactly requires determining, for each table in the cluster database, the storage space re-
quired per row (see Section 10.5, Data Type Storage Requirements, for details), and multiplying this by the number of rows. You
must also remember to account for any column indexes as follows:
Each primary key or hash index created for an NDBCLUSTER table requires 2125 bytes per record. These indexes use In-
dexMemory.
MySQL 5.1 Frequently Asked Questions
2715
Each ordered index requires 10 bytes storage per record, using DataMemory.
Creating a primary key or unique index also creates an ordered index, unless this index is created with USING HASH. In other
words:
A primary key or unique index on a Cluster table normally takes up 31 to 35 bytes per record.
However, if the primary key or unique index is created with USING HASH, then it requires only 21 to 25 bytes per record.
Note that creating MySQL Cluster tables with USING HASH for all primary keys and unique indexes will generally cause table updates
to run more quickly in some cases by a much as 20 to 30 percent faster than updates on tables where USING HASH was not used in
creating primary and unique keys. This is due to the fact that less memory is required (because no ordered indexes are created), and that
less CPU must be utilized (because fewer indexes must be read and possibly updated). However, it also means that queries that could
otherwise use range scans must be satisfied by other means, which can result in slower selects.
When calculating Cluster memory requirements, you may find useful the ndb_size.pl utility which is available in recent MySQL
5.1 releases. This Perl script connects to a current (non-Cluster) MySQL database and creates a report on how much space that database
would require if it used the NDBCLUSTER storage engine. For more information, see Section 17.6.21, ndb_size.pl NDB-
CLUSTER Size Requirement Estimator.
It is especially important to keep in mind that every MySQL Cluster table must have a primary key. The NDB storage engine creates a
primary key automatically if none is defined, and this primary key is created without USING HASH.
To determine how much memory is being used for storage of Cluster indexes at any given time, you can check the Cluster log for the
warnings which are written to it when 80% of available DataMemory or IndexMemory is in use, and again when use reaches 85%,
90%, and so on. Beginning with MySQL Cluster NDB 6.2.3 and 6.3.0, you can use the REPORT MemoryUsage command in the
cluster management client to obtain a real-time report of the amount of memory used to store MySQL Cluster data and indexes. For
more information about this comannd, see
23.10.12: What file systems can I use with MySQL Cluster? What about network file systems or network shares?
Generally, any file system that is native to the host operating system should work well with MySQL Cluster. If you find that a given file
system works particularly well (or not so especially well) with MySQL Cluster, we invite you to discuss your findings in the MySQL
Cluster Forums.
For Windows, it is recommended that you use NTFS file systems for MySQL Cluster, just as we do for standard MySQL. We do not
test MySQL Cluster with FAT or VFAT file systems. Because of this, we do not recommend their use with MySQL or MySQL Cluster.
MySQL Cluster is implemented as a shared-nothing solution; the idea behind this is that the failure of a single piece of hardware should
not cause the failure of multiple cluster nodes, or possibly even the failure of the cluster as a whole. For this reason, the use of network
shares or network file systems is not supported for MySQL Cluster. This also applies to shared storage devices such as SANs.
23.10.13: Can I run MySQL Cluster nodes inside virtual machines (such as those created by VirtualBox, VMWare, Parallels, or
Xen)?
This is possible but not recommended for a production environment.
We have found that running MySQL Cluster processes inside a virtual machine can give rise to issues with timing and disk subsystems
that have a strong negative impact on the operation of the cluster. The behavior of the cluster is often unpredictable in these cases.
If an issue can be reproduced outside the virtual environment, then we may be able to provide assistance. Otherwise, we cannot support
it at this time.
23.10.14: I am trying to populate a MySQL Cluster database. The loading process terminates prematurely and I get an error
message like this one: ERROR 1114: THE TABLE 'MY_CLUSTER_TABLE' IS FULL Why is this happening?
The cause is very likely to be that your setup does not provide sufficient RAM for all table data and all indexes, including the primary
key required by the NDB storage engine and automatically created in the event that the table definition does not include the definition of
a primary key.
It is also worth noting that all data nodes should have the same amount of RAM, since no data node in a cluster can use more memory
than the least amount available to any individual data node. For example, if there are four computers hosting Cluster data nodes, and
three of these have 3GB of RAM available to store Cluster data while the remaining data node has only 1GB RAM, then each data node
can devote at most 1GB to MySQL Cluster data and indexes.
MySQL 5.1 Frequently Asked Questions
2716
23.10.15: MySQL Cluster uses TCP/IP. Does this mean that I can run it over the Internet, with one or more nodes in remote loc-
ations?
It is very unlikely that a cluster would perform reliably under such conditions, as MySQL Cluster was designed and implemented with
the assumption that it would be run under conditions guaranteeing dedicated high-speed connectivity such as that found in a LAN set-
ting using 100 Mbps or gigabit Ethernet preferably the latter. We neither test nor warrant its performance using anything slower than
this.
In addition, it is extremely important to keep in mind that communications between the nodes in a MySQL Cluster are not secure; they
are neither encrypted nor safeguarded by any other protective mechanism. The most secure configuration for a cluster is in a private net-
work behind a firewall, with no direct access to any Cluster data or management nodes from outside. (For SQL nodes, you should take
the same precautions as you would with any other instance of the MySQL server.) For more information, see Section 17.8, MySQL
Cluster Security Issues.
23.10.16: Do I have to learn a new programming or query language to use MySQL Cluster?
No. Although some specialized commands are used to manage and configure the cluster itself, only standard (My)SQL queries and
commands are required for the following operations:
Creating, altering, and dropping tables (including Disk Data tables and related objects)
Inserting, updating, and deleting table data
Creating, changing, and dropping primary and unique indexes
Some specialized configuration parameters and files are required to set up a MySQL Cluster see Section 17.3.4, MySQL Cluster
Configuration Files, for information about these.
A few simple commands are used in the MySQL Cluster management client (ndb_mgm) for tasks such as starting and stopping cluster
nodes. See Section 17.7.2, Commands in the MySQL Cluster Management Client.
23.10.17: How do I find out what an error or warning message means when using MySQL Cluster?
There are two ways in which this can be done:

From within the mysql client, use SHOW ERRORS or SHOW WARNINGS immediately upon being notified of the error or warning
condition. Errors and warnings also be displayed in MySQL Query Browser.

From a system shell prompt, use perror --ndb error_code.


23.10.18: Is MySQL Cluster transaction-safe? What isolation levels are supported?
Yes: For tables created with the NDBCLUSTER storage engine, transactions are supported. Currently, MySQL Cluster supports only the
READ COMMITTED transaction isolation level.
23.10.19: What storage engines are supported by MySQL Cluster?
Clustering with MySQL is supported only by the NDBCLUSTER storage engine (also called NDB). That is, in order for a table to be
shared between nodes in a MySQL Cluster, the table must be created using ENGINE=NDBCLUSTER (or the equivalent option EN-
GINE=NDB).
It is possible to create tables using other storage engines (such as MyISAM or InnoDB) on a MySQL server being used with a MySQL
Cluster, but these non-NDBCLUSTER tables do not participate in clustering; such a table is strictly local to the individual MySQL server
instance on which it is created.
23.10.20: In the event of a catastrophic failure say, for instance, the whole city loses power and my UPS fails would I lose
all my data?
All committed transactions are logged. Therefore, although it is possible that some data could be lost in the event of a catastrophe, this
should be quite limited. Data loss can be further reduced by minimizing the number of operations per transaction. (It is not a good idea
MySQL 5.1 Frequently Asked Questions
2717
to perform large numbers of operations per transaction in any case.)
23.10.21: Is it possible to use FULLTEXT indexes with MySQL Cluster?
FULLTEXT indexing is not supported by any storage engine other than MyISAM. We are working to add this capability to MySQL
Cluster tables in a future release.
23.10.22: Can I run multiple nodes on a single computer?
It is possible but not always advisable. One of the chief reasons to run a cluster is to provide redundancy. To obtain the full benefits of
this redundancy, each node should reside on a separate machine. If you place multiple nodes on a single machine and that machine fails,
you lose all of those nodes. For this reason, if you do run multiple data nodes on a single machine, it is extremely important that they be
set up in such a way that the failure of this machine does not cause the loss of all the data nodes in a given node group.
Given that MySQL Cluster can be run on commodity hardware loaded with a low-cost (or even no-cost) operating system, the expense
of an extra machine or two is well worth it to safeguard mission-critical data. It also worth noting that the requirements for a cluster host
running a management node are minimal. This task can be accomplished with a 200 MHz Pentium CPU and sufficient RAM for the op-
erating system plus a small amount of overhead for the ndb_mgmd and ndb_mgm processes.
It is acceptable to run multiple cluster data nodes on a single host that has multiple CPUs, cores, or both. Beginning with MySQL
Cluster NDB 6.4, there is also a special multi-threaded version of the data node binary intended for use on such systems. For more in-
formation, see Section 17.6.3, ndbmtd The MySQL Cluster Data Node Daemon (Multi-Threaded).
It is also possible in some cases to run data nodes and SQL nodes concurrently on the same machine; how well such an arrangement
performs is dependent on a number of factors such as number of cores and CPUs as well as the amount of disk and memory available to
the data node and SQL node processes, and you must take these factors into account when planning such a configuration.
23.10.23: Can I add data nodes to a MySQL Cluster without restarting it?
Beginning with MySQL Cluster NDB 6.4, it is possible to add new data nodes to a running MySQL Cluster without taking it offline.
For more information, see Section 17.7.8, Adding MySQL Cluster Data Nodes Online.
For other types of MySQL Cluster nodes, a rolling restart is all that is required (see Section 17.5.1, Performing a Rolling Restart of a
MySQL Cluster).
In MySQL Cluster NDB 6.3 and earlier, it was not possible to add new data nodes without shutting down and restarting the MySQL
Cluster.
23.10.24: Are there any limitations that I should be aware of when using MySQL Cluster?
Limitations on NDB tables in MySQL 5.1 (including MySQL Cluster NDB 6.x) include the following:
Temporary tables are not supported; a CREATE TEMPORARY TABLE statement using ENGINE=NDB or ENGINE=NDBCLUSTER
fails with an error.
The only types of user-defined partitioning supported for NDBCLUSTER tables are KEY and LINEAR KEY. (Beginning with
MySQL 5.1.12, attempting to create an NDB table using any other partitioning type fails with an error.)
FULLTEXT indexes and index prefixes are not supported. Only complete columns may be indexed.
Spatial indexes are not supported (although spatial columns can be used). See Section 11.13, Spatial Extensions.
Prior to MySQL Cluster NDB 6.3.19, the NDBCLUSTER storage engine did not support partial transactions or partial rollbacks of
transactions. Beginning with MySQL Cluster NDB 6.3.19, this limitation has been removed, and the behavior of NDBCLUSTER is
now in line with that of other transactional storage engines (such as InnoDB) that can roll back individual statements.
The maximum number of attributes allowed per table is 128, and attribute names cannot be any longer than 31 characters. For each
table, the maximum combined length of the table and database names is 122 characters.
The maximum size for a table row is 8 kilobytes, not counting BLOB values. There is no set limit for the number of rows per table.
Table size limits depend on a number of factors, in particular on the amount of RAM available to each data node.
The NDBCLUSTER engine does not support foreign key constraints. As with MyISAM tables, if these are specified in a CREATE
TABLE or ALTER TABLE statement, they are ignored.
MySQL 5.1 Frequently Asked Questions
2718
For a complete listing of limitations in MySQL Cluster, see Section 17.12, Known Limitations of MySQL Cluster.
23.10.25: How do I import an existing MySQL database into a MySQL Cluster?
You can import databases into MySQL Cluster much as you would with any other version of MySQL. Other than the limitations men-
tioned elsewhere in this FAQ, the only other special requirement is that any tables to be included in the cluster must use the NDB storage
engine. This means that the tables must be created with ENGINE=NDB or ENGINE=NDBCLUSTER.
It is also possible to convert existing tables using other storage engines to NDBCLUSTER using one or more ALTER TABLE statement.
However, the definition of the table must be compatible with the NDBCLUSTER storage engine prior to making the conversion.
See Section 17.12, Known Limitations of MySQL Cluster, for details.
23.10.26: How do cluster nodes communicate with one another?
Cluster nodes can communicate via any of three different transport mechanisms: TCP/IP, SHM (shared memory), and SCI (Scalable
Coherent Interface). Where available, SHM is used by default between nodes residing on the same cluster host; however, this is con-
sidered experimental. SCI is a high-speed (1 gigabit per second and higher), high-availability protocol used in building scalable multi-
processor systems; it requires special hardware and drivers. See Section 17.11, Using High-Speed Interconnects with MySQL Cluster,
for more about using SCI as a transport mechanism for MySQL Cluster.
23.10.27: What is an arbitrator?
If one or more nodes in a cluster fail, it is possible that not all cluster nodes will be able to see one another. In fact, it is possible that
two sets of nodes might become isolated from one another in a network partitioning, also known as a split brain scenario. This type of
situation is undesirable because each set of nodes tries to behave as though it is the entire cluster.
When cluster nodes go down, there are two possibilities. If more than 50% of the remaining nodes can communicate with each other,
we have what is sometimes called a majority rules situation, and this set of nodes is considered to be the cluster. The arbitrator comes
into play when there is an even number of nodes: in such cases, the set of nodes to which the arbitrator belongs is considered to be the
cluster, and nodes not belonging to this set are shut down.
The preceding information is somewhat simplified. A more complete explanation taking into account node groups follows:
When all nodes in at least one node group are alive, network partitioning is not an issue, because no one portion of the cluster can form
a functional cluster. The real problem arises when no single node group has all its nodes alive, in which case network partitioning (the
split-brain scenario) becomes possible. Then an arbitrator is required. All cluster nodes recognize the same node as the arbitrator,
which is normally the management server; however, it is possible to configure any of the MySQL Servers in the cluster to act as the ar-
bitrator instead. The arbitrator accepts the first set of cluster nodes to contact it, and tells the remaining set to shut down. Arbitrator se-
lection is controlled by the ArbitrationRank configuration parameter for MySQL Server and management server nodes. (See Sec-
tion 17.3.4.5, Defining a MySQL Cluster Management Server, for details.)
The role of arbitrator does not in and of itself impose any heavy demands upon the host so designated, and thus the arbitrator host does
not need to be particularly fast or to have extra memory especially for this purpose.
23.10.28: What data types are supported by MySQL Cluster?
MySQL Cluster NDB 6.x, supports all of the usual MySQL data types, including those associated with MySQL's spatial extensions;
however, the NDBCLUSTER storage engine does not support spatial indexes. (Spatial indexes are supported only by MyISAM; see Sec-
tion 11.13, Spatial Extensions, for more information.) In addition, there are some differences with regard to indexes when used with
NDBCLUSTER tables.
Note
MySQL Cluster Disk Data tables (that is, tables created with TABLESPACE ... STORAGE DISK EN-
GINE=NDBCLUSTER) have only fixed-width rows. This means that (for example) each Disk Data table record containing
a VARCHAR(255) column requires space for 255 characters (as required for the character set and collation being used for
the table), regardless of the actual number of characters stored therein.
See Section 17.12, Known Limitations of MySQL Cluster, for more information about these issues.
23.10.29: How do I start and stop MySQL Cluster?
It is necessary to start each node in the cluster separately, in the following order:
MySQL 5.1 Frequently Asked Questions
2719
1. Start the management node, using the ndb_mgmd command.
You must include the -f or --config-file option to tell the management node where its configuration file can be found. Be-
ginning with MySQL Cluster NDB 6.4, the management server must also know where it is to keep its configuration cache.
2. Start each data node with the ndbd command. (Beginning with MySQL Cluster NDB 6.4, the ndbmtd command can be used on
computers with multiple CPUs, multiple cores, or both.)
Each data node must be started with the -c or --connect-string option so that the data node knows how to connect to the
management server.
3. Start each MySQL Server (SQL node) using your preferred startup script, such as mysqld_safe.
Each MySQL Server must be started with the --ndbcluster and --ndb-connectstring options. These options cause
mysqld to enable NDBCLUSTER storage engine support and how to connect to the management server.
Each of these commands must be run from a system shell on the machine housing the affected node. (You do not have to be physically
present at the machine a remote login shell can be used for this purpose.) You can verify that the cluster is running by starting the
NDB management client ndb_mgm on the machine housing the management node and issuing the SHOW or ALL STATUS command.
To shut down a running cluster, issue the command SHUTDOWN in the management client. Alternatively, you may enter the following
command in a system shell:
shell> ndb_mgm -e "SHUTDOWN"
(The quotation marks are optional; in addition, the SHUTDOWN command is not case-sensitive.)
Either of these commands causes the ndb_mgm, ndb_mgm, and any ndbd processes to terminate gracefully. MySQL servers running
as Cluster SQL nodes can be stopped using mysqladmin shutdown.
For more information, see Section 17.7.2, Commands in the MySQL Cluster Management Client, and Section 17.2.6, Safe Shut-
down and Restart of MySQL Cluster.
23.10.30: What happens to MySQL Cluster data when the cluster is shut down?
The data that was held in memory by the MySQL Cluster data nodes is written to disk, and is reloaded into memory the next time that
the cluster is started.
23.10.31: Is it a good idea to have more than one management node for a MySQL Cluster?
It can be helpful as a fail-safe. Only one management node controls the cluster at any given time, but it is possible to configure one
management node as primary, and one or more additional management nodes to take over in the event that the primary management
node fails.
See Section 17.3.4, MySQL Cluster Configuration Files, for information on how to configure MySQL Cluster management nodes.
23.10.32: Can I mix different kinds of hardware and operating systems in one MySQL Cluster?
Yes, as long as all machines and operating systems have the same endianness (all big-endian or all little-endian). We are working to
overcome this limitation in a future MySQL Cluster release.
It is also possible to use software from different MySQL Cluster releases on different nodes. However, we support this only as part of a
rolling upgrade procedure (see Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster).
23.10.33: Can I run two data nodes on a single host? Two SQL nodes?
Yes, it is possible to do this. In the case of multiple data nodes, it is advisable (but not required) for each node to use a different data dir-
ectory. If you want to run multiple SQL nodes on one machine, each instance of mysqld must use a different TCP/IP port. However,
running more than one cluster node of a given type per machine is generally not encouraged or supported for production use.
We also advise against running data nodes and SQL nodes together on the same host, since the ndbd and mysqld processes may com-
pete for memory.
23.10.34: Can I use host names with MySQL Cluster?
MySQL 5.1 Frequently Asked Questions
2720
Yes, it is possible to use DNS and DHCP for cluster hosts. However, if your application requires five nines availability, use fixed
(numeric) IP addresses. Making communication between Cluster hosts dependent on services such as DNS and DHCP introduces addi-
tional potential points of failure.
23.10.35: Does MySQL Cluster support IPv6?
Beginning with MySQL Cluster NDB 6.4, IPv6 is supported for connections between SQL nodes (MySQL servers). However, connec-
tions between all other types of nodes must use IPv4.
In practical terms, this means that you can use IPv6 for replication between MySQL Clusters, but connections between nodes in the
same MySQL Cluster must use IPv4. For more information, see Section 17.9.3, Known Issues in MySQL Cluster Replication.
23.10.36: How do I handle MySQL users in a MySQL Cluster having multiple MySQL servers?
MySQL user accounts and privileges are not automatically propagated between different MySQL servers accessing the same MySQL
Cluster. Therefore, you must make sure that these are copied between the SQL nodes yourself. You can do this manually, or automate
the task with scripts.
Warning
Do not attempt to work around this issue by converting the MySQL system tables to use the NDBCLUSTER storage en-
gine. Only the MyISAM storage engine is supported for these tables.
23.10.37: How do I continue to send queries in the event that one of the SQL nodes fails?
MySQL Cluster does not provide any sort of automatic failover between SQL nodes. Your application must be prepared to handle any
loss of SQL nodes and to fail over between them.
A.11. MySQL 5.1 FAQ MySQL Chinese, Japanese, and Korean Char-
acter Sets
This set of Frequently Asked Questions derives from the experience of MySQL's Support and Development groups in handling many
inquiries about CJK (Chinese-Japanese-Korean) issues.
Questions
23.11.1: What CJK character sets are available in MySQL?
23.11.2: I have inserted CJK characters into my table. Why does SELECT display them as ? characters?
23.11.3: What problems should I be aware of when working with the Big5 Chinese character set?
23.11.4: Why do Japanese character set conversions fail?
23.11.5: What should I do if I want to convert SJIS 81CA to cp932?
23.11.6: How does MySQL represent the Yen () sign?
23.11.7: Do MySQL plan to make a separate character set where 5C is the Yen sign, as at least one other major DBMS does?
23.11.8: Of what issues should I be aware when working with Korean character sets in MySQL?
23.11.9: Why do I get DATA TRUNCATED error messages?
23.11.10: Why does my GUI front end or browser not display CJK characters correctly in my application using Access, PHP, or an-
other API?
23.11.11: I've upgraded to MySQL 5.1. How can I revert to behavior like that in MySQL 4.0 with regard to character sets?
23.11.12: Why do some LIKE and FULLTEXT searches with CJK characters fail?
23.11.13: How do I know whether character X is available in all character sets?
23.11.14: Why don't CJK strings sort correctly in Unicode? (I)
MySQL 5.1 Frequently Asked Questions
2721
23.11.15: Why don't CJK strings sort correctly in Unicode? (II)
23.11.16: Why are my supplementary characters rejected by MySQL?
23.11.17: Shouldn't it be CJKV?
23.11.18: Does MySQL allow CJK characters to be used in database and table names?
23.11.19: Where can I find translations of the MySQL Manual into Chinese, Japanese, and Korean?
23.11.20: Where can I get help with CJK and related issues in MySQL?
Questions and Answers
23.11.1: What CJK character sets are available in MySQL?
The list of CJK character sets may vary depending on your MySQL version. For example, the eucjpms character set was not suppor-
ted prior to MySQL 5.0.3. However, since the name of the applicable language appears in the DESCRIPTION column for every entry
in the INFORMATION_SCHEMA.CHARACTER_SETS table, you can obtain a current list of all the non-Unicode CJK character sets us-
ing this query:
mysql> SELECT CHARACTER_SET_NAME, DESCRIPTION
-> FROM INFORMATION_SCHEMA.CHARACTER_SETS
-> WHERE DESCRIPTION LIKE '%Chinese%'
-> OR DESCRIPTION LIKE '%Japanese%'
-> OR DESCRIPTION LIKE '%Korean%'
-> ORDER BY CHARACTER_SET_NAME;
+--------------------+---------------------------+
| CHARACTER_SET_NAME | DESCRIPTION |
+--------------------+---------------------------+
| big5 | Big5 Traditional Chinese |
| cp932 | SJIS for Windows Japanese |
| eucjpms | UJIS for Windows Japanese |
| euckr | EUC-KR Korean |
| gb2312 | GB2312 Simplified Chinese |
| gbk | GBK Simplified Chinese |
| sjis | Shift-JIS Japanese |
| ujis | EUC-JP Japanese |
+--------------------+---------------------------+
8 rows in set (0.01 sec)
(See Section 20.9, The INFORMATION_SCHEMA CHARACTER_SETS Table, for more information.)
MySQL supports the two common variants of the GB (Guojia Biaozhun, or National Standard, or Simplified Chinese) character sets
which are official in the People's Republic of China: gb2312 and gbk. Sometimes people try to insert gbk characters into gb2312,
and it works most of the time because gbk is a superset of gb2312 but eventually they try to insert a rarer Chinese character and it
doesn't work. (See Bug#16072 for an example).
Here, we try to clarify exactly what characters are legitimate in gb2312 or gbk, with reference to the official documents. Please check
these references before reporting gb2312 or gbk bugs.
For a complete listing of the gb2312 characters, ordered according to the gb2312_chinese_ci collation: gb2312
MySQL's gbk is in reality Microsoft code page 936. This differs from the official gbk for characters A1A4 (middle dot), A1AA
(em dash), A6E0-A6F5, and A8BB-A8C0. For a listing of the differences, see ht-
tp://recode.progiciels-bpi.ca/showfile.html?name=dist/libiconv/gbk.h.
For a listing of gbk/Unicode mappings, see ht-
tp://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT.
For MySQL's listing of gbk characters, see gbk.
23.11.2: I have inserted CJK characters into my table. Why does SELECT display them as ? characters?
This problem is usually due to a setting in MySQL that doesn't match the settings for the application program or the operating system.
Here are some common steps for correcting these types of issues:
Be certain of what MySQL version you are using.
MySQL 5.1 Frequently Asked Questions
2722
Use the statement SELECT VERSION(); to determine this.
Make sure that the database is actually using the desired character set.
People often think that the client character set is always the same as either the server character set or the character set used for dis-
play purposes. However, both of these are false assumptions. You can make sure by checking the result of SHOW CREATE TABLE
tablename or better yet by using this statement:
SELECT character_set_name, collation_name
FROM information_schema.columns
WHERE table_schema = your_database_name
AND table_name = your_table_name
AND column_name = your_column_name;
Determine the hexadecimal value of the character or characters that are not being displayed correctly.
You can obtain this information for a column column_name in the table table_name using the following query:
SELECT HEX(column_name)
FROM table_name;
3F is the encoding for the ? character; this means that ? is the character actually stored in the column. This most often happens be-
cause of a problem converting a particular character from your client character set to the target character set.
Make sure that a round trip possible that is, when you select literal (or _introducer hexadecimal-value), you ob-
tain literal as a result.
For example, the Japanese Katakana character Pe (^') exists in all CJK character sets, and has the code point value (hexadecimal
coding) 0x30da. To test a round trip for this character, use this query:
SELECT '^' AS `^`; /* or SELECT _ucs2 0x30da; */
If the result is not also ^, then the round trip has failed.
For bug reports regarding such failures, we might ask you to follow up with SELECT HEX('^');. Then we can determine
whether the client encoding is correct.
Make sure that the problem is not with the browser or other application, rather than with MySQL.
Use the mysql client program (on Windows: mysql.exe) to accomplish this task. If mysql displays correctly but your applica-
tion doesn't, then your problem is probably due to system settings.
To find out what your settings are, use the SHOW VARIABLES statement, whose output should resemble what is shown here:
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.03 sec)
These are typical character-set settings for an international-oriented client (notice the use of utf8 Unicode) connected to a server in
the West (latin1 is a West Europe character set and a default for MySQL).
Although Unicode (usually the utf8 variant on Unix, and the ucs2 variant on Windows) is preferable to Latin, it is often not what
your operating system utilities support best. Many Windows users find that a Microsoft character set, such as cp932 for Japanese
Windows, is suitable.
If you cannot control the server settings, and you have no idea what your underlying computer is, then try changing to a common
character set for the country that you're in (euckr = Korea; gb2312 or gbk = People's Republic of China; big5 = Taiwan; sjis,
ujis, cp932, or eucjpms = Japan; ucs2 or utf8 = anywhere). Usually it is necessary to change only the client and connection
and results settings. There is a simple statement which changes all three at once: SET NAMES. For example:
MySQL 5.1 Frequently Asked Questions
2723
SET NAMES 'big5';
Once the setting is correct, you can make it permanent by editing my.cnf or my.ini. For example you might add lines looking
like these:
[mysqld]
character-set-server=big5
[client]
default-character-set=big5
It is also possible that there are issues with the API configuration setting being used in your application; see Why does my GUI front
end or browser not display CJK characters correctly...? for more information.
23.11.3: What problems should I be aware of when working with the Big5 Chinese character set?
MySQL supports the Big5 character set which is common in Hong Kong and Taiwan (Republic of China). MySQL's big5 is in reality
Microsoft code page 950, which is very similar to the original big5 character set. We changed to this character set starting with
MySQL version 4.1.16 / 5.0.16 (as a result of Bug#12476). For example, the following statements work in current versions of MySQL,
but not in old versions:
mysql> CREATE TABLE big5 (BIG5 CHAR(1) CHARACTER SET BIG5);
Query OK, 0 rows affected (0.13 sec)
mysql> INSERT INTO big5 VALUES (0xf9dc);
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM big5;
+------+
| big5 |
+------+
| M |
+------+
1 row in set (0.02 sec)
A feature request for adding HKSCS extensions has been filed. People who need this extension may find the suggested patch for
Bug#13577 to be of interest.
23.11.4: Why do Japanese character set conversions fail?
MySQL supports the sjis, ujis, cp932, and eucjpms character sets, as well as Unicode. A common need is to convert between
character sets. For example, there might be a Unix server (typically with sjis or ujis) and a Windows client (typically with cp932).
In the following conversion table, the ucs2 column represents the source, and the sjis, cp932, ujis, and eucjpms columns rep-
resent the destinations that is, the last 4 columns provide the hexadecimal result when we use CONVERT(ucs2) or we assign a
ucs2 column containing the value to an sjis, cp932, ujis, or eucjpms column.
Character Name ucs2 sjis cp932 ujis eucjpms
BROKEN BAR 00A6 3F 3F 8FA2C3 3F
FULLWIDTH BROKEN BAR FFE4 3F FA55 3F 8FA2
YEN SIGN 00A5 3F 3F 20 3F
FULLWIDTH YEN SIGN FFE5 818F 818F A1EF 3F
TILDE 007E 7E 7E 7E 7E
OVERLINE 203E 3F 3F 20 3F
HORIZONTAL BAR 2015 815C 815C A1BD A1BD
EM DASH 2014 3F 3F 3F 3F
REVERSE SOLIDUS 005C 815F 5C 5C 5C
FULLWIDTH "" FF3C 3F 815F 3F A1C0
WAVE DASH 301C 8160 3F A1C1 3F
FULLWIDTH TILDE FF5E 3F 8160 3F A1C1
DOUBLE VERTICAL LINE 2016 8161 3F A1C2 3F
PARALLEL TO 2225 3F 8161 3F A1C2
MySQL 5.1 Frequently Asked Questions
2724
Character Name ucs2 sjis cp932 ujis eucjpms
MINUS SIGN 2212 817C 3F A1DD 3F
FULLWIDTH HYPHEN-MINUS FF0D 3F 817C 3F A1DD
CENT SIGN 00A2 8191 3F A1F1 3F
FULLWIDTH CENT SIGN FFE0 3F 8191 3F A1F1
POUND SIGN 00A3 8192 3F A1F2 3F
FULLWIDTH POUND SIGN FFE1 3F 8192 3F A1F2
NOT SIGN 00AC 81CA 3F A2CC 3F
FULLWIDTH NOT SIGN FFE2 3F 81CA 3F A2CC
Now consider the following portion of the table.
ucs2 sjis cp932
NOT SIGN 00AC 81CA 3F
FULLWIDTH NOT SIGN FFE2 3F 81CA
This means that MySQL converts the NOT SIGN (Unicode U+00AC) to sjis code point 0x81CA and to cp932 code point 3F. (3F
is the question mark (?) this is what is always used when the conversion cannot be performed.
23.11.5: What should I do if I want to convert SJIS 81CA to cp932?
Our answer is: ?. There are serious complaints about this: many people would prefer a loose conversion, so that 81CA (NOT
SIGN) in sjis becomes 81CA (FULLWIDTH NOT SIGN) in cp932. We are considering a change to this behavior.
23.11.6: How does MySQL represent the Yen () sign?
A problem arises because some versions of Japanese character sets (both sjis and euc) treat 5C as a reverse solidus (\ also known
as a backslash), and others treat it as a yen sign ().
MySQL follows only one version of the JIS (Japanese Industrial Standards) standard description. In MySQL, 5C is always the reverse
solidus (\).
23.11.7: Do MySQL plan to make a separate character set where 5C is the Yen sign, as at least one other major DBMS does?
This is one possible solution to the Yen sign issue; however, this will not happen in MySQL 5.1 or 6.0.
23.11.8: Of what issues should I be aware when working with Korean character sets in MySQL?
In theory, while there have been several versions of the euckr (Extended Unix Code Korea) character set, only one problem has been
noted.
We use the ASCII variant of EUC-KR, in which the code point 0x5c is REVERSE SOLIDUS, that is \, instead of the KS-Roman
variant of EUC-KR, in which the code point 0x5c is WON SIGN(W). This means that you cannot convert Unicode U+20A9 to
euckr:
mysql> SELECT
-> CONVERT('W' USING euckr) AS euckr,
-> HEX(CONVERT('W' USING euckr)) AS hexeuckr;
+-------+----------+
| euckr | hexeuckr |
+-------+----------+
| ? | 3F |
+-------+----------+
1 row in set (0.00 sec)
MySQL's graphic Korean chart is here: euckr.
23.11.9: Why do I get DATA TRUNCATED error messages?
For illustration, we'll create a table with one Unicode (ucs2) column and one Chinese (gb2312) column.
mysql> CREATE TABLE ch
-> (ucs2 CHAR(3) CHARACTER SET ucs2,
-> gb2312 CHAR(3) CHARACTER SET gb2312);
MySQL 5.1 Frequently Asked Questions
2725
Query OK, 0 rows affected (0.05 sec)
We'll try to place the rare character Jin both columns.
mysql> INSERT INTO ch VALUES ('AJB','AJB');
Query OK, 1 row affected, 1 warning (0.00 sec)
Ah, there is a warning. Use the following statement to see what it is:
mysql> SHOW WARNINGS;
+---------+------+---------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------+
| Warning | 1265 | Data truncated for column 'gb2312' at row 1 |
+---------+------+---------------------------------------------+
1 row in set (0.00 sec)
So it is a warning about the gb2312 column only.
mysql> SELECT ucs2,HEX(ucs2),gb2312,HEX(gb2312) FROM ch;
+-------+--------------+--------+-------------+
| ucs2 | HEX(ucs2) | gb2312 | HEX(gb2312) |
+-------+--------------+--------+-------------+
| AJB | 00416C4C0042 | A?B | 413F42 |
+-------+--------------+--------+-------------+
1 row in set (0.00 sec)
There are several things that need explanation here.
1. The fact that it is a warning rather than an error is characteristic of MySQL. We like to try to do what we can, to get the best
fit, rather than give up.
2. The Jcharacter isn't in the gb2312 character set. We described that problem earlier.
3. Admittedly the message is misleading. We didn't truncate in this case, we replaced with a question mark. We've had a complaint
about this message (See Bug#9337). But until we come up with something better, just accept that error/warning code 2165 can
mean a variety of things.
4. With SQL_MODE=TRADITIONAL, there would be an error message, but instead of error 2165 you would see: ERROR 1406
(22001): Data too long for column 'gb2312' at row 1.
23.11.10: Why does my GUI front end or browser not display CJK characters correctly in my application using Access, PHP, or
another API?
Obtain a direct connection to the server using the mysql client (Windows: mysql.exe), and try the same query there. If mysql re-
sponds correctly, then the trouble may be that your application interface requires initialization. Use mysql to tell you what character set
or sets it uses with the statement SHOW VARIABLES LIKE 'char%';. If you are using Access, then you are most likely connect-
ing with MyODBC. In this case, you should check Section 21.1.4, Connector/ODBC Configuration. If, for instance, you use big5,
you would enter SET NAMES 'big5'. (Note that no ; is required in this case). If you are using ASP, you might need to add SET
NAMES in the code. Here is an example that has worked in the past:
<%
Session.CodePage=0
Dim strConnection
Dim Conn
strConnection="driver={MySQL ODBC 3.51 Driver};server=server;uid=username;" \
& "pwd=password;database=database;stmt=SET NAMES 'big5';"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strConnection
%>
In much the same way, if you are using any character set other than latin1 with Connector/NET, then you must specify the character
set in the connection string. See Section 21.2.4.2, Connecting to MySQL Using Connector/NET, for more information.
If you are using PHP, try this:
<?php
$link = mysql_connect($host, $usr, $pwd);
mysql_select_db($db);
if( mysql_error() ) { print "Database ERROR: " . mysql_error(); }
mysql_query("SET NAMES 'utf8'", $link);
?>
MySQL 5.1 Frequently Asked Questions
2726
In this case, we used SET NAMES to change character_set_client and character_set_connection and charac-
ter_set_results.
We encourage the use of the newer mysqli extension, rather than mysql. Using mysqli, the previous example could be rewritten as
shown here:
<?php
$link = new mysqli($host, $usr, $pwd, $db);
if( mysqli_connect_errno() )
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$link->query("SET NAMES 'utf8'");
?>
Another issue often encountered in PHP applications has to do with assumptions made by the browser. Sometimes adding or changing a
<meta> tag suffices to correct the problem: for example, to insure that the user agent interprets page content as UTF-8, you should in-
clude <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> in the <head> of the HTML
page.
If you are using Connector/J, see Section 21.4.4.4, Using Character Sets and Unicode.
23.11.11: I've upgraded to MySQL 5.1. How can I revert to behavior like that in MySQL 4.0 with regard to character sets?
In MySQL Version 4.0, there was a single global character set for both server and client, and the decision as to which character to use
was made by the server administrator. This changed starting with MySQL Version 4.1. What happens now is a handshake, as de-
scribed in Section 9.1.4, Connection Character Sets and Collations:
When a client connects, it sends to the server the name of the character set that it wants to use. The server uses the
name to set the character_set_client, character_set_results, and charac-
ter_set_connection system variables. In effect, the server performs a SET NAMES operation using the char-
acter set name.
The effect of this is that you cannot control the client character set by starting mysqld with --character-set-server=utf8.
However, some of our Asian customers have said that they prefer the MySQL 4.0 behavior. To make it possible to retain this behavior,
we added a mysqld switch, --character-set-client-handshake, which can be turned off with -
-skip-character-set-client-handshake. If you start mysqld with -
-skip-character-set-client-handshake, then, when a client connects, it sends to the server the name of the character set
that it wants to use however, the server ignores this request from the client.
By way of example, suppose that your favorite server character set is latin1 (unlikely in a CJK area, but this is the default value).
Suppose further that the client uses utf8 because this is what the client's operating system supports. Now, start the server with lat-
in1 as its default character set:
mysqld --character-set-server=latin1
And then start the client with the default character set utf8:
mysql --default-character-set=utf8
The current settings can be seen by viewing the output of SHOW VARIABLES:
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.01 sec)
Now stop the client, and then stop the server using mysqladmin. Then start the server again, but this time tell it to skip the handshake
like so:
mysqld --character-set-server=utf8 --skip-character-set-client-handshake
MySQL 5.1 Frequently Asked Questions
2727
Start the client with utf8 once again as the default character set, then display the current settings:
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.01 sec)
As you can see by comparing the differing results from SHOW VARIABLES, the server ignores the client's initial settings if the -
-skip-character-set-client-handshake is used.
23.11.12: Why do some LIKE and FULLTEXT searches with CJK characters fail?
There is a very simple problem with LIKE searches on BINARY and BLOB columns: we need to know the end of a character. With
multi-byte character sets, different characters might have different octet lengths. For example, in utf8, A requires one byte but ^re-
quires three bytes, as shown here:
+-------------------------+---------------------------+
| OCTET_LENGTH(_utf8 'A') | OCTET_LENGTH(_utf8 '^') |
+-------------------------+---------------------------+
| 1 | 3 |
+-------------------------+---------------------------+
1 row in set (0.00 sec)
If we don't know where the first character ends, then we don't know where the second character begins, in which case even very simple
searches such as LIKE '_A%' fail. The solution is to use a regular CJK character set in the first place, or to convert to a CJK character
set before comparing.
This is one reason why MySQL cannot allow encodings of nonexistent characters. If it is not strict about rejecting bad input, then it has
no way of knowing where characters end.
For FULLTEXT searches, we need to know where words begin and end. With Western languages, this is rarely a problem because most
(if not all) of these use an easy-to-identify word boundary the space character. However, this is not usually the case with Asian writ-
ing. We could use arbitrary halfway measures, like assuming that all Han characters represent words, or (for Japanese) depending on
changes from Katakana to Hiragana due to grammatical endings. However, the only sure solution requires a comprehensive word list,
which means that we would have to include a dictionary in the server for each Asian language supported. This is simply not feasible.
23.11.13: How do I know whether character X is available in all character sets?
The majority of simplified Chinese and basic nonhalfwidth Japanese Kana characters appear in all CJK character sets. This stored pro-
cedure accepts a UCS-2 Unicode character, converts it to all other character sets, and displays the results in hexadecimal.
DELIMITER //
CREATE PROCEDURE p_convert(ucs2_char CHAR(1) CHARACTER SET ucs2)
BEGIN
CREATE TABLE tj
(ucs2 CHAR(1) character set ucs2,
utf8 CHAR(1) character set utf8,
big5 CHAR(1) character set big5,
cp932 CHAR(1) character set cp932,
eucjpms CHAR(1) character set eucjpms,
euckr CHAR(1) character set euckr,
gb2312 CHAR(1) character set gb2312,
gbk CHAR(1) character set gbk,
sjis CHAR(1) character set sjis,
ujis CHAR(1) character set ujis);
INSERT INTO tj (ucs2) VALUES (ucs2_char);
UPDATE tj SET utf8=ucs2,
big5=ucs2,
cp932=ucs2,
eucjpms=ucs2,
euckr=ucs2,
gb2312=ucs2,
gbk=ucs2,
sjis=ucs2,
ujis=ucs2;
MySQL 5.1 Frequently Asked Questions
2728
/* If there is a conversion problem, UPDATE will produce a warning. */
SELECT hex(ucs2) AS ucs2,
hex(utf8) AS utf8,
hex(big5) AS big5,
hex(cp932) AS cp932,
hex(eucjpms) AS eucjpms,
hex(euckr) AS euckr,
hex(gb2312) AS gb2312,
hex(gbk) AS gbk,
hex(sjis) AS sjis,
hex(ujis) AS ujis
FROM tj;
DROP TABLE tj;
END//
The input can be any single ucs2 character, or it can be the code point value (hexadecimal representation) of that character. For ex-
ample, from Unicode's list of ucs2 encodings and names (http://www.unicode.org/Public/UNIDATA/UnicodeData.txt), we know that
the Katakana character Pe appears in all CJK character sets, and that its code point value is 0x30da. If we use this value as the argu-
ment to p_convert(), the result is as shown here:
mysql> CALL p_convert(0x30da)//
+------+--------+------+-------+---------+-------+--------+------+------+------+
| ucs2 | utf8 | big5 | cp932 | eucjpms | euckr | gb2312 | gbk | sjis | ujis |
+------+--------+------+-------+---------+-------+--------+------+------+------+
| 30DA | E3839A | C772 | 8379 | A5DA | ABDA | A5DA | A5DA | 8379 | A5DA |
+------+--------+------+-------+---------+-------+--------+------+------+------+
1 row in set (0.04 sec)
Since none of the column values is 3F that is, the question mark character (?) we know that every conversion worked.
23.11.14: Why don't CJK strings sort correctly in Unicode? (I)
Sometimes people observe that the result of a utf8_unicode_ci or ucs2_unicode_ci search, or of an ORDER BY sort is not
what they think a native would expect. Although we never rule out the possibility that there is a bug, we have found in the past that
many people do not read correctly the standard table of weights for the Unicode Collation Algorithm. MySQL uses the table found at
http://www.unicode.org/Public/UCA/4.0.0/allkeys-4.0.0.txt. This is not the first table you will find by navigating from the uni-
code.org home page, because MySQL uses the older 4.0.0 allkeys table, rather than the more recent 4.1.0 table. This is because we
are very wary about changing ordering which affects indexes, lest we bring about situations such as that reported in Bug#16526, illus-
trated as follows:
mysql< CREATE TABLE tj (s1 CHAR(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
Query OK, 0 rows affected (0.05 sec)
mysql> INSERT INTO tj VALUES ('D'),('L');
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM tj WHERE s1 = 'L';
+------+
| s1 |
+------+
| D |
| L |
+------+
2 rows in set (0.00 sec)
The character in the first result row is not the one that we searched for. Why did MySQL retrieve it? First we look for the Unicode code
point value, which is possible by reading the hexadecimal number for the ucs2 version of the characters:
mysql> SELECT s1, HEX(CONVERT(s1 USING ucs2)) FROM tj;
+------+-----------------------------+
| s1 | HEX(CONVERT(s1 USING ucs2)) |
+------+-----------------------------+
| D | 304C |
| L | 304B |
+------+-----------------------------+
2 rows in set (0.03 sec)
Now we search for 304B and 304C in the 4.0.0 allkeys table, and find these lines:
304B ; [.1E57.0020.000E.304B] # HIRAGANA LETTER KA
304C ; [.1E57.0020.000E.304B][.0000.0140.0002.3099] # HIRAGANA LETTER GA; QQCM
The official Unicode names (following the # mark) tell us the Japanese syllabary (Hiragana), the informal classification (letter, digit,
or punctuation mark), and the Western identifier (KA or GA, which happen to be voiced and unvoiced components of the same letter
pair). More importantly, the primary weight (the first hexadecimal number inside the square brackets) is 1E57 on both lines. For com-
parisons in both searching and sorting, MySQL pays attention to the primary weight only, ignoring all the other numbers. This means
MySQL 5.1 Frequently Asked Questions
2729
that we are sorting Dand Lcorrectly according to the Unicode specification. If we wanted to distinguish them, we'd have to use a non-
UCA (Unicode Collation Algorithm) collation (utf8_bin or utf8_general_ci), or to compare the HEX() values, or use ORDER
BY CONVERT(s1 USING sjis). Being correct according to Unicode isn't enough, of course: the person who submitted the bug
was equally correct. We plan to add another collation for Japanese according to the JIS X 4061 standard, in which voiced/unvoiced let-
ter pairs like KA/GA are distinguishable for ordering purposes.
23.11.15: Why don't CJK strings sort correctly in Unicode? (II)
If you are using Unicode (ucs2 or utf8), and you know what the Unicode sort order is (see Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets), but MySQL still seems to sort your table incorrectly, then you should first
verify the table character set:
mysql> SHOW CREATE TABLE t\G
******************** 1. row ******************
Table: t
Create Table: CREATE TABLE `t` (
`s1` char(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
Since the character set appears to be correct, let's see what information the INFORMATION_SCHEMA.COLUMNS table can provide
about this column:
mysql> SELECT COLUMN_NAME, CHARACTER_SET_NAME, COLLATION_NAME
-> FROM INFORMATION_SCHEMA.COLUMNS
-> WHERE COLUMN_NAME = 's1'
-> AND TABLE_NAME = 't';
+-------------+--------------------+-----------------+
| COLUMN_NAME | CHARACTER_SET_NAME | COLLATION_NAME |
+-------------+--------------------+-----------------+
| s1 | ucs2 | ucs2_general_ci |
+-------------+--------------------+-----------------+
1 row in set (0.01 sec)
(See Section 20.3, The INFORMATION_SCHEMA COLUMNS Table, for more information.)
You can see that the collation is ucs2_general_ci instead of ucs2_unicode_ci. The reason why this is so can be found using
SHOW CHARSET, as shown here:
mysql> SHOW CHARSET LIKE 'ucs2%';
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |
+---------+---------------+-------------------+--------+
1 row in set (0.00 sec)
For ucs2 and utf8, the default collation is general. To specify a Unicode collation, use COLLATE ucs2_unicode_ci.
23.11.16: Why are my supplementary characters rejected by MySQL?
Before MySQL 6.0.4, MySQL does not support supplementary characters that is, characters which need more than 3 bytes for
UTF-8. We support only what Unicode calls the Basic Multilingual Plane / Plane 0. Only a few very rare Han characters are supple-
mentary; support for them is uncommon. This has led to reports such as that found in Bug#12600, which we rejected as not a bug.
With utf8, we must truncate an input string when we encounter bytes that we don't understand. Otherwise, we wouldn't know how
long the bad multi-byte character is.
One possible workaround is to use ucs2 instead of utf8, in which case the bad characters are changed to question marks; however,
no truncation takes place. You can also change the data type to BLOB or BINARY, which perform no validity checking.
As of MySQL 6.0.4, Unicode support is extended to include supplementary characters by means of additional Unicode character sets:
utf16, utf32, and 4-byte utf8. These character sets support supplementary Unicode characters outside the Basic Multilingual Plane
(BMP).
23.11.17: Shouldn't it be CJKV?
No. The term CJKV (Chinese Japanese Korean Vietnamese) refers to Vietnamese character sets which contain Han (originally
Chinese) characters. MySQL has no plan to support the old Vietnamese script using Han characters. MySQL does of course support the
modern Vietnamese script with Western characters.
Bug#4745 is a request for a specialized Vietnamese collation, which we might add in the future if there is sufficient demand for it.
23.11.18: Does MySQL allow CJK characters to be used in database and table names?
MySQL 5.1 Frequently Asked Questions
2730
This issue is fixed in MySQL 5.1, by automatically rewriting the names of the corresponding directories and files.
For example, if you create a database named Mon a server whose operating system does not support CJK in directory names, MySQL
creates a directory named @0w@00a5@00ae. which is just a fancy way of encoding E6A5AE that is, the Unicode hexadecimal rep-
resentation for the Mcharacter. However, if you run a SHOW DATABASES statement, you can see that the database is listed as M.
23.11.19: Where can I find translations of the MySQL Manual into Chinese, Japanese, and Korean?
A Simplified Chinese version of the Manual, current for MySQL 5.1.12, can be found at http://dev.mysql.com/doc/. The Japanese trans-
lation of the MySQL 4.1 manual can be downloaded from http://dev.mysql.com/doc/.
23.11.20: Where can I get help with CJK and related issues in MySQL?
The following resources are available:
A listing of MySQL user groups can be found at http://dev.mysql.com/user-groups/.
You can contact a sales engineer at the MySQL KK Japan office using any of the following:
Tel: +81(0)3-5326-3133
Fax: +81(0)3-5326-3001
Email: [email protected]
View feature requests relating to character set issues at http://tinyurl.com/y6xcuf.
Visit the MySQL Character Sets, Collation, Unicode Forum. We are also in the process of adding foreign-language forums at ht-
tp://forums.mysql.com/.
A.12. MySQL 5.1 FAQ Connectors & APIs
For common questions, issues, and answers relating to the MySQL Connectors and other APIs, see the following areas of the Manual:
Section 21.10.10, Common Questions and Problems When Using the C API
Section 21.11.5, Common Problems with MySQL and PHP
Section 21.1.7, Connector/ODBC Notes and Tips
Section 21.2.4, Connector/NET Programming
Section 21.4.5, Connector/J Notes and Tips
Section 21.5.6, Connector/MXJ Notes and Tips
A.13. MySQL 5.1 FAQ Replication
For answers to common queries and question regarding Replication within MySQL, see Section 16.3.4, Replication FAQ.
A.14. MySQL 5.1 FAQ MySQL, DRBD, and Heartbeat
A.14.1. Distributed Replicated Block Device (DRBD)
In the following section, we provide answers to questions that are most frequently asked about Distributed Replicated Block Device
(DRBD).
Questions
23.14.1.1: What is DRBD?
MySQL 5.1 Frequently Asked Questions
2731
23.14.1.2: What are Block Devices?
23.14.1.3: How is DRBD licensed?
23.14.1.4: Where can I download DRBD?
23.14.1.5: If I find a bug in DRBD, to whom do I submit the issue?
23.14.1.6: Where can I get more technical and business information concerning MySQL and DRBD?
Questions and Answers
23.14.1.1: What is DRBD?
DRBD is an acronym for Distributed Replicated Block Device. DRBD is an open source Linux kernel block device which leverages
synchronous replication to achieve a consistent view of data between two systems, typically an Active and Passive system. DRBD cur-
rently supports all the major flavors of Linux and comes bundled in several major Linux distributions. The DRBD project is maintained
by LINBIT.
23.14.1.2: What are Block Devices?
A block device is the type of device used to represent storage in the Linux Kernel. All physical disk devices present a block device inter-
face. Additionally, virtual disk systems like LVM or DRBD present a block device interface. In this way, the file system or other soft-
ware that might want to access a disk device can be used with any number of real or virtual devices without having to know anything
about their underlying implementation details.
23.14.1.3: How is DRBD licensed?
DRBD is licensed under the GPL.
23.14.1.4: Where can I download DRBD?
Please see http://www.drbd.org/download/packages/.
23.14.1.5: If I find a bug in DRBD, to whom do I submit the issue?
Bug reports should be submitted to the DRBD mailing list. Please see http://lists.linbit.com/.
23.14.1.6: Where can I get more technical and business information concerning MySQL and DRBD?
Please visit http://mysql.com/drbd/.
A.14.2. Linux Heartbeat
In the following section, we provide answers to questions that are most frequently asked about Linux Heartbeat.
Questions
23.14.2.1: What is Linux Heartbeat?
23.14.2.2: How is Linux Heartbeat licensed?
23.14.2.3: Where can I download Linux Heartbeat?
23.14.2.4: If I find a bug with Linux Heartbeat, to whom do I submit the issue?
Questions and Answers
23.14.2.1: What is Linux Heartbeat?
The Linux-HA project (http://www.linux-ha.org/) offers a high availability solution commonly referred to as Linux Heartbeat. Linux
Heartbeat ships as part of several Linux distributions, as well as within several embedded high availability systems. This solution can
also be used for other applications besides databases servers, such as mail servers, web servers, file servers, and DNS servers.
MySQL 5.1 Frequently Asked Questions
2732
Linux Heartbeat implements a heartbeat-protocol. A heartbeat-protocol means that messages are sent at regular intervals between two or
more nodes. If a message is not received from a node within a given interval, then it is assumed the node has failed and some type of
failover or recovery action is required. Linux Heartbeat is typically configured to send these heartbeat messages over standard Ethernet
interfaces, but it does also support other methods, such as serial-line links.
23.14.2.2: How is Linux Heartbeat licensed?
Linux Heartbeat is licensed under the GPL.
23.14.2.3: Where can I download Linux Heartbeat?
Please see http://linux-ha.org/download/index.html.
23.14.2.4: If I find a bug with Linux Heartbeat, to whom do I submit the issue?
Bug reports should be submitted to http://www.linux-ha.org/ClusterResourceManager/BugReports.
A.14.3. DRBD Architecture
In the following section, we provide answers to questions that are most frequently asked about DRBD Architecture.
Questions
23.14.3.1: Is an Active/Active option available for MySQL with DRBD?
23.14.3.2: What MySQL storage engines are supported with DRBD?
23.14.3.3: How long does a failover take?
23.14.3.4: How long does it take to resynchronize data after a failure?
23.14.3.5: Are there any situations where you shouldn't use DRBD?
23.14.3.6: Are there any limitations to DRBD?
23.14.3.7: Where can I find more information on sample architectures?
Questions and Answers
23.14.3.1: Is an Active/Active option available for MySQL with DRBD?
Currently, MySQL does not support Active/Active configurations using DRBD out of the box.
23.14.3.2: What MySQL storage engines are supported with DRBD?
All of the MySQL transactional storage engines are supported by DRBD, including InnoDB and Falcon. For archived or read-only data,
MyISAM or Archive can also be used.
23.14.3.3: How long does a failover take?
Failover time is dependent on many things, some of which are configurable. After activating the passive host, MySQL will have to start
and run a normal recovery process. If the InnoDB log files have been configured to a large size and there was heavy write traffic, this
may take a reasonably long period of time. However, under normal circumstances, failover tends to take less than a minute.
23.14.3.4: How long does it take to resynchronize data after a failure?
Resynchronization time depends on how long the two machines are out of communication and how much data was written during that
period of time. Resynchronization time is a function of data to be synced, network speed and disk speed. DRBD maintains a bitmap of
changed blocks on the primary machine, so only those blocks that have changed will need to be transferred.
23.14.3.5: Are there any situations where you shouldn't use DRBD?
See When Not To Use DRBD.
MySQL 5.1 Frequently Asked Questions
2733
23.14.3.6: Are there any limitations to DRBD?
See DRBD limitations (or are they?).
23.14.3.7: Where can I find more information on sample architectures?
For an example of a Heartbeat R1-compatible resource configuration involving a MySQL database backed by DRBD, see DRBD User's
Guide.
For an example of the same DRBD-backed configuration for a MySQL database in a Heartbeat CRM cluster, see DRBD User's Guide.
A.14.4. DRBD and MySQL Replication
In the following section, we provide answers to questions that are most frequently asked about MySQL Replication Scale-out.
Questions
23.14.4.1: What is the difference between MySQL Cluster and DRBD?
23.14.4.2: What is the difference between MySQL Replication and DRBD?
23.14.4.3: How can I combine MySQL Replication scale-out with DRBD?
Questions and Answers
23.14.4.1: What is the difference between MySQL Cluster and DRBD?
Both MySQL Cluster and DRBD replicate data synchronously. MySQL Cluster leverages a shared-nothing storage architecture in
which the cluster can be architected beyond an Active/Passive configuration. DRBD operates at a much lower level within the stack,
at the disk I/O level. For a comparison of various high availability features between these two options, please refer to Chapter 14, High
Availability and Scalability.
23.14.4.2: What is the difference between MySQL Replication and DRBD?
MySQL Replication replicates data asynchronously while DRBD replicates data synchronously. Also, MySQL Replication replicates
MySQL statements, while DRBD replicates the underlying block device that stores the MySQL data files. For a comparison of various
high availability features between these two options, please refer to the high availability comparison grid, Chapter 14, High Availability
and Scalability.
23.14.4.3: How can I combine MySQL Replication scale-out with DRBD?
MySQL Replication is typically deployed in a Master to many Slaves configuration. In this configuration, having many Slaves provides
read scalability. DRBD is used to provide high-availability for the Master MySQL Server in an Active/Passive configuration. This
provides for automatic failover, safeguards against data loss, and automatically synchronizes the failed MySQL Master after a failover.
The most likely scenario in which MySQL Replication scale-out can be leveraged with DRBD is in the form of attaching replicated
MySQL read-slaves off of the Active-Master MySQL Server, shown in Figure A.1, Active-Master MySQL Server. Since DRBD
replicates an entire block device, master information such as the binary logs are also replicated. In this way, all of the slaves can attach
to the Virtual IP Address managed by Linux Heartbeat. In the event of a failure, the asynchronous nature of MySQL Replication allows
the slaves to continue with the new Active machine as their master with no intervention needed.
Figure A.1. Active-Master MySQL Server
MySQL 5.1 Frequently Asked Questions
2734
A.14.5. DRBD and File Systems
In the following section, we provide answers to questions that are most frequently asked about DRBD and file systems.
Questions
23.14.5.1: Can XFS be used with DRBD?
Questions and Answers
23.14.5.1: Can XFS be used with DRBD?
Yes. XFS uses dynamic block size, thus DRBD 0.7 or later is needed.
A.14.6. DRBD and LVM
In the following section, we provide answers to questions that are most frequently asked about DRBD and LVM.
Questions
23.14.6.1: Can I use DRBD on top of LVM?
23.14.6.2: Can I use LVM on top of DRBD?
23.14.6.3: Can I use DRBD on top of LVM while at the same time running LVM on top of that DRBD?
Questions and Answers
23.14.6.1: Can I use DRBD on top of LVM?
MySQL 5.1 Frequently Asked Questions
2735
Yes, DRBD supports on-line resizing. If you enlarge your logical volume that acts as a backing device for DRBD, you can enlarge
DRBD itself too, and of course your file system if it supports resizing.
23.14.6.2: Can I use LVM on top of DRBD?
Yes, you can use DRBD as a Physical Volume (PV) for LVM. Depending on the default LVM configuration shipped with your distribu-
tion, you may need to add the /dev/drbd* device files to the filter option in your lvm.conf so LVM scans your DRBDs for
PV signatures.
23.14.6.3: Can I use DRBD on top of LVM while at the same time running LVM on top of that DRBD?
This requires careful tuning of your LVM configuration to avoid duplicate PV scans, but yes, it is possible.
A.14.7. DRBD and Virtualization
In the following section, we provide answers to questions that are most frequently asked about DRBD and virtualization.
Questions
23.14.7.1: Can I use DRBD with OpenVZ?
23.14.7.2: Can I use DRBD with Xen and/or KVM?
Questions and Answers
23.14.7.1: Can I use DRBD with OpenVZ?
See http://wiki.openvz.org/HA_cluster_with_DRBD_and_Heartbeat.
23.14.7.2: Can I use DRBD with Xen and/or KVM?
Yes. If you are looking for professional consultancy or expert commercial support for Xen- or KVM-based virtualization clusters with
DRBD, contact LINBIT (http://www.linbit.com).
A.14.8. DRBD and Security
In the following section, we provide answers to questions that are most frequently asked about DRBD and security.
Questions
23.14.8.1: Can I encrypt/compress the exchanged data?
23.14.8.2: Does DRBD do mutual node authentication?
Questions and Answers
23.14.8.1: Can I encrypt/compress the exchanged data?
Yes. But there is no option within DRBD to allow for this. Youll need to leverage a VPN and the network layer should do the rest.
23.14.8.2: Does DRBD do mutual node authentication?
Yes, starting with DRBD 8 shared-secret mutual node authentication is supported.
A.14.9. DRBD and System Requirements
In the following section, we provide answers to questions that are most frequently asked about DRBD and System Requirements.
Questions
MySQL 5.1 Frequently Asked Questions
2736
23.14.9.1: What other packages besides DRBD are required?
23.14.9.2: How many machines are required to set up DRBD?
23.14.9.3: Does DRBD only run on Linux?
Questions and Answers
23.14.9.1: What other packages besides DRBD are required?
When using pre-built binary packages, none except a matching kernel, plus packages for glibc and your favorite shell. When compil-
ing DRBD from source additional prerequisite packages may be required. They include but are not limited to:
glib-devel
openssl
devel
libgcrypt-devel
glib2-devel
pkgconfig
ncurses-devel
rpm-build
rpm-devel
redhat-rpm-config
gcc
gcc-c++
bison
flex
gnutls-devel
lm_sensors-devel
net-snmp-devel
python-devel
bzip2-devel
libselinux-devel
perl-DBI
libnet
Pre-built x86 and x86_64 packages for specific kernel versions are available with a support subscription from LINBIT. Please note that
if the kernel is upgraded, DRBD must be as well.
23.14.9.2: How many machines are required to set up DRBD?
Two machines are required to achieve the minimum degree of high availability. Although at any one given point in time one will be
primary and one will be secondary, it is better to consider the machines as part of a mirrored pair without a natural primary machine.
MySQL 5.1 Frequently Asked Questions
2737
23.14.9.3: Does DRBD only run on Linux?
DRBD is a Linux Kernel Module, and can work with many popular Linux distributions. DRBD is currently not available for non-Linux
operating systems.
A.14.10. DBRD and Support and Consulting
In the following section, we provide answers to questions that are most frequently asked about DRBD and resources.
Questions
23.14.10.1: Does MySQL offer professional consulting to help with designing a DRBD system?
23.14.10.2: Does MySQL offer support for DRBD and Linux Heartbeat from MySQL?
23.14.10.3: Are pre-built binaries or RPMs available?
23.14.10.4: Does MySQL have documentation to help me with the installation and configuration of DRBD and Linux Heartbeat?
23.14.10.5: Is there a dedicated discussion forum for MySQL High-Availability?
23.14.10.6: Where can I get more information about MySQL for DRBD?
Questions and Answers
23.14.10.1: Does MySQL offer professional consulting to help with designing a DRBD system?
Yes. MySQL offers consulting for the design, installation, configuration, and monitoring of high availability DRBD. For more informa-
tion concerning a High Availability Jumpstart, please see: http://www.mysql.com/consulting/packaged/scaleout.html.
23.14.10.2: Does MySQL offer support for DRBD and Linux Heartbeat from MySQL?
Yes. Support for DRBD and Linux Heartbeat is available with an add-on subscription to MySQL Enterprise called DRBD for
MySQL. For more information about support options for DRBD see: http://mysql.com/products/enterprise/features.html.
For the list of supported Linux distributions, please see: http://www.mysql.com/support/supportedplatforms/enterprise.html.
Note
DRBD is only available on Linux. DRBD is not available on Windows, MacOS, Solaris, HPUX, AIX, FreeBSD, or other
non-Linux platforms.
23.14.10.3: Are pre-built binaries or RPMs available?
Yes. DRBD for MySQL is an add-on subscription to MySQL Enterprise, which provides pre-built binaries for DRBD. For more in-
formation, see: http://mysql.com/products/enterprise/features.html.
23.14.10.4: Does MySQL have documentation to help me with the installation and configuration of DRBD and Linux Heart-
beat?
For MySQL-specific DRBD documentation, see Section 14.1, Using MySQL with DRBD.
For general DRBD documentation, see DRBD User's Guide.
23.14.10.5: Is there a dedicated discussion forum for MySQL High-Availability?
Yes, http://forums.mysql.com/list.php?144.
23.14.10.6: Where can I get more information about MySQL for DRBD?
For more information about MySQL for DRBD, including a technical white paper please see: DRBD for MySQL High Availability.
MySQL 5.1 Frequently Asked Questions
2738
Appendix B. Errors, Error Codes, and Common Problems
This appendix lists common problems and errors that may occur and potential resolutions, in addition to listing the errors that may ap-
pear when you call MySQL from any host language. The first section covers problems and resolutions. Detailed information on errors is
provided; The first list displays server error messages. The second list displays client program messages.
MySQL Enterprise
The MySQL Enterprise Monitor provides a Virtual DBA to assist with problem solving. For more information,
see http://www.mysql.com/products/enterprise/advisors.html.
B.1. Problems and Common Errors
This section lists some common problems and error messages that you may encounter. It describes how to determine the causes of the
problems and what to do to solve them.
B.1.1. How to Determine What Is Causing a Problem
When you run into a problem, the first thing you should do is to find out which program or piece of equipment is causing it:
If you have one of the following symptoms, then it is probably a hardware problems (such as memory, motherboard, CPU, or hard
disk) or kernel problem:
The keyboard doesn't work. This can normally be checked by pressing the Caps Lock key. If the Caps Lock light doesn't change,
you have to replace your keyboard. (Before doing this, you should try to restart your computer and check all cables to the key-
board.)
The mouse pointer doesn't move.
The machine doesn't answer to a remote machine's pings.
Other programs that are not related to MySQL don't behave correctly.
Your system restarted unexpectedly. (A faulty user-level program should never be able to take down your system.)
In this case, you should start by checking all your cables and run some diagnostic tool to check your hardware! You should also
check whether there are any patches, updates, or service packs for your operating system that could likely solve your problem.
Check also that all your libraries (such as glibc) are up to date.
It is always good to use a machine with ECC memory to discover memory problems early.
If your keyboard is locked up, you may be able to recover by logging in to your machine from another machine and executing
kbd_mode -a.
Please examine your system log file (/var/log/messages or similar) for reasons for your problem. If you think the problem is
in MySQL, you should also examine MySQL's log files. See Section 5.2, MySQL Server Logs.
If you don't think you have hardware problems, you should try to find out which program is causing problems. Try using top, ps,
Task Manager, or some similar program, to check which program is taking all CPU or is locking the machine.
Use top, df, or a similar program to check whether you are out of memory, disk space, file descriptors, or some other critical re-
source.
If the problem is some runaway process, you can always try to kill it. If it doesn't want to die, there is probably a bug in the operat-
ing system.
If after you have examined all other possibilities and you have concluded that the MySQL server or a MySQL client is causing the prob-
lem, it is time to create a bug report for our mailing list or our support team. In the bug report, try to give a very detailed description of
how the system is behaving and what you think is happening. You should also state why you think that MySQL is causing the problem.
Take into consideration all the situations in this chapter. State any problems exactly how they appear when you examine your system.
Use the copy and paste method for any output and error messages from programs and log files.
2739
Try to describe in detail which program is not working and all symptoms you see. We have in the past received many bug reports that
state only the system doesn't work. This doesn't provide us with any information about what could be the problem.
If a program fails, it is always useful to know the following information:
Has the program in question made a segmentation fault (did it dump core)?
Is the program taking up all available CPU time? Check with top. Let the program run for a while, it may simply be evaluating
something computationally intensive.
If the mysqld server is causing problems, can you get any response from it with mysqladmin -u root ping or mysqlad-
min -u root processlist?
What does a client program say when you try to connect to the MySQL server? (Try with mysql, for example.) Does the client
jam? Do you get any output from the program?
When sending a bug report, you should follow the outline described in Section 1.6, How to Report Bugs or Problems.
B.1.2. Common Errors When Using MySQL Programs
This section lists some errors that users frequently encounter when running MySQL programs. Although the problems show up when
you try to run client programs, the solutions to many of the problems involves changing the configuration of the MySQL server.
B.1.2.1. Access denied
An Access denied error can have many causes. Often the problem is related to the MySQL accounts that the server allows client
programs to use when connecting. See Section 5.4, The MySQL Access Privilege System, and Section 5.4.7, Causes of Access-
Denied Errors.
B.1.2.2. Can't connect to [local] MySQL server
A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file
in the file system (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file con-
nection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you
don't specify a host name or if you specify the special host name localhost.
If the MySQL server is running on Windows, you can connect via TCP/IP. If the server is started with the --enable-named-pipe
option, you can also connect with named pipes if you run the client on the host where the server is running. The name of the named pipe
is MySQL by default. If you don't give a host name when connecting to mysqld, a MySQL client first tries to connect to the named
pipe. If that doesn't work, it connects to the TCP/IP port. You can force the use of named pipes on Windows by using . as the host
name.
The error (2002) Can't connect to ... normally means that there is no MySQL server running on the system or that you are us-
ing an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the
TCP/IP port you are using has not been blocked by a firewall or port blocking service.
The error (2003) Can't connect to MySQL server on 'server' (10061) indicates that the network connection has
been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network
port you specified is the one configured on the server.
Start by checking whether there is a process named mysqld running on your server host. (Use ps xa | grep mysqld on Unix or
the Task Manager on Windows.) If there is no such process, you should start the server. See Section 2.11.2.3, Starting and
Troubleshooting the MySQL Server.
If a mysqld process is running, you can check it by trying the following commands. The port number or Unix socket file name might
be different in your setup. host_ip represents the IP number of the machine where the server is running.
shell> mysqladmin version
shell> mysqladmin variables
shell> mysqladmin -h `hostname` version variables
shell> mysqladmin -h `hostname` --port=3306 version
shell> mysqladmin -h host_ip version
shell> mysqladmin --protocol=SOCKET --socket=/tmp/mysql.sock version
Errors, Error Codes, and Common Problems
2740
Note the use of backticks rather than forward quotes with the hostname command; these cause the output of hostname (that is, the
current host name) to be substituted into the mysqladmin command. If you have no hostname command or are running on Win-
dows, you can manually type the host name of your machine (without backticks) following the -h option. You can also try -h
127.0.0.1 to connect with TCP/IP to the local host.
Make sure that the server has not been configured to ignore network connections or (if you are attempting to connect remotely) that it
has not been configured to listen only locally on its network interfaces. If the server was started with --skip-networking, it will
not accept TCP/IP connections at all. If the server was started with --bind-address=127.0.0.1, it will listen for TCP/IP con-
nections only locally on the loopback interface and will not accept remote connections.
Check to make sure that there is no firewall blocking access to MySQL. Your firewall may be configured on the basis of the application
being executed, or the port number used by MySQL for communication (3306 by default). Under Linux or Unix, check your IP tables
(or similar) configuration to ensure that the port has not been blocked. Under Windows, applications such as ZoneAlarm or the Win-
dows XP personal firewall may need to be configured not to block the MySQL port.
Here are some reasons the Can't connect to local MySQL server error might occur:
mysqld is not running on the local host. Check your operating system's process list to ensure the mysqld process is present.
You're running a MySQL server on Windows with many TCP/IP connections to it. If you're experiencing that quite often your cli-
ents get that error, you can find a workaround here: Section B.1.2.2.1, Connection to MySQL Server Failing on
Windows.
You are running on a system that uses MIT-pthreads. If you are running on a system that doesn't have native threads, mysqld uses
the MIT-pthreads package. See Section 2.1.1, Operating Systems Supported by MySQL Community Server. However, not all
MIT-pthreads versions support Unix socket files. On a system without socket file support, you must always specify the host name
explicitly when connecting to the server. Try using this command to check the connection to the server:
shell> mysqladmin -h `hostname` version
Someone has removed the Unix socket file that mysqld uses (/tmp/mysql.sock by default). For example, you might have a
cron job that removes old files from the /tmp directory. You can always run mysqladmin version to check whether the
Unix socket file that mysqladmin is trying to use really exists. The fix in this case is to change the cron job to not remove
mysql.sock or to place the socket file somewhere else. See Section B.1.4.5, How to Protect or Change the MySQL Unix Socket
File.
You have started the mysqld server with the --socket=/path/to/socket option, but forgotten to tell client programs the
new name of the socket file. If you change the socket path name for the server, you must also notify the MySQL clients. You can do
this by providing the same --socket option when you run client programs. You also need to ensure that clients have permission
to access the mysql.sock file. To find out where the socket file is, you can do:
shell> netstat -ln | grep mysql
See Section B.1.4.5, How to Protect or Change the MySQL Unix Socket File.
You are using Linux and one server thread has died (dumped core). In this case, you must kill the other mysqld threads (for ex-
ample, with kill or with the mysql_zap script) before you can restart the MySQL server. See Section B.1.4.2, What to Do If
MySQL Keeps Crashing.
The server or client program might not have the proper access privileges for the directory that holds the Unix socket file or the sock-
et file itself. In this case, you must either change the access privileges for the directory or socket file so that the server and clients
can access them, or restart mysqld with a --socket option that specifies a socket file name in a directory where the server can
create it and where client programs can access it.
If you get the error message Can't connect to MySQL server on some_host, you can try the following things to find out
what the problem is:
Check whether the server is running on that host by executing telnet some_host 3306 and pressing the Enter key a couple
of times. (3306 is the default MySQL port number. Change the value if your server is listening to a different port.) If there is a
MySQL server running and listening to the port, you should get a response that includes the server's version number. If you get an
error such as telnet: Unable to connect to remote host: Connection refused, then there is no server run-
ning on the given port.
Errors, Error Codes, and Common Problems
2741
If the server is running on the local host, try using mysqladmin -h localhost variables to connect using the Unix sock-
et file. Verify the TCP/IP port number that the server is configured to listen to (it is the value of the port variable.)
If you are running under Linux and Security-Enhanced Linux (SELinux) is enabled, make sure you have disabled SELinux protec-
tion for the mysqld process.
B.1.2.2.1. Connection to MySQL Server Failing on Windows
When you're running a MySQL server on Windows with many TCP/IP connections to it, and you're experiencing that quite often your
clients get a Can't connect to MySQL server error, the reason might be that Windows doesn't allow for enough ephemeral
(short-lived) ports to serve those connections.
By default, Windows allows 5000 ephemeral (short-lived) TCP ports to the user. After any port is closed it will remain in a
TIME_WAIT status for 120 seconds. This status allows the connection to be reused at a much lower cost than reinitializing a brand new
connection. However, the port will not be available again until this time expires.
With a small stack of available TCP ports (5000) and a high number of TCP ports being open and closed over a short period of time
along with the TIME_WAIT status you have a good chance for running out of ports. There are two ways to address this problem:
Reduce the number of TCP ports consumed quickly by investigating connection pooling or persistent connections where possible
Tune some settings in the Windows registry (see below)
IMPORTANT: The following procedure involves modifying the Windows registry. Before you modify the registry, make sure to
back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to
back up, restore, and edit the registry, view the following article in the Microsoft Knowledge Base: ht-
tp://support.microsoft.com/kb/256986/EN-US/.
1. Start Registry Editor (Regedt32.exe).
2. Locate the following key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
3. On the Edit menu, click Add Value, and then add the following registry value:
Value Name: MaxUserPort
Data Type: REG_DWORD
Value: 65534
This sets the number of ephemeral ports available to any user. The valid range is between 5000 and 65534 (decimal). The default
value is 0x1388 (5000 decimal).
4. On the Edit menu, click Add Value, and then add the following registry value:
Value Name: TcpTimedWaitDelay
Data Type: REG_DWORD
Value: 30
This sets the number of seconds to hold a TCP port connection in TIME_WAIT state before closing. The valid range is between 0
(zero) and 300 (decimal). The default value is 0x78 (120 decimal).
5. Quit Registry Editor.
6. Reboot the machine.
Note: Undoing the above should be as simple as deleting the registry entries you've created.
B.1.2.3. Lost connection to MySQL server
There are three likely causes for this error message.
Errors, Error Codes, and Common Problems
2742
Usually it indicates network connectivity trouble and you should check the condition of your network if this error occurs frequently. If
the error message includes during query, this is probably the case you are experiencing.
Sometimes the during query form happens when millions of rows are being sent as part of one or more queries. If you know that this
is happening, you should try increasing net_read_timeout from its default of 30 seconds to 60 seconds or longer, sufficient for the
data transfer to complete.
More rarely, it can happen when the client is attempting the initial connection to the server. In this case, if your connect_timeout
value is set to only a few seconds, you may be able to resolve the problem by increasing it to ten seconds, perhaps more if you have a
very long distance or slow connection. You can determine whether you are experiencing this more uncommon cause by using SHOW
GLOBAL STATUS LIKE 'Aborted_connects'. It will increase by one for each initial connection attempt that the server aborts.
You may see reading authorization packet as part of the error message; if so, that also suggests that this is the solution that you need.
If the cause is none of those just described, you may be experiencing a problem with BLOB values that are larger than
max_allowed_packet, which can cause this error with some clients. Sometime you may see packet too large as part of the error
message, and that confirms that you need to increase max_allowed_packet.
B.1.2.4. Client does not support authentication protocol
MySQL 5.1 uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older
(pre-4.1) clients. If you upgrade the server from 4.0, attempts to connect to it with an older client may fail with the following message:
shell> mysql
Client does not support authentication protocol requested
by server; consider upgrading MySQL client
To solve this problem, you should use one of the following approaches:
Upgrade all client programs to use a 4.1.1 or newer client library.
When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASS-
WORD statement and the OLD_PASSWORD() function:
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Alternatively, use UPDATE and FLUSH PRIVILEGES:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
Substitute the password you want to use for newpwd in the preceding examples. MySQL cannot tell you what the original pass-
word was, so you'll need to pick a new one.
Tell the server to use the older password hashing algorithm:
1. Start mysqld with the --old-passwords option.
2. Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify
these accounts with the following query:
mysql> SELECT Host, User, Password FROM mysql.user
-> WHERE LENGTH(Password) > 16;
For each account record displayed by the query, use the Host and User values and assign a password using the
OLD_PASSWORD() function and either SET PASSWORD or UPDATE, as described earlier.
Note
In older versions of PHP, the mysql extension does not support the authentication protocol in MySQL 4.1.1 and higher.
Errors, Error Codes, and Common Problems
2743
This is true regardless of the PHP version being used. If you wish to use the mysql extension with MySQL 4.1 or newer,
you may need to follow one of the options discussed above for configuring MySQL to work with old clients. The mysqli
extension (stands for "MySQL, Improved"; added in PHP 5) is compatible with the improved password hashing employed
in MySQL 4.1 and higher, and no special configuration of MySQL need be done to use this MySQL client library. For
more information about the mysqli extension, see http://php.net/mysqli.
It may also be possible to compile the older mysql extension against the new MySQL client library. This is beyond the scope of this
Manual; consult the PHP documentation for more information. You also be able to obtain assistance with these issues in our MySQL
with PHP forum.
For additional background on password hashing and authentication, see Section 5.5.6.3, Password Hashing in MySQL.
B.1.2.5. Password Fails When Entered Interactively
MySQL client programs prompt for a password when invoked with a --password or -p option that has no following password
value:
shell> mysql -u user_name -p
Enter password:
On some systems, you may find that your password works when specified in an option file or on the command line, but not when you
enter it interactively at the Enter password: prompt. This occurs when the library provided by the system to read passwords limits
password values to a small number of characters (typically eight). That is a problem with the system library, not with MySQL. To work
around it, change your MySQL password to a value that is eight or fewer characters long, or put your password in an option file.
B.1.2.6. Host 'host_name' is blocked
If you get the following error, it means that mysqld has received many connect requests from the host 'host_name' that have been
interrupted in the middle:
Host 'host_name' is blocked because of many connection errors.
Unblock with 'mysqladmin flush-hosts'
The number of interrupted connect requests allowed is determined by the value of the max_connect_errors system variable. After
max_connect_errors failed requests, mysqld assumes that something is wrong (for example, that someone is trying to break in),
and blocks the host from further connections until you execute a mysqladmin flush-hosts command or issue a FLUSH HOSTS
statement. See Section 5.1.4, Server System Variables.
By default, mysqld blocks a host after 10 connection errors. You can adjust the value by starting the server like this:
shell> mysqld_safe --max_connect_errors=10000 &
If you get this error message for a given host, you should first verify that there isn't anything wrong with TCP/IP connections from that
host. If you are having network problems, it does you no good to increase the value of the max_connect_errors variable.
B.1.2.7. Too many connections
If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections
are in use by other clients.
The number of connections allowed is controlled by the max_connections system variable. Beginning with MySQL 5.1.15, its de-
fault value is 151 to improve performance when MySQL is used with the Apache Web server. (Previously, the default was 100.) If you
need to support more connections, you should set a larger value for this variable.
MySQL Enterprise
Subscribers to the MySQL Enterprise Monitor receive advice on dynamically configuring the
max_connections variable avoiding failed connection attempts. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the
SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator
can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients
are connected. See Section 12.5.5.31, SHOW PROCESSLIST Syntax.
The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform. Linux or
Errors, Error Codes, and Common Problems
2744
Solaris should be able to support 500-1000 simultaneous connections, depending on how much RAM you have and what your clients
are doing. Static Linux binaries provided by Sun Microsystems, Inc. can support up to 4000 connections.
B.1.2.8. Out of memory
If you issue a query using the mysql client program and receive an error like the following one, it means that mysql does not have
enough memory to store the entire query result:
mysql: Out of memory at line 42, 'malloc.c'
mysql: needed 8136 byte (8k), memory in use: 12481367 bytes (12189k)
ERROR 2008: MySQL client ran out of memory
To remedy the problem, first check whether your query is correct. Is it reasonable that it should return so many rows? If not, correct the
query and try again. Otherwise, you can invoke mysql with the --quick option. This causes it to use the mysql_use_result()
C API function to retrieve the result set, which places less of a load on the client (but more on the server).
B.1.2.9. MySQL server has gone away
This section also covers the related Lost connection to server during query error.
The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection. In
this case, you normally get one of the following error codes (which one you get is operating system-dependent).
Error Code Description
CR_SERVER_GONE_ERROR The client couldn't send a question to the server.
CR_SERVER_LOST The client didn't get an error when writing to the server, but it didn't get a full answer
(or any answer) to the question.
By default, the server closes the connection after eight hours if nothing has happened. You can change the time limit by setting the
wait_timeout variable when you start mysqld. See Section 5.1.4, Server System Variables.
If you have a script, you just have to issue the query again for the client to do an automatic reconnection. This assumes that you have
automatic reconnection in the client enabled (which is the default for the mysql command-line client).
Some other common reasons for the MySQL server has gone away error are:
You (or the db administrator) has killed the running thread with a KILL statement or a mysqladmin kill command.
You tried to run a query after closing the connection to the server. This indicates a logic error in the application that should be cor-
rected.
A client application running on a different host does not have the necessary privileges to connect to the MySQL server from that
host.
You got a timeout from the TCP/IP connection on the client side. This may happen if you have been using the commands:
mysql_options(..., MYSQL_OPT_READ_TIMEOUT,...) or mysql_options(...,
MYSQL_OPT_WRITE_TIMEOUT,...). In this case increasing the timeout may help solve the problem.
You have encountered a timeout on the server side and the automatic reconnection in the client is disabled (the reconnect flag in
the MYSQL structure is equal to 0).
You are using a Windows client and the server had dropped the connection (probably because wait_timeout expired) before the
command was issued.
The problem on Windows is that in some cases MySQL doesn't get an error from the OS when writing to the TCP/IP connection to
the server, but instead gets the error when trying to read the answer from the connection.
Prior to MySQL 5.1.8, even if the reconnect flag in the MYSQL structure is equal to 1, MySQL does not automatically reconnect
and re-issue the query as it doesn't know if the server did get the original query or not.
The solution to this is to either do a mysql_ping() on the connection if there has been a long time since the last query (this is
what MyODBC does) or set wait_timeout on the mysqld server so high that it in practice never times out.
Errors, Error Codes, and Common Problems
2745
You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too
large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries
(for example, if you are working with big BLOB columns), you can increase the query limit by setting the server's
max_allowed_packet variable, which has a default value of 1MB. You may also need to increase the maximum packet size on
the client end. More information on setting the packet size is given in Section B.1.2.10, Packet too large.
An INSERT or REPLACE statement that inserts a great many rows can also cause these sorts of errors. Either one of these state-
ments sends a single request to the server irrespective of the number of rows to be inserted; thus, you can often avoid the error by re-
ducing the number of rows sent per INSERT or REPLACE.
You also get a lost connection if you are sending a packet 16MB or larger if your client is older than 4.0.8 and your server is 4.0.8
and above, or the other way around.
It is also possible to see this error if host name lookups fail (for example, if the DNS server on which your server or network relies
goes down). This is because MySQL is dependent on the host system for name resolution, but has no way of knowing whether it is
working from MySQL's point of view the problem is indistinguishable from any other network timeout.
You may also see the MySQL server has gone away error if MySQL is started with the --skip-networking option.
Another networking issue that can cause this error occurs if the MySQL port (default 3306) is blocked by your firewall, thus pre-
venting any connections at all to the MySQL server.
You can also encounter this error with applications that fork child processes, all of which try to use the same connection to the
MySQL server. This can be avoided by using a separate connection for each child process.
You have encountered a bug where the server died while executing the query.
You can check whether the MySQL server died and restarted by executing mysqladmin version and examining the server's up-
time. If the client connection was broken because mysqld crashed and restarted, you should concentrate on finding the reason for the
crash. Start by checking whether issuing the query again kills the server again. See Section B.1.4.2, What to Do If MySQL Keeps
Crashing.
You can get more information about the lost connections by starting mysqld with the --log-warnings=2 option. This logs some
of the disconnected errors in the hostname.err file. See Section 5.2.2, The Error Log.
If you want to create a bug report regarding this problem, be sure that you include the following information:
Indicate whether the MySQL server died. You can find information about this in the server error log. See Section B.1.4.2, What to
Do If MySQL Keeps Crashing.
If a specific query kills mysqld and the tables involved were checked with CHECK TABLE before you ran the query, can you
provide a reproducible test case? See MySQL Internals: Porting.
What is the value of the wait_timeout system variable in the MySQL server? (mysqladmin variables gives you the
value of this variable.)
Have you tried to run mysqld with the general query log enabled to determine whether the problem query appears in the log? (See
Section 5.2.3, The General Query Log.)
See also Section B.1.2.11, Communication Errors and Aborted Connections, and Section 1.6, How to Report Bugs or Problems.
B.1.2.10. Packet too large
A communication packet is a single SQL statement sent to the MySQL server, a single row that is sent to the client, or a binary log
event sent from a master replication server to a slave.
The largest possible packet that can be transmitted to or from a MySQL 5.1 server or client is 1GB.
When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too
large error and closes the connection. With some clients, you may also get a Lost connection to MySQL server during
query error if the communication packet is too large.
Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must in-
Errors, Error Codes, and Common Problems
2746
crease this variable both in the client and in the server.
If you are using the mysql client program, its default max_allowed_packet variable is 16MB. To set a larger value, start mysql
like this:
shell> mysql --max_allowed_packet=32M
That sets the packet size to 32MB.
The server's default max_allowed_packet value is 1MB. You can increase this if the server needs to handle big queries (for ex-
ample, if you are working with big BLOB columns). For example, to set the variable to 16MB, start the server like this:
shell> mysqld --max_allowed_packet=16M
You can also use an option file to set max_allowed_packet. For example, to set the size for the server to 16MB, add the following
lines in an option file:
[mysqld]
max_allowed_packet=16M
It is safe to increase the value of this variable because the extra memory is allocated only when needed. For example, mysqld allocates
more memory only when you issue a long query or when mysqld must return a large result row. The small default value of the vari-
able is a precaution to catch incorrect packets between the client and server and also to ensure that you do not run out of memory by us-
ing large packets accidentally.
You can also get strange problems with large packets if you are using large BLOB values but have not given mysqld access to enough
memory to handle the query. If you suspect this is the case, try adding ulimit -d 256000 to the beginning of the mysqld_safe
script and restarting mysqld.
B.1.2.11. Communication Errors and Aborted Connections
The server error log can be a useful source of information about connection problems. See Section 5.2.2, The Error Log. If you start
the server with the --log-warnings option, you might find messages like this in your error log:
010301 14:38:23 Aborted connection 854 to db: 'users' user: 'josh'
If a client successfully connects but later disconnects improperly or is terminated, the server increments the Aborted_clients
status variable, and logs an ABORTED CONNECTION message to the error log. The cause can be any of the following:
The client program did not call mysql_close() before exiting.
The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to
the server. See Section 5.1.4, Server System Variables.
The client program ended abruptly in the middle of a data transfer.
If a client is unable even to connect, the server increments the Aborted_connects status variable. Unsuccessful connect attempts
can occur for the following reasons:
A client doesn't have privileges to connect to a database.
A client uses an incorrect password.
A connection packet doesn't contain the right information.
It takes more than connect_timeout seconds to get a connect packet. See Section 5.1.4, Server System Variables.
If these kinds of things happen, it might indicate that someone is trying to break into your server! Messages for these types of problems
are logged to the general query log if it is enabled.
MySQL Enterprise
Errors, Error Codes, and Common Problems
2747
For reasons of security and performance the advisors provided by the MySQL Enterprise Monitor pay special
attention to the Aborted_connects status variable. For more information, see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
Other reasons for problems with aborted clients or aborted connections:
Use of Ethernet protocol with Linux, both half and full duplex. Many Linux Ethernet drivers have this bug. You should test for this
bug by transferring a huge file via FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode,
you are experiencing a Linux duplex syndrome. The only solution is switching the duplex mode for both your network card and
hub/switch to either full duplex or to half duplex and testing the results to determine the best setting.
Some problem with the thread library that causes interrupts on reads.
Badly configured TCP/IP.
Faulty Ethernets, hubs, switches, cables, and so forth. This can be diagnosed properly only by replacing hardware.
The max_allowed_packet variable value is too small or queries require more memory than you have allocated for mysqld.
See Section B.1.2.10, Packet too large.
See also Section B.1.2.9, MySQL server has gone away.
B.1.2.12. The table is full
The effective maximum table size for MySQL databases is usually determined by operating system constraints on file sizes, not by
MySQL internal limits. The following table lists some examples of operating system file-size limits. This is only a rough guide and is
not intended to be definitive. For the most up-to-date information, be sure to check the documentation specific to your operating system.
Operating System File-size Limit
Win32 w/ FAT/FAT32 2GB/4GB
Win32 w/ NTFS 2TB (possibly larger)
Linux 2.2-Intel 32-bit 2GB (LFS: 4GB)
Linux 2.4+ (using ext3 file system) 4TB
Solaris 9/10 16TB
MacOS X w/ HFS+ 2TB
NetWare w/NSS file system 8TB
Windows users, please note that FAT and VFAT (FAT32) are not considered suitable for production use with MySQL. Use NTFS in-
stead.
On Linux 2.2, you can get MyISAM tables larger than 2GB in size by using the Large File Support (LFS) patch for the ext2 file system.
Most current Linux distributions are based on kernel 2.4 or higher and include all the required LFS patches. On Linux 2.4, patches also
exist for ReiserFS to get support for big files (up to 2TB). With JFS and XFS, petabyte and larger files are possible on Linux.
For a detailed overview about LFS in Linux, have a look at Andreas Jaeger's Large File Support in Linux page at ht-
tp://www.suse.de/~aj/linux_lfs.html.
If you do encounter a full-table error, there are several reasons why it might have occurred:
The InnoDB storage engine maintains InnoDB tables within a tablespace that can be created from several files. This allows a table
to exceed the maximum individual file size. The tablespace can include raw disk partitions, which allows extremely large tables.
The maximum tablespace size is 64TB.
If you are using InnoDB tables and run out of room in the InnoDB tablespace. In this case, the solution is to extend the InnoDB
tablespace. See Section 13.6.5, Adding, Removing, or Resizing InnoDB Data and Log Files.
You are using MyISAM tables on an operating system that supports files only up to 2GB in size and you have hit this limit for the
data file or index file.
Errors, Error Codes, and Common Problems
2748
You are using a MyISAM table and the space required for the table exceeds what is allowed by the internal pointer size. MyISAM al-
lows data and index files to grow up to 256TB by default, but this limit can be changed up to the maximum allowable size of
65,536TB (256
7
1 bytes).
If you need a MyISAM table that is larger than the default limit and your operating system supports large files, the CREATE TABLE
statement supports AVG_ROW_LENGTH and MAX_ROWS options. See Section 12.1.17, CREATE TABLE Syntax. The server uses
these options to determine how large a table to allow.
If the pointer size is too small for an existing table, you can change the options with ALTER TABLE to increase a table's maximum
allowable size. See Section 12.1.7, ALTER TABLE Syntax.
ALTER TABLE tbl_name MAX_ROWS=1000000000 AVG_ROW_LENGTH=nnn;
You have to specify AVG_ROW_LENGTH only for tables with BLOB or TEXT columns; in this case, MySQL can't optimize the
space required based only on the number of rows.
To change the default size limit for MyISAM tables, set the myisam_data_pointer_size, which sets the number of bytes
used for internal row pointers. The value is used to set the pointer size for new tables if you do not specify the MAX_ROWS option.
The value of myisam_data_pointer_size can be from 2 to 7. A value of 4 allows tables up to 4GB; a value of 6 allows
tables up to 256TB.
You can check the maximum data and index sizes by using this statement:
SHOW TABLE STATUS FROM db_name LIKE 'tbl_name';
You also can use myisamchk -dv /path/to/table-index-file. See Section 12.5.5, SHOW Syntax, or Section 4.6.3,
myisamchk MyISAM Table-Maintenance Utility.
Other ways to work around file-size limits for MyISAM tables are as follows:
If your large table is read only, you can use myisampack to compress it. myisampack usually compresses a table by at least
50%, so you can have, in effect, much bigger tables. myisampack also can merge multiple tables into a single table. See Sec-
tion 4.6.5, myisampack Generate Compressed, Read-Only MyISAM Tables.
MySQL includes a MERGE library that allows you to handle a collection of MyISAM tables that have identical structure as a
single MERGE table. See Section 13.8, The MERGE Storage Engine.
You are using the NDB storage engine, in which case you need to increase the values for the DataMemory and IndexMemory
configuration parameters in your config.ini file. See Section 17.3.5.1, MySQL Cluster Data Node Configuration Parameters.
You are using the MEMORY (HEAP) storage engine; in this case you need to increase the value of the max_heap_table_size
system variable. See Section 5.1.4, Server System Variables.
B.1.2.13. Can't create/write to file
If you get an error of the following type for some queries, it means that MySQL cannot create a temporary file for the result set in the
temporary directory:
Can't create/write to file '\\sqla3fe_0.ism'.
The preceding error is a typical message for Windows; the Unix message is similar.
One fix is to start mysqld with the --tmpdir option or to add the option to the [mysqld] section of your option file. For example,
to specify a directory of C:\temp, use these lines:
[mysqld]
tmpdir=C:/temp
The C:\temp directory must exist and have sufficient space for the MySQL server to write to. See Section 4.2.3.3, Using Option
Files.
Another cause of this error can be permissions issues. Make sure that the MySQL server can write to the tmpdir directory.
Errors, Error Codes, and Common Problems
2749
Check also the error code that you get with perror. One reason the server cannot write to a table is that the file system is full:
shell> perror 28
OS error code 28: No space left on device
If you get an error of the following type during startup, it indicates that the file system and/or directory used for storing data files is
write protected. Providing the write error is to a test file, This error is not serious and can be safely ignored.
Can't create test file /usr/local/mysql/data/master.lower-test
B.1.2.14. Commands out of sync
If you get Commands out of sync; you can't run this command now in your client code, you are calling client func-
tions in the wrong order.
This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called
mysql_free_result(). It can also happen if you try to execute two queries that return data without calling
mysql_use_result() or mysql_store_result() in between.
B.1.2.15. Ignoring user
If you get the following error, it means that when mysqld was started or when it reloaded the grant tables, it found an account in the
user table that had an invalid password.
Found wrong password for user 'some_user'@'some_host'; ignoring user
As a result, the account is simply ignored by the permission system.
The following list indicates possible causes of and fixes for this problem:
You may be running a new version of mysqld with an old user table. You can check this by executing mysqlshow mysql
user to see whether the Password column is shorter than 16 characters. If so, you can correct this condition by running the
scripts/add_long_password script.
The account has an old password (eight characters long). Update the account in the user table to have a new password.
You have specified a password in the user table without using the PASSWORD() function. Use mysql to update the account in
the user table with a new password, making sure to use the PASSWORD() function:
mysql> UPDATE user SET Password=PASSWORD('newpwd')
-> WHERE User='some_user' AND Host='some_host';
B.1.2.16. Table 'tbl_name' doesn't exist
If you get either of the following errors, it usually means that no table exists in the default database with the given name:
Table 'tbl_name' doesn't exist
Can't find file: 'tbl_name' (errno: 2)
In some cases, it may be that the table does exist but that you are referring to it incorrectly:
Because MySQL uses directories and files to store databases and tables, database and table names are case sensitive if they are loc-
ated on a file system that has case-sensitive file names.
Even for file systems that are not case sensitive, such as on Windows, all references to a given table within a query must use the
same lettercase.
You can check which tables are in the default database with SHOW TABLES. See Section 12.5.5, SHOW Syntax.
B.1.2.17. Can't initialize character set
Errors, Error Codes, and Common Problems
2750
You might see an error like this if you have character set problems:
MySQL Connection Failed: Can't initialize character set charset_name
This error can have any of the following causes:
The character set is a multi-byte character set and you have no support for the character set in the client. In this case, you need to re-
compile the client by running configure with the --with-charset=charset_name or
--with-extra-charsets=charset_name option. See Section 2.10.2, Typical configure Options.
All standard MySQL binaries are compiled with --with-extra-charsets=complex, which enables support for all multi-
byte character sets. See Section 9.2, The Character Set Used for Data and Sorting.
The character set is a simple character set that is not compiled into mysqld, and the character set definition files are not in the place
where the client expects to find them.
In this case, you need to use one of the following methods to solve the problem:
Recompile the client with support for the character set. See Section 2.10.2, Typical configure Options.
Specify to the client the directory where the character set definition files are located. For many clients, you can do this with the
--character-sets-dir option.
Copy the character definition files to the path where the client expects them to be.
B.1.2.18. 'FILE' NOT FOUND and Similar Errors
If you get ERROR '...' not found (errno: 23), Can't open file: ... (errno: 24), or any other error with
errno 23 or errno 24 from MySQL, it means that you haven't allocated enough file descriptors for the MySQL server. You can
use the perror utility to get a description of what the error number means:
shell> perror 23
OS error code 23: File table overflow
shell> perror 24
OS error code 24: Too many open files
shell> perror 11
OS error code 11: Resource temporarily unavailable
The problem here is that mysqld is trying to keep open too many files simultaneously. You can either tell mysqld not to open so
many files at once or increase the number of file descriptors available to mysqld.
To tell mysqld to keep open fewer files at a time, you can make the table cache smaller by reducing the value of the ta-
ble_open_cache system variable (the default value is 64). Reducing the value of max_connections also reduces the number of
open files (the default value is 100).
To change the number of file descriptors available to mysqld, you can use the --open-files-limit option to mysqld_safe or
set the open_files_limit system variable. See Section 5.1.4, Server System Variables. The easiest way to set these values is to
add an option to your option file. See Section 4.2.3.3, Using Option Files. If you have an old version of mysqld that doesn't support
setting the open files limit, you can edit the mysqld_safe script. There is a commented-out line ulimit -n 256 in the script. You
can remove the # character to uncomment this line, and change the number 256 to set the number of file descriptors to be made
available to mysqld.
--open-files-limit and ulimit can increase the number of file descriptors, but only up to the limit imposed by the operating
system. There is also a hard limit that can be overridden only if you start mysqld_safe or mysqld as root (just remember that
you also need to start the server with the --user option in this case so that it does not continue to run as root after it starts up). If you
need to increase the operating system limit on the number of file descriptors available to each process, consult the documentation for
your system.
Note
If you run the tcsh shell, ulimit does not work! tcsh also reports incorrect values when you ask for the current limits.
In this case, you should start mysqld_safe using sh.
Errors, Error Codes, and Common Problems
2751
B.1.2.19. Table-Corruption Issues
If you have started mysqld with --myisam-recover, MySQL automatically checks and tries to repair MyISAM tables if they are
marked as 'not closed properly' or 'crashed'. If this happens, MySQL writes an entry in the hostname.err file 'Warning:
Checking table ...' which is followed by Warning: Repairing table if the table needs to be repaired. If you get a lot
of these errors, without mysqld having died unexpectedly just before, then something is wrong and needs to be investigated further.
See also Section 5.1.2, Server Command Options, and Section 22.5.1.7, Making a Test Case If You Experience Table Corruption.
B.1.3. Installation-Related Issues
B.1.3.1. Problems Linking to the MySQL Client Library
When you are linking an application program to use the MySQL client library, you might get undefined reference errors for symbols
that start with mysql_, such as those shown here:
/tmp/ccFKsdPa.o: In function `main':
/tmp/ccFKsdPa.o(.text+0xb): undefined reference to `mysql_init'
/tmp/ccFKsdPa.o(.text+0x31): undefined reference to `mysql_real_connect'
/tmp/ccFKsdPa.o(.text+0x57): undefined reference to `mysql_real_connect'
/tmp/ccFKsdPa.o(.text+0x69): undefined reference to `mysql_error'
/tmp/ccFKsdPa.o(.text+0x9a): undefined reference to `mysql_close'
You should be able to solve this problem by adding -Ldir_path -lmysqlclient at the end of your link command, where
dir_path represents the path name of the directory where the client library is located. To determine the correct directory, try this
command:
shell> mysql_config --libs
The output from mysql_config might indicate other libraries that should be specified on the link command as well.
If you get undefined reference errors for the uncompress or compress function, add -lz to the end of your link command
and try again.
If you get undefined reference errors for a function that should exist on your system, such as connect, check the manual page
for the function in question to determine which libraries you should add to the link command.
You might get undefined reference errors such as the following for functions that don't exist on your system:
mf_format.o(.text+0x201): undefined reference to `__lxstat'
This usually means that your MySQL client library was compiled on a system that is not 100% compatible with yours. In this case, you
should download the latest MySQL source distribution and compile MySQL yourself. See Section 2.10, MySQL Installation Using a
Source Distribution.
You might get undefined reference errors at runtime when you try to execute a MySQL program. If these errors specify symbols that
start with mysql_ or indicate that the mysqlclient library can't be found, it means that your system can't find the shared
libmysqlclient.so library. The fix for this is to tell your system to search for shared libraries where the library is located. Use
whichever of the following methods is appropriate for your system:
Add the path to the directory where libmysqlclient.so is located to the LD_LIBRARY_PATH environment variable.
Add the path to the directory where libmysqlclient.so is located to the LD_LIBRARY environment variable.
Copy libmysqlclient.so to some directory that is searched by your system, such as /lib, and update the shared library in-
formation by executing ldconfig.
Another way to solve this problem is by linking your program statically with the -static option, or by removing the dynamic
MySQL libraries before linking your code. Before trying the second method, you should be sure that no other programs are using the
dynamic libraries.
B.1.3.2. Problems with File Permissions
Errors, Error Codes, and Common Problems
2752
If you have problems with file permissions, the UMASK environment variable might be set incorrectly when mysqld starts. For ex-
ample, MySQL might issue the following error message when you create a table:
ERROR: Can't find file: 'path/with/filename.frm' (Errcode: 13)
The default UMASK value is 0660. You can change this behavior by starting mysqld_safe as follows:
shell> UMASK=384 # = 600 in octal
shell> export UMASK
shell> mysqld_safe &
By default, MySQL creates database directories with an access permission value of 0700. You can modify this behavior by setting the
UMASK_DIR variable. If you set its value, new directories are created with the combined UMASK and UMASK_DIR values. For ex-
ample, if you want to give group access to all new directories, you can do this:
shell> UMASK_DIR=504 # = 770 in octal
shell> export UMASK_DIR
shell> mysqld_safe &
MySQL assumes that the value for UMASK or UMASK_DIR is in octal if it starts with a zero.
See Section 2.14, Environment Variables.
B.1.4. Administration-Related Issues
B.1.4.1. How to Reset the Root Password
If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. However, it
is recommended to set a password for each account. See Section 5.3.1, General Security Guidelines.
If you set a root password previously, but have forgotten what it was, you can set a new password. The next two sections show pro-
cedures for Windows and Unix systems, respectively.
B.1.4.1.1. Resetting the Root Password on Windows Systems
Use the following procedure for resetting the password for any MySQL root accounts on Windows:
1. Log on to your system as Administrator.
2. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager:
Start Menu -> Control Panel -> Administrative Tools -> Services
Then find the MySQL service in the list, and stop it.
If your server is not running as a service, you may need to use the Task Manager to force it to stop.
3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
The UPDATE and FLUSH statements each must be written on a single line. The UPDATE statement resets the password for all ex-
isting root accounts, and the FLUSH statement tells the server to reload the grant tables into memory.
4. Save the file. For this example, the file will be named C:\mysql-init.txt.
5. Open a console window to get to the command prompt:
Start Menu -> Run -> cmd
6. Start the MySQL server with the special --init-file option:
Errors, Error Codes, and Common Problems
2753
C:\> C:\mysql\bin\mysqld --init-file=C:\mysql-init.txt
If you installed MySQL to a location other than C:\mysql, adjust the command accordingly.
The server executes the contents of the file named by the --init-file option at startup, changing each root account pass-
word.
You can also add the --console option to the command if you want server output to appear in the console window rather than in
a log file.
If you installed MySQL using the MySQL Installation Wizard, you may need to specify a --defaults-file option:
C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe"
--defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
--init-file=C:\mysql-init.txt
The appropriate --defaults-file setting can be found using the Services Manager:
Start Menu -> Control Panel -> Administrative Tools -> Services
Find the MySQL service in the list, right-click on it, and choose the Properties option. The Path to executable field
contains the --defaults-file setting.
7. After the server has started successfully, delete C:\mysql-init.txt.
8. Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services
window. If you start the server manually, use whatever command you normally use.
You should now be able to connect to MySQL as root using the new password.
B.1.4.1.2. Resetting the Root Password on Unix Systems
MySQL Enterprise
For expert advice on security-related issues, subscribe to the MySQL Enterprise Monitor. For more information,
see http://www.mysql.com/products/enterprise/advisors.html.
Use the following procedure for resetting the password for any MySQL root accounts on Unix. The instructions assume that you will
start the server so that it runs using the Unix login account that you normally use for running the server. For example, if you run the
server using the mysql login account, you should log in as mysql before using the instructions. (Alternatively, you can log in as
root, but in this case you must start mysqld with the --user=mysql option. If you start the server as root without using -
-user=mysql, the server may create root-owned files in the data directory, such as log files, and these may cause permission-re-
lated problems for future server startups. If that happens, you will need to either change the ownership of the files to mysql or remove
them.)
1. Log on to your system as the Unix mysql user that the mysqld server runs as.
2. Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution,
host name, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /
usr/local/mysql/data/. Generally, the file name has an extension of .pid and begins with either mysqld or your sys-
tem's host name.
You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the path name of the
.pid file in the following command:
shell> kill `cat /mysql-data-directory/host_name.pid`
Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into
the kill command.
3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
Errors, Error Codes, and Common Problems
2754
FLUSH PRIVILEGES;
The UPDATE and FLUSH statements each must be written on a single line. The UPDATE statement resets the password for all ex-
isting root accounts, and the FLUSH statement tells the server to reload the grant tables into memory.
4. Save the file. For this example, the file will be named /home/me/mysql-init. The file contains the password, so it should not
be saved where it can be read by other users.
5. Start the MySQL server with the special --init-file option:
shell> mysqld_safe --init-file=/home/me/mysql-init &
The server executes the contents of the file named by the --init-file option at startup, changing each root account pass-
word.
6. After the server has started successfully, delete /home/me/mysql-init.
You should now be able to connect to MySQL as root using the new password.
Alternatively, on any platform, you can set the new password using the mysql client (but this approach is less secure):
1. Stop mysqld and restart it with the --skip-grant-tables option.
2. Connect to the mysqld server with this command:
shell> mysql
3. Issue the following statements in the mysql client. Replace the password with the password that you want to use.
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;
You should now be able to connect to MySQL as root using the new password.
B.1.4.2. What to Do If MySQL Keeps Crashing
Each MySQL version is tested on many platforms before it is released. This doesn't mean that there are no bugs in MySQL, but if there
are bugs, they should be very few and can be hard to find. If you have a problem, it always helps if you try to find out exactly what
crashes your system, because you have a much better chance of getting the problem fixed quickly.
First, you should try to find out whether the problem is that the mysqld server dies or whether your problem has to do with your client.
You can check how long your mysqld server has been up by executing mysqladmin version. If mysqld has died and restarted,
you may find the reason by looking in the server's error log. See Section 5.2.2, The Error Log.
On some systems, you can find in the error log a stack trace of where mysqld died that you can resolve with the re-
solve_stack_dump program. See MySQL Internals: Porting. Note that the variable values written in the error log may not always
be 100% correct.
Many server crashes are caused by corrupted data files or index files. MySQL updates the files on disk with the write() system call
after every SQL statement and before the client is notified about the result. (This is not true if you are running with -
-delay-key-write, in which case data files are written but not index files.) This means that data file contents are safe even if
mysqld crashes, because the operating system ensures that the unflushed data is written to disk. You can force MySQL to flush
everything to disk after every SQL statement by starting mysqld with the --flush option.
The preceding means that normally you should not get corrupted tables unless one of the following happens:
The MySQL server or the server host was killed in the middle of an update.
You have found a bug in mysqld that caused it to die in the middle of an update.
Errors, Error Codes, and Common Problems
2755
Some external program is manipulating data files or index files at the same time as mysqld without locking the table properly.
You are running many mysqld servers using the same data directory on a system that doesn't support good file system locks
(normally handled by the lockd lock manager), or you are running multiple servers with external locking disabled.
You have a crashed data file or index file that contains very corrupt data that confused mysqld.
You have found a bug in the data storage code. This isn't likely, but it is at least possible. In this case, you can try to change the stor-
age engine to another engine by using ALTER TABLE on a repaired copy of the table.
Because it is very difficult to know why something is crashing, first try to check whether things that work for others crash for you.
Please try the following things:
Stop the mysqld server with mysqladmin shutdown, run myisamchk --silent --force */*.MYI from the data
directory to check all MyISAM tables, and restart mysqld. This ensures that you are running from a clean state. See Chapter 5,
MySQL Server Administration.
Start mysqld with the general query log enabled (see Section 5.2.3, The General Query Log). Then try to determine from the in-
formation written to the log whether some specific query kills the server. About 95% of all bugs are related to a particular query.
Normally, this is one of the last queries in the log file just before the server restarts. See Section 5.2.3, The General Query Log. If
you can repeatedly kill MySQL with a specific query, even when you have checked all tables just before issuing it, then you have
been able to locate the bug and should submit a bug report for it. See Section 1.6, How to Report Bugs or Problems.
Try to make a test case that we can use to repeat the problem. See MySQL Internals: Porting.
Try running the tests in the mysql-test directory and the MySQL benchmarks. See Section 22.1.2, MySQL Test Suite. They
should test MySQL rather well. You can also add code to the benchmarks that simulates your application. The benchmarks can be
found in the sql-bench directory in a source distribution or, for a binary distribution, in the sql-bench directory under your
MySQL installation directory.
Try the fork_big.pl script. (It is located in the tests directory of source distributions.)
If you configure MySQL for debugging, it is much easier to gather information about possible errors if something goes wrong. Con-
figuring MySQL for debugging causes a safe memory allocator to be included that can find some errors. It also provides a lot of out-
put about what is happening. Reconfigure MySQL with the --with-debug or --with-debug=full option to configure
and then recompile. See MySQL Internals: Porting.
Make sure that you have applied the latest patches for your operating system.
Use the --skip-external-locking option to mysqld. On some systems, the lockd lock manager does not work properly;
the --skip-external-locking option tells mysqld not to use external locking. (This means that you cannot run two
mysqld servers on the same data directory and that you must be careful if you use myisamchk. Nevertheless, it may be instruct-
ive to try the option as a test.)
Have you tried mysqladmin -u root processlist when mysqld appears to be running but not responding? Sometimes
mysqld is not comatose even though you might think so. The problem may be that all connections are in use, or there may be some
internal lock problem. mysqladmin -u root processlist usually is able to make a connection even in these cases, and
can provide useful information about the current number of connections and their status.
Run the command mysqladmin -i 5 status or mysqladmin -i 5 -r status in a separate window to produce stat-
istics while you run your other queries.
Try the following:
1. Start mysqld from gdb (or another debugger). See MySQL Internals: Porting.
2. Run your test scripts.
3. Print the backtrace and the local variables at the three lowest levels. In gdb, you can do this with the following commands
when mysqld has crashed inside gdb:
backtrace
info local
up
info local
Errors, Error Codes, and Common Problems
2756
up
info local
With gdb, you can also examine which threads exist with info threads and switch to a specific thread with thread N,
where N is the thread ID.
Try to simulate your application with a Perl script to force MySQL to crash or misbehave.
Send a normal bug report. See Section 1.6, How to Report Bugs or Problems. Be even more detailed than usual. Because MySQL
works for many people, it may be that the crash results from something that exists only on your computer (for example, an error that
is related to your particular system libraries).
If you have a problem with tables containing dynamic-length rows and you are using only VARCHAR columns (not BLOB or TEXT
columns), you can try to change all VARCHAR to CHAR with ALTER TABLE. This forces MySQL to use fixed-size rows. Fixed-
size rows take a little extra space, but are much more tolerant to corruption.
The current dynamic row code has been in use for several years with very few problems, but dynamic-length rows are by nature
more prone to errors, so it may be a good idea to try this strategy to see whether it helps.
Do not rule out your server hardware when diagnosing problems. Defective hardware can be the cause of data corruption. Particular
attention should be paid to your memory and disk subsystems when troubleshooting hardware.
B.1.4.3. How MySQL Handles a Full Disk
This section describes how MySQL responds to disk-full errors (such as no space left on device), and to quota-exceeded errors (such
as write failed or user block limit reached).
This section is relevant for writes to MyISAM tables. It also applies for writes to binary log files and binary log index file, except that
references to row and record should be understood to mean event.
When a disk-full condition occurs, MySQL does the following:
It checks once every minute to see whether there is enough space to write the current row. If there is enough space, it continues as if
nothing had happened.
Every 10 minutes it writes an entry to the log file, warning about the disk-full condition.
To alleviate the problem, you can take the following actions:
To continue, you only have to free enough disk space to insert all records.
To abort the thread, you must use mysqladmin kill. The thread is aborted the next time it checks the disk (in one minute).
Other threads might be waiting for the table that caused the disk-full condition. If you have several locked threads, killing the one
thread that is waiting on the disk-full condition allows the other threads to continue.
Exceptions to the preceding behavior are when you use REPAIR TABLE or OPTIMIZE TABLE or when the indexes are created in a
batch after LOAD DATA INFILE or after an ALTER TABLE statement. All of these statements may create large temporary files that,
if left to themselves, would cause big problems for the rest of the system. If the disk becomes full while MySQL is doing any of these
operations, it removes the big temporary files and mark the table as crashed. The exception is that for ALTER TABLE, the old table is
left unchanged.
MySQL Enterprise
For early notification of possible problems with your MySQL configuration subscribe to the MySQL Enterprise
Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
B.1.4.4. Where MySQL Stores Temporary Files
Errors, Error Codes, and Common Problems
2757
On Unix, MySQL uses the value of the TMPDIR environment variable as the path name of the directory in which to store temporary
files. If TMPDIR is not set, MySQL uses the system default, which is usually /tmp, /var/tmp, or /usr/tmp.
On Windows, Netware and OS2, MySQL checks in order the values of the TMPDIR, TEMP, and TMP environment variables. For the
first one found to be set, MySQL uses it and does not check those remaining. If none of TMPDIR, TEMP, or TMP are set, MySQL uses
the Windows system default, which is usually C:\windows\temp\.
If the file system containing your temporary file directory is too small, you can use the --tmpdir option to mysqld to specify a dir-
ectory in a file system where you have enough space.
In MySQL 5.1, the --tmpdir option can be set to a list of several paths that are used in round-robin fashion. Paths should be separ-
ated by colon characters (:) on Unix and semicolon characters (;) on Windows, NetWare, and OS/2.
Note
To spread the load effectively, these paths should be located on different physical disks, not different partitions of the same
disk.
If the MySQL server is acting as a replication slave, you should not set --tmpdir to point to a directory on a memory-based file sys-
tem or to a directory that is cleared when the server host restarts. A replication slave needs some of its temporary files to survive a ma-
chine restart so that it can replicate temporary tables or LOAD DATA INFILE operations. If files in the temporary file directory are
lost when the server restarts, replication fails.
MySQL creates all temporary files as hidden files. This ensures that the temporary files are removed if mysqld is terminated. The dis-
advantage of using hidden files is that you do not see a big temporary file that fills up the file system in which the temporary file direct-
ory is located.
MySQL Enterprise
Advisors provided by the MySQL Enterprise Monitor automatically detect excessive temporary table storage to
disk. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
When sorting (ORDER BY or GROUP BY), MySQL normally uses one or two temporary files. The maximum disk space required is de-
termined by the following expression:
(length of what is sorted + sizeof(row pointer))
* number of matched rows
* 2
The row pointer size is usually four bytes, but may grow in the future for really big tables.
For some SELECT queries, MySQL also creates temporary SQL tables. These are not hidden and have names of the form SQL_*.
ALTER TABLE creates a temporary table in the same directory as the original table.
B.1.4.5. How to Protect or Change the MySQL Unix Socket File
The default location for the Unix socket file that the server uses for communication with local clients is /tmp/mysql.sock. (For
some distribution formats, the directory might be different, such as /var/lib/mysql for RPMs.)
On some versions of Unix, anyone can delete files in the /tmp directory or other similar directories used for temporary files. If the
socket file is located in such a directory on your system, this might cause problems.
On most versions of Unix, you can protect your /tmp directory so that files can be deleted only by their owners or the superuser
(root). To do this, set the sticky bit on the /tmp directory by logging in as root and using the following command:
shell> chmod +t /tmp
You can check whether the sticky bit is set by executing ls -ld /tmp. If the last permission character is t, the bit is set.
Another approach is to change the place where the server creates the Unix socket file. If you do this, you should also let client programs
know the new location of the file. You can specify the file location in several ways:
Specify the path in a global or local option file. For example, put the following lines in /etc/my.cnf:
Errors, Error Codes, and Common Problems
2758
[mysqld]
socket=/path/to/socket
[client]
socket=/path/to/socket
See Section 4.2.3.3, Using Option Files.
Specify a --socket option on the command line to mysqld_safe and when you run client programs.
Set the MYSQL_UNIX_PORT environment variable to the path of the Unix socket file.
Recompile MySQL from source to use a different default Unix socket file location. Define the path to the file with the -
-with-unix-socket-path option when you run configure. See Section 2.10.2, Typical configure Options.
You can test whether the new socket location works by attempting to connect to the server with this command:
shell> mysqladmin --socket=/path/to/socket version
B.1.4.6. Time Zone Problems
If you have a problem with SELECT NOW() returning values in UTC and not your local time, you have to tell the server your current
time zone. The same applies if UNIX_TIMESTAMP() returns the wrong value. This should be done for the environment in which the
server runs; for example, in mysqld_safe or mysql.server. See Section 2.14, Environment Variables.
You can set the time zone for the server with the --timezone=timezone_name option to mysqld_safe. You can also set it by
setting the TZ environment variable before you start mysqld.
The allowable values for --timezone or TZ are system-dependent. Consult your operating system documentation to see what values
are acceptable.
B.1.5. Query-Related Issues
B.1.5.1. Case Sensitivity in String Searches
For nonbinary strings (CHAR, VARCHAR, TEXT), string searches use the collation of the comparison operands. For binary strings
(BINARY, VARBINARY, BLOB), comparisons use the numeric values of the bytes in the operands; this means that for alphabetic char-
acters, comparisons will be case sensitive.
A comparison between a nonbinary string and binary string is treated as a comparison of binary strings.
Simple comparison operations (>=, >, =, <, <=, sorting, and grouping) are based on each character's sort value. Characters
with the same sort value are treated as the same character. For example, if e and have the same sort value in a given collation,
they compare as equal.
The default character set and collation are latin1 and latin1_swedish_ci, so nonbinary string comparisons are case insensitive
by default. This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a. To make this
search case sensitive, make sure that one of the operands has a case sensitive or binary collation. For example, if you are comparing a
column and a string that both have the latin1 character set, you can use the COLLATE operator to cause either operand to have the
latin1_general_cs or latin1_bin collation:
col_name COLLATE latin1_general_cs LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_general_cs
col_name COLLATE latin1_bin LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_bin
If you want a column always to be treated in case-sensitive fashion, declare it with a case sensitive or binary collation. See Sec-
tion 12.1.17, CREATE TABLE Syntax.
To cause a case-sensitive comparison of nonbinary strings to be case insensitive, use COLLATE to name a case-insensitive collation.
The strings in the following example normally are case sensitive, but COLLATE changes the comparison to be case insensitive:
mysql> SET @s1 = 'MySQL' COLLATE latin1_bin,
-> @s2 = 'mysql' COLLATE latin1_bin;
Errors, Error Codes, and Common Problems
2759
mysql> SELECT @s1 = @s2;
+-----------+
| @s1 = @s2 |
+-----------+
| 0 |
+-----------+
mysql> SELECT @s1 COLLATE latin1_swedish_ci = @s2;
+-------------------------------------+
| @s1 COLLATE latin1_swedish_ci = @s2 |
+-------------------------------------+
| 1 |
+-------------------------------------+
A binary string is case sensitive in comparisons. To compare the string as case insensitive, convert it to a nonbinary string and use
COLLATE to name a case-insensitive collation:
mysql> SET @s = BINARY 'MySQL';
mysql> SELECT @s = 'mysql';
+--------------+
| @s = 'mysql' |
+--------------+
| 0 |
+--------------+
mysql> SELECT CONVERT(@s USING latin1) COLLATE latin1_swedish_ci = 'mysql';
+--------------------------------------------------------------+
| CONVERT(@s USING latin1) COLLATE latin1_swedish_ci = 'mysql' |
+--------------------------------------------------------------+
| 1 |
+--------------------------------------------------------------+
To determine whether a value will compare as a nonbinary or binary string, use the COLLATION() function. This example shows that
VERSION() returns a string that has a case-insensitive collation, so comparisons are case insensitive:
mysql> SELECT COLLATION(VERSION());
+----------------------+
| COLLATION(VERSION()) |
+----------------------+
| utf8_general_ci |
+----------------------+
For binary strings, the collation value is binary, so comparisons will be case sensitive. One context in which you will see binary is
for compression and encryption functions, which return binary strings as a general rule: string:
mysql> SELECT COLLATION(ENCRYPT('x')), COLLATION(SHA1('x'));
+-------------------------+----------------------+
| COLLATION(ENCRYPT('x')) | COLLATION(SHA1('x')) |
+-------------------------+----------------------+
| binary | binary |
+-------------------------+----------------------+
B.1.5.2. Problems Using DATE Columns
The format of a DATE value is 'YYYY-MM-DD'. According to standard SQL, no other format is allowed. You should use this format in
UPDATE expressions and in the WHERE clause of SELECT statements. For example:
mysql> SELECT * FROM tbl_name WHERE date >= '2003-05-05';
As a convenience, MySQL automatically converts a date to a number if the date is used in a numeric context (and vice versa). It is also
smart enough to allow a relaxed string form when updating and in a WHERE clause that compares a date to a TIMESTAMP, DATE, or
DATETIME column. (Relaxed form means that any punctuation character may be used as the separator between parts. For example,
'2004-08-15' and '2004#08#15' are equivalent.) MySQL can also convert a string containing no separators (such as
'20040815'), provided it makes sense as a date.
When you compare a DATE, TIME, DATETIME, or TIMESTAMP to a constant string with the <, <=, =, >=, >, or BETWEEN operators,
MySQL normally converts the string to an internal long integer for faster comparison (and also for a bit more relaxed string check-
ing). However, this conversion is subject to the following exceptions:
When you compare two columns
When you compare a DATE, TIME, DATETIME, or TIMESTAMP column to an expression
When you use any other comparison method than those just listed, such as IN or STRCMP().
Errors, Error Codes, and Common Problems
2760
For these exceptional cases, the comparison is done by converting the objects to strings and performing a string comparison.
To keep things safe, assume that strings are compared as strings and use the appropriate string functions if you want to compare a tem-
poral value to a string.
The special date '0000-00-00' can be stored and retrieved as '0000-00-00'. When using a '0000-00-00' date through My-
ODBC, it is automatically converted to NULL in MyODBC 2.50.12 and above, because ODBC can't handle this kind of date.
Because MySQL performs the conversions described above, the following statements work:
mysql> INSERT INTO tbl_name (idate) VALUES (19970505);
mysql> INSERT INTO tbl_name (idate) VALUES ('19970505');
mysql> INSERT INTO tbl_name (idate) VALUES ('97-05-05');
mysql> INSERT INTO tbl_name (idate) VALUES ('1997.05.05');
mysql> INSERT INTO tbl_name (idate) VALUES ('1997 05 05');
mysql> INSERT INTO tbl_name (idate) VALUES ('0000-00-00');
mysql> SELECT idate FROM tbl_name WHERE idate >= '1997-05-05';
mysql> SELECT idate FROM tbl_name WHERE idate >= 19970505;
mysql> SELECT MOD(idate,100) FROM tbl_name WHERE idate >= 19970505;
mysql> SELECT idate FROM tbl_name WHERE idate >= '19970505';
However, the following does not work:
mysql> SELECT idate FROM tbl_name WHERE STRCMP(idate,'20030505')=0;
STRCMP() is a string function, so it converts idate to a string in 'YYYY-MM-DD' format and performs a string comparison. It does
not convert '20030505' to the date '2003-05-05' and perform a date comparison.
If you are using the ALLOW_INVALID_DATES SQL mode, MySQL allows you to store dates that are given only limited checking:
MySQL requires only that the day is in the range from 1 to 31 and the month is in the range from 1 to 12.
This makes MySQL very convenient for Web applications where you obtain year, month, and day in three different fields and you want
to store exactly what the user inserted (without date validation).
If you are not using the NO_ZERO_IN_DATE SQL mode, the day or month part can be zero. This is convenient if you want to store a
birthdate in a DATE column and you know only part of the date.
If you are not using the NO_ZERO_DATE SQL mode, MySQL also allows you to store '0000-00-00' as a dummy date. This is in
some cases more convenient than using NULL values.
If the date cannot be converted to any reasonable value, a 0 is stored in the DATE column, which is retrieved as '0000-00-00'. This
is both a speed and a convenience issue. We believe that the database server's responsibility is to retrieve the same date you stored (even
if the data was not logically correct in all cases). We think it is up to the application and not the server to check the dates.
If you want MySQL to check all dates and accept only legal dates (unless overridden by IGNORE), you should set sql_mode to
"NO_ZERO_IN_DATE,NO_ZERO_DATE".
B.1.5.3. Problems with NULL Values
The concept of the NULL value is a common source of confusion for newcomers to SQL, who often think that NULL is the same thing
as an empty string ''. This is not the case. For example, the following statements are completely different:
mysql> INSERT INTO my_table (phone) VALUES (NULL);
mysql> INSERT INTO my_table (phone) VALUES ('');
Both statements insert a value into the phone column, but the first inserts a NULL value and the second inserts an empty string. The
meaning of the first can be regarded as phone number is not known and the meaning of the second can be regarded as the person is
known to have no phone, and thus no phone number.
To help with NULL handling, you can use the IS NULL and IS NOT NULL operators and the IFNULL() function.
In SQL, the NULL value is never true in comparison to any other value, even NULL. An expression that contains NULL always produces
a NULL value unless otherwise indicated in the documentation for the operators and functions involved in the expression. All columns
in the following example return NULL:
mysql> SELECT NULL, 1+NULL, CONCAT('Invisible',NULL);
Errors, Error Codes, and Common Problems
2761
If you want to search for column values that are NULL, you cannot use an expr = NULL test. The following statement returns no
rows, because expr = NULL is never true for any expression:
mysql> SELECT * FROM my_table WHERE phone = NULL;
To look for NULL values, you must use the IS NULL test. The following statements show how to find the NULL phone number and the
empty phone number:
mysql> SELECT * FROM my_table WHERE phone IS NULL;
mysql> SELECT * FROM my_table WHERE phone = '';
See Section 3.3.4.6, Working with NULL Values, for additional information and examples.
You can add an index on a column that can have NULL values if you are using the MyISAM, InnoDB, or MEMORY storage engine. Oth-
erwise, you must declare an indexed column NOT NULL, and you cannot insert NULL into the column.
When reading data with LOAD DATA INFILE, empty or missing columns are updated with ''. If you want a NULL value in a
column, you should use \N in the data file. The literal word NULL may also be used under some circumstances. See Section 12.2.6,
LOAD DATA INFILE Syntax.
When using DISTINCT, GROUP BY, or ORDER BY, all NULL values are regarded as equal.
When using ORDER BY, NULL values are presented first, or last if you specify DESC to sort in descending order.
Aggregate (summary) functions such as COUNT(), MIN(), and SUM() ignore NULL values. The exception to this is COUNT(*),
which counts rows and not individual column values. For example, the following statement produces two counts. The first is a count of
the number of rows in the table, and the second is a count of the number of non-NULL values in the age column:
mysql> SELECT COUNT(*), COUNT(age) FROM person;
For some data types, MySQL handles NULL values specially. If you insert NULL into a TIMESTAMP column, the current date and time
is inserted. If you insert NULL into an integer or floating-point column that has the AUTO_INCREMENT attribute, the next number in
the sequence is inserted.
B.1.5.4. Problems with Column Aliases
You can use an alias to refer to a column in GROUP BY, ORDER BY, or HAVING clauses. Aliases can also be used to give columns
better names:
SELECT SQRT(a*b) AS root FROM tbl_name GROUP BY root HAVING root > 0;
SELECT id, COUNT(*) AS cnt FROM tbl_name GROUP BY id HAVING cnt > 0;
SELECT id AS 'Customer identity' FROM tbl_name;
Standard SQL doesn't allow you to refer to a column alias in a WHERE clause. This restriction is imposed because when the WHERE
code is executed, the column value may not yet be determined. For example, the following query is illegal:
SELECT id, COUNT(*) AS cnt FROM tbl_name WHERE cnt > 0 GROUP BY id;
The WHERE statement is executed to determine which rows should be included in the GROUP BY part, whereas HAVING is used to de-
cide which rows from the result set should be used.
B.1.5.5. Rollback Failure for Nontransactional Tables
If you receive the following message when trying to perform a ROLLBACK, it means that one or more of the tables you used in the
transaction do not support transactions:
Warning: Some non-transactional changed tables couldn't be rolled back
These nontransactional tables are not affected by the ROLLBACK statement.
If you were not deliberately mixing transactional and nontransactional tables within the transaction, the most likely cause for this mes-
sage is that a table you thought was transactional actually is not. This can happen if you try to create a table using a transactional storage
engine that is not supported by your mysqld server (or that was disabled with a startup option). If mysqld doesn't support a storage
Errors, Error Codes, and Common Problems
2762
engine, it instead creates the table as a MyISAM table, which is nontransactional.
You can check the storage engine for a table by using either of these statements:
SHOW TABLE STATUS LIKE 'tbl_name';
SHOW CREATE TABLE tbl_name;
See Section 12.5.5.38, SHOW TABLE STATUS Syntax, and Section 12.5.5.12, SHOW CREATE TABLE Syntax.
You can check which storage engines your mysqld server supports by using this statement:
SHOW ENGINES;
You can also use the following statement, and check the value of the variable that is associated with the storage engine in which you are
interested:
SHOW VARIABLES LIKE 'have_%';
For example, to determine whether the InnoDB storage engine is available, check the value of the have_innodb variable.
See Section 12.5.5.17, SHOW ENGINES Syntax, and Section 12.5.5.41, SHOW VARIABLES Syntax.
MySQL Enterprise
Ensure that your data is adequately protected by subscribing to the MySQL Enterprise Monitor. For more in-
formation, see http://www.mysql.com/products/enterprise/advisors.html.
B.1.5.6. Deleting Rows from Related Tables
If the total length of the DELETE statement for related_table is more than 1MB (the default value of the
max_allowed_packet system variable), you should split it into smaller parts and execute multiple DELETE statements. You prob-
ably get the fastest DELETE by specifying only 100 to 1,000 related_column values per statement if the related_column is in-
dexed. If the related_column isn't indexed, the speed is independent of the number of arguments in the IN clause.
B.1.5.7. Solving Problems with No Matching Rows
If you have a complicated query that uses many tables but that doesn't return any rows, you should use the following procedure to find
out what is wrong:
1. Test the query with EXPLAIN to check whether you can find something that is obviously wrong. See Section 12.3.2, EXPLAIN
Syntax.
2. Select only those columns that are used in the WHERE clause.
3. Remove one table at a time from the query until it returns some rows. If the tables are large, it is a good idea to use LIMIT 10
with the query.
4. Issue a SELECT for the column that should have matched a row against the table that was last removed from the query.
5. If you are comparing FLOAT or DOUBLE columns with numbers that have decimals, you can't use equality (=) comparisons. This
problem is common in most computer languages because not all floating-point values can be stored with exact precision. In some
cases, changing the FLOAT to a DOUBLE fixes this. See Section B.1.5.8, Problems with Floating-Point Comparisons.
6. If you still can't figure out what is wrong, create a minimal test that can be run with mysql test < query.sql that shows
your problems. You can create a test file by dumping the tables with mysqldump --quick db_name tbl_name_1 ...
tbl_name_n > query.sql. Open the file in an editor, remove some insert lines (if there are more than needed to demonstrate
the problem), and add your SELECT statement at the end of the file.
Verify that the test file demonstrates the problem by executing these commands:
shell> mysqladmin create test2
shell> mysql test2 < query.sql
Attach the test file to a bug report, which you can file using the instructions in Section 1.6, How to Report Bugs or Problems.
Errors, Error Codes, and Common Problems
2763
B.1.5.8. Problems with Floating-Point Comparisons
Floating-point numbers sometimes cause confusion because they are approximate. That is, they are not stored as exact values inside
computer architecture. What you can see on the screen usually is not the exact value of the number. The FLOAT and DOUBLE data
types are such. For DECIMAL columns, MySQL performs operations with a precision of 65 decimal digits, which should solve most
common inaccuracy problems.
The following example demonstrates the problem using DOUBLE. It shows that are calculations that are done using floating-point oper-
ations are subject to floating-point error.
mysql> CREATE TABLE t1 (i INT, d1 DOUBLE, d2 DOUBLE);
mysql> INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
-> (2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
-> (2, 30.40, 30.40), (3, 37.00, 7.40), (3, -29.60, 0.00),
-> (4, 60.00, 15.40), (4, -10.60, 0.00), (4, -34.00, 0.00),
-> (5, 33.00, 0.00), (5, -25.80, 0.00), (5, 0.00, 7.20),
-> (6, 0.00, 0.00), (6, -51.40, 0.00);
mysql> SELECT i, SUM(d1) AS a, SUM(d2) AS b
-> FROM t1 GROUP BY i HAVING a <> b;
+------+-------+------+
| i | a | b |
+------+-------+------+
| 1 | 21.4 | 21.4 |
| 2 | 76.8 | 76.8 |
| 3 | 7.4 | 7.4 |
| 4 | 15.4 | 15.4 |
| 5 | 7.2 | 7.2 |
| 6 | -51.4 | 0 |
+------+-------+------+
The result is correct. Although the first five records look like they should not satisfy the comparison (the values of a and b do not ap-
pear to be different), they may do so because the difference between the numbers shows up around the tenth decimal or so, depending
on factors such as computer architecture or the compiler version or optimization level. For example, different CPUs may evaluate float-
ing-point numbers differently.
If columns d1 and d2 had been defined as DECIMAL rather than DOUBLE, the result of the SELECT query would have contained only
one row the last one shown above.
The correct way to do floating-point number comparison is to first decide on an acceptable tolerance for differences between the num-
bers and then do the comparison against the tolerance value. For example, if we agree that floating-point numbers should be regarded
the same if they are same within a precision of one in ten thousand (0.0001), the comparison should be written to find differences larger
than the tolerance value:
mysql> SELECT i, SUM(d1) AS a, SUM(d2) AS b FROM t1
-> GROUP BY i HAVING ABS(a - b) > 0.0001;
+------+-------+------+
| i | a | b |
+------+-------+------+
| 6 | -51.4 | 0 |
+------+-------+------+
1 row in set (0.00 sec)
Conversely, to get rows where the numbers are the same, the test should find differences within the tolerance value:
mysql> SELECT i, SUM(d1) AS a, SUM(d2) AS b FROM t1
-> GROUP BY i HAVING ABS(a - b) <= 0.0001;
+------+------+------+
| i | a | b |
+------+------+------+
| 1 | 21.4 | 21.4 |
| 2 | 76.8 | 76.8 |
| 3 | 7.4 | 7.4 |
| 4 | 15.4 | 15.4 |
| 5 | 7.2 | 7.2 |
+------+------+------+
5 rows in set (0.03 sec)
B.1.6. Optimizer-Related Issues
MySQL uses a cost-based optimizer to determine the best way to resolve a query. In many cases, MySQL can calculate the best possible
query plan, but sometimes MySQL doesn't have enough information about the data at hand and has to make educated guesses about
Errors, Error Codes, and Common Problems
2764
the data.
For the cases when MySQL does not do the "right" thing, tools that you have available to help MySQL are:
Use the EXPLAIN statement to get information about how MySQL processes a query. To use it, just add the keyword EXPLAIN to
the front of your SELECT statement:
mysql> EXPLAIN SELECT * FROM t1, t2 WHERE t1.i = t2.i;
EXPLAIN is discussed in more detail in Section 12.3.2, EXPLAIN Syntax.
Use ANALYZE TABLE tbl_name to update the key distributions for the scanned table. See Section 12.5.2.1, ANALYZE TA-
BLE Syntax.
Use FORCE INDEX for the scanned table to tell MySQL that table scans are very expensive compared to using the given index:
SELECT * FROM t1, t2 FORCE INDEX (index_for_column)
WHERE t1.col_name=t2.col_name;
USE INDEX and IGNORE INDEX may also be useful. See Section 12.2.8.2, Index Hint Syntax.
Global and table-level STRAIGHT_JOIN. See Section 12.2.8, SELECT Syntax.
You can tune global or thread-specific system variables. For example, Start mysqld with the --max-seeks-for-key=1000
option or use SET max_seeks_for_key=1000 to tell the optimizer to assume that no key scan causes more than 1,000 key
seeks. See Section 5.1.4, Server System Variables.
MySQL Enterprise
For expert advice on configuring MySQL servers for optimal performance, subscribe to the MySQL Enterprise
Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
B.1.7. Table Definition-Related Issues
B.1.7.1. Problems with ALTER TABLE
ALTER TABLE changes a table to the current character set. If you get a duplicate-key error during ALTER TABLE, the cause is either
that the new character sets maps two keys to the same value or that the table is corrupted. In the latter case, you should run REPAIR
TABLE on the table.
If ALTER TABLE dies with the following error, the problem may be that MySQL crashed during an earlier ALTER TABLE operation
and there is an old table named A-xxx or B-xxx lying around:
Error on rename of './database/name.frm'
to './database/B-xxx.frm' (Errcode: 17)
In this case, go to the MySQL data directory and delete all files that have names starting with A- or B-. (You may want to move them
elsewhere instead of deleting them.)
ALTER TABLE works in the following way:
Create a new table named A-xxx with the requested structural changes.
Copy all rows from the original table to A-xxx.
Rename the original table to B-xxx.
Rename A-xxx to your original table name.
Delete B-xxx.
If something goes wrong with the renaming operation, MySQL tries to undo the changes. If something goes seriously wrong (although
Errors, Error Codes, and Common Problems
2765
this shouldn't happen), MySQL may leave the old table as B-xxx. A simple rename of the table files at the system level should get your
data back.
If you use ALTER TABLE on a transactional table or if you are using Windows or OS/2, ALTER TABLE unlocks the table if you had
done a LOCK TABLE on it. This is done because InnoDB and these operating systems cannot drop a table that is in use.
B.1.7.2. How to Change the Order of Columns in a Table
First, consider whether you really need to change the column order in a table. The whole point of SQL is to abstract the application from
the data storage format. You should always specify the order in which you wish to retrieve your data. The first of the following state-
ments returns columns in the order col_name1, col_name2, col_name3, whereas the second returns them in the order
col_name1, col_name3, col_name2:
mysql> SELECT col_name1, col_name2, col_name3 FROM tbl_name;
mysql> SELECT col_name1, col_name3, col_name2 FROM tbl_name;
If you decide to change the order of table columns anyway, you can do so as follows:
1. Create a new table with the columns in the new order.
2. Execute this statement:
mysql> INSERT INTO new_table
-> SELECT columns-in-new-order FROM old_table;
3. Drop or rename old_table.
4. Rename the new table to the original name:
mysql> ALTER TABLE new_table RENAME old_table;
SELECT * is quite suitable for testing queries. However, in an application, you should never rely on using SELECT * and retrieving
the columns based on their position. The order and position in which columns are returned does not remain the same if you add, move,
or delete columns. A simple change to your table structure could cause your application to fail.
B.1.7.3. TEMPORARY Table Problems
The following list indicates limitations on the use of TEMPORARY tables:
A TEMPORARY table can only be of type MEMORY, MyISAM, MERGE, or InnoDB.
Temporary tables are not supported for MySQL Cluster.
You cannot refer to a TEMPORARY table more than once in the same query. For example, the following does not work:
mysql> SELECT * FROM temp_table, temp_table AS t2;
ERROR 1137: Can't reopen table: 'temp_table'
This error also occurs if you refer to a temporary table multiple times in a stored function under different aliases, even if the refer-
ences occur in different statements within the function.
The SHOW TABLES statement does not list TEMPORARY tables.
You cannot use RENAME to rename a TEMPORARY table. However, you can use ALTER TABLE instead:
mysql> ALTER TABLE orig_name RENAME new_name;
There are known issues in using temporary tables with replication. See Section 16.3.1, Replication Features and Issues, for more
information.
Errors, Error Codes, and Common Problems
2766
B.1.8. Known Issues in MySQL
This section is a list of the known issues in recent versions of MySQL.
For information about platform-specific issues, see the installation and porting instructions in Section 2.13, Operating System-Specific
Notes, and MySQL Internals: Porting.
B.1.8.1. Open Issues in MySQL
The following problems are known and fixing them is a high priority:
C API
Bug#40552: Race condition around default_directories in load_defaults()
Target fix: 5.1
Bug#43560: client crashes in mysql_stmt_execute/mysql_stmt_close after connection loss
Target fix: 5.1
Bug#42675: Dangling pointer leads to a client crash (mysys/my_error.c patch enclosed)
Target fix: 5.1
Bug#27475: mysql_fetch_field do NOT report correctly certain field types
Target fix: 5.1
Bug#43397: mysql headers redefine pthread_mutex_init unnecessarily
Target fix: 5.1
Client
Bug#34861: mysqldump with --tab gives weird output for triggers.
Target fix: 5.1
Bug#35934: mysql_upgrade calls mysqlcheck with insufficient parameters
Target fix: 5.1
Bug#34129: mysqldumpslow does not aggregate times
Target fix: 5.1
Bug#39852: bug in mysql_setpermission
Target fix: 5.1
Bug#44278: mysqlhotcopy unable to backup schema with a hyphen in its name
Target fix: 5.1
Bug#40395: mysqladmin -i delay extended-status does not iterate with -r
Target fix: 5.1
Bug#36391: mysqlbinlog creates invalid charset statements
Target fix: 5.1
Errors, Error Codes, and Common Problems
2767
Server
Bug#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
Target fix: 5.1.35
Bug#42610: Dynamic plugin broken in 5.1.31
Target fix: 5.1.33
Bug#44521: Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
Target fix: 5.1
Bug#45387: Information about statement id for prepared statements missed from general log
Target fix: 5.1
Bug#41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch() returns short string value.
Target fix: 5.1
Bug#41004: events_scheduling times out sporadically on pushbuild
Target fix: 5.1
Bug#35068: Assertion fails when reading from i_s.tables and there is incorrect merge table
Target fix: 5.1
Bug#38883: thd_security_context is not thread safe, crashes?
Target fix: 5.1
Bug#38941: fast mutexes in MySQL 5.1 have mutex contention when calling random()
Target fix: 5.1
Bug#40877: multi statement execution fails in 5.1.30
Target fix: 5.1
Bug#45638: Create temporary table with engine innodb fails
Target fix: 5.1
Bug#39494: please support >4GB key_buffer_size on windows
Target fix: 5.1
Bug#31616: div_precision_increment description looks wrong
Target fix: 5.1
Bug#43354: Use key hint can crash server in explain extended query
Target fix: 5.1
Bug#40757: server crash after failed plugin/engine initialization
Target fix: 5.1
Bug#40536: SELECT is blocked by INSERT DELAYED waiting on upgrading lock, even with low_pri
Target fix: 5.1
Errors, Error Codes, and Common Problems
2768
Bug#43827: Server closes connections and restarts
Target fix: 5.1
Bug#22891: session level max_allowed_packet can be set but is ignored
Target fix: 5.1
Bug#40949: Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
Target fix: 5.1
Bug#41030: Wrong meta data (incorrect fieldlen)
Target fix: 5.1
Bug#42563: Message tells me to repair table though Storage Engine doesn't allow me to.
Target fix: 5.1
Bug#45336: --enable-foobar doesn't work for any plugin foobar.
Target fix: 5.1
Server: Archive
Bug#37719: Crash if rename Archive table to same name with different case and then select
Target fix: 5.1
Bug#32880: Repairing Archive table fails with internal error 144
Target fix: 5.1
Server: CSV
Bug#41441: repair csv table crashes debug server
Target fix: 5.1.31
Server: Charsets
Bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers
Target fix: 5.1.31
Bug#41385: Crash when attempting to repair a #mysql50# upgraded table with triggers.
Target fix: 5.1.31
Bug#40053: 'check table .. for upgrade' doesn't detect collation change made in 5.1.24-rc
Already fixed in: 5.1.30
Bug#32831: libmysql should be built with all charsets
Target fix: 5.1
Bug#45012: my_like_range_cp932 generates invalid string
Target fix: 5.1
Errors, Error Codes, and Common Problems
2769
Bug#43593: dump/backup/restore/upgrade tools fails
Target fix: 5.1
Bug#45485: replication different between master/slaver using procedure with gbk
Target fix: 5.1
Bug#41084: full-text index added to custom UCA collation not working
Target fix: 5.1
Server: Compiling
Bug#42524: Function pthread_setschedprio() is defined but seems broken on i5/OS PASE
Target fix: 5.1.32
Bug#26760: SSL support missing from 5.1.15-0 x86_64 Client Programs?
Target fix: 5.1.31
Bug#43715: Link errors when trying to link mysql_embedded.exe
Target fix: 5.1
Bug#43449: Undefined symbol __1cG__CrunMex_rethrow_q6F_v_ when compiling using Sun Studio
Target fix: 5.1
Bug#42872: In MySQL 5.1.31, unrecognized --with-innodb, --with-partition, --with-federated
Target fix: 5.1
Bug#39996: 5.1 fails to compile on Windows 32-bit with VS2005
Target fix: 5.1
Bug#45706: rpm install fails due to incorrect libc linking
Target fix: 5.1
Bug#45113: mysql_config returns incorrect path if built with prefix != execprefix
Target fix: 5.1
Bug#42599: error: `pthread_setschedprio' was not declared in this scope
Target fix: 5.1
Bug#25404: mysql_config need several issues corrected
Target fix: 5.1
Bug#38364: gen_lex_hash segmentation fault in debug build
Target fix: 5.1
Bug#42733: type-punning warnings when compiling MySQL with -O2/-O3 -Wall and gcc 4.x
Target fix: 5.1
Bug#39102: valgrind build does not compile in realpath, which make DATA/INDEX DIR fail
Target fix: 5.1
Errors, Error Codes, and Common Problems
2770
Bug#39802: On Windows, 32-bit time_t should be enforced
Target fix: 5.1
Bug#31506: detection of function's availability is wrong in configure.in
Target fix: 5.1
Bug#38697: utf8_general_cs cannot be used with Windows?
Target fix: 5.1
Bug#39279: mysqld Linux-ia64 binary depends on two versions of libunwind
Target fix: 5.1
Bug#42071: Obsoleted configure options were still used in the official compiling.
Target fix: 5.1
Bug#39571: abi_check: Does not create all prerequisites
Target fix: 5.1
Bug#42141: Compiler crash in "mf_format.c" when optimizing for 64 bit
Target fix: 5.1
Bug#42721: configure.in invokes 'nm' directly
Target fix: 5.1
Bug#39288: MySQL Embedded server (libmysqld.a) is built without -fPIC flag
Target fix: 5.1
Server: Config Wizard
Bug#42386: MySQL .msi installer does not start configuration wizard on Vista when prompted
Target fix: 5.1.33
Bug#43282: Change installation path. mysql.exe not found
Target fix: 5.1
Bug#37294: Windows .msi - 'Repair' option doesn't back out as expected
Target fix: 5.1
Bug#44428: Cannot recreate instance after clean install (apply security settings fails)
Target fix: 5.1
Bug#38723: MySQL Configuration Wizard on Vista unreadable
Target fix: 5.1
Server: DB2SE for IBM i
Bug#45197: cp1250 character set with IBMDB2I generates 2027 error
Target fix: 5.1
Errors, Error Codes, and Common Problems
2771
Bug#44856: IBMDB2I gives misleading 2504 error
Target fix: 5.1
Bug#44337: Select query using index merge fails with MCH3601
Target fix: 5.1
Bug#44022: CREATE TABLE sometimes fails silently for IBMDB2I engine
Target fix: 5.1
Bug#44811: Tests with utf8 charset fail with ibmdb2i on 64bit MySQL
Target fix: 5.1
Server: DB2SE for i5OS
Bug#44025: Some schema names longer than 8 characters not supported by IBMDB2I
Target fix: 5.1
Bug#44020: Unicode Swedish collations not working with IBMDB2I
Target fix: 5.1
Server: DDL
Bug#37016: TRUNCATE TABLE removes some rows but not all
Target fix: 5.1.31
Bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
Already fixed in: 5.1.30
Bug#39372: "Smart" ALTER TABLE not so smart after all.
Target fix: 5.1
Bug#41465: confusing error message when comment is too long
Target fix: 5.1
Bug#39200: optimize table does not recognize ROW_FORMAT=COMPRESSED
Target fix: 5.1
Bug#45567: Fast ALTER TABLE broken for enum and set
Target fix: 5.1
Bug#43508: Renaming timestamp or date column triggers table copy
Target fix: 5.1
Bug#40886: ALTER TABLE statements appear to randomly fail on Mac OS 10.4
Target fix: 5.1
Bug#42226: ALTER DATABASE returns OK even when there are errors
Target fix: 5.1
Errors, Error Codes, and Common Problems
2772
Bug#40277: SHOW CREATE VIEW returns invalid SQL
Target fix: 5.1
Bug#35796: SHOW CREATE TABLE and default value for BIT field
Target fix: 5.1
Bug#41041: Obsolete debug code can be used to crash server
Target fix: 5.1
Server: DML
Bug#39920: MySQL cannot deal with Leap Second expression in string literal.
Target fix: 5.0.74
Bug#44743: Join in combination with concat does not always work
Target fix: 5.1
Bug#41156: List of derived tables acts like a chain of mutually-nested subqueries
Target fix: 5.1
Bug#40384: Gap in auto_increment sequence when inserts fire a trigger
Target fix: 5.1
Bug#41371: Select returns 1 row with condition "col is not null and col is null"
Target fix: 5.1
Bug#45168: assertion with convert() and empty set value
Target fix: 5.1
Bug#33717: INSERT...(default) fails for enum. Crashes CSV tables, loads spaces for MyISAM
Target fix: 5.1
Bug#38693: leaked memory with blobs!
Target fix: 5.1
Bug#44306: Assertion fail on duplicate key error in 'INSERT ... SELECT' statements
Target fix: 5.1
Bug#33844: Server crashes when client dies during LOAD DATA INFILE
Target fix: 5.1
Bug#40745: Error during WHERE clause calculation in UPDATE leads to an assertion failure
Target fix: 5.1
Bug#43385: Cannot ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME when Views exist
Target fix: 5.1
Bug#40127: Multiple table DELETE IGNORE hangs on foreign key constraint violation on 5.0
Target fix: 5.1
Errors, Error Codes, and Common Problems
2773
Server: Docs
Bug#26077: 'reap' command fetches first command issued by send, not the most recent
Target fix: 5.1
Server: Errors
Bug#41121: "Statement is not safe to log in statement format" is prints table name only
Target fix: 5.1
Bug#41077: Warning contains wrong future version
Target fix: 5.1
Server: FTS
Bug#39746: Debug flag breaks struct definition (server crash)
Target fix: 5.1
Bug#28234: global/session scope - documentation vs implementation
Target fix: 5.1
Bug#42907: Multi-term boolean fulltext query containing a single quote fails in 5.1.x
Target fix: 5.1
Bug#39640: ftb_query_add_word does not recognice MYSQL_FTFLAGS_NEED_COPY
Target fix: 5.1
Server: GIS
Bug#31435: ha_innodb.cc:3983: ulint convert_search_mode_to_innobase(ha_rkey_function): Asse
Target fix: 5.1
Server: General
Bug#43748: crash when non-super user tries to kill the replication threads
Target fix: 5.1.34
Bug#41456: SET PASSWORD hates CURRENT_USER()
Target fix: 5.1.31
Bug#41363: crash of mysqld on windows with aggregate in case
Target fix: 5.1.31
Bug#40104: regression with table names?
Target fix: 5.1
Errors, Error Codes, and Common Problems
2774
Bug#38249: innodb_log_arch_dir still in support files
Target fix: 5.1
Bug#45195: valgrind warnings about uninitialized values in store_record_in_cache()
Target fix: 5.1
Bug#36751: Segmentation fault in ctype-bin.c:308; Linux 86_64, with-max-indexes=128
Target fix: 5.1
Bug#42957: no results from select where .. (col=col and col=col) or ... (false expression)
Target fix: 5.1
Bug#44358: valgrind errors with decode() function
Target fix: 5.1
Bug#40915: Events takes mutex in wrong order which can easily lead to deadlocks
Target fix: 5.1
Bug#44736: mysqld_safe's my_which() is broken and doesn't find 'logger'
Target fix: 5.1
Bug#44638: mysql_upgrade, mysqlcheck output instance unclear
Target fix: 5.1
Bug#39178: Server crash in YaSSL with non-RSA-requesting client if server uses RSA key
Target fix: 5.1
Bug#41612: resolve_stack_dump does not decode 5.1 stack trace
Target fix: 5.1
Bug#10206: InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback.
Target fix: 5.1
Bug#37284: Crash in Field_string::type()
Target fix: 5.1
Bug#30261: "mysqld --help" no longer possible for root
Target fix: 5.1
Bug#41710: MySQL 5.1.30 crashes on the latest OpenSolaris 10
Target fix: 5.1
Bug#38477: my_pthread_setprio can change dispatch class on Solaris, not just priority
Target fix: 5.1
Bug#44367: valgrind warnings with find_in_set() functions
Target fix: 5.1
Bug#45309: InnoDB does not rollback for delete and update queries if query was killed
Target fix: 5.1
Errors, Error Codes, and Common Problems
2775
Bug#39265: SQL_MODE OLD_NOT_NULL_CHECK_BEHAVIOUR for backward compatibility
Target fix: 5.1
Bug#44664: valgrind warning for COMMIT_AND_CHAIN and ROLLBACK_AND_CHAIN
Target fix: 5.1
Bug#43962: "Packets out of order" calling a SHOW TABLE STATUS
Target fix: 5.1
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Target fix: 5.1
Bug#42158: leak: SSL_get_peer_certificate() doesn't have matching X509_free()
Target fix: 5.1
Bug#40862: main.subselect_notembedded test case fails
Target fix: 5.1
Bug#45548: XA transaction without access to InnoDB tables crashes the server
Target fix: 5.1
Bug#42146: DATETIME fractional seconds parse error
Target fix: 5.1
Bug#44365: valgrind warnings with encrypt() function
Target fix: 5.1
Bug#40657: assertion with out of range variables and traditional sql_mode
Target fix: 5.1
Bug#44164: TL_WRITE has no description in lock_descriptions[]
Target fix: 5.1
Server: I_S
Bug#39541: CHECK TABLE on information_schema myisam tables produces error
Target fix: 5.0.74
Bug#39955: SELECT on INFORMATION_SCHEMA.GLOBAL_VARIABLES takes too long
Target fix: 5.1
Bug#35275: INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS omits KEY_BLOCK_SIZE
Target fix: 5.1
Bug#38918: selecting from information_schema.columns is disproportionately slow
Target fix: 5.1
Bug#42758: INFORMATION_SCHEMA.COLUMNS is inconsistent
Target fix: 5.1
Errors, Error Codes, and Common Problems
2776
Bug#38909: CREATE_OPTIONS in information_schema produces wrong results
Target fix: 5.1
Bug#35789: wrong datatypes for collation and charset columns in EVENTS, ROUTINES, TRIGGERS
Target fix: 5.1
Server: InnoDB
Bug#45357: 5.1.35 crashes with Failing assertion: index->type & DICT_CLUSTERED
Target fix: 5.1.37
Bug#39320: assert btr/btr0pcur.c line 217 -innodb_locks_unsafe_for_binlog or read committed
Target fix: 5.1.35
Bug#40386: Not flushing query cache after truncate
Target fix: 5.1.31
Bug#40360: Binlog related errors with binlog off
Already fixed in: 5.1.30
Bug#42400: InnoDB autoinc code can't handle floating-point columns
Target fix: 5.1
Bug#39438: Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
Target fix: 5.1
Bug#42101: Race condition in innodb_commit_concurrency
Target fix: 5.1
Bug#36169: create innodb compressed table with too large row size crashed
Target fix: 5.1
Bug#45097: Hang during recovery, redo logs for doublewrite buffer pages
Target fix: 5.1
Bug#44320: InnoDB: missing DB_ROLL_PTR in Table Monitor COLUMNS output
Target fix: 5.1
Bug#42152: Race condition in lock_is_table_exclusive()
Target fix: 5.1
Bug#39830: Table autoinc value not updated on first insert
Target fix: 5.1
Bug#38231: Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
Target fix: 5.1
Bug#38189: innodb_stats_on_metadata missing
Target fix: 5.1
Errors, Error Codes, and Common Problems
2777
Bug#45749: Race condition in SET GLOBAL innodb_commit_concurrency=DEFAULT
Target fix: 5.1
Bug#44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from the index (PRIMARY)
Target fix: 5.1
Bug#36411: "Failed to read auto-increment value from storage engine" in 5.1.24 auto-inc
Target fix: 5.1
Bug#43203: Overflow from auto incrementing causes server segv
Target fix: 5.1
Bug#40369: dtype_get_sql_null_size() returns 0 or 1, not the size
Target fix: 5.1
Bug#39793: Foreign keys not constructed when column has a '#' in a comment or default value
Target fix: 5.1
Bug#42075: dict_load_indexes failure in dict_load_table will corrupt the dictionary cache
Target fix: 5.1
Bug#43660: SHOW INDEXES/ANALYZE does NOT update cardinality for indexes of InnoDB table
Target fix: 5.1
Bug#39648: Replication failure on RBR + Innodb + 2 bit fields + LIMIT + no PK
Target fix: 5.1
Bug#42279: Race condition in btr_search_drop_page_hash_when_freed()
Target fix: 5.1
Bug#37885: row_search_for_mysql may gap lock unnecessarily with SQL comments in query
Target fix: 5.1
Bug#35498: Cannot get table test/table1 auto-inccounter value in ::info
Target fix: 5.1
Bug#42714: AUTO_INCREMENT errors in 5.1.31
Target fix: 5.1
Bug#41671: Semi-consistent read does not unlock rows in READ COMMITTED mode
Target fix: 5.1
Bug#32430: 'show innodb status' causes errors Invalid (old?) table or database name in logs
Target fix: 5.1
Server: InnoDB Plugin
Bug#37788: InnoDB Plugin: AUTO_INCREMENT wrong for compressed tables
Target fix: 5.1
Errors, Error Codes, and Common Problems
2778
Server: Installing
Bug#17270: mysql client tool could not find ../share/charsets folder and fails.
Target fix: 5.1
Bug#41828: mysql_install_db misses mysqld options when using --basedir
Target fix: 5.1
Bug#41313: network administrator does not have TRIGGER and EVENT privileges
Target fix: 5.1
Server: Locking
Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table
Target fix: 5.1.31
Bug#41110: crash with handler command when used concurrently with alter table
Target fix: 5.1
Bug#41140: Failure of replication on triggered insert if innodb_autoinc_lock_mode > 0
Target fix: 5.1
Bug#44672: Assertion failed: thd->transaction.xid_state.xid.is_null()
Target fix: 5.1
Bug#39843: DELETE requires write access to table in subquery in where clause
Target fix: 5.1
Bug#33278: ANALYZE TABLE in InnoDB holds exclusive locks on subsequent execution
Target fix: 5.1
Server: Logging
Bug#43885: main.variables-big fails because of warnings within the server log
Target fix: 5.1
Bug#37132: Logging to slow_log table fails with very slow queries
Target fix: 5.1
Bug#40281: partitioning the general log table crashes the server
Target fix: 5.1
Server: Memory
Bug#39886: Table full for MEMORY table is not written into error log
Target fix: 5.1
Errors, Error Codes, and Common Problems
2779
Server: Merge
Bug#40675: MySQL 5.1 crash with index merge algorithm and Merge tables
Target fix: 5.1.33
Bug#41305: server crashes when inserting duplicate row into a merge table
Target fix: 5.1
Bug#44040: MySQL allows creating a MERGE table upon VIEWs but crashes when using it
Target fix: 5.1
Bug#41212: crash after race condition between merge table and table_cache evictions
Target fix: 5.1
Server: MyISAM
Bug#41574: REPAIR TABLE: crashes for compressed tables
Target fix: 5.1.31
Bug#40321: ha_myisam::info could update rec_per_key incorrectly
Target fix: 5.1
Bug#40634: table scan temporary table is 4x slower due to mmap instead instead of caching
Target fix: 5.1
Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value.
Target fix: 5.1
Bug#38848: myisam_use_mmap causes widespread myisam corruption on windows
Target fix: 5.1
Bug#37756: enabling fulltext indexes with myisam_repair_threads > 1 causes crash
Target fix: 5.1
Bug#43940: 64-bit windows myisamchk doesn't support key_buffer_size > 4G
Target fix: 5.1
Bug#37631: Incorrect key file for table after upgrading from 5.0 to 5.1
Target fix: 5.1
Bug#40827: Killing insert-select to MyISAM can cause table corruption
Target fix: 5.1
Server: Optimizer
Bug#37362: Crash in do_field_eq
Target fix: 5.1.36
Errors, Error Codes, and Common Problems
2780
Bug#34773: query with explain extended and derived table / other table crashes server
Target fix: 5.1.31
Bug#38842: Fix for 25951 seems incorrect
Target fix: 5.0.74
Bug#37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of requested column
Target fix: 5.1
Bug#44886: SIGSEGV in test_if_skip_sort_order() - uninitialized variable used as subscript
Target fix: 5.1
Bug#41543: Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno
Target fix: 5.1
Bug#37936: ASSERT_COLUMN_MARKED_FOR_WRITE in Field_datetime::store , Field_varstring::store
Target fix: 5.1
Bug#37822: Correlated subquery with IN and IS UNKNOWN provides wrong result
Target fix: 5.1
Bug#31399: Wrong query result when doing join buffering over BIT fields
Target fix: 5.1
Bug#39433: poor optimized query
Target fix: 5.1
Server: Options
Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors
Target fix: 5.1
Server: Packaging
Bug#43153: Version comment is too long
Target fix: 5.1.34
Bug#40845: Win inst shows screens with wrong naming "MySQL Monitoring and Advisory Service"
Target fix: 5.1.31
Bug#41838: shared-compat packages missing for Enterprise 5.1 builds
Target fix: 5.1.31
Bug#34025: mysql_config is not returning -ldl lib flag needed when using embedded server
Target fix: 5.1.31
Bug#39074: Binaries do not work on Solaris 10 older than U5
Already fixed in: 5.1.30
Errors, Error Codes, and Common Problems
2781
Bug#31143: mysqlslap.exe (and other) missing in windows install packages
Target fix: 5.1
Bug#43918: Generated version string is too long for the binlog
Target fix: 5.1
Bug#44496: No "MySQL Manual" in Install-Package
Target fix: 5.1
Bug#45415: rpm upgrade recreates test database
Target fix: 5.1
Bug#39641: mysql_config --plugindir links to /usr/local/mysql/lib/plugin in tar.gz packages
Target fix: 5.1
Bug#41577: improper value in example config file
Target fix: 5.1
Bug#44353: build-v9.bat is missing in source archive
Target fix: 5.1
Bug#41189: No debug symbols in 5.1.30 build for Mac OSX (mysql-5.1.30-osx10.5-x86.dmg)
Target fix: 5.1
Bug#41998: Solaris 10 postinstall script fails to copy from wrong dir
Target fix: 5.1
Bug#37697: make_binary_distribution places files in wrong path
Target fix: 5.1
Server: Parser
Bug#39559: dump of stored procedures / functions with C-style comment can't be read back
Target fix: 5.1
Bug#38159: Function parsing problem generates misleading error message
Target fix: 5.1
Bug#43746: YACC return wrong query string when parse 'load data infile' sql statement
Target fix: 5.1
Server: Partition
Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
The crash is observed with queries of the form "SELECT * FROM part_table WHERE a < const ORDER BY a" or "SELECT *
FROM part_table WHERE a <> ORDER BY a" where a is an indexed column used as the partition key. The crash can be
avoided by 'limiting' the where clause with a very low value as in: "SELECT * FROM part_table WHERE a < const AND a > -
1000 ORDER BY a" or "SELECT * FROM part_table WHERE a <> AND a > -1000 ORDER BY a"
Errors, Error Codes, and Common Problems
2782
Target fix: 5.1.31
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work on non-partitioned table
Target fix: 5.1.31
Bug#14326: No formatting of SHOW CREATE TABLE output
Target fix: 5.1.31
Bug#37721: ORDER BY when WHERE contains non-partitioned index column
Target fix: 5.1.31
Bug#40176: Combination of event, trigger and partitioning breaks auto increment
Target fix: 5.1.31
Bug#40494: MYSQL server crashes on range access with partitioning and order by
Already fixed in: 5.1.30
Bug#44657: Got error 124 from storage engine when load concurrent data infile working
Target fix: 5.1
Bug#40972: Partition pruning can lead to crash for bad dates
Target fix: 5.1
Bug#40515: Query on a partitioned table does not return 'lock wait timeout exceeded'
Target fix: 5.1
Bug#42849: innodb crash with varying time_zone on partitioned timestamp primary key
Target fix: 5.1
Bug#40389: REORGANIZE PARTITION crashes when only using one partition
Target fix: 5.1
Bug#44821: select distinct on partitioned table returns wrong results
Target fix: 5.1
Bug#44653: Server crash noticed when executing random queries with partitions.
Target fix: 5.1
Bug#36001: Partitions: spelling and using some error messages
Target fix: 5.1
Bug#36312: InnoDB DATA_FREE BUG?
Target fix: 5.1
Bug#37453: Dropping/creating index on partitioned table with InnoDB Plugin locks table
Target fix: 5.1
Bug#42944: partition not pruned correctly
Target fix: 5.1
Errors, Error Codes, and Common Problems
2783
Bug#39084: Getting intermittent errors with statement-based binary logging
Target fix: 5.1
Bug#38719: Partitioning returns a different error code for a duplicate key error
Target fix: 5.1
Bug#30102: rename table does corrupt tables with partition files on failure
Target fix: 5.1
Server: Privileges
Bug#37191: Failed assertion in CREATE VIEW
Target fix: 5.1
Bug#30305: Create routine in wrong context in SHOW PRIVILEGES
Target fix: 5.1
Bug#45100: Incomplete DROP USER in case of SQL_MODE = 'PAD_CHAR_TO_FULL_LENGTH'
Target fix: 5.1
Server: Query Cache
Bug#43758: Query cache can lock up threads in 'freeing items' state
Target fix: 5.1.36
Bug#43861: main.query_cache_28249 fails sporadically
Target fix: 5.1
Bug#41098: Query Cache returns wrong result with concurrent insert
Target fix: 5.1
Server: RBR
Bug#42977: RBR logs for rows with more than 250 column results in corrupt binlog.
Target fix: 5.1.34
Bug#41986: Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables
Target fix: 5.1.31
Bug#40221: Replication failure on RBR + UPDATE the primary key
Target fix: 5.1.31
Bug#40004: Replication failure with no PK + no indexes
Already fixed in: 5.1.30
Bug#39934: Slave stops for engine that only support row-based logging
Target fix: 5.1
Errors, Error Codes, and Common Problems
2784
Bug#40278: Replication failure on RBR + MyISAM + SAVEPOINTs
Target fix: 5.1
Bug#39701: Mixed binlog format does not switch to row mode on LOAD_FILE
Target fix: 5.1
Bug#31502: 5.1.20 -> 5.1.22 Slave crashes if it gets an event w/ data for non-exist column
Target fix: 5.1
Bug#45243: crash on win in sql thread clear_tables_to_lock() -> free()
Target fix: 5.1
Bug#38230: Differences between master and slave after UPDATE or DELETE with LIMIT with pk
Target fix: 5.1
Bug#42941: --database paramater to mysqlbinlog fails with RBR
Target fix: 5.1
Bug#39753: Replication failure on MIXED + bit + myisam + no PK
Target fix: 5.1
Bug#42914: non-updated blob columns are included in RBR binlog record.
Target fix: 5.1
Bug#42749: infinite loop writing to row based binlog - processlist shows "freeing items"
Target fix: 5.1
Server: Replication
Bug#44581: Slave stops when transaction with non-transactional table gets lock wait timeout
Target fix: 5.1.37
Bug#40116: Uncommited changes are replicated and stay on slave after rollback on master
Target fix: 5.1.31
Bug#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event
Target fix: 5.1
Bug#43579: mysql_upgrade tries to alter log tables on replicated database
Target fix: 5.1
Bug#42851: Spurious "Statement is not safe to log in statement format." warnings
Target fix: 5.1
Bug#45242: crash on win in mysql_close() -> free()
Target fix: 5.1
Bug#41980: SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 !
Target fix: 5.1
Errors, Error Codes, and Common Problems
2785
Bug#40796: Crash due to heap corruption in rpl.rpl_extraColmaster_myisam
Target fix: 5.1
Bug#38240: Crash in safe_mutex_lock () thr_mutex.c line 97 on rotate_relay_log ()
Target fix: 5.1
Bug#34739: unexpected binlog file name when --log-bin is set to a directory name
Target fix: 5.1
Bug#38174: secure-file-priv breaks LOAD DATA INFILE replication in statement mode
Target fix: 5.1
Bug#35583: mysqlbinlog replay fails with ERROR 1146 when temp tables are used
Target fix: 5.1
Bug#40013: mixed replication: row based format could lead to stale tmp tables on the slave
Target fix: 5.1
Bug#44179: reset slave crashes in my_error when reset_logs returns non-zero
Target fix: 5.1
Bug#36763: TRUNCATE TABLE fails to replicate when stmt-based binlogging is not supported.
Target fix: 5.1
Bug#34628: LOAD DATA CONCURRENT INFILE drops CONCURRENT in binary log
Target fix: 5.1
Bug#38934: slave slave until does not work with --replicate-same-server-id
Target fix: 5.1
Bug#41948: Query_log_event constructor needlessly contorted
Target fix: 5.1
Bug#44181: CHANGE MASTER complains Could not initialize master info
Target fix: 5.1
Bug#34541: mysqlbinlog prints 'set;' in stm mode after changing autocommit mode
Target fix: 5.1
Bug#39526: sql_mode not retained in binary log for CREATE PROCEDURE
Target fix: 5.1
Bug#31240: load data infile replication between (4.0 or 4.1) and 5.1 fails
Target fix: 5.1
Bug#38205: Row-based Replication (RBR) causes inconsistencies: HA_ERR_FOUND_DUPP_KEY
Target fix: 5.1
Bug#45238: rpl_slave_skip, rpl_change_master failed (lost connection) for STOP SLAVE
Target fix: 5.1
Errors, Error Codes, and Common Problems
2786
Bug#44442: Incident events are silent in mysqlbinlog output
Target fix: 5.1
Bug#22504: load data infile sql statement in replication architechure get error
Target fix: 5.1
Bug#45677: Slave stops with Duplicate entry for key PRIMARY when using trigger
Target fix: 5.1
Bug#42861: Assigning invalid directories to --slave-load-tmpdir crashes the slave
Target fix: 5.1
Bug#41941: Failed OPTIMIZE TABLE is logged to binary log for MERGE engine
Target fix: 5.1
Bug#42829: binlogging enabled for all schemas regardless of binlog-db-db / binlog-ignore-db
Target fix: 5.1
Bug#41166: stored function requires "deterministic" if binlog_format is "statement"
Target fix: 5.1
Bug#39393: slave-skip-errors does not work when using ROW based replication
Target fix: 5.1
Bug#44270: RESET SLAVE does not reset Last_IO_Error or Last_IO_Errno
Target fix: 5.1
Bug#44331: Restore of database with events produces warning in replication
Target fix: 5.1
Bug#42415: UPDATE with LIMIT clause unsafe for statement format even when ORDER BY PK
Target fix: 5.1
Bug#32228: A disk full makes binary log corrupt.
Target fix: 5.1
Bug#41961: Some log_event types do not skip post-header when reading
Target fix: 5.1
Bug#45214: get_master_version_and_clock does not report error when queries fail
Target fix: 5.1
Bug#38197: Errors in @@init_slave not visible in 'show slave status'
Target fix: 5.1
Server: SE API
Bug#39053: UNISTALL PLUGIN does not allow the storage engine to cleanup open connections
Target fix: 5.1
Errors, Error Codes, and Common Problems
2787
Bug#38338: REPLACE causes last_insert_id() to return an incorrect value
Target fix: 5.1
Server: SP
Bug#42188: crash and/or memory corruption with user variables in trigger
Target fix: 5.1.32
Bug#38066: Events log 'note' level messages by default in the error log
Target fix: 5.1.31
Bug#40770: Server Crash when running with triggers including variable settings (rpl_sys)
The crash is observed when the trigger/SP assigns values to user variables. The crash can be avoided by using local variables in-
stead of user variables in the trigger/SP code.
Target fix: 5.1.31
Bug#45261: Crash, stored procedure + decimal
Target fix: 5.1
Bug#43884: SP + filename param as TEXT + LOAD_FILE inside, causes valgrind warnings in PB
Target fix: 5.1
Bug#41726: upgrade from 5.0 to 5.1.30 crashes if you didn't run mysql_upgrade
Target fix: 5.1
Bug#43587: Putting event_scheduler=1 in init SQL file crashes mysqld
Target fix: 5.1
Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
Target fix: 5.1
Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
Target fix: 5.1
Server: Types
Bug#42014: Crash, name_const with collate
Target fix: 5.1.32
Bug#35558: Wrong server metadata blows up the client
Target fix: 5.1
Bug#45262: Bad effects with CREATE TABLE and DECIMAL
Target fix: 5.1
Server: Views
Errors, Error Codes, and Common Problems
2788
Bug#40825: Error 1356 while selecting from a view with a "HAVING" clause though query works
Target fix: 5.1
Server: XML
Bug#43183: ExctractValue() brings result list in missorder
Target fix: 5.1.36 5.0
Bug#42495: updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507
Target fix: 5.1.32
Bug#38227: EXTRACTVALUE doesn't work with DTD declarations
Target fix: 5.1
Tests: Replication
Bug#43913: rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm
Target fix: 5.1
Bug#45630: rpl_trigger.test causes valgrind failures within nptl_pthread_exit_hack_handler
Target fix: 5.1
Bug#45511: rpl.rpl_binlog_corruption fails with warning messages in Valgrind
Target fix: 5.1
Tests: Server
Bug#42383: main.innodb_bug39438: Can't create table 'test.bug39438'
Target fix: 5.1
libmysqld
Bug#44091: libmysqld gets stuck waiting on mutex on initialization
Target fix: 5.1.35
Bug#43706: libmysqld segfaults when re-intialised
Target fix: 5.1
Bug#43733: Select on processlist let the embedded server crash (concurrent_innodb_safelog)
Target fix: 5.1
Bug#38293: Libmysqld crash in mysql_library_init if language file missing
Target fix: 5.1
Bug#39289: libmysqld.a calls exit() upon error
Target fix: 5.1
Errors, Error Codes, and Common Problems
2789
Bug#37995: Error message truncation in test "innodb" in embedded mode
Target fix: 5.1
Bug#34517: SHOW GLOBAL STATUS does not work properly in embedded server.
Target fix: 5.1
Bug#38522: 5 seconds delay when closing application using embedded server
Target fix: 5.1
B.1.8.2. Additional Known Issues
The following problems are also known and fixing them is also a high priority:
MySQL Cluster fails to recover from an out-of-disk failure when using disk data. (Bug#17614)
Subquery optimization for IN is not as effective as for =.
Even if you use lower_case_table_names=2 (which enables MySQL to remember the case used for databases and table
names), MySQL does not remember the case used for database names for the function DATABASE() or within the various logs (on
case-insensitive systems).
Dropping a FOREIGN KEY constraint doesn't work in replication because the constraint may have another name on the slave.
REPLACE (and LOAD DATA with the REPLACE option) does not trigger ON DELETE CASCADE.
DISTINCT with ORDER BY doesn't work inside GROUP_CONCAT() if you don't use all and only those columns that are in the
DISTINCT list.
If one user has a long-running transaction and another user drops a table that is updated in the transaction, there is small chance that
the binary log may contain the DROP TABLE command before the table is used in the transaction itself. We plan to fix this by hav-
ing the DROP TABLE command wait until the table is not being used in any transaction.
When inserting a big integer value (between 2
63
and 2
64
1) into a decimal or string column, it is inserted as a negative value because
the number is evaluated in a signed integer context.
FLUSH TABLES WITH READ LOCK does not block COMMIT if the server is running without binary logging, which may cause a
problem (of consistency between tables) when doing a full backup.
ANALYZE TABLE, OPTIMIZE TABLE, and REPAIR TABLE may cause problems on tables for which you are using INSERT
DELAYED.
Performing LOCK TABLE ... and FLUSH TABLES ... doesn't guarantee that there isn't a half-finished transaction in progress
on the table.
Replication uses query-level logging: The master writes the executed queries to the binary log. This is a very fast, compact, and effi-
cient logging method that works perfectly in most cases.
It is possible for the data on the master and slave to become different if a query is designed in such a way that the data modification
is nondeterministic (generally not a recommended practice, even outside of replication).
For example:
CREATE ... SELECT or INSERT ... SELECT statements that insert zero or NULL values into an AUTO_INCREMENT
column.
DELETE if you are deleting rows from a table that has foreign keys with ON DELETE CASCADE properties.
REPLACE ... SELECT, INSERT IGNORE ... SELECT if you have duplicate key values in the inserted data.
If and only if the preceding queries have no ORDER BY clause guaranteeing a deterministic order.
Errors, Error Codes, and Common Problems
2790
For example, for INSERT ... SELECT with no ORDER BY, the SELECT may return rows in a different order (which results in
a row having different ranks, hence getting a different number in the AUTO_INCREMENT column), depending on the choices made
by the optimizers on the master and slave.
A query is optimized differently on the master and slave only if:
The table is stored using a different storage engine on the master than on the slave. (It is possible to use different storage engines
on the master and slave. For example, you can use InnoDB on the master, but MyISAM on the slave if the slave has less avail-
able disk space.)
MySQL buffer sizes (key_buffer_size, and so on) are different on the master and slave.
The master and slave run different MySQL versions, and the optimizer code differs between these versions.
This problem may also affect database restoration using mysqlbinlog|mysql.
The easiest way to avoid this problem is to add an ORDER BY clause to the aforementioned nondeterministic queries to ensure that
the rows are always stored or modified in the same order.
In future MySQL versions, we will automatically add an ORDER BY clause when needed.
The following issues are known and will be fixed in due time:
Log file names are based on the server host name (if you don't specify a file name with the startup option). You have to use options
such as --log-bin=old_host_name-bin if you change your host name to something else. Another option is to rename the
old files to reflect your host name change (if these are binary logs, you need to edit the binary log index file and fix the binlog
names there as well). See Section 5.1.2, Server Command Options.
mysqlbinlog does not delete temporary files left after a LOAD DATA INFILE command. See Section 4.6.7, mysqlbinlog
Utility for Processing Binary Log Files.
RENAME doesn't work with TEMPORARY tables or tables used in a MERGE table.
Due to the way table format (.frm) files are stored, you cannot use character 255 (CHAR(255)) in table names, column names, or
enumerations. This is scheduled to be fixed in version 5.1 when we implement new table definition format files.
When using SET CHARACTER SET, you can't use translated characters in database, table, and column names.
You can't use _ or % with ESCAPE in LIKE ... ESCAPE.
You cannot build the server in another directory when using MIT-pthreads. Because this requires changes to MIT-pthreads, we are
not likely to fix this. See Section 2.10.5, MIT-pthreads Notes.
BLOB and TEXT values can't reliably be used in GROUP BY, ORDER BY or DISTINCT. Only the first max_sort_length
bytes are used when comparing BLOB values in these cases. The default value of max_sort_length is 1024 and can be changed
at server startup time or at runtime.
Numeric calculations are done with BIGINT or DOUBLE (both are normally 64 bits long). Which precision you get depends on the
function. The general rule is that bit functions are performed with BIGINT precision, IF() and ELT() with BIGINT or DOUBLE
precision, and the rest with DOUBLE precision. You should try to avoid using unsigned long long values if they resolve to be larger
than 63 bits (9223372036854775807) for anything other than bit fields.
You can have up to 255 ENUM and SET columns in one table.
In MIN(), MAX(), and other aggregate functions, MySQL currently compares ENUM and SET columns by their string value rather
than by the string's relative position in the set.
mysqld_safe redirects all messages from mysqld to the mysqld log. One problem with this is that if you execute mysqlad-
min refresh to close and reopen the log, stdout and stderr are still redirected to the old log. If you use the general query
log extensively, you should edit mysqld_safe to log to host_name.err instead of host_name.log so that you can easily
reclaim the space for the old log by deleting it and executing mysqladmin refresh.
In an UPDATE statement, columns are updated from left to right. If you refer to an updated column, you get the updated value in-
Errors, Error Codes, and Common Problems
2791
stead of the original value. For example, the following statement increments KEY by 2, not 1:
mysql> UPDATE tbl_name SET KEY=KEY+1,KEY=KEY+1;
You can refer to multiple temporary tables in the same query, but you cannot refer to any given temporary table more than once. For
example, the following doesn't work:
mysql> SELECT * FROM temp_table, temp_table AS t2;
ERROR 1137: Can't reopen table: 'temp_table'
The optimizer may handle DISTINCT differently when you are using hidden columns in a join than when you are not. In a join,
hidden columns are counted as part of the result (even if they are not shown), whereas in normal queries, hidden columns don't par-
ticipate in the DISTINCT comparison. We will probably change this in the future to never compare the hidden columns when ex-
ecuting DISTINCT.
An example of this is:
SELECT DISTINCT mp3id FROM band_downloads
WHERE userid = 9 ORDER BY id DESC;
and
SELECT DISTINCT band_downloads.mp3id
FROM band_downloads,band_mp3
WHERE band_downloads.userid = 9
AND band_mp3.id = band_downloads.mp3id
ORDER BY band_downloads.id DESC;
In the second case, using MySQL Server 3.23.x, you may get two identical rows in the result set (because the values in the hidden
id column may differ).
Note that this happens only for queries where that do not have the ORDER BY columns in the result.
If you execute a PROCEDURE on a query that returns an empty set, in some cases the PROCEDURE does not transform the columns.
Creation of a table of type MERGE doesn't check whether the underlying tables are compatible types.
If you use ALTER TABLE to add a UNIQUE index to a table used in a MERGE table and then add a normal index on the MERGE ta-
ble, the key order is different for the tables if there was an old, non-UNIQUE key in the table. This is because ALTER TABLE puts
UNIQUE indexes before normal indexes to be able to detect duplicate keys as early as possible.
B.2. Types of Error Values
When an error occurs in MySQL, the server returns two types of error values:
A MySQL-specific error code. This value is numeric. It is not portable to other database systems.
An SQLSTATE value. The value is a five-character string (for example, '42S02'). The values are specified by ANSI SQL and
ODBC and are more standardized.
When an error occurs, you can access the MySQL error code, the SQLSTATE value, and a string containing an error message using C
API functions:
MySQL error code: Call mysql_errno()
SQLSTATE value: Call mysql_sqlstate()
Error message: Call mysql_error()
For prepared statements, the corresponding error functions are mysql_stmt_errno(), mysql_stmt_sqlstate(), and
Errors, Error Codes, and Common Problems
2792
mysql_stmt_error(). All error functions are described in Section 21.10, MySQL C API.
The first two characters of an SQLSTATE value indicate the error class:
'00' indicates success.
'01' indicates a warning.
'02' indicates not found. These values are relevant only within the context of cursors and are used to control what happens when
a cursor reaches the end of a data set.
Other values indicate an exception.
B.3. Server Error Codes and Messages
MySQL programs have access to several types of error information when the server returns an error. For example, the mysql client
program displays errors using the following format:
shell> SELECT * FROM no_such_table;
ERROR 1146 (42S02): Table 'test.no_such_table' doesn't exist
The message displayed contains three types of information:
A numeric error code (1146). This number is MySQL-specific and is not portable to other database systems.
A five-character SQLSTATE value ('42S02'). The values are specified by ANSI SQL and ODBC and are more standardized. Not
all MySQL error numbers are mapped to SQLSTATE error codes. The value 'HY000' (general error) is used for unmapped errors.
A string that provides a textual description of the error.
Server error information comes from the following source files. For details about the way that error information is defined, see the
MySQL Internals manual, available at http://dev.mysql.com/doc/.
Error message information is listed in the share/errmsg.txt file. %d and %s represent numbers and strings, respectively, that
are substituted into the Message values when they are displayed.
The Error values listed in share/errmsg.txt are used to generate the definitions in the include/mysqld_error.h and
include/mysqld_ername.h MySQL source files.
The SQLSTATE values listed in share/errmsg.txt are used to generate the definitions in the include/sql_state.h
MySQL source file.
Because updates are frequent, it is possible that those files will contain additional error information not listed here.
Error: 1000 SQLSTATE: HY000 (ER_HASHCHK)
Message: hashchk
Error: 1001 SQLSTATE: HY000 (ER_NISAMCHK)
Message: isamchk
Error: 1002 SQLSTATE: HY000 (ER_NO)
Message: NO
Error: 1003 SQLSTATE: HY000 (ER_YES)
Message: YES
Errors, Error Codes, and Common Problems
2793
Error: 1004 SQLSTATE: HY000 (ER_CANT_CREATE_FILE)
Message: Can't create file '%s' (errno: %d)
Error: 1005 SQLSTATE: HY000 (ER_CANT_CREATE_TABLE)
Message: Can't create table '%s' (errno: %d)
Error: 1006 SQLSTATE: HY000 (ER_CANT_CREATE_DB)
Message: Can't create database '%s' (errno: %d)
Error: 1007 SQLSTATE: HY000 (ER_DB_CREATE_EXISTS)
Message: Can't create database '%s'; database exists
Error: 1008 SQLSTATE: HY000 (ER_DB_DROP_EXISTS)
Message: Can't drop database '%s'; database doesn't exist
Error: 1009 SQLSTATE: HY000 (ER_DB_DROP_DELETE)
Message: Error dropping database (can't delete '%s', errno: %d)
Error: 1010 SQLSTATE: HY000 (ER_DB_DROP_RMDIR)
Message: Error dropping database (can't rmdir '%s', errno: %d)
Error: 1011 SQLSTATE: HY000 (ER_CANT_DELETE_FILE)
Message: Error on delete of '%s' (errno: %d)
Error: 1012 SQLSTATE: HY000 (ER_CANT_FIND_SYSTEM_REC)
Message: Can't read record in system table
Error: 1013 SQLSTATE: HY000 (ER_CANT_GET_STAT)
Message: Can't get status of '%s' (errno: %d)
Error: 1014 SQLSTATE: HY000 (ER_CANT_GET_WD)
Message: Can't get working directory (errno: %d)
Error: 1015 SQLSTATE: HY000 (ER_CANT_LOCK)
Message: Can't lock file (errno: %d)
Error: 1016 SQLSTATE: HY000 (ER_CANT_OPEN_FILE)
Message: Can't open file: '%s' (errno: %d)
Error: 1017 SQLSTATE: HY000 (ER_FILE_NOT_FOUND)
Message: Can't find file: '%s' (errno: %d)
Error: 1018 SQLSTATE: HY000 (ER_CANT_READ_DIR)
Message: Can't read dir of '%s' (errno: %d)
Error: 1019 SQLSTATE: HY000 (ER_CANT_SET_WD)
Message: Can't change dir to '%s' (errno: %d)
Error: 1020 SQLSTATE: HY000 (ER_CHECKREAD)
Message: Record has changed since last read in table '%s'
Errors, Error Codes, and Common Problems
2794
Error: 1021 SQLSTATE: HY000 (ER_DISK_FULL)
Message: Disk full (%s); waiting for someone to free some space...
Error: 1022 SQLSTATE: 23000 (ER_DUP_KEY)
Message: Can't write; duplicate key in table '%s'
Error: 1023 SQLSTATE: HY000 (ER_ERROR_ON_CLOSE)
Message: Error on close of '%s' (errno: %d)
Error: 1024 SQLSTATE: HY000 (ER_ERROR_ON_READ)
Message: Error reading file '%s' (errno: %d)
Error: 1025 SQLSTATE: HY000 (ER_ERROR_ON_RENAME)
Message: Error on rename of '%s' to '%s' (errno: %d)
Error: 1026 SQLSTATE: HY000 (ER_ERROR_ON_WRITE)
Message: Error writing file '%s' (errno: %d)
Error: 1027 SQLSTATE: HY000 (ER_FILE_USED)
Message: '%s' is locked against change
Error: 1028 SQLSTATE: HY000 (ER_FILSORT_ABORT)
Message: Sort aborted
Error: 1029 SQLSTATE: HY000 (ER_FORM_NOT_FOUND)
Message: View '%s' doesn't exist for '%s'
Error: 1030 SQLSTATE: HY000 (ER_GET_ERRNO)
Message: Got error %d from storage engine
Error: 1031 SQLSTATE: HY000 (ER_ILLEGAL_HA)
Message: Table storage engine for '%s' doesn't have this option
Error: 1032 SQLSTATE: HY000 (ER_KEY_NOT_FOUND)
Message: Can't find record in '%s'
Error: 1033 SQLSTATE: HY000 (ER_NOT_FORM_FILE)
Message: Incorrect information in file: '%s'
Error: 1034 SQLSTATE: HY000 (ER_NOT_KEYFILE)
Message: Incorrect key file for table '%s'; try to repair it
Error: 1035 SQLSTATE: HY000 (ER_OLD_KEYFILE)
Message: Old key file for table '%s'; repair it!
Error: 1036 SQLSTATE: HY000 (ER_OPEN_AS_READONLY)
Message: Table '%s' is read only
Error: 1037 SQLSTATE: HY001 (ER_OUTOFMEMORY)
Message: Out of memory; restart server and try again (needed %d bytes)
Errors, Error Codes, and Common Problems
2795
Error: 1038 SQLSTATE: HY001 (ER_OUT_OF_SORTMEMORY)
Message: Out of sort memory; increase server sort buffer size
Error: 1039 SQLSTATE: HY000 (ER_UNEXPECTED_EOF)
Message: Unexpected EOF found when reading file '%s' (errno: %d)
Error: 1040 SQLSTATE: 08004 (ER_CON_COUNT_ERROR)
Message: Too many connections
Error: 1041 SQLSTATE: HY000 (ER_OUT_OF_RESOURCES)
Message: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to
allow mysqld to use more memory or you can add more swap space
Error: 1042 SQLSTATE: 08S01 (ER_BAD_HOST_ERROR)
Message: Can't get hostname for your address
Error: 1043 SQLSTATE: 08S01 (ER_HANDSHAKE_ERROR)
Message: Bad handshake
Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR)
Message: Access denied for user '%s'@'%s' to database '%s'
Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR)
Message: Access denied for user '%s'@'%s' (using password: %s)
Error: 1046 SQLSTATE: 3D000 (ER_NO_DB_ERROR)
Message: No database selected
Error: 1047 SQLSTATE: 08S01 (ER_UNKNOWN_COM_ERROR)
Message: Unknown command
Error: 1048 SQLSTATE: 23000 (ER_BAD_NULL_ERROR)
Message: Column '%s' cannot be null
Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR)
Message: Unknown database '%s'
Error: 1050 SQLSTATE: 42S01 (ER_TABLE_EXISTS_ERROR)
Message: Table '%s' already exists
Error: 1051 SQLSTATE: 42S02 (ER_BAD_TABLE_ERROR)
Message: Unknown table '%s'
Error: 1052 SQLSTATE: 23000 (ER_NON_UNIQ_ERROR)
Message: Column '%s' in %s is ambiguous
Error: 1053 SQLSTATE: 08S01 (ER_SERVER_SHUTDOWN)
Message: Server shutdown in progress
Error: 1054 SQLSTATE: 42S22 (ER_BAD_FIELD_ERROR)
Errors, Error Codes, and Common Problems
2796
Message: Unknown column '%s' in '%s'
Error: 1055 SQLSTATE: 42000 (ER_WRONG_FIELD_WITH_GROUP)
Message: '%s' isn't in GROUP BY
Error: 1056 SQLSTATE: 42000 (ER_WRONG_GROUP_FIELD)
Message: Can't group on '%s'
Error: 1057 SQLSTATE: 42000 (ER_WRONG_SUM_SELECT)
Message: Statement has sum functions and columns in same statement
Error: 1058 SQLSTATE: 21S01 (ER_WRONG_VALUE_COUNT)
Message: Column count doesn't match value count
Error: 1059 SQLSTATE: 42000 (ER_TOO_LONG_IDENT)
Message: Identifier name '%s' is too long
Error: 1060 SQLSTATE: 42S21 (ER_DUP_FIELDNAME)
Message: Duplicate column name '%s'
Error: 1061 SQLSTATE: 42000 (ER_DUP_KEYNAME)
Message: Duplicate key name '%s'
Error: 1062 SQLSTATE: 23000 (ER_DUP_ENTRY)
Message: Duplicate entry '%s' for key %d
Error: 1063 SQLSTATE: 42000 (ER_WRONG_FIELD_SPEC)
Message: Incorrect column specifier for column '%s'
Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR)
Message: %s near '%s' at line %d
Error: 1065 SQLSTATE: 42000 (ER_EMPTY_QUERY)
Message: Query was empty
Error: 1066 SQLSTATE: 42000 (ER_NONUNIQ_TABLE)
Message: Not unique table/alias: '%s'
Error: 1067 SQLSTATE: 42000 (ER_INVALID_DEFAULT)
Message: Invalid default value for '%s'
Error: 1068 SQLSTATE: 42000 (ER_MULTIPLE_PRI_KEY)
Message: Multiple primary key defined
Error: 1069 SQLSTATE: 42000 (ER_TOO_MANY_KEYS)
Message: Too many keys specified; max %d keys allowed
Error: 1070 SQLSTATE: 42000 (ER_TOO_MANY_KEY_PARTS)
Message: Too many key parts specified; max %d parts allowed
Errors, Error Codes, and Common Problems
2797
Error: 1071 SQLSTATE: 42000 (ER_TOO_LONG_KEY)
Message: Specified key was too long; max key length is %d bytes
Error: 1072 SQLSTATE: 42000 (ER_KEY_COLUMN_DOES_NOT_EXITS)
Message: Key column '%s' doesn't exist in table
Error: 1073 SQLSTATE: 42000 (ER_BLOB_USED_AS_KEY)
Message: BLOB column '%s' can't be used in key specification with the used table type
Error: 1074 SQLSTATE: 42000 (ER_TOO_BIG_FIELDLENGTH)
Message: Column length too big for column '%s' (max = %lu); use BLOB or TEXT instead
Error: 1075 SQLSTATE: 42000 (ER_WRONG_AUTO_KEY)
Message: Incorrect table definition; there can be only one auto column and it must be defined as a key
Error: 1076 SQLSTATE: HY000 (ER_READY)
Message: %s: ready for connections. Version: '%s' socket: '%s' port: %d
Error: 1077 SQLSTATE: HY000 (ER_NORMAL_SHUTDOWN)
Message: %s: Normal shutdown
Error: 1078 SQLSTATE: HY000 (ER_GOT_SIGNAL)
Message: %s: Got signal %d. Aborting!
Error: 1079 SQLSTATE: HY000 (ER_SHUTDOWN_COMPLETE)
Message: %s: Shutdown complete
Error: 1080 SQLSTATE: 08S01 (ER_FORCING_CLOSE)
Message: %s: Forcing close of thread %ld user: '%s'
Error: 1081 SQLSTATE: 08S01 (ER_IPSOCK_ERROR)
Message: Can't create IP socket
Error: 1082 SQLSTATE: 42S12 (ER_NO_SUCH_INDEX)
Message: Table '%s' has no index like the one used in CREATE INDEX; recreate the table
Error: 1083 SQLSTATE: 42000 (ER_WRONG_FIELD_TERMINATORS)
Message: Field separator argument is not what is expected; check the manual
Error: 1084 SQLSTATE: 42000 (ER_BLOBS_AND_NO_TERMINATED)
Message: You can't use fixed rowlength with BLOBs; please use 'fields terminated by'
Error: 1085 SQLSTATE: HY000 (ER_TEXTFILE_NOT_READABLE)
Message: The file '%s' must be in the database directory or be readable by all
Error: 1086 SQLSTATE: HY000 (ER_FILE_EXISTS_ERROR)
Message: File '%s' already exists
Error: 1087 SQLSTATE: HY000 (ER_LOAD_INFO)
Message: Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld
Errors, Error Codes, and Common Problems
2798
Error: 1088 SQLSTATE: HY000 (ER_ALTER_INFO)
Message: Records: %ld Duplicates: %ld
Error: 1089 SQLSTATE: HY000 (ER_WRONG_SUB_KEY)
Message: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine
doesn't support unique prefix keys
Error: 1090 SQLSTATE: 42000 (ER_CANT_REMOVE_ALL_FIELDS)
Message: You can't delete all columns with ALTER TABLE; use DROP TABLE instead
Error: 1091 SQLSTATE: 42000 (ER_CANT_DROP_FIELD_OR_KEY)
Message: Can't DROP '%s'; check that column/key exists
Error: 1092 SQLSTATE: HY000 (ER_INSERT_INFO)
Message: Records: %ld Duplicates: %ld Warnings: %ld
Error: 1093 SQLSTATE: HY000 (ER_UPDATE_TABLE_USED)
Message: You can't specify target table '%s' for update in FROM clause
Error: 1094 SQLSTATE: HY000 (ER_NO_SUCH_THREAD)
Message: Unknown thread id: %lu
Error: 1095 SQLSTATE: HY000 (ER_KILL_DENIED_ERROR)
Message: You are not owner of thread %lu
Error: 1096 SQLSTATE: HY000 (ER_NO_TABLES_USED)
Message: No tables used
Error: 1097 SQLSTATE: HY000 (ER_TOO_BIG_SET)
Message: Too many strings for column %s and SET
Error: 1098 SQLSTATE: HY000 (ER_NO_UNIQUE_LOGFILE)
Message: Can't generate a unique log-filename %s.(1-999)
Error: 1099 SQLSTATE: HY000 (ER_TABLE_NOT_LOCKED_FOR_WRITE)
Message: Table '%s' was locked with a READ lock and can't be updated
Error: 1100 SQLSTATE: HY000 (ER_TABLE_NOT_LOCKED)
Message: Table '%s' was not locked with LOCK TABLES
Error: 1101 SQLSTATE: 42000 (ER_BLOB_CANT_HAVE_DEFAULT)
Message: BLOB/TEXT column '%s' can't have a default value
Error: 1102 SQLSTATE: 42000 (ER_WRONG_DB_NAME)
Message: Incorrect database name '%s'
Error: 1103 SQLSTATE: 42000 (ER_WRONG_TABLE_NAME)
Message: Incorrect table name '%s'
Error: 1104 SQLSTATE: 42000 (ER_TOO_BIG_SELECT)
Errors, Error Codes, and Common Problems
2799
Message: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET
SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
Error: 1105 SQLSTATE: HY000 (ER_UNKNOWN_ERROR)
Message: Unknown error
Error: 1106 SQLSTATE: 42000 (ER_UNKNOWN_PROCEDURE)
Message: Unknown procedure '%s'
Error: 1107 SQLSTATE: 42000 (ER_WRONG_PARAMCOUNT_TO_PROCEDURE)
Message: Incorrect parameter count to procedure '%s'
Error: 1108 SQLSTATE: HY000 (ER_WRONG_PARAMETERS_TO_PROCEDURE)
Message: Incorrect parameters to procedure '%s'
Error: 1109 SQLSTATE: 42S02 (ER_UNKNOWN_TABLE)
Message: Unknown table '%s' in %s
Error: 1110 SQLSTATE: 42000 (ER_FIELD_SPECIFIED_TWICE)
Message: Column '%s' specified twice
Error: 1111 SQLSTATE: HY000 (ER_INVALID_GROUP_FUNC_USE)
Message: Invalid use of group function
Error: 1112 SQLSTATE: 42000 (ER_UNSUPPORTED_EXTENSION)
Message: Table '%s' uses an extension that doesn't exist in this MySQL version
Error: 1113 SQLSTATE: 42000 (ER_TABLE_MUST_HAVE_COLUMNS)
Message: A table must have at least 1 column
Error: 1114 SQLSTATE: HY000 (ER_RECORD_FILE_FULL)
Message: The table '%s' is full
Error: 1115 SQLSTATE: 42000 (ER_UNKNOWN_CHARACTER_SET)
Message: Unknown character set: '%s'
Error: 1116 SQLSTATE: HY000 (ER_TOO_MANY_TABLES)
Message: Too many tables; MySQL can only use %d tables in a join
Error: 1117 SQLSTATE: HY000 (ER_TOO_MANY_FIELDS)
Message: Too many columns
Error: 1118 SQLSTATE: 42000 (ER_TOO_BIG_ROWSIZE)
Message: Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. You have to change
some columns to TEXT or BLOBs
Error: 1119 SQLSTATE: HY000 (ER_STACK_OVERRUN)
Message: Thread stack overrun: Used: %ld of a %ld stack. Use 'mysqld -O thread_stack=#' to specify a bigger stack if needed
Error: 1120 SQLSTATE: 42000 (ER_WRONG_OUTER_JOIN)
Errors, Error Codes, and Common Problems
2800
Message: Cross dependency found in OUTER JOIN; examine your ON conditions
Error: 1121 SQLSTATE: 42000 (ER_NULL_COLUMN_IN_INDEX)
Message: Table handler doesn't support NULL in given index. Please change column '%s' to be NOT NULL or use another handler
Error: 1122 SQLSTATE: HY000 (ER_CANT_FIND_UDF)
Message: Can't load function '%s'
Error: 1123 SQLSTATE: HY000 (ER_CANT_INITIALIZE_UDF)
Message: Can't initialize function '%s'; %s
Error: 1124 SQLSTATE: HY000 (ER_UDF_NO_PATHS)
Message: No paths allowed for shared library
Error: 1125 SQLSTATE: HY000 (ER_UDF_EXISTS)
Message: Function '%s' already exists
Error: 1126 SQLSTATE: HY000 (ER_CANT_OPEN_LIBRARY)
Message: Can't open shared library '%s' (errno: %d %s)
Error: 1127 SQLSTATE: HY000 (ER_CANT_FIND_DL_ENTRY)
Message: Can't find symbol '%s' in library
Error: 1128 SQLSTATE: HY000 (ER_FUNCTION_NOT_DEFINED)
Message: Function '%s' is not defined
Error: 1129 SQLSTATE: HY000 (ER_HOST_IS_BLOCKED)
Message: Host '%s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
Error: 1130 SQLSTATE: HY000 (ER_HOST_NOT_PRIVILEGED)
Message: Host '%s' is not allowed to connect to this MySQL server
Error: 1131 SQLSTATE: 42000 (ER_PASSWORD_ANONYMOUS_USER)
Message: You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords
Error: 1132 SQLSTATE: 42000 (ER_PASSWORD_NOT_ALLOWED)
Message: You must have privileges to update tables in the mysql database to be able to change passwords for others
Error: 1133 SQLSTATE: 42000 (ER_PASSWORD_NO_MATCH)
Message: Can't find any matching row in the user table
Error: 1134 SQLSTATE: HY000 (ER_UPDATE_INFO)
Message: Rows matched: %ld Changed: %ld Warnings: %ld
Error: 1135 SQLSTATE: HY000 (ER_CANT_CREATE_THREAD)
Message: Can't create a new thread (errno %d); if you are not out of available memory, you can consult the manual for a possible
OS-dependent bug
Error: 1136 SQLSTATE: 21S01 (ER_WRONG_VALUE_COUNT_ON_ROW)
Message: Column count doesn't match value count at row %ld
Errors, Error Codes, and Common Problems
2801
Error: 1137 SQLSTATE: HY000 (ER_CANT_REOPEN_TABLE)
Message: Can't reopen table: '%s'
Error: 1138 SQLSTATE: 22004 (ER_INVALID_USE_OF_NULL)
Message: Invalid use of NULL value
Error: 1139 SQLSTATE: 42000 (ER_REGEXP_ERROR)
Message: Got error '%s' from regexp
Error: 1140 SQLSTATE: 42000 (ER_MIX_OF_GROUP_FUNC_AND_FIELDS)
Message: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY
clause
Error: 1141 SQLSTATE: 42000 (ER_NONEXISTING_GRANT)
Message: There is no such grant defined for user '%s' on host '%s'
Error: 1142 SQLSTATE: 42000 (ER_TABLEACCESS_DENIED_ERROR)
Message: %s command denied to user '%s'@'%s' for table '%s'
Error: 1143 SQLSTATE: 42000 (ER_COLUMNACCESS_DENIED_ERROR)
Message: %s command denied to user '%s'@'%s' for column '%s' in table '%s'
Error: 1144 SQLSTATE: 42000 (ER_ILLEGAL_GRANT_FOR_TABLE)
Message: Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used
Error: 1145 SQLSTATE: 42000 (ER_GRANT_WRONG_HOST_OR_USER)
Message: The host or user argument to GRANT is too long
Error: 1146 SQLSTATE: 42S02 (ER_NO_SUCH_TABLE)
Message: Table '%s.%s' doesn't exist
Error: 1147 SQLSTATE: 42000 (ER_NONEXISTING_TABLE_GRANT)
Message: There is no such grant defined for user '%s' on host '%s' on table '%s'
Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND)
Message: The used command is not allowed with this MySQL version
Error: 1149 SQLSTATE: 42000 (ER_SYNTAX_ERROR)
Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
syntax to use
Error: 1150 SQLSTATE: HY000 (ER_DELAYED_CANT_CHANGE_LOCK)
Message: Delayed insert thread couldn't get requested lock for table %s
Error: 1151 SQLSTATE: HY000 (ER_TOO_MANY_DELAYED_THREADS)
Message: Too many delayed threads in use
Error: 1152 SQLSTATE: 08S01 (ER_ABORTING_CONNECTION)
Message: Aborted connection %ld to db: '%s' user: '%s' (%s)
Error: 1153 SQLSTATE: 08S01 (ER_NET_PACKET_TOO_LARGE)
Errors, Error Codes, and Common Problems
2802
Message: Got a packet bigger than 'max_allowed_packet' bytes
Error: 1154 SQLSTATE: 08S01 (ER_NET_READ_ERROR_FROM_PIPE)
Message: Got a read error from the connection pipe
Error: 1155 SQLSTATE: 08S01 (ER_NET_FCNTL_ERROR)
Message: Got an error from fcntl()
Error: 1156 SQLSTATE: 08S01 (ER_NET_PACKETS_OUT_OF_ORDER)
Message: Got packets out of order
Error: 1157 SQLSTATE: 08S01 (ER_NET_UNCOMPRESS_ERROR)
Message: Couldn't uncompress communication packet
Error: 1158 SQLSTATE: 08S01 (ER_NET_READ_ERROR)
Message: Got an error reading communication packets
Error: 1159 SQLSTATE: 08S01 (ER_NET_READ_INTERRUPTED)
Message: Got timeout reading communication packets
Error: 1160 SQLSTATE: 08S01 (ER_NET_ERROR_ON_WRITE)
Message: Got an error writing communication packets
Error: 1161 SQLSTATE: 08S01 (ER_NET_WRITE_INTERRUPTED)
Message: Got timeout writing communication packets
Error: 1162 SQLSTATE: 42000 (ER_TOO_LONG_STRING)
Message: Result string is longer than 'max_allowed_packet' bytes
Error: 1163 SQLSTATE: 42000 (ER_TABLE_CANT_HANDLE_BLOB)
Message: The used table type doesn't support BLOB/TEXT columns
Error: 1164 SQLSTATE: 42000 (ER_TABLE_CANT_HANDLE_AUTO_INCREMENT)
Message: The used table type doesn't support AUTO_INCREMENT columns
Error: 1165 SQLSTATE: HY000 (ER_DELAYED_INSERT_TABLE_LOCKED)
Message: INSERT DELAYED can't be used with table '%s' because it is locked with LOCK TABLES
Error: 1166 SQLSTATE: 42000 (ER_WRONG_COLUMN_NAME)
Message: Incorrect column name '%s'
Error: 1167 SQLSTATE: 42000 (ER_WRONG_KEY_COLUMN)
Message: The used storage engine can't index column '%s'
Error: 1168 SQLSTATE: HY000 (ER_WRONG_MRG_TABLE)
Message: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
Error: 1169 SQLSTATE: 23000 (ER_DUP_UNIQUE)
Message: Can't write, because of unique constraint, to table '%s'
Errors, Error Codes, and Common Problems
2803
Error: 1170 SQLSTATE: 42000 (ER_BLOB_KEY_WITHOUT_LENGTH)
Message: BLOB/TEXT column '%s' used in key specification without a key length
Error: 1171 SQLSTATE: 42000 (ER_PRIMARY_CANT_HAVE_NULL)
Message: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead
Error: 1172 SQLSTATE: 42000 (ER_TOO_MANY_ROWS)
Message: Result consisted of more than one row
Error: 1173 SQLSTATE: 42000 (ER_REQUIRES_PRIMARY_KEY)
Message: This table type requires a primary key
Error: 1174 SQLSTATE: HY000 (ER_NO_RAID_COMPILED)
Message: This version of MySQL is not compiled with RAID support
Error: 1175 SQLSTATE: HY000 (ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE)
Message: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
Error: 1176 SQLSTATE: 42000 (ER_KEY_DOES_NOT_EXITS)
Message: Key '%s' doesn't exist in table '%s'
Error: 1177 SQLSTATE: 42000 (ER_CHECK_NO_SUCH_TABLE)
Message: Can't open table
Error: 1178 SQLSTATE: 42000 (ER_CHECK_NOT_IMPLEMENTED)
Message: The storage engine for the table doesn't support %s
Error: 1179 SQLSTATE: 25000 (ER_CANT_DO_THIS_DURING_AN_TRANSACTION)
Message: You are not allowed to execute this command in a transaction
Error: 1180 SQLSTATE: HY000 (ER_ERROR_DURING_COMMIT)
Message: Got error %d during COMMIT
Error: 1181 SQLSTATE: HY000 (ER_ERROR_DURING_ROLLBACK)
Message: Got error %d during ROLLBACK
Error: 1182 SQLSTATE: HY000 (ER_ERROR_DURING_FLUSH_LOGS)
Message: Got error %d during FLUSH_LOGS
Error: 1183 SQLSTATE: HY000 (ER_ERROR_DURING_CHECKPOINT)
Message: Got error %d during CHECKPOINT
Error: 1184 SQLSTATE: 08S01 (ER_NEW_ABORTING_CONNECTION)
Message: Aborted connection %ld to db: '%s' user: '%s' host: '%s' (%s)
Error: 1185 SQLSTATE: HY000 (ER_DUMP_NOT_IMPLEMENTED)
Message: The storage engine for the table does not support binary table dump
Error: 1186 SQLSTATE: HY000 (ER_FLUSH_MASTER_BINLOG_CLOSED)
Message: Binlog closed, cannot RESET MASTER
Errors, Error Codes, and Common Problems
2804
Error: 1187 SQLSTATE: HY000 (ER_INDEX_REBUILD)
Message: Failed rebuilding the index of dumped table '%s'
Error: 1188 SQLSTATE: HY000 (ER_MASTER)
Message: Error from master: '%s'
Error: 1189 SQLSTATE: 08S01 (ER_MASTER_NET_READ)
Message: Net error reading from master
Error: 1190 SQLSTATE: 08S01 (ER_MASTER_NET_WRITE)
Message: Net error writing to master
Error: 1191 SQLSTATE: HY000 (ER_FT_MATCHING_KEY_NOT_FOUND)
Message: Can't find FULLTEXT index matching the column list
Error: 1192 SQLSTATE: HY000 (ER_LOCK_OR_ACTIVE_TRANSACTION)
Message: Can't execute the given command because you have active locked tables or an active transaction
Error: 1193 SQLSTATE: HY000 (ER_UNKNOWN_SYSTEM_VARIABLE)
Message: Unknown system variable '%s'
Error: 1194 SQLSTATE: HY000 (ER_CRASHED_ON_USAGE)
Message: Table '%s' is marked as crashed and should be repaired
Error: 1195 SQLSTATE: HY000 (ER_CRASHED_ON_REPAIR)
Message: Table '%s' is marked as crashed and last (automatic?) repair failed
Error: 1196 SQLSTATE: HY000 (ER_WARNING_NOT_COMPLETE_ROLLBACK)
Message: Some non-transactional changed tables couldn't be rolled back
Error: 1197 SQLSTATE: HY000 (ER_TRANS_CACHE_FULL)
Message: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable
and try again
Error: 1198 SQLSTATE: HY000 (ER_SLAVE_MUST_STOP)
Message: This operation cannot be performed with a running slave; run STOP SLAVE first
Error: 1199 SQLSTATE: HY000 (ER_SLAVE_NOT_RUNNING)
Message: This operation requires a running slave; configure slave and do START SLAVE
Error: 1200 SQLSTATE: HY000 (ER_BAD_SLAVE)
Message: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
Error: 1201 SQLSTATE: HY000 (ER_MASTER_INFO)
Message: Could not initialize master info structure; more error messages can be found in the MySQL error log
Error: 1202 SQLSTATE: HY000 (ER_SLAVE_THREAD)
Message: Could not create slave thread; check system resources
Error: 1203 SQLSTATE: 42000 (ER_TOO_MANY_USER_CONNECTIONS)
Errors, Error Codes, and Common Problems
2805
Message: User %s already has more than 'max_user_connections' active connections
Error: 1204 SQLSTATE: HY000 (ER_SET_CONSTANTS_ONLY)
Message: You may only use constant expressions with SET
Error: 1205 SQLSTATE: HY000 (ER_LOCK_WAIT_TIMEOUT)
Message: Lock wait timeout exceeded; try restarting transaction
Error: 1206 SQLSTATE: HY000 (ER_LOCK_TABLE_FULL)
Message: The total number of locks exceeds the lock table size
Error: 1207 SQLSTATE: 25000 (ER_READ_ONLY_TRANSACTION)
Message: Update locks cannot be acquired during a READ UNCOMMITTED transaction
Error: 1208 SQLSTATE: HY000 (ER_DROP_DB_WITH_READ_LOCK)
Message: DROP DATABASE not allowed while thread is holding global read lock
Error: 1209 SQLSTATE: HY000 (ER_CREATE_DB_WITH_READ_LOCK)
Message: CREATE DATABASE not allowed while thread is holding global read lock
Error: 1210 SQLSTATE: HY000 (ER_WRONG_ARGUMENTS)
Message: Incorrect arguments to %s
Error: 1211 SQLSTATE: 42000 (ER_NO_PERMISSION_TO_CREATE_USER)
Message: '%s'@'%s' is not allowed to create new users
Error: 1212 SQLSTATE: HY000 (ER_UNION_TABLES_IN_DIFFERENT_DIR)
Message: Incorrect table definition; all MERGE tables must be in the same database
Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)
Message: Deadlock found when trying to get lock; try restarting transaction
Error: 1214 SQLSTATE: HY000 (ER_TABLE_CANT_HANDLE_FT)
Message: The used table type doesn't support FULLTEXT indexes
Error: 1215 SQLSTATE: HY000 (ER_CANNOT_ADD_FOREIGN)
Message: Cannot add foreign key constraint
Error: 1216 SQLSTATE: 23000 (ER_NO_REFERENCED_ROW)
Message: Cannot add or update a child row: a foreign key constraint fails
Error: 1217 SQLSTATE: 23000 (ER_ROW_IS_REFERENCED)
Message: Cannot delete or update a parent row: a foreign key constraint fails
Error: 1218 SQLSTATE: 08S01 (ER_CONNECT_TO_MASTER)
Message: Error connecting to master: %s
Error: 1219 SQLSTATE: HY000 (ER_QUERY_ON_MASTER)
Message: Error running query on master: %s
Errors, Error Codes, and Common Problems
2806
Error: 1220 SQLSTATE: HY000 (ER_ERROR_WHEN_EXECUTING_COMMAND)
Message: Error when executing command %s: %s
Error: 1221 SQLSTATE: HY000 (ER_WRONG_USAGE)
Message: Incorrect usage of %s and %s
Error: 1222 SQLSTATE: 21000 (ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT)
Message: The used SELECT statements have a different number of columns
Error: 1223 SQLSTATE: HY000 (ER_CANT_UPDATE_WITH_READLOCK)
Message: Can't execute the query because you have a conflicting read lock
Error: 1224 SQLSTATE: HY000 (ER_MIXING_NOT_ALLOWED)
Message: Mixing of transactional and non-transactional tables is disabled
Error: 1225 SQLSTATE: HY000 (ER_DUP_ARGUMENT)
Message: Option '%s' used twice in statement
Error: 1226 SQLSTATE: 42000 (ER_USER_LIMIT_REACHED)
Message: User '%s' has exceeded the '%s' resource (current value: %ld)
Error: 1227 SQLSTATE: 42000 (ER_SPECIFIC_ACCESS_DENIED_ERROR)
Message: Access denied; you need the %s privilege for this operation
Error: 1228 SQLSTATE: HY000 (ER_LOCAL_VARIABLE)
Message: Variable '%s' is a SESSION variable and can't be used with SET GLOBAL
Error: 1229 SQLSTATE: HY000 (ER_GLOBAL_VARIABLE)
Message: Variable '%s' is a GLOBAL variable and should be set with SET GLOBAL
Error: 1230 SQLSTATE: 42000 (ER_NO_DEFAULT)
Message: Variable '%s' doesn't have a default value
Error: 1231 SQLSTATE: 42000 (ER_WRONG_VALUE_FOR_VAR)
Message: Variable '%s' can't be set to the value of '%s'
Error: 1232 SQLSTATE: 42000 (ER_WRONG_TYPE_FOR_VAR)
Message: Incorrect argument type to variable '%s'
Error: 1233 SQLSTATE: HY000 (ER_VAR_CANT_BE_READ)
Message: Variable '%s' can only be set, not read
Error: 1234 SQLSTATE: 42000 (ER_CANT_USE_OPTION_HERE)
Message: Incorrect usage/placement of '%s'
Error: 1235 SQLSTATE: 42000 (ER_NOT_SUPPORTED_YET)
Message: This version of MySQL doesn't yet support '%s'
Error: 1236 SQLSTATE: HY000 (ER_MASTER_FATAL_ERROR_READING_BINLOG)
Message: Got fatal error %d: '%s' from master when reading data from binary log
Errors, Error Codes, and Common Problems
2807
Error: 1237 SQLSTATE: HY000 (ER_SLAVE_IGNORED_TABLE)
Message: Slave SQL thread ignored the query because of replicate-*-table rules
Error: 1238 SQLSTATE: HY000 (ER_INCORRECT_GLOBAL_LOCAL_VAR)
Message: Variable '%s' is a %s variable
Error: 1239 SQLSTATE: 42000 (ER_WRONG_FK_DEF)
Message: Incorrect foreign key definition for '%s': %s
Error: 1240 SQLSTATE: HY000 (ER_KEY_REF_DO_NOT_MATCH_TABLE_REF)
Message: Key reference and table reference don't match
Error: 1241 SQLSTATE: 21000 (ER_OPERAND_COLUMNS)
Message: Operand should contain %d column(s)
Error: 1242 SQLSTATE: 21000 (ER_SUBQUERY_NO_1_ROW)
Message: Subquery returns more than 1 row
Error: 1243 SQLSTATE: HY000 (ER_UNKNOWN_STMT_HANDLER)
Message: Unknown prepared statement handler (%.*s) given to %s
Error: 1244 SQLSTATE: HY000 (ER_CORRUPT_HELP_DB)
Message: Help database is corrupt or does not exist
Error: 1245 SQLSTATE: HY000 (ER_CYCLIC_REFERENCE)
Message: Cyclic reference on subqueries
Error: 1246 SQLSTATE: HY000 (ER_AUTO_CONVERT)
Message: Converting column '%s' from %s to %s
Error: 1247 SQLSTATE: 42S22 (ER_ILLEGAL_REFERENCE)
Message: Reference '%s' not supported (%s)
Error: 1248 SQLSTATE: 42000 (ER_DERIVED_MUST_HAVE_ALIAS)
Message: Every derived table must have its own alias
Error: 1249 SQLSTATE: 01000 (ER_SELECT_REDUCED)
Message: Select %u was reduced during optimization
Error: 1250 SQLSTATE: 42000 (ER_TABLENAME_NOT_ALLOWED_HERE)
Message: Table '%s' from one of the SELECTs cannot be used in %s
Error: 1251 SQLSTATE: 08004 (ER_NOT_SUPPORTED_AUTH_MODE)
Message: Client does not support authentication protocol requested by server; consider upgrading MySQL client
Error: 1252 SQLSTATE: 42000 (ER_SPATIAL_CANT_HAVE_NULL)
Message: All parts of a SPATIAL index must be NOT NULL
Error: 1253 SQLSTATE: 42000 (ER_COLLATION_CHARSET_MISMATCH)
Message: COLLATION '%s' is not valid for CHARACTER SET '%s'
Errors, Error Codes, and Common Problems
2808
Error: 1254 SQLSTATE: HY000 (ER_SLAVE_WAS_RUNNING)
Message: Slave is already running
Error: 1255 SQLSTATE: HY000 (ER_SLAVE_WAS_NOT_RUNNING)
Message: Slave already has been stopped
Error: 1256 SQLSTATE: HY000 (ER_TOO_BIG_FOR_UNCOMPRESS)
Message: Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)
Error: 1257 SQLSTATE: HY000 (ER_ZLIB_Z_MEM_ERROR)
Message: ZLIB: Not enough memory
Error: 1258 SQLSTATE: HY000 (ER_ZLIB_Z_BUF_ERROR)
Message: ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)
Error: 1259 SQLSTATE: HY000 (ER_ZLIB_Z_DATA_ERROR)
Message: ZLIB: Input data corrupted
Error: 1260 SQLSTATE: HY000 (ER_CUT_VALUE_GROUP_CONCAT)
Message: %d line(s) were cut by GROUP_CONCAT()
Error: 1261 SQLSTATE: 01000 (ER_WARN_TOO_FEW_RECORDS)
Message: Row %ld doesn't contain data for all columns
Error: 1262 SQLSTATE: 01000 (ER_WARN_TOO_MANY_RECORDS)
Message: Row %ld was truncated; it contained more data than there were input columns
Error: 1263 SQLSTATE: 22004 (ER_WARN_NULL_TO_NOTNULL)
Message: Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld
Error: 1264 SQLSTATE: 22003 (ER_WARN_DATA_OUT_OF_RANGE)
Message: Out of range value for column '%s' at row %ld
Error: 1265 SQLSTATE: 01000 (WARN_DATA_TRUNCATED)
Message: Data truncated for column '%s' at row %ld
Error: 1266 SQLSTATE: HY000 (ER_WARN_USING_OTHER_HANDLER)
Message: Using storage engine %s for table '%s'
Error: 1267 SQLSTATE: HY000 (ER_CANT_AGGREGATE_2COLLATIONS)
Message: Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'
Error: 1268 SQLSTATE: HY000 (ER_DROP_USER)
Message: Cannot drop one or more of the requested users
Error: 1269 SQLSTATE: HY000 (ER_REVOKE_GRANTS)
Message: Can't revoke all privileges for one or more of the requested users
Error: 1270 SQLSTATE: HY000 (ER_CANT_AGGREGATE_3COLLATIONS)
Message: Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'
Errors, Error Codes, and Common Problems
2809
Error: 1271 SQLSTATE: HY000 (ER_CANT_AGGREGATE_NCOLLATIONS)
Message: Illegal mix of collations for operation '%s'
Error: 1272 SQLSTATE: HY000 (ER_VARIABLE_IS_NOT_STRUCT)
Message: Variable '%s' is not a variable component (can't be used as XXXX.variable_name)
Error: 1273 SQLSTATE: HY000 (ER_UNKNOWN_COLLATION)
Message: Unknown collation: '%s'
Error: 1274 SQLSTATE: HY000 (ER_SLAVE_IGNORED_SSL_PARAMS)
Message: SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they
can be used later if MySQL slave with SSL is started
Error: 1275 SQLSTATE: HY000 (ER_SERVER_IS_IN_SECURE_AUTH_MODE)
Message: Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to
the new format
Error: 1276 SQLSTATE: HY000 (ER_WARN_FIELD_RESOLVED)
Message: Field or reference '%s%s%s%s%s' of SELECT #%d was resolved in SELECT #%d
Error: 1277 SQLSTATE: HY000 (ER_BAD_SLAVE_UNTIL_COND)
Message: Incorrect parameter or combination of parameters for START SLAVE UNTIL
Error: 1278 SQLSTATE: HY000 (ER_MISSING_SKIP_SLAVE)
Message: It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise,
you will get problems if you get an unexpected slave's mysqld restart
Error: 1279 SQLSTATE: HY000 (ER_UNTIL_COND_IGNORED)
Message: SQL thread is not to be started so UNTIL options are ignored
Error: 1280 SQLSTATE: 42000 (ER_WRONG_NAME_FOR_INDEX)
Message: Incorrect index name '%s'
Error: 1281 SQLSTATE: 42000 (ER_WRONG_NAME_FOR_CATALOG)
Message: Incorrect catalog name '%s'
Error: 1282 SQLSTATE: HY000 (ER_WARN_QC_RESIZE)
Message: Query cache failed to set size %lu; new query cache size is %lu
Error: 1283 SQLSTATE: HY000 (ER_BAD_FT_COLUMN)
Message: Column '%s' cannot be part of FULLTEXT index
Error: 1284 SQLSTATE: HY000 (ER_UNKNOWN_KEY_CACHE)
Message: Unknown key cache '%s'
Error: 1285 SQLSTATE: HY000 (ER_WARN_HOSTNAME_WONT_WORK)
Message: MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work
Error: 1286 SQLSTATE: 42000 (ER_UNKNOWN_STORAGE_ENGINE)
Message: Unknown table engine '%s'
Errors, Error Codes, and Common Problems
2810
Error: 1287 SQLSTATE: HY000 (ER_WARN_DEPRECATED_SYNTAX)
Message: '%s' is deprecated; use '%s' instead
Error: 1288 SQLSTATE: HY000 (ER_NON_UPDATABLE_TABLE)
Message: The target table %s of the %s is not updatable
Error: 1289 SQLSTATE: HY000 (ER_FEATURE_DISABLED)
Message: The '%s' feature is disabled; you need MySQL built with '%s' to have it working
Error: 1290 SQLSTATE: HY000 (ER_OPTION_PREVENTS_STATEMENT)
Message: The MySQL server is running with the %s option so it cannot execute this statement
Error: 1291 SQLSTATE: HY000 (ER_DUPLICATED_VALUE_IN_TYPE)
Message: Column '%s' has duplicated value '%s' in %s
Error: 1292 SQLSTATE: 22007 (ER_TRUNCATED_WRONG_VALUE)
Message: Truncated incorrect %s value: '%s'
Error: 1293 SQLSTATE: HY000 (ER_TOO_MUCH_AUTO_TIMESTAMP_COLS)
Message: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or
ON UPDATE clause
Error: 1294 SQLSTATE: HY000 (ER_INVALID_ON_UPDATE)
Message: Invalid ON UPDATE clause for '%s' column
Error: 1295 SQLSTATE: HY000 (ER_UNSUPPORTED_PS)
Message: This command is not supported in the prepared statement protocol yet
Error: 1296 SQLSTATE: HY000 (ER_GET_ERRMSG)
Message: Got error %d '%s' from %s
Error: 1297 SQLSTATE: HY000 (ER_GET_TEMPORARY_ERRMSG)
Message: Got temporary error %d '%s' from %s
Error: 1298 SQLSTATE: HY000 (ER_UNKNOWN_TIME_ZONE)
Message: Unknown or incorrect time zone: '%s'
Error: 1299 SQLSTATE: HY000 (ER_WARN_INVALID_TIMESTAMP)
Message: Invalid TIMESTAMP value in column '%s' at row %ld
Error: 1300 SQLSTATE: HY000 (ER_INVALID_CHARACTER_STRING)
Message: Invalid %s character string: '%s'
Error: 1301 SQLSTATE: HY000 (ER_WARN_ALLOWED_PACKET_OVERFLOWED)
Message: Result of %s() was larger than max_allowed_packet (%ld) - truncated
Error: 1302 SQLSTATE: HY000 (ER_CONFLICTING_DECLARATIONS)
Message: Conflicting declarations: '%s%s' and '%s%s'
Error: 1303 SQLSTATE: 2F003 (ER_SP_NO_RECURSIVE_CREATE)
Errors, Error Codes, and Common Problems
2811
Message: Can't create a %s from within another stored routine
Error: 1304 SQLSTATE: 42000 (ER_SP_ALREADY_EXISTS)
Message: %s %s already exists
Error: 1305 SQLSTATE: 42000 (ER_SP_DOES_NOT_EXIST)
Message: %s %s does not exist
Error: 1306 SQLSTATE: HY000 (ER_SP_DROP_FAILED)
Message: Failed to DROP %s %s
Error: 1307 SQLSTATE: HY000 (ER_SP_STORE_FAILED)
Message: Failed to CREATE %s %s
Error: 1308 SQLSTATE: 42000 (ER_SP_LILABEL_MISMATCH)
Message: %s with no matching label: %s
Error: 1309 SQLSTATE: 42000 (ER_SP_LABEL_REDEFINE)
Message: Redefining label %s
Error: 1310 SQLSTATE: 42000 (ER_SP_LABEL_MISMATCH)
Message: End-label %s without match
Error: 1311 SQLSTATE: 01000 (ER_SP_UNINIT_VAR)
Message: Referring to uninitialized variable %s
Error: 1312 SQLSTATE: 0A000 (ER_SP_BADSELECT)
Message: PROCEDURE %s can't return a result set in the given context
Error: 1313 SQLSTATE: 42000 (ER_SP_BADRETURN)
Message: RETURN is only allowed in a FUNCTION
Error: 1314 SQLSTATE: 0A000 (ER_SP_BADSTATEMENT)
Message: %s is not allowed in stored procedures
Error: 1315 SQLSTATE: 42000 (ER_UPDATE_LOG_DEPRECATED_IGNORED)
Message: The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored
Error: 1316 SQLSTATE: 42000 (ER_UPDATE_LOG_DEPRECATED_TRANSLATED)
Message: The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET
SQL_LOG_BIN
Error: 1317 SQLSTATE: 70100 (ER_QUERY_INTERRUPTED)
Message: Query execution was interrupted
Error: 1318 SQLSTATE: 42000 (ER_SP_WRONG_NO_OF_ARGS)
Message: Incorrect number of arguments for %s %s; expected %u, got %u
Error: 1319 SQLSTATE: 42000 (ER_SP_COND_MISMATCH)
Message: Undefined CONDITION: %s
Errors, Error Codes, and Common Problems
2812
Error: 1320 SQLSTATE: 42000 (ER_SP_NORETURN)
Message: No RETURN found in FUNCTION %s
Error: 1321 SQLSTATE: 2F005 (ER_SP_NORETURNEND)
Message: FUNCTION %s ended without RETURN
Error: 1322 SQLSTATE: 42000 (ER_SP_BAD_CURSOR_QUERY)
Message: Cursor statement must be a SELECT
Error: 1323 SQLSTATE: 42000 (ER_SP_BAD_CURSOR_SELECT)
Message: Cursor SELECT must not have INTO
Error: 1324 SQLSTATE: 42000 (ER_SP_CURSOR_MISMATCH)
Message: Undefined CURSOR: %s
Error: 1325 SQLSTATE: 24000 (ER_SP_CURSOR_ALREADY_OPEN)
Message: Cursor is already open
Error: 1326 SQLSTATE: 24000 (ER_SP_CURSOR_NOT_OPEN)
Message: Cursor is not open
Error: 1327 SQLSTATE: 42000 (ER_SP_UNDECLARED_VAR)
Message: Undeclared variable: %s
Error: 1328 SQLSTATE: HY000 (ER_SP_WRONG_NO_OF_FETCH_ARGS)
Message: Incorrect number of FETCH variables
Error: 1329 SQLSTATE: 02000 (ER_SP_FETCH_NO_DATA)
Message: No data - zero rows fetched, selected, or processed
Error: 1330 SQLSTATE: 42000 (ER_SP_DUP_PARAM)
Message: Duplicate parameter: %s
Error: 1331 SQLSTATE: 42000 (ER_SP_DUP_VAR)
Message: Duplicate variable: %s
Error: 1332 SQLSTATE: 42000 (ER_SP_DUP_COND)
Message: Duplicate condition: %s
Error: 1333 SQLSTATE: 42000 (ER_SP_DUP_CURS)
Message: Duplicate cursor: %s
Error: 1334 SQLSTATE: HY000 (ER_SP_CANT_ALTER)
Message: Failed to ALTER %s %s
Error: 1335 SQLSTATE: 0A000 (ER_SP_SUBSELECT_NYI)
Message: Subquery value not supported
Error: 1336 SQLSTATE: 0A000 (ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG)
Message: %s is not allowed in stored function or trigger
Errors, Error Codes, and Common Problems
2813
Error: 1337 SQLSTATE: 42000 (ER_SP_VARCOND_AFTER_CURSHNDLR)
Message: Variable or condition declaration after cursor or handler declaration
Error: 1338 SQLSTATE: 42000 (ER_SP_CURSOR_AFTER_HANDLER)
Message: Cursor declaration after handler declaration
Error: 1339 SQLSTATE: 20000 (ER_SP_CASE_NOT_FOUND)
Message: Case not found for CASE statement
Error: 1340 SQLSTATE: HY000 (ER_FPARSER_TOO_BIG_FILE)
Message: Configuration file '%s' is too big
Error: 1341 SQLSTATE: HY000 (ER_FPARSER_BAD_HEADER)
Message: Malformed file type header in file '%s'
Error: 1342 SQLSTATE: HY000 (ER_FPARSER_EOF_IN_COMMENT)
Message: Unexpected end of file while parsing comment '%s'
Error: 1343 SQLSTATE: HY000 (ER_FPARSER_ERROR_IN_PARAMETER)
Message: Error while parsing parameter '%s' (line: '%s')
Error: 1344 SQLSTATE: HY000 (ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER)
Message: Unexpected end of file while skipping unknown parameter '%s'
Error: 1345 SQLSTATE: HY000 (ER_VIEW_NO_EXPLAIN)
Message: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
Error: 1346 SQLSTATE: HY000 (ER_FRM_UNKNOWN_TYPE)
Message: File '%s' has unknown type '%s' in its header
Error: 1347 SQLSTATE: HY000 (ER_WRONG_OBJECT)
Message: '%s.%s' is not %s
Error: 1348 SQLSTATE: HY000 (ER_NONUPDATEABLE_COLUMN)
Message: Column '%s' is not updatable
Error: 1349 SQLSTATE: HY000 (ER_VIEW_SELECT_DERIVED)
Message: View's SELECT contains a subquery in the FROM clause
Error: 1350 SQLSTATE: HY000 (ER_VIEW_SELECT_CLAUSE)
Message: View's SELECT contains a '%s' clause
Error: 1351 SQLSTATE: HY000 (ER_VIEW_SELECT_VARIABLE)
Message: View's SELECT contains a variable or parameter
Error: 1352 SQLSTATE: HY000 (ER_VIEW_SELECT_TMPTABLE)
Message: View's SELECT refers to a temporary table '%s'
Error: 1353 SQLSTATE: HY000 (ER_VIEW_WRONG_LIST)
Message: View's SELECT and view's field list have different column counts
Errors, Error Codes, and Common Problems
2814
Error: 1354 SQLSTATE: HY000 (ER_WARN_VIEW_MERGE)
Message: View merge algorithm can't be used here for now (assumed undefined algorithm)
Error: 1355 SQLSTATE: HY000 (ER_WARN_VIEW_WITHOUT_KEY)
Message: View being updated does not have complete key of underlying table in it
Error: 1356 SQLSTATE: HY000 (ER_VIEW_INVALID)
Message: View '%s.%s' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Error: 1357 SQLSTATE: HY000 (ER_SP_NO_DROP_SP)
Message: Can't drop or alter a %s from within another stored routine
Error: 1358 SQLSTATE: HY000 (ER_SP_GOTO_IN_HNDLR)
Message: GOTO is not allowed in a stored procedure handler
Error: 1359 SQLSTATE: HY000 (ER_TRG_ALREADY_EXISTS)
Message: Trigger already exists
Error: 1360 SQLSTATE: HY000 (ER_TRG_DOES_NOT_EXIST)
Message: Trigger does not exist
Error: 1361 SQLSTATE: HY000 (ER_TRG_ON_VIEW_OR_TEMP_TABLE)
Message: Trigger's '%s' is view or temporary table
Error: 1362 SQLSTATE: HY000 (ER_TRG_CANT_CHANGE_ROW)
Message: Updating of %s row is not allowed in %strigger
Error: 1363 SQLSTATE: HY000 (ER_TRG_NO_SUCH_ROW_IN_TRG)
Message: There is no %s row in %s trigger
Error: 1364 SQLSTATE: HY000 (ER_NO_DEFAULT_FOR_FIELD)
Message: Field '%s' doesn't have a default value
Error: 1365 SQLSTATE: 22012 (ER_DIVISION_BY_ZERO)
Message: Division by 0
Error: 1366 SQLSTATE: HY000 (ER_TRUNCATED_WRONG_VALUE_FOR_FIELD)
Message: Incorrect %s value: '%s' for column '%s' at row %ld
Error: 1367 SQLSTATE: 22007 (ER_ILLEGAL_VALUE_FOR_TYPE)
Message: Illegal %s '%s' value found during parsing
Error: 1368 SQLSTATE: HY000 (ER_VIEW_NONUPD_CHECK)
Message: CHECK OPTION on non-updatable view '%s.%s'
Error: 1369 SQLSTATE: HY000 (ER_VIEW_CHECK_FAILED)
Message: CHECK OPTION failed '%s.%s'
Error: 1370 SQLSTATE: 42000 (ER_PROCACCESS_DENIED_ERROR)
Message: %s command denied to user '%s'@'%s' for routine '%s'
Errors, Error Codes, and Common Problems
2815
Error: 1371 SQLSTATE: HY000 (ER_RELAY_LOG_FAIL)
Message: Failed purging old relay logs: %s
Error: 1372 SQLSTATE: HY000 (ER_PASSWD_LENGTH)
Message: Password hash should be a %d-digit hexadecimal number
Error: 1373 SQLSTATE: HY000 (ER_UNKNOWN_TARGET_BINLOG)
Message: Target log not found in binlog index
Error: 1374 SQLSTATE: HY000 (ER_IO_ERR_LOG_INDEX_READ)
Message: I/O error reading log index file
Error: 1375 SQLSTATE: HY000 (ER_BINLOG_PURGE_PROHIBITED)
Message: Server configuration does not permit binlog purge
Error: 1376 SQLSTATE: HY000 (ER_FSEEK_FAIL)
Message: Failed on fseek()
Error: 1377 SQLSTATE: HY000 (ER_BINLOG_PURGE_FATAL_ERR)
Message: Fatal error during log purge
Error: 1378 SQLSTATE: HY000 (ER_LOG_IN_USE)
Message: A purgeable log is in use, will not purge
Error: 1379 SQLSTATE: HY000 (ER_LOG_PURGE_UNKNOWN_ERR)
Message: Unknown error during log purge
Error: 1380 SQLSTATE: HY000 (ER_RELAY_LOG_INIT)
Message: Failed initializing relay log position: %s
Error: 1381 SQLSTATE: HY000 (ER_NO_BINARY_LOGGING)
Message: You are not using binary logging
Error: 1382 SQLSTATE: HY000 (ER_RESERVED_SYNTAX)
Message: The '%s' syntax is reserved for purposes internal to the MySQL server
Error: 1383 SQLSTATE: HY000 (ER_WSAS_FAILED)
Message: WSAStartup Failed
Error: 1384 SQLSTATE: HY000 (ER_DIFF_GROUPS_PROC)
Message: Can't handle procedures with different groups yet
Error: 1385 SQLSTATE: HY000 (ER_NO_GROUP_FOR_PROC)
Message: Select must have a group with this procedure
Error: 1386 SQLSTATE: HY000 (ER_ORDER_WITH_PROC)
Message: Can't use ORDER clause with this procedure
Error: 1387 SQLSTATE: HY000 (ER_LOGGING_PROHIBIT_CHANGING_OF)
Message: Binary logging and replication forbid changing the global server %s
Errors, Error Codes, and Common Problems
2816
Error: 1388 SQLSTATE: HY000 (ER_NO_FILE_MAPPING)
Message: Can't map file: %s, errno: %d
Error: 1389 SQLSTATE: HY000 (ER_WRONG_MAGIC)
Message: Wrong magic in %s
Error: 1390 SQLSTATE: HY000 (ER_PS_MANY_PARAM)
Message: Prepared statement contains too many placeholders
Error: 1391 SQLSTATE: HY000 (ER_KEY_PART_0)
Message: Key part '%s' length cannot be 0
Error: 1392 SQLSTATE: HY000 (ER_VIEW_CHECKSUM)
Message: View text checksum failed
Error: 1393 SQLSTATE: HY000 (ER_VIEW_MULTIUPDATE)
Message: Can not modify more than one base table through a join view '%s.%s'
Error: 1394 SQLSTATE: HY000 (ER_VIEW_NO_INSERT_FIELD_LIST)
Message: Can not insert into join view '%s.%s' without fields list
Error: 1395 SQLSTATE: HY000 (ER_VIEW_DELETE_MERGE_VIEW)
Message: Can not delete from join view '%s.%s'
Error: 1396 SQLSTATE: HY000 (ER_CANNOT_USER)
Message: Operation %s failed for %s
Error: 1397 SQLSTATE: XAE04 (ER_XAER_NOTA)
Message: XAER_NOTA: Unknown XID
Error: 1398 SQLSTATE: XAE05 (ER_XAER_INVAL)
Message: XAER_INVAL: Invalid arguments (or unsupported command)
Error: 1399 SQLSTATE: XAE07 (ER_XAER_RMFAIL)
Message: XAER_RMFAIL: The command cannot be executed when global transaction is in the %s state
Error: 1400 SQLSTATE: XAE09 (ER_XAER_OUTSIDE)
Message: XAER_OUTSIDE: Some work is done outside global transaction
Error: 1401 SQLSTATE: XAE03 (ER_XAER_RMERR)
Message: XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency
Error: 1402 SQLSTATE: XA100 (ER_XA_RBROLLBACK)
Message: XA_RBROLLBACK: Transaction branch was rolled back
Error: 1403 SQLSTATE: 42000 (ER_NONEXISTING_PROC_GRANT)
Message: There is no such grant defined for user '%s' on host '%s' on routine '%s'
Error: 1404 SQLSTATE: HY000 (ER_PROC_AUTO_GRANT_FAIL)
Message: Failed to grant EXECUTE and ALTER ROUTINE privileges
Errors, Error Codes, and Common Problems
2817
Error: 1405 SQLSTATE: HY000 (ER_PROC_AUTO_REVOKE_FAIL)
Message: Failed to revoke all privileges to dropped routine
Error: 1406 SQLSTATE: 22001 (ER_DATA_TOO_LONG)
Message: Data too long for column '%s' at row %ld
Error: 1407 SQLSTATE: 42000 (ER_SP_BAD_SQLSTATE)
Message: Bad SQLSTATE: '%s'
Error: 1408 SQLSTATE: HY000 (ER_STARTUP)
Message: %s: ready for connections. Version: '%s' socket: '%s' port: %d %s
Error: 1409 SQLSTATE: HY000 (ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR)
Message: Can't load value from file with fixed size rows to variable
Error: 1410 SQLSTATE: 42000 (ER_CANT_CREATE_USER_WITH_GRANT)
Message: You are not allowed to create a user with GRANT
Error: 1411 SQLSTATE: HY000 (ER_WRONG_VALUE_FOR_TYPE)
Message: Incorrect %s value: '%s' for function %s
Error: 1412 SQLSTATE: HY000 (ER_TABLE_DEF_CHANGED)
Message: Table definition has changed, please retry transaction
Error: 1413 SQLSTATE: 42000 (ER_SP_DUP_HANDLER)
Message: Duplicate handler declared in the same block
Error: 1414 SQLSTATE: 42000 (ER_SP_NOT_VAR_ARG)
Message: OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger
Error: 1415 SQLSTATE: 0A000 (ER_SP_NO_RETSET)
Message: Not allowed to return a result set from a %s
Error: 1416 SQLSTATE: 22003 (ER_CANT_CREATE_GEOMETRY_OBJECT)
Message: Cannot get geometry object from data you send to the GEOMETRY field
Error: 1417 SQLSTATE: HY000 (ER_FAILED_ROUTINE_BREAK_BINLOG)
Message: A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-
transactional tables were updated, the binary log will miss their changes
Error: 1418 SQLSTATE: HY000 (ER_BINLOG_UNSAFE_ROUTINE)
Message: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is
enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
Error: 1419 SQLSTATE: HY000 (ER_BINLOG_CREATE_ROUTINE_NEED_SUPER)
Message: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe
log_bin_trust_function_creators variable)
Error: 1420 SQLSTATE: HY000 (ER_EXEC_STMT_WITH_OPEN_CURSOR)
Message: You can't execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it.
Errors, Error Codes, and Common Problems
2818
Error: 1421 SQLSTATE: HY000 (ER_STMT_HAS_NO_OPEN_CURSOR)
Message: The statement (%lu) has no open cursor.
Error: 1422 SQLSTATE: HY000 (ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG)
Message: Explicit or implicit commit is not allowed in stored function or trigger.
Error: 1423 SQLSTATE: HY000 (ER_NO_DEFAULT_FOR_VIEW_FIELD)
Message: Field of view '%s.%s' underlying table doesn't have a default value
Error: 1424 SQLSTATE: HY000 (ER_SP_NO_RECURSION)
Message: Recursive stored functions and triggers are not allowed.
Error: 1425 SQLSTATE: 42000 (ER_TOO_BIG_SCALE)
Message: Too big scale %d specified for column '%s'. Maximum is %lu.
Error: 1426 SQLSTATE: 42000 (ER_TOO_BIG_PRECISION)
Message: Too big precision %d specified for column '%s'. Maximum is %lu.
Error: 1427 SQLSTATE: 42000 (ER_M_BIGGER_THAN_D)
Message: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%s').
Error: 1428 SQLSTATE: HY000 (ER_WRONG_LOCK_OF_SYSTEM_TABLE)
Message: You can't combine write-locking of system tables with other tables or lock types
Error: 1429 SQLSTATE: HY000 (ER_CONNECT_TO_FOREIGN_DATA_SOURCE)
Message: Unable to connect to foreign data source: %s
Error: 1430 SQLSTATE: HY000 (ER_QUERY_ON_FOREIGN_DATA_SOURCE)
Message: There was a problem processing the query on the foreign data source. Data source error: %s
Error: 1431 SQLSTATE: HY000 (ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST)
Message: The foreign data source you are trying to reference does not exist. Data source error: %s
Error: 1432 SQLSTATE: HY000 (ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE)
Message: Can't create federated table. The data source connection string '%s' is not in the correct format
Error: 1433 SQLSTATE: HY000 (ER_FOREIGN_DATA_STRING_INVALID)
Message: The data source connection string '%s' is not in the correct format
Error: 1434 SQLSTATE: HY000 (ER_CANT_CREATE_FEDERATED_TABLE)
Message: Can't create federated table. Foreign data src error: %s
Error: 1435 SQLSTATE: HY000 (ER_TRG_IN_WRONG_SCHEMA)
Message: Trigger in wrong schema
Error: 1436 SQLSTATE: HY000 (ER_STACK_OVERRUN_NEED_MORE)
Message: Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Use 'mysqld -O thread_stack=#' to spe-
cify a bigger stack.
Error: 1437 SQLSTATE: 42000 (ER_TOO_LONG_BODY)
Errors, Error Codes, and Common Problems
2819
Message: Routine body for '%s' is too long
Error: 1438 SQLSTATE: HY000 (ER_WARN_CANT_DROP_DEFAULT_KEYCACHE)
Message: Cannot drop default keycache
Error: 1439 SQLSTATE: 42000 (ER_TOO_BIG_DISPLAYWIDTH)
Message: Display width out of range for column '%s' (max = %lu)
Error: 1440 SQLSTATE: XAE08 (ER_XAER_DUPID)
Message: XAER_DUPID: The XID already exists
Error: 1441 SQLSTATE: 22008 (ER_DATETIME_FUNCTION_OVERFLOW)
Message: Datetime function: %s field overflow
Error: 1442 SQLSTATE: HY000 (ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG)
Message: Can't update table '%s' in stored function/trigger because it is already used by statement which invoked this stored func-
tion/trigger.
Error: 1443 SQLSTATE: HY000 (ER_VIEW_PREVENT_UPDATE)
Message: The definition of table '%s' prevents operation %s on table '%s'.
Error: 1444 SQLSTATE: HY000 (ER_PS_NO_RECURSION)
Message: The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a pre-
pared statement in such a recursive manner
Error: 1445 SQLSTATE: HY000 (ER_SP_CANT_SET_AUTOCOMMIT)
Message: Not allowed to set autocommit from a stored function or trigger
Error: 1446 SQLSTATE: HY000 (ER_MALFORMED_DEFINER)
Message: Definer is not fully qualified
Error: 1447 SQLSTATE: HY000 (ER_VIEW_FRM_NO_USER)
Message: View '%s'.'%s' has no definer information (old table format). Current user is used as definer. Please recreate the view!
Error: 1448 SQLSTATE: HY000 (ER_VIEW_OTHER_USER)
Message: You need the SUPER privilege for creation view with '%s'@'%s' definer
Error: 1449 SQLSTATE: HY000 (ER_NO_SUCH_USER)
Message: The user specified as a definer ('%s'@'%s') does not exist
Error: 1450 SQLSTATE: HY000 (ER_FORBID_SCHEMA_CHANGE)
Message: Changing schema from '%s' to '%s' is not allowed.
Error: 1451 SQLSTATE: 23000 (ER_ROW_IS_REFERENCED_2)
Message: Cannot delete or update a parent row: a foreign key constraint fails (%s)
Error: 1452 SQLSTATE: 23000 (ER_NO_REFERENCED_ROW_2)
Message: Cannot add or update a child row: a foreign key constraint fails (%s)
Error: 1453 SQLSTATE: 42000 (ER_SP_BAD_VAR_SHADOW)
Errors, Error Codes, and Common Problems
2820
Message: Variable '%s' must be quoted with `...`, or renamed
Error: 1454 SQLSTATE: HY000 (ER_TRG_NO_DEFINER)
Message: No definer attribute for trigger '%s'.'%s'. The trigger will be activated under the authorization of the invoker, which may
have insufficient privileges. Please recreate the trigger.
Error: 1455 SQLSTATE: HY000 (ER_OLD_FILE_FORMAT)
Message: '%s' has an old format, you should re-create the '%s' object(s)
Error: 1456 SQLSTATE: HY000 (ER_SP_RECURSION_LIMIT)
Message: Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %s
Error: 1457 SQLSTATE: HY000 (ER_SP_PROC_TABLE_CORRUPT)
Message: Failed to load routine %s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)
Error: 1458 SQLSTATE: 42000 (ER_SP_WRONG_NAME)
Message: Incorrect routine name '%s'
Error: 1459 SQLSTATE: HY000 (ER_TABLE_NEEDS_UPGRADE)
Message: Table upgrade required. Please do "REPAIR TABLE `%s`" or dump/reload to fix it!
Error: 1460 SQLSTATE: 42000 (ER_SP_NO_AGGREGATE)
Message: AGGREGATE is not supported for stored functions
Error: 1461 SQLSTATE: 42000 (ER_MAX_PREPARED_STMT_COUNT_REACHED)
Message: Can't create more than max_prepared_stmt_count statements (current value: %lu)
Error: 1462 SQLSTATE: HY000 (ER_VIEW_RECURSIVE)
Message: `%s`.`%s` contains view recursion
Error: 1463 SQLSTATE: 42000 (ER_NON_GROUPING_FIELD_USED)
Message: non-grouping field '%s' is used in %s clause
Error: 1464 SQLSTATE: HY000 (ER_TABLE_CANT_HANDLE_SPKEYS)
Message: The used table type doesn't support SPATIAL indexes
Error: 1465 SQLSTATE: HY000 (ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA)
Message: Triggers can not be created on system tables
Error: 1466 SQLSTATE: HY000 (ER_REMOVED_SPACES)
Message: Leading spaces are removed from name '%s'
Error: 1467 SQLSTATE: HY000 (ER_AUTOINC_READ_FAILED)
Message: Failed to read auto-increment value from storage engine
Error: 1468 SQLSTATE: HY000 (ER_USERNAME)
Message: user name
Error: 1469 SQLSTATE: HY000 (ER_HOSTNAME)
Message: host name
Errors, Error Codes, and Common Problems
2821
Error: 1470 SQLSTATE: HY000 (ER_WRONG_STRING_LENGTH)
Message: String '%s' is too long for %s (should be no longer than %d)
Error: 1471 SQLSTATE: HY000 (ER_NON_INSERTABLE_TABLE)
Message: The target table %s of the %s is not insertable-into
Error: 1472 SQLSTATE: HY000 (ER_ADMIN_WRONG_MRG_TABLE)
Message: Table '%s' is differently defined or of non-MyISAM type or doesn't exist
Error: 1473 SQLSTATE: HY000 (ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT)
Message: Too high level of nesting for select
Error: 1474 SQLSTATE: HY000 (ER_NAME_BECOMES_EMPTY)
Message: Name '%s' has become ''
Error: 1475 SQLSTATE: HY000 (ER_AMBIGUOUS_FIELD_TERM)
Message: First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS EN-
CLOSED BY
Error: 1476 SQLSTATE: HY000 (ER_FOREIGN_SERVER_EXISTS)
Message: The foreign server, %s, you are trying to create already exists.
Error: 1477 SQLSTATE: HY000 (ER_FOREIGN_SERVER_DOESNT_EXIST)
Message: The foreign server name you are trying to reference does not exist. Data source error: %s
Error: 1478 SQLSTATE: HY000 (ER_ILLEGAL_HA_CREATE_OPTION)
Message: Table storage engine '%s' does not support the create option '%s'
Error: 1479 SQLSTATE: HY000 (ER_PARTITION_REQUIRES_VALUES_ERROR)
Message: Syntax error: %s PARTITIONING requires definition of VALUES %s for each partition
Error: 1480 SQLSTATE: HY000 (ER_PARTITION_WRONG_VALUES_ERROR)
Message: Only %s PARTITIONING can use VALUES %s in partition definition
Error: 1481 SQLSTATE: HY000 (ER_PARTITION_MAXVALUE_ERROR)
Message: MAXVALUE can only be used in last partition definition
Error: 1482 SQLSTATE: HY000 (ER_PARTITION_SUBPARTITION_ERROR)
Message: Subpartitions can only be hash partitions and by key
Error: 1483 SQLSTATE: HY000 (ER_PARTITION_SUBPART_MIX_ERROR)
Message: Must define subpartitions on all partitions if on one partition
Error: 1484 SQLSTATE: HY000 (ER_PARTITION_WRONG_NO_PART_ERROR)
Message: Wrong number of partitions defined, mismatch with previous setting
Error: 1485 SQLSTATE: HY000 (ER_PARTITION_WRONG_NO_SUBPART_ERROR)
Message: Wrong number of subpartitions defined, mismatch with previous setting
Error: 1486 SQLSTATE: HY000 (ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR)
Errors, Error Codes, and Common Problems
2822
Message: Constant/Random expression in (sub)partitioning function is not allowed
Error: 1487 SQLSTATE: HY000 (ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR)
Message: Expression in RANGE/LIST VALUES must be constant
Error: 1488 SQLSTATE: HY000 (ER_FIELD_NOT_FOUND_PART_ERROR)
Message: Field in list of fields for partition function not found in table
Error: 1489 SQLSTATE: HY000 (ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR)
Message: List of fields is only allowed in KEY partitions
Error: 1490 SQLSTATE: HY000 (ER_INCONSISTENT_PARTITION_INFO_ERROR)
Message: The partition info in the frm file is not consistent with what can be written into the frm file
Error: 1491 SQLSTATE: HY000 (ER_PARTITION_FUNC_NOT_ALLOWED_ERROR)
Message: The %s function returns the wrong type
Error: 1492 SQLSTATE: HY000 (ER_PARTITIONS_MUST_BE_DEFINED_ERROR)
Message: For %s partitions each partition must be defined
Error: 1493 SQLSTATE: HY000 (ER_RANGE_NOT_INCREASING_ERROR)
Message: VALUES LESS THAN value must be strictly increasing for each partition
Error: 1494 SQLSTATE: HY000 (ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR)
Message: VALUES value must be of same type as partition function
Error: 1495 SQLSTATE: HY000 (ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR)
Message: Multiple definition of same constant in list partitioning
Error: 1496 SQLSTATE: HY000 (ER_PARTITION_ENTRY_ERROR)
Message: Partitioning can not be used stand-alone in query
Error: 1497 SQLSTATE: HY000 (ER_MIX_HANDLER_ERROR)
Message: The mix of handlers in the partitions is not allowed in this version of MySQL
Error: 1498 SQLSTATE: HY000 (ER_PARTITION_NOT_DEFINED_ERROR)
Message: For the partitioned engine it is necessary to define all %s
Error: 1499 SQLSTATE: HY000 (ER_TOO_MANY_PARTITIONS_ERROR)
Message: Too many partitions (including subpartitions) were defined
Error: 1500 SQLSTATE: HY000 (ER_SUBPARTITION_ERROR)
Message: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
Error: 1501 SQLSTATE: HY000 (ER_CANT_CREATE_HANDLER_FILE)
Message: Failed to create specific handler file
Error: 1502 SQLSTATE: HY000 (ER_BLOB_FIELD_IN_PART_FUNC_ERROR)
Message: A BLOB field is not allowed in partition function
Errors, Error Codes, and Common Problems
2823
Error: 1503 SQLSTATE: HY000 (ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF)
Message: A %s must include all columns in the table's partitioning function
Error: 1504 SQLSTATE: HY000 (ER_NO_PARTS_ERROR)
Message: Number of %s = 0 is not an allowed value
Error: 1505 SQLSTATE: HY000 (ER_PARTITION_MGMT_ON_NONPARTITIONED)
Message: Partition management on a not partitioned table is not possible
Error: 1506 SQLSTATE: HY000 (ER_FOREIGN_KEY_ON_PARTITIONED)
Message: Foreign key clause is not yet supported in conjunction with partitioning
Error: 1507 SQLSTATE: HY000 (ER_DROP_PARTITION_NON_EXISTENT)
Message: Error in list of partitions to %s
Error: 1508 SQLSTATE: HY000 (ER_DROP_LAST_PARTITION)
Message: Cannot remove all partitions, use DROP TABLE instead
Error: 1509 SQLSTATE: HY000 (ER_COALESCE_ONLY_ON_HASH_PARTITION)
Message: COALESCE PARTITION can only be used on HASH/KEY partitions
Error: 1510 SQLSTATE: HY000 (ER_REORG_HASH_ONLY_ON_SAME_NO)
Message: REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers
Error: 1511 SQLSTATE: HY000 (ER_REORG_NO_PARAM_ERROR)
Message: REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
Error: 1512 SQLSTATE: HY000 (ER_ONLY_ON_RANGE_LIST_PARTITION)
Message: %s PARTITION can only be used on RANGE/LIST partitions
Error: 1513 SQLSTATE: HY000 (ER_ADD_PARTITION_SUBPART_ERROR)
Message: Trying to Add partition(s) with wrong number of subpartitions
Error: 1514 SQLSTATE: HY000 (ER_ADD_PARTITION_NO_NEW_PARTITION)
Message: At least one partition must be added
Error: 1515 SQLSTATE: HY000 (ER_COALESCE_PARTITION_NO_PARTITION)
Message: At least one partition must be coalesced
Error: 1516 SQLSTATE: HY000 (ER_REORG_PARTITION_NOT_EXIST)
Message: More partitions to reorganize than there are partitions
Error: 1517 SQLSTATE: HY000 (ER_SAME_NAME_PARTITION)
Message: Duplicate partition name %s
Error: 1518 SQLSTATE: HY000 (ER_NO_BINLOG_ERROR)
Message: It is not allowed to shut off binlog on this command
Error: 1519 SQLSTATE: HY000 (ER_CONSECUTIVE_REORG_PARTITIONS)
Message: When reorganizing a set of partitions they must be in consecutive order
Errors, Error Codes, and Common Problems
2824
Error: 1520 SQLSTATE: HY000 (ER_REORG_OUTSIDE_RANGE)
Message: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
Error: 1521 SQLSTATE: HY000 (ER_PARTITION_FUNCTION_FAILURE)
Message: Partition function not supported in this version for this handler
Error: 1522 SQLSTATE: HY000 (ER_PART_STATE_ERROR)
Message: Partition state cannot be defined from CREATE/ALTER TABLE
Error: 1523 SQLSTATE: HY000 (ER_LIMITED_PART_RANGE)
Message: The %s handler only supports 32 bit integers in VALUES
Error: 1524 SQLSTATE: HY000 (ER_PLUGIN_IS_NOT_LOADED)
Message: Plugin '%s' is not loaded
Error: 1525 SQLSTATE: HY000 (ER_WRONG_VALUE)
Message: Incorrect %s value: '%s'
Error: 1526 SQLSTATE: HY000 (ER_NO_PARTITION_FOR_GIVEN_VALUE)
Message: Table has no partition for value %s
Error: 1527 SQLSTATE: HY000 (ER_FILEGROUP_OPTION_ONLY_ONCE)
Message: It is not allowed to specify %s more than once
Error: 1528 SQLSTATE: HY000 (ER_CREATE_FILEGROUP_FAILED)
Message: Failed to create %s
Error: 1529 SQLSTATE: HY000 (ER_DROP_FILEGROUP_FAILED)
Message: Failed to drop %s
Error: 1530 SQLSTATE: HY000 (ER_TABLESPACE_AUTO_EXTEND_ERROR)
Message: The handler doesn't support autoextend of tablespaces
Error: 1531 SQLSTATE: HY000 (ER_WRONG_SIZE_NUMBER)
Message: A size parameter was incorrectly specified, either number or on the form 10M
Error: 1532 SQLSTATE: HY000 (ER_SIZE_OVERFLOW_ERROR)
Message: The size number was correct but we don't allow the digit part to be more than 2 billion
Error: 1533 SQLSTATE: HY000 (ER_ALTER_FILEGROUP_FAILED)
Message: Failed to alter: %s
Error: 1534 SQLSTATE: HY000 (ER_BINLOG_ROW_LOGGING_FAILED)
Message: Writing one row to the row-based binary log failed
Error: 1535 SQLSTATE: HY000 (ER_BINLOG_ROW_WRONG_TABLE_DEF)
Message: Table definition on master and slave does not match: %s
Error: 1536 SQLSTATE: HY000 (ER_BINLOG_ROW_RBR_TO_SBR)
Message: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log
Errors, Error Codes, and Common Problems
2825
events
Error: 1537 SQLSTATE: HY000 (ER_EVENT_ALREADY_EXISTS)
Message: Event '%s' already exists
Error: 1538 SQLSTATE: HY000 (ER_EVENT_STORE_FAILED)
Message: Failed to store event %s. Error code %d from storage engine.
Error: 1539 SQLSTATE: HY000 (ER_EVENT_DOES_NOT_EXIST)
Message: Unknown event '%s'
Error: 1540 SQLSTATE: HY000 (ER_EVENT_CANT_ALTER)
Message: Failed to alter event '%s'
Error: 1541 SQLSTATE: HY000 (ER_EVENT_DROP_FAILED)
Message: Failed to drop %s
Error: 1542 SQLSTATE: HY000 (ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG)
Message: INTERVAL is either not positive or too big
Error: 1543 SQLSTATE: HY000 (ER_EVENT_ENDS_BEFORE_STARTS)
Message: ENDS is either invalid or before STARTS
Error: 1544 SQLSTATE: HY000 (ER_EVENT_EXEC_TIME_IN_THE_PAST)
Message: Event execution time is in the past. Event has been disabled
Error: 1545 SQLSTATE: HY000 (ER_EVENT_OPEN_TABLE_FAILED)
Message: Failed to open mysql.event
Error: 1546 SQLSTATE: HY000 (ER_EVENT_NEITHER_M_EXPR_NOR_M_AT)
Message: No datetime expression provided
Error: 1547 SQLSTATE: HY000 (ER_COL_COUNT_DOESNT_MATCH_CORRUPTED)
Message: Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted
Error: 1548 SQLSTATE: HY000 (ER_CANNOT_LOAD_FROM_TABLE)
Message: Cannot load from mysql.%s. The table is probably corrupted
Error: 1549 SQLSTATE: HY000 (ER_EVENT_CANNOT_DELETE)
Message: Failed to delete the event from mysql.event
Error: 1550 SQLSTATE: HY000 (ER_EVENT_COMPILE_ERROR)
Message: Error during compilation of event's body
Error: 1551 SQLSTATE: HY000 (ER_EVENT_SAME_NAME)
Message: Same old and new event name
Error: 1552 SQLSTATE: HY000 (ER_EVENT_DATA_TOO_LONG)
Message: Data for column '%s' too long
Errors, Error Codes, and Common Problems
2826
Error: 1553 SQLSTATE: HY000 (ER_DROP_INDEX_FK)
Message: Cannot drop index '%s': needed in a foreign key constraint
Error: 1554 SQLSTATE: HY000 (ER_WARN_DEPRECATED_SYNTAX_WITH_VER)
Message: The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead
Error: 1555 SQLSTATE: HY000 (ER_CANT_WRITE_LOCK_LOG_TABLE)
Message: You can't write-lock a log table. Only read access is possible
Error: 1556 SQLSTATE: HY000 (ER_CANT_LOCK_LOG_TABLE)
Message: You can't use locks with log tables.
Error: 1557 SQLSTATE: 23000 (ER_FOREIGN_DUPLICATE_KEY)
Message: Upholding foreign key constraints for table '%s', entry '%s', key %d would lead to a duplicate entry
Error: 1558 SQLSTATE: HY000 (ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE)
Message: Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use
mysql_upgrade to fix this error.
Error: 1559 SQLSTATE: HY000 (ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR)
Message: Cannot switch out of the row-based binary log format when the session has open temporary tables
Error: 1560 SQLSTATE: HY000 (ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT)
Message: Cannot change the binary logging format inside a stored function or trigger
Error: 1561 SQLSTATE: HY000 (ER_NDB_CANT_SWITCH_BINLOG_FORMAT)
Message: The NDB cluster engine does not support changing the binlog format on the fly yet
Error: 1562 SQLSTATE: HY000 (ER_PARTITION_NO_TEMPORARY)
Message: Cannot create temporary table with partitions
Error: 1563 SQLSTATE: HY000 (ER_PARTITION_CONST_DOMAIN_ERROR)
Message: Partition constant is out of partition function domain
Error: 1564 SQLSTATE: HY000 (ER_PARTITION_FUNCTION_IS_NOT_ALLOWED)
Message: This partition function is not allowed
Error: 1565 SQLSTATE: HY000 (ER_DDL_LOG_ERROR)
Message: Error in DDL log
Error: 1566 SQLSTATE: HY000 (ER_NULL_IN_VALUES_LESS_THAN)
Message: Not allowed to use NULL value in VALUES LESS THAN
Error: 1567 SQLSTATE: HY000 (ER_WRONG_PARTITION_NAME)
Message: Incorrect partition name
Error: 1568 SQLSTATE: 25001 (ER_CANT_CHANGE_TX_ISOLATION)
Message: Transaction isolation level can't be changed while a transaction is in progress
Error: 1569 SQLSTATE: HY000 (ER_DUP_ENTRY_AUTOINCREMENT_CASE)
Errors, Error Codes, and Common Problems
2827
Message: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%s' for key '%s'
Error: 1570 SQLSTATE: HY000 (ER_EVENT_MODIFY_QUEUE_ERROR)
Message: Internal scheduler error %d
Error: 1571 SQLSTATE: HY000 (ER_EVENT_SET_VAR_ERROR)
Message: Error during starting/stopping of the scheduler. Error code %u
Error: 1572 SQLSTATE: HY000 (ER_PARTITION_MERGE_ERROR)
Message: Engine cannot be used in partitioned tables
Error: 1573 SQLSTATE: HY000 (ER_CANT_ACTIVATE_LOG)
Message: Cannot activate '%s' log
Error: 1574 SQLSTATE: HY000 (ER_RBR_NOT_AVAILABLE)
Message: The server was not built with row-based replication
Error: 1575 SQLSTATE: HY000 (ER_BASE64_DECODE_ERROR)
Message: Decoding of base64 string failed
Error: 1576 SQLSTATE: HY000 (ER_EVENT_RECURSION_FORBIDDEN)
Message: Recursion of EVENT DDL statements is forbidden when body is present
Error: 1577 SQLSTATE: HY000 (ER_EVENTS_DB_ERROR)
Message: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
Error: 1578 SQLSTATE: HY000 (ER_ONLY_INTEGERS_ALLOWED)
Message: Only integers allowed as number here
Error: 1579 SQLSTATE: HY000 (ER_UNSUPORTED_LOG_ENGINE)
Message: This storage engine cannot be used for log tables"
Error: 1580 SQLSTATE: HY000 (ER_BAD_LOG_STATEMENT)
Message: You cannot '%s' a log table if logging is enabled
Error: 1581 SQLSTATE: HY000 (ER_CANT_RENAME_LOG_TABLE)
Message: Cannot rename '%s'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive
table and another table back to '%s'
Error: 1582 SQLSTATE: 42000 (ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT)
Message: Incorrect parameter count in the call to native function '%s'
Error: 1583 SQLSTATE: 42000 (ER_WRONG_PARAMETERS_TO_NATIVE_FCT)
Message: Incorrect parameters in the call to native function '%s'
Error: 1584 SQLSTATE: 42000 (ER_WRONG_PARAMETERS_TO_STORED_FCT)
Message: Incorrect parameters in the call to stored function '%s'
Error: 1585 SQLSTATE: HY000 (ER_NATIVE_FCT_NAME_COLLISION)
Message: This function '%s' has the same name as a native function
Errors, Error Codes, and Common Problems
2828
Error: 1586 SQLSTATE: 23000 (ER_DUP_ENTRY_WITH_KEY_NAME)
Message: Duplicate entry '%s' for key '%s'
Error: 1587 SQLSTATE: HY000 (ER_BINLOG_PURGE_EMFILE)
Message: Too many files opened, please execute the command again
Error: 1588 SQLSTATE: HY000 (ER_EVENT_CANNOT_CREATE_IN_THE_PAST)
Message: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately
after creation.
Error: 1589 SQLSTATE: HY000 (ER_EVENT_CANNOT_ALTER_IN_THE_PAST)
Message: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately
after creation.
Error: 1590 SQLSTATE: HY000 (ER_SLAVE_INCIDENT)
Message: The incident %s occured on the master. Message: %s
Error: 1591 SQLSTATE: HY000 (ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT)
Message: Table has no partition for some existing values
Error: 1592 SQLSTATE: HY000 (ER_BINLOG_UNSAFE_STATEMENT)
Message: Statement may not be safe to log in statement format.
Error: 1593 SQLSTATE: HY000 (ER_SLAVE_FATAL_ERROR)
Message: Fatal error: %s
Error: 1594 SQLSTATE: HY000 (ER_SLAVE_RELAY_LOG_READ_FAILURE)
Message: Relay log read failure: %s
Error: 1595 SQLSTATE: HY000 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE)
Message: Relay log write failure: %s
Error: 1596 SQLSTATE: HY000 (ER_SLAVE_CREATE_EVENT_FAILURE)
Message: Failed to create %s
Error: 1597 SQLSTATE: HY000 (ER_SLAVE_MASTER_COM_FAILURE)
Message: Master command %s failed: %s
Error: 1598 SQLSTATE: HY000 (ER_BINLOG_LOGGING_IMPOSSIBLE)
Message: Binary logging not possible. Message: %s
Error: 1599 SQLSTATE: HY000 (ER_VIEW_NO_CREATION_CTX)
Message: View `%s`.`%s` has no creation context
Error: 1600 SQLSTATE: HY000 (ER_VIEW_INVALID_CREATION_CTX)
Message: Creation context of view `%s`.`%s' is invalid
Error: 1601 SQLSTATE: HY000 (ER_SR_INVALID_CREATION_CTX)
Message: Creation context of stored routine `%s`.`%s` is invalid
Error: 1602 SQLSTATE: HY000 (ER_TRG_CORRUPTED_FILE)
Errors, Error Codes, and Common Problems
2829
Message: Corrupted TRG file for table `%s`.`%s`
Error: 1603 SQLSTATE: HY000 (ER_TRG_NO_CREATION_CTX)
Message: Triggers for table `%s`.`%s` have no creation context
Error: 1604 SQLSTATE: HY000 (ER_TRG_INVALID_CREATION_CTX)
Message: Trigger creation context of table `%s`.`%s` is invalid
Error: 1605 SQLSTATE: HY000 (ER_EVENT_INVALID_CREATION_CTX)
Message: Creation context of event `%s`.`%s` is invalid
Error: 1606 SQLSTATE: HY000 (ER_TRG_CANT_OPEN_TABLE)
Message: Cannot open table for trigger `%s`.`%s`
Error: 1607 SQLSTATE: HY000 (ER_CANT_CREATE_SROUTINE)
Message: Cannot create stored routine `%s`. Check warnings
Error: 1608 SQLSTATE: HY000 (ER_SLAVE_AMBIGOUS_EXEC_MODE)
Message: Ambiguous slave modes combination. %s
Error: 1609 SQLSTATE: HY000 (ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT)
Message: The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement.
Error: 1610 SQLSTATE: HY000 (ER_SLAVE_CORRUPT_EVENT)
Message: Corrupted replication event was detected
Error: 1611 SQLSTATE: HY000 (ER_LOAD_DATA_INVALID_COLUMN)
Message: Invalid column reference (%s) in LOAD DATA
Error: 1612 SQLSTATE: HY000 (ER_LOG_PURGE_NO_FILE)
Message: Being purged log %s was not found
Error: 1613 SQLSTATE: XA106 (ER_XA_RBTIMEOUT)
Message: XA_RBTIMEOUT: Transaction branch was rolled back: took too long
Error: 1614 SQLSTATE: XA102 (ER_XA_RBDEADLOCK)
Message: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
Error: 1615 SQLSTATE: HY000 (ER_NEED_REPREPARE)
Message: Prepared statement needs to be re-prepared
Error: 1616 SQLSTATE: HY000 (ER_DELAYED_NOT_SUPPORTED)
Message: DELAYED option not supported for table '%s'
Error: 1617 SQLSTATE: HY000 (WARN_NO_MASTER_INFO)
Message: The master info structure does not exist
Error: 1618 SQLSTATE: HY000 (WARN_OPTION_IGNORED)
Message: <%s> option ignored
Errors, Error Codes, and Common Problems
2830
Error: 1619 SQLSTATE: HY000 (WARN_PLUGIN_DELETE_BUILTIN)
Message: Built-in plugins cannot be deleted
Error: 1620 SQLSTATE: HY000 (WARN_PLUGIN_BUSY)
Message: Plugin is busy and will be uninstalled on shutdown
Error: 1621 SQLSTATE: HY000 (ER_VARIABLE_IS_READONLY)
Message: %s variable '%s' is read-only. Use SET %s to assign the value
Error: 1622 SQLSTATE: HY000 (ER_WARN_ENGINE_TRANSACTION_ROLLBACK)
Message: Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted
Error: 1623 SQLSTATE: HY000 (ER_SLAVE_HEARTBEAT_FAILURE)
Message: Unexpected master's heartbeat data: %s
Error: 1624 SQLSTATE: HY000 (ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE)
Message: The requested value for the heartbeat period %s %s
Error: 1625 SQLSTATE: HY000 (ER_NDB_REPLICATION_SCHEMA_ERROR)
Message: Bad schema for mysql.ndb_replication table. Message: %s
Error: 1626 SQLSTATE: HY000 (ER_CONFLICT_FN_PARSE_ERROR)
Message: Error in parsing conflict function. Message: %s
Error: 1627 SQLSTATE: HY000 (ER_EXCEPTIONS_WRITE_ERROR)
Message: Write to exceptions table failed. Message: %s"
Error: 1628 SQLSTATE: HY000 (ER_TOO_LONG_TABLE_COMMENT)
Message: Comment for table '%s' is too long (max = %lu)
Error: 1629 SQLSTATE: HY000 (ER_TOO_LONG_FIELD_COMMENT)
Message: Comment for field '%s' is too long (max = %lu)
Error: 1630 SQLSTATE: 42000 (ER_FUNC_INEXISTENT_NAME_COLLISION)
Message: FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
Error: 1631 SQLSTATE: HY000 (ER_DATABASE_NAME)
Message: Database `%s`
Error: 1632 SQLSTATE: HY000 (ER_TABLE_NAME)
Message: Table `%s`
Error: 1633 SQLSTATE: HY000 (ER_PARTITION_NAME)
Message: Partition `%s`
Error: 1634 SQLSTATE: HY000 (ER_SUBPARTITION_NAME)
Message: Subpartition `%s`
Error: 1635 SQLSTATE: HY000 (ER_TEMPORARY_NAME)
Message: Temporary
Errors, Error Codes, and Common Problems
2831
Error: 1636 SQLSTATE: HY000 (ER_RENAMED_NAME)
Message: Renamed
B.4. Client Error Codes and Messages
Client error information comes from the following source files:
The Error values and the symbols in parentheses correspond to definitions in the include/errmsg.h MySQL source file.
The Message values correspond to the error messages that are listed in the libmysql/errmsg.c file. %d and %s represent num-
bers and strings, respectively, that are substituted into the messages when they are displayed.
Because updates are frequent, it is possible that those files will contain additional error information not listed here.
Error: 2000 (CR_UNKNOWN_ERROR)
Message: Unknown MySQL error
Error: 2001 (CR_SOCKET_CREATE_ERROR)
Message: Can't create UNIX socket (%d)
Error: 2002 (CR_CONNECTION_ERROR)
Message: Can't connect to local MySQL server through socket '%s' (%d)
Error: 2003 (CR_CONN_HOST_ERROR)
Message: Can't connect to MySQL server on '%s' (%d)
Error: 2004 (CR_IPSOCK_ERROR)
Message: Can't create TCP/IP socket (%d)
Error: 2005 (CR_UNKNOWN_HOST)
Message: Unknown MySQL server host '%s' (%d)
Error: 2006 (CR_SERVER_GONE_ERROR)
Message: MySQL server has gone away
Error: 2007 (CR_VERSION_ERROR)
Message: Protocol mismatch; server version = %d, client version = %d
Error: 2008 (CR_OUT_OF_MEMORY)
Message: MySQL client ran out of memory
Error: 2009 (CR_WRONG_HOST_INFO)
Message: Wrong host info
Error: 2010 (CR_LOCALHOST_CONNECTION)
Message: Localhost via UNIX socket
Error: 2011 (CR_TCP_CONNECTION)
Message: %s via TCP/IP
Errors, Error Codes, and Common Problems
2832
Error: 2012 (CR_SERVER_HANDSHAKE_ERR)
Message: Error in server handshake
Error: 2013 (CR_SERVER_LOST)
Message: Lost connection to MySQL server during query
Error: 2014 (CR_COMMANDS_OUT_OF_SYNC)
Message: Commands out of sync; you can't run this command now
Error: 2015 (CR_NAMEDPIPE_CONNECTION)
Message: Named pipe: %s
Error: 2016 (CR_NAMEDPIPEWAIT_ERROR)
Message: Can't wait for named pipe to host: %s pipe: %s (%lu)
Error: 2017 (CR_NAMEDPIPEOPEN_ERROR)
Message: Can't open named pipe to host: %s pipe: %s (%lu)
Error: 2018 (CR_NAMEDPIPESETSTATE_ERROR)
Message: Can't set state of named pipe to host: %s pipe: %s (%lu)
Error: 2019 (CR_CANT_READ_CHARSET)
Message: Can't initialize character set %s (path: %s)
Error: 2020 (CR_NET_PACKET_TOO_LARGE)
Message: Got packet bigger than 'max_allowed_packet' bytes
Error: 2021 (CR_EMBEDDED_CONNECTION)
Message: Embedded server
Error: 2022 (CR_PROBE_SLAVE_STATUS)
Message: Error on SHOW SLAVE STATUS:
Error: 2023 (CR_PROBE_SLAVE_HOSTS)
Message: Error on SHOW SLAVE HOSTS:
Error: 2024 (CR_PROBE_SLAVE_CONNECT)
Message: Error connecting to slave:
Error: 2025 (CR_PROBE_MASTER_CONNECT)
Message: Error connecting to master:
Error: 2026 (CR_SSL_CONNECTION_ERROR)
Message: SSL connection error
Error: 2027 (CR_MALFORMED_PACKET)
Message: Malformed packet
Error: 2028 (CR_WRONG_LICENSE)
Message: This client library is licensed only for use with MySQL servers having '%s' license
Errors, Error Codes, and Common Problems
2833
Error: 2029 (CR_NULL_POINTER)
Message: Invalid use of null pointer
Error: 2030 (CR_NO_PREPARE_STMT)
Message: Statement not prepared
Error: 2031 (CR_PARAMS_NOT_BOUND)
Message: No data supplied for parameters in prepared statement
Error: 2032 (CR_DATA_TRUNCATED)
Message: Data truncated
Error: 2033 (CR_NO_PARAMETERS_EXISTS)
Message: No parameters exist in the statement
Error: 2034 (CR_INVALID_PARAMETER_NO)
Message: Invalid parameter number
Error: 2035 (CR_INVALID_BUFFER_USE)
Message: Can't send long data for non-string/non-binary data types (parameter: %d)
Error: 2036 (CR_UNSUPPORTED_PARAM_TYPE)
Message: Using unsupported buffer type: %d (parameter: %d)
Error: 2037 (CR_SHARED_MEMORY_CONNECTION)
Message: Shared memory: %s
Error: 2038 (CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR)
Message: Can't open shared memory; client could not create request event (%lu)
Error: 2039 (CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR)
Message: Can't open shared memory; no answer event received from server (%lu)
Error: 2040 (CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR)
Message: Can't open shared memory; server could not allocate file mapping (%lu)
Error: 2041 (CR_SHARED_MEMORY_CONNECT_MAP_ERROR)
Message: Can't open shared memory; server could not get pointer to file mapping (%lu)
Error: 2042 (CR_SHARED_MEMORY_FILE_MAP_ERROR)
Message: Can't open shared memory; client could not allocate file mapping (%lu)
Error: 2043 (CR_SHARED_MEMORY_MAP_ERROR)
Message: Can't open shared memory; client could not get pointer to file mapping (%lu)
Error: 2044 (CR_SHARED_MEMORY_EVENT_ERROR)
Message: Can't open shared memory; client could not create %s event (%lu)
Error: 2045 (CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR)
Message: Can't open shared memory; no answer from server (%lu)
Errors, Error Codes, and Common Problems
2834
Error: 2046 (CR_SHARED_MEMORY_CONNECT_SET_ERROR)
Message: Can't open shared memory; cannot send request event to server (%lu)
Error: 2047 (CR_CONN_UNKNOW_PROTOCOL)
Message: Wrong or unknown protocol
Error: 2048 (CR_INVALID_CONN_HANDLE)
Message: Invalid connection handle
Error: 2049 (CR_SECURE_AUTH)
Message: Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)
Error: 2050 (CR_FETCH_CANCELED)
Message: Row retrieval was canceled by mysql_stmt_close() call
Error: 2051 (CR_NO_DATA)
Message: Attempt to read column without prior row fetch
Error: 2052 (CR_NO_STMT_METADATA)
Message: Prepared statement contains no metadata
Error: 2053 (CR_NO_RESULT_SET)
Message: Attempt to read a row while there is no result set associated with the statement
Error: 2054 (CR_NOT_IMPLEMENTED)
Message: This feature is not implemented yet
Error: 2055 (CR_SERVER_LOST_EXTENDED)
Message: Lost connection to MySQL server at '%s', system error: %d
Error: 2056 (CR_STMT_CLOSED)
Message: Statement closed indirectly because of a preceeding %s() call
Error: 2057 (CR_NEW_STMT_METADATA)
Message: The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind
the result set columns, and execute the statement again
Errors, Error Codes, and Common Problems
2835
Appendix C. MySQL Change History
This appendix lists the changes from version to version in the MySQL source code through the latest version of MySQL 5.1, which is
currently MySQL 5.1.36. Starting with MySQL 5.0, we began offering a new version of the Manual for each new series of MySQL re-
leases (5.0, 5.1, and so on). For information about changes in previous release series of the MySQL database software, see the corres-
ponding version of this Manual. For information about legacy versions of the MySQL software through the 4.1 series, see MySQL 3.23,
4.0, 4.1 Reference Manual.
We update this section as we add new features in the 5.1 series, so that everybody can follow the development process.
Note that we tend to update the manual at the same time we make changes to MySQL. If you find a recent version of MySQL listed
here that you can't find on our download page (http://dev.mysql.com/downloads/), it means that the version has not yet been released.
The date mentioned with a release version is the date of the last Bazaar ChangeSet on which the release was based, not the date when
the packages were made available. The binaries are usually made available a few days after the date of the tagged ChangeSet, because
building and testing all packages takes some time.
The manual included in the source and binary distributions may not be fully accurate when it comes to the release changelog entries, be-
cause the integration of the manual happens at build time. For the most up-to-date release changelog, please refer to the online version
instead.
C.1. Changes in Release 5.1.x (Production)
An overview of which features were added in MySQL 5.1 can be found here: Section 1.4.1, What Is New in MySQL 5.1.
For a full list of changes, please refer to the changelog sections for each individual 5.1 release.
For changes relating to MySQL Cluster NDB 6.x, see Section 17.15, Changes in MySQL Cluster NDB 6.X and 7.X.
C.1.1. Changes in MySQL 5.1.36 (Not yet released)
Functionality added or changed:
Important Change: Replication: Previously, incident log events were represented as comments in the output from mysqlbinlog,
making them effectively silent when playing back the binlog.
(An incident log event represents an incident that could cause the contents of the database to change without that event being recor-
ded in the binary log.)
This meant that, if the SQL were applied to a server, it could potentially lead to the master and the slave having different data. To
make it possible to handle incident log events without breaking applications that expect the previous behavior, the nonsense state-
ment RELOAD DATABASE is added to the SQL output for that incident log event, which causes an error.
To use this functionality currently requires hand editing of the dump file and handling of each case on an individual basis by a data-
base administrator before applying the output to a server. (Bug#44442)
The time zone tables for Windows available at http://dev.mysql.com/downloads/timezones.html have been updated. (Bug#39923)
The mysqltest program now has a move_file from_file to_file command for renaming files. This should be used in
test cases rather than invoking an external command that might be platform specific. (Bug#39542)
Bugs fixed:
Incompatible Change: The server can load plugins under the control of startup options. For example, many storage engines can be
built in pluggable form and loaded when the server starts. In the following descriptions, plugin_name stands for a plugin name
such as innodb.
Previously, plugin options were handled like other boolean options (see Section 4.2.3.2, Program Option Modifiers). That is, any
of these options enabled the plugin:
--plugin_name
2836
--plugin_name=1
--enable-plugin_name
And these options disabled the plugin:
--plugin_name=0
--disable-plugin_name
--skip-plugin_name
However, use of a boolean option for plugin loading did not provide control over what to do if the plugin failed to start properly:
Should the server exit, or start with the plugin disabled? The actual behavior has been that the server starts with the plugin disabled,
which can be problematic. For example, if InnoDB fails to start, existing InnoDB tables become inaccessible, and attempts to cre-
ate new InnoDB tables result in tables that use the default storage engine unless the NO_ENGINE_SUBSTITUTION SQL mode
has been enabled to cause an error to occur instead.
Now, there is a change in the options used to control plugin loading, such that they have a tristate format:
--plugin_name=OFF
Do not enable the plugin.
--plugin_name[=ON]
Enable the plugin. If plugin initialization fails, start the server anyway, but with the plugin disabled. Specifying the option as
--plugin_name without a value also enables the plugin.
--plugin_name=FORCE
Enable the plugin. If plugin initialization fails, do not start the server. In other words, force the server to run with the plugin or
not at all.
The values OFF, ON, and FORCE are not case sensitive.
Suppose that CSV and InnoDB have been built as pluggable storage engines and that you want the server to load them at startup,
subject to these conditions: The server is allowed to run if CSV initialization fails, but must require that InnoDB initialization suc-
ceed. To accomplish that, use these lines in an option file:
[mysqld]
csv=ON
innodb=FORCE
This change is incompatible with the previous implementation if you used options of the form --plugin_name=0 or --plu-
gin_name=1, which should be changed to --plugin_name=OFF or --plugin_name=ON, respectively.
--enable-plugin_name is still supported and is the same as --plugin_name=ON. --disable-plugin_name and -
-skip-plugin_name are still supported and are the same as --plugin_name=OFF. (Bug#19027)
Important Change: Replication: BEGIN, COMMIT, and ROLLBACK statements are no longer affected by -
-replicate-do-db or --replicate-ignore-db rules. (Bug#43263)
Partitioning: Queries using DISTINCT on multiple columns or GROUP BY on multiple columns did not return correct results with
partitioned tables. (Bug#44821)
See also Bug#41136.
Replication: When using row-based logging, the length of an event for which the field metadata exceeded 255 bytes in size was in-
correctly calculated. This could lead to corruption of the binary log, or cause the server to hang. (Bug#42749)
See also Bug#44548, Bug#44672, Bug#44752.
Replication: The warning STATEMENT IS NOT SAFE TO LOG IN STATEMENT FORMAT, issued in situations when it cannot be de-
termined that a statement or other database event can be written reliably to the binary log using the statement-based format, has been
changed to STATEMENT MAY NOT BE SAFE TO LOG IN STATEMENT FORMAT. (Bug#42415)
Replication: The Query_log_event used by replication to transfer a query to the slave has been refactored.
Query_log_event also stores and sends the error code resulting from the execution since it, in some cases, is necessary to ex-
MySQL Change History
2837
ecute the statement on the slave as well, which should result in the same error code. The Query_log_event constructor previ-
ously worked out for itself the error code using a complex routine, the result of which was often set aside within the constructor it-
self. This was also involved with at least 2 known bugs relating to invalid errors, and taken as a clear sign that the constructor was
not well-designed and needed to be re-written. (Bug#41948)
See also Bug#37145.
Replication: When stopping and restarting the slave while it was replicating temporary tables, the slave server could crash or raise
an assertion failure. This was due to the fact that, although temporary tables were saved between slave thread restarts, the reference
to the thread being used (table->in_use) was not being properly updated when restarting, continuing to reference the old thread
instead of the new one. This issue affected statement-based replication only. (Bug#41725)
Use of ROUND() on a LONGTEXT or LONGBLOB column of a derived table could cause a server crash. (Bug#45152)
DROP USER could fail to drop all privileges for an account if the PAD_CHAR_TO_FULL_LENGTH SQL mode was enabled.
(Bug#45100)
ALTER TABLE on a view crashed the server. (Bug#44860)
UNCOMPRESSED_LENGTH() returned a garbage result when passed a string shorter than 5 bytes. Now UNCOM-
PRESSED_LENGTH() returns NULL and generates a warning. (Bug#44796)
Several Valgrind warnings were silenced. (Bug#44774, Bug#44792)
Selecting RAND(N) function where N is a column of a constant table (table with a single row) failed with a SIGFPE signal.
(Bug#44768)
Conversion of a string to a different character set could use the same buffer for input and output, leading to incorrect results or warn-
ings. (Bug#44743, Bug#44766)
mysqld_safe could fail to find the logger program. (Bug#44736)
A Valgrind warning related to transaction processing was silenced. (Bug#44664)
innochecksum could incorrectly determine the input file name from the arguments. (Bug#44484)
Incorrect time was reported at the end of mysqldump output. (Bug#44424)
Caching of GROUP BY expressions could lead to mismatches between compile-time and runtime calculations and cause a server
crash. (Bug#44399)
Lettercase conversion in multibyte cp932 or sjis character sequences could produce incorrect results. (Bug#44352)
InnoDB was missing DB_ROLL_PTR information in Table Monitor COLUMNS output. (Bug#44320)
Assertion failure could occur for duplicate-key errors in INSERT INTO ... SELECT statements. (Bug#44306)
On 64-bit Windows systems, myisamchk did not handle key_buffer_size values larger than 4GB. (Bug#43940)
Invalidation of query cache entries due to table modifications could cause threads to hang inside the query cache with state freeing
items. (Bug#43758)
EXPLAIN EXTENDED could crash for UNION queries in which the last SELECT was not parenthesized and included an ORDER
BY clause. (Bug#43612)
Multiple-table updates for InnoDB tables could produce unexpected results. (Bug#43580)
For DELETE statements with ORDER BY var, where var was a global system variable with a NULL value, the server could
crash. (Bug#42778)
Builds linked against OpenSSL had a memory leak in association with use of X509 certificates. (Bug#42158)
There was a race condition when changing innodb_commit_concurrency at runtime from zero to nonzero or from nonzero to
zero. Now this variable cannot be changed at runtime from zero to nonzero or vice versa. The value can still be changed from one
nonzero value to another. (Bug#42101)
MySQL Change History
2838
SELECT ... INTO @var could produce values different from SELECT ... without the INTO clause. (Bug#42009)
mysql_zap did not work on Mac OS X. (Bug#41883)
Shared-memory connections did not work in Vista if mysqld was started from the command line. (Bug#41190)
For views created with a column list clause, column aliases were not substituted when selecting through the view using a HAVING
clause. (Bug#40825)
A multiple-table DELETE involving a table self-join could cause a server crash. (Bug#39918)
Creating an InnoDB table with a comment containing a '#' character caused foreign key constraints to be omitted. (Bug#39793)
The mysql option --ignore-spaces was nonfunctional. (Bug#39101)
If a query was such as to produce the error 1054 Unknown column '...' in 'field list', using EXPLAIN EX-
TENDED with the query could cause a server crash. (Bug#37362)
If the MYSQL_HISTFILE environment variable was set to /dev/null, the mysql client overwrote the /dev/null device file
as a normal file. (Bug#34224)
mysqld_safe mishandled certain parameters if they contained spaces. (Bug#33685)
mysqladmin kill did not work for thread IDs larger than 32 bits. (Bug#32457)
The InnoDB adaptive hash latch is released (if held) for serveral potentially long-running operations. This improves throughput for
other queries if the current query is removing a temporary table, changing a temporary table from memory to disk, using CREATE
TABLE ... SELECT, or performing a MyISAM repair on a table used within a transaction. (Bug#32149)
Several client programs failed to interpret --skip-password as send no password. (Bug#28479)
Output from mysql --html did not encode the <, >, or & characters. (Bug#27884)
mysql_convert_table_format did not prevent converting tables to MEMORY or BLACKHOLE tables, which could result in
data loss. (Bug#27149)
C.1.2. Changes in MySQL 5.1.35 (13 May 2009)
This release of MySQL has two known outstanding issues for Windows:
The .msi installer does not detect an existing root password on the initial configuration attempt. To work around this, install and
configure MySQL as normal, but skip any changes to security. (There is a checkbox that allows this on the security screen of the
configuration wizard.) Then check your settings:
If the old root password and security settings are okay, you are done and can proceed to use MySQL.
Otherwise, reconfigure with the wizard and make any changes on the second configuration attempt. The wizard will properly
prompt for the existing root password and allow changes to be made.
This issue has been filed as Bug#45200 for correction in a future release.
The Windows configuration wizard allows changes to InnoDB settings during a reconfiguration operation. For an upgrade, this
may cause difficulties. To work around this, use one of the following alternatives:
Do not change InnoDB settings.
Copy files from the old InnoDB location to the new one.
This issue has been filed as Bug#45201 for correction in a future release.
Bugs fixed:
MySQL Change History
2839
Important Change: Replication: The transactional behavior of STOP SLAVE has changed. Formerly, it took effect immediately,
even inside a transaction; now, it waits until the current replication event group (if any) has finished executing, or until the user is-
sues a KILL QUERY or KILL CONNECTION statement.
This was done in order to solve the problem encountered when replication was stopped while a nontransactional slave was replicat-
ing a transaction on the master. (It was impossible to roll back a mixed-engines transaction when one of the engines was nontransac-
tional, which meant that the slave could not safely re-apply any transaction that had been interrupted by STOP SLAVE.) (Bug#319,
Bug#38205)
See also Bug#43217.
Partitioning: When a value was equal to a PARTITION ... VALUES LESS THAN (value) value other than MAXVALUE,
the corresponding partition was not pruned. (Bug#42944)
Replication: Unrelated errors occurring during the execution of RESET SLAVE could cause the slave to crash. (Bug#44179)
Replication: The --slave-skip-errors option had no effect when using row-based logging format. (Bug#39393)
Replication: The following erors were not correctly reported:
Failures during slave thread initialization
Failures while initializing the relay log position (immediately following the starting of the slave thread)
Failures while processing queries passed through the --init_slave option.
Information about these types of failures can now be found in the output of SHOW SLAVE STATUS. (Bug#38197)
Replication: Killing the thread executing a DDL statement, after it had finished its execution but before it had written the binlog
event, caused the error code in the binlog event to be set (incorrectly) to ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED, which caused replication to fail. (Bug#37145)
See also Bug#27571, Bug#22725.
Replication: Column alises used inside subqueries were ignored in the binary log. (Bug#35515)
Valgrind warnings for the DECODE(), ENCRYPT(), and FIND_IN_SET() functions were corrected. (Bug#44358, Bug#44365,
Bug#44367)
On Windows, entries for build-vs9.bat and build-vs9_x64.bat were missing in win/Makefile.am. (Bug#44353)
Incomplete cleanup of JOIN_TAB::select during the filesort of rows for a GROUP BY clause inside a subquery caused a server
crash. (Bug#44290)
Not all lock types had proper descriptive strings, resulting in garbage output from mysqladmin debug. (Bug#44164)
Use of HANDLER statements with INFORMATION_SCHEMA tables caused a server crash. Now HANDLER is prohibited with such
tables. (Bug#44151)
Invoking SHOW TABLE STATUS from within a stored procedure could cause a Packets out of order error. (Bug#43962)
myisamchk could display a negative Max keyfile length value. (Bug#43950)
On 64-bit systems, a key_buffer_size value larger than 4GB could couse MyISAM index corruption. (Bug#43932)
mysqld_multi incorrectly passed --no-defaults to mysqld_safe. (Bug#43876)
SHOW VARIABLES did not properly display the value of slave_skip_errors. (Bug#43835)
On Windows, a server crash occurred for attempts to insert a floating-point value into a CHAR column with a maximum length less
than the converted floating-point value length. (Bug#43833)
Incorrect initialization of MyISAM table indexes could cause incorrect query results. (Bug#43737)
libmysqld crashed when it was reinitialized. (Bug#43706, Bug#44091)
MySQL Change History
2840
InnoDB uses random numbers to generate dives into indexes for calculating index cardinality. However, under certain conditions,
the algorithm did not generate random numbers, so ANALYZE TABLE did not update cardinality estimates properly. A new al-
gorithm has been introduced with better randomization properties, together with a system variable, in-
nodb_use_legacy_cardinality_algorithm, that controls which algorithm to use. The default value of the variable is 1
(ON), to use the original algorithm for compatibility with existing applications. The variable can be set to 0 (OFF) to use the new al-
gorithm with improved randomness. (Bug#43660)
UNION of floating-point numbers did unnecessary rounding. (Bug#43432)
ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME failed when the database contained views. (Bug#43385)
Certain statements might open a table and then wait for an impending global read lock without noticing whether they hold a table
being waiting for by the global read lock, causing a hang. Affected statements are SELECT ... FOR UPDATE, LOCK TABLES
... WRITE, TRUNCATE TABLE, and LOAD DATA INFILE. (Bug#43230)
Using an XML function such as ExtractValue() more than once in a single query could produce erroneous results.
(Bug#43183)
See also Bug#43937.
Full-text prefix searches could hang the connection and cause 100% CPU consumption. (Bug#42907)
InnoDB had excessive contention for a character set mutex. (Bug#42649)
Incorrect elevation of warning messages to error messages for unsafe statements caused a server crash. (Bug#42640)
CHECK TABLE suggested use of REPAIR TABLE for corrupt tables for storage engines not supported by REPAIR TABLE. Now
CHECK TABLE suggests that the user dump and reload the table. (Bug#42563)
Compressing a table with the myisampack utility caused the server to produce Valgrind warnings when it opened the table.
(Bug#41541)
For a MyISAM table with DELAY_KEY_WRITE enabled, the index file could be corrupted without the table being marked as
crashed if the server was killed. (Bug#41330)
For some queries, an equality propagation problem could cause a = b and b = a to be handled differently. (Bug#40925)
Killing an INSERT ... SELECT statement for a MyISAM table could cause table corruption if the table had indexes.
(Bug#40827)
A multiple-table DELETE IGNORE statement involving a foreign key constraint caused an assertion failure. (Bug#40127)
Multiple-table UPDATE statements did not properly activate triggers. (Bug#39953)
The mysql_setpermission operation for removing database privileges removed global privileges instead. (Bug#39852)
A stored routine contain a C-style comment could not be dumped and reloaded. (Bug#39559)
In an UPDATE or DELETE via a secondary index, InnoDB did not store the cursor position. This made InnoDB crash in semi-
consistent read while attempting to unlock a nonmatching record. (Bug#39320)
The functions listed in Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific Functions, previously accepted
WKB arguments and returned WKB values. They now accept WKB or geometry arguments and return geometry values.
The functions listed in Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions, previously accepted WKB argu-
ments and returned geometry values. They now accept WKB or geometry arguments and return geometry values. (Bug#38990)
On WIndows, running the server with myisam_use_mmap enabled caused MyISAM table corruption. (Bug#38848)
CHECK TABLE did not properly check whether MyISAM tables created by servers from MySQL 4.0 or older needed to be up-
graded. This could cause problems upgrading to MySQL 5.1 or higher. (Bug#37631)
An UPDATE statement that updated a column using the same DES_ENCRYPT() value for each row actually updated different rows
with different values. (Bug#35087)
For shared-memory connections, the read and write methods did not properly handle asynchronous close events, which could lead to
MySQL Change History
2841
the client locking up waiting for a server response. For example, a call to mysql_real_query() would block forever on the cli-
ent side if the executed statement was aborted on the server side. Thanks to Armin Schffmann for the bug report and patch.
(Bug#33899)
CHECKSUM TABLE was not killable with KILL QUERY. (Bug#33146)
myisamchk and myisampack were not being linked with the library that enabled support for * filename pattern expansion.
(Bug#29248)
For InnoDB tables that have their own .ibd tablespace file, a superfluous ibuf cursor restoration fails! message
could be written to the error log. This warning has been suppressed. (Bug#27276)
COMMIT did not delete savepoints if there were no changes in the transaction. (Bug#26288)
Several memory allocation functions were not being checked for out-of-memory return values. (Bug#25058)
C.1.3. Changes in MySQL 5.1.34 (02 April 2009)
Support Ending for AIX 5.2: Per the MySQL Support Lifecycle policy regarding ending support for OS versions that have reached
vendor end of life, we plan to discontinue building or supporting MySQL binaries for AIX 5.2 as of April 30, 2009. This release of
MySQL 5.1 (5.1.34) is the last MySQL 5.1 release with support for AIX 5.2. For more information, see the March 24, 2009 note at
MySQL Product Support EOL Announcements.
Functionality added or changed:
The optimizer_switch system variable is now available to control optimizations that can be switched on and off. See Sec-
tion 7.2.18, Using optimizer_switch to Control the Optimizer.
Bugs fixed:
Replication: Important Note: Binary logging with --binlog_format=ROW failed when a change to be logged included more
than 251 columns. This issue was not known to occur with mixed-format or statement-based logging. (Bug#42977)
See also Bug#42914.
Replication: Assigning an invalid directory for the --slave-load-tmpdir caused the replication slave to crash. (Bug#42861)
Replication: The mysql.procs_priv system table was not replicated. (Bug#42217)
Replication: An INSERT DELAYED into a TIMESTAMP column issued concurrently with an insert on the same column not using
DELAYED, but applied after the other insert, was logged using the same timestamp as generated by the other (non-DELAYED) insert.
(Bug#41719)
Replication: The MIXED binary logging format did not switch to row-based mode for statements containing the LOAD_FILE()
function. (Bug#39701)
Replication: When the server SQL mode included IGNORE_SPACE, statement-based replication of LOAD DATA INFILE ...
INTO tbl_name failed because the statement was read incorrectly from the binary log; a trailing space was omitted, causing the
statement to fail with a syntax error when run on the slave. (Bug#22504)
See also Bug#43746.
An attempt by a user who did not have the SUPER privilege to kill a system thread could cause a server crash. (Bug#43748)
On Windows, incorrectly specified link dependencies in CMakeLists.txt resulted in link errors for mysql_embedded,
mysqltest_embedded, and mysql_client_test_embedded. (Bug#43715)
mysql crashed if a request for the current database name returned an empty result, such as after the client has executed a preceding
SET sql_select_limit=0 statement. (Bug#43254)
If the value of the version_comment system variable was too long, the mysql client displayed a truncated startup message.
(Bug#43153)
MySQL Change History
2842
Queries of the following form returned an empty result:
SELECT ... WHERE ... (col=col AND col=col) OR ... (false expression)
(Bug#42957)
The strings/CHARSET_INFO.txt file was not included in source distributions. (Bug#42937)
A dangling pointer in mysys/my_error.c could lead to client crashes. (Bug#42675)
Passing an unknown time zone specification to CONVERT_TZ() resulted in a memory leak. (Bug#42502)
With more than two arguments, LEAST(), GREATEST(), and CASE could unnecessarily return Illegal mix of colla-
tions errors. (Bug#41627)
The mysql client could misinterpret its input if a line was longer than an internal buffer. (Bug#41486)
In the help command output displayed by mysql, the description for the \c (clear) command was misleading. (Bug#41268)
The load_defaults(), my_search_option_files() and my_print_default_files() functions in the C client
library were subject to a race condition in multi-threaded operation. (Bug#40552)
If --basedir was specified, mysqld_safe did not use it when attempting to locate my_print_defaults. (Bug#39326)
When MySQL was configured with the --with-max-indexes=128 option, mysqld crashed. (Bug#36751)
Setting the join_buffer_size variable to its minimum value produced spurious warnings. (Bug#36446)
The use of NAME_CONST() can result in a problem for CREATE TABLE ... SELECT statements when the source column ex-
pressions refer to local variables. Converting these references to NAME_CONST() expressions can result in column names that are
different on the master and slave servers, or names that are too long to be legal column identifiers. A workaround is to supply aliases
for columns that refer to local variables.
Now a warning is issued in such cases that indicate possible problems. (Bug#35383)
An attempt to check or repair an ARCHIVE table that had been subjected to a server crash returned a 144 internal error. The data
appeared to be irrecoverable. (Bug#32880)
The Time column for SHOW PROCESSLIST output and the value of the TIME column of the INFORMA-
TION_SCHEMA.PROCESSLIST table now can have negative values. Previously, the column was unsigned and negative values
were displayed incorrectly as large positive values. Negative values can occur if a thread alters the time into the future with SET
TIMESTAMP = value or the thread is executing on a slave and processing events from a master that has its clock set ahead of the
slave. (Bug#22047)
Restoring a mysqldump dump file containing FEDERATED tables failed because the file contained the data for the table. Now only
the table definition is dumped (because the data is located elsewhere). (Bug#21360)
C.1.4. Changes in MySQL 5.1.33 (13 March 2009)
Support Ending for AIX 5.2: Per the MySQL Support Lifecycle policy regarding ending support for OS versions that have reached
vendor end of life, we plan to discontinue building or supporting MySQL binaries for AIX 5.2 as of April 30, 2009. The next release of
MySQL 5.1 (5.1.34) will be the last MySQL 5.1 release with support for AIX 5.2. For more information, see the March 24, 2009 note at
MySQL Product Support EOL Announcements.
Functionality added or changed:
mysql-test-run.pl now supports an --experimental=file_name option. It enables you to specify a file that contains a
list of test cases that should be displayed with the [ exp-fail ] code rather than [ fail ] if they fail. (Bug#42888)
The MD5 algorithm now uses the Xfree implementation. (Bug#42434)
The query cache now checks whether a SELECT statement begins with SQL_NO_CACHE to determine whether it can skip checking
for the query result in the query cache. This is not supported when SQL_NO_CACHE occurs within a comment. (Bug#37416)
MySQL Change History
2843
Bugs fixed:
Partitioning: A duplicate key error raised when inserting into a partitioned table used a different error code from that returned by
such an error raised when inserting into a table that was not partitioned. (Bug#38719)
See also Bug#28842.
Partitioning: Several error messages relating to partitioned tables were incorrect or missing. (Bug#36001)
Replication: When --binlog_format was set to STATEMENT, a statement unsafe for statement-based logging caused an error
or warning to be issued even if sql_log_bin was set to 0. (Bug#41980)
Replication: When using MIXED replication format and temporary tables were created in statement-based mode, but a later opera-
tion in the same session caused a switch to row-based mode, the temporary tables were not dropped on the slave at the end of the
session. (Bug#40013)
See also Bug#43046.
This regression was introduced by Bug#20499.
Replication: When using the MIXED replication format, UPDATE and DELETE statements that searched for rows where part of the
key had nullable BIT columns failed. This occurred because operations that inserted the data were replicated as statements, but UP-
DATE and DELETE statements affecting the same data were replicated using row-based format.
This issue did not occur when using statement-based replication (only) or row-based replication (only). (Bug#39753)
See also Bug#39648.
Replication: The server SQL mode in effect when a stored procedure was created was not retained in the binary log. This could
cause a CREATE PROCEDURE statement that succeeded on the master to fail on the slave.
This issue was first noticed when a stored procedure was created when ANSI_QUOTES was in effect on the master, but could pos-
sibly cause failed CREATE PROCEDURE statements and other problems on the slave when using other server SQL modes as well.
(Bug#39526)
Replication: If --secure-file-priv was set on the slave, it was unable to execute LOAD DATA INFILE statements sent
from the master when using mixed-format or statement-based replication.
As a result of this fix, this security restriction is now ignored on the slave in such cases; instead the slave checks whether the files
were created and should be read by the slave in its --slave-load-tmpdir. (Bug#38174)
Replication: Server IDs greater than 2147483647 (2
32
1) were represented by negative numbers in the binary log. (Bug#37313)
Replication: When its disk becomes full, a replication slave may wait while writing the binary log, relay log or MyISAM tables,
continuing after space has been made available. The error message provided in such cases was not clear about the frequency with
which checking for free space is done (once every 60 seconds), and how long the server waits after space has been freed before con-
tinuing (also 60 seconds); this caused users to think that the server had hung.
These issues have been addressed by making the error message clearer, and dividing it into two separate messages:
1. The error message DISK IS FULL WRITING 'FILENAME' (ERRCODE: ERROR_CODE). WAITING FOR SOMEONE TO FREE
SPACE... (EXPECT UP TO 60 SECS DELAY FOR SERVER TO CONTINUE AFTER FREEING DISK SPACE) is printed only
once.
2. The warning RETRY IN 60 SECS, MESSAGE REPRINTED IN 600 SECS is printed once every for every 10 times that the
check for free space is made; that is, the check is performed once each 60 seconds, but the reminder that space needs to be
freed is printed only once every 10 minutes (600 seconds).
(Bug#22082)
Replication: The statements DROP PROCEDURE IF EXISTS and DROP FUNCTION IF EXISTS were not written to the bin-
ary log if the procedure or function to be dropped did not exist. (Bug#13684)
See also Bug#25705.
MySQL Change History
2844
The IBM DB2i storage engine has been added to this release for the IBM i Series platform. For more information, see Section 13.7,
The IBMDB2I Storage Engine. (Bug#44217)
On 64-bit debug builds, code in safemalloc resulted in errors due to use of a 32-bit value for 64-bit allocations. (Bug#43885)
make distcheck failed to properly handle subdirectories of storage/ndb. (Bug#43614)
Use of USE INDEX hints could cause EXPLAIN EXTENDED to crash. (Bug#43354)
For InnoDB tables, overflow in an AUTO_INCREMENT column could cause a server crash. (Bug#43203)
On 32-bit Windows, mysqld could not use large buffers due to a 2GB user mode address limit. (Bug#43082)
stderr should be unbuffered, but when the server redirected stderr to a file, it became buffered. (Bug#42790)
The DATA_TYPE column of the INFORMATION_SCHEMA.COLUMNS table displayed the UNSIGNED attribute for floating-point
data types. (The column should contain only the data type name.) (Bug#42758)
For InnoDB tables, spurious duplicate-key errors could occur when inserting into an AUTO_INCREMENT column. (Bug#42714)
mysqldump included views that were excluded with the --ignore-table option. (Bug#42635)
An earlier bug fix resulted in the problem that the InnoDB plugin could not be used with a server that was compiled with the built-
in InnoDB. To handle this two changes were made:
The server now supports an --ignore-builtin-innodb option that causes the server to behave as if the built-in InnoDB
is not present. This option causes other InnoDB options not to be recognized.
For the INSTALL PLUGIN statement, the server reads option (my.cnf) files just as during server startup. This enables the
plugin to pick up any relevant options from those files. Consequently, a plugin no longer is started with each option set to its de-
fault value.
Because of this change, it is possible to add plugin options to an option file even before loading a plugin (if the loose prefix is
used). It is also possible to uninstall a plugin, edit my.cnf, and install the plugin again. Restarting the plugin this way enables it
to the new option values without a server restart.
Note
InnoDB Plugin versions 1.0.4 and higher will take advantage of this bug fix. Although the InnoDB Plugin is source code
compatible with multiple MySQL releases, a given binary InnoDB Plugin can be used only with a specific MySQL re-
lease. When InnoDB Plugin 1.0.4 is released, it is expected to be compiled for MySQL 5.1.34. For 5.1.33, you can use
InnoDB Plugin 1.0.3, but you must build from source.
(Bug#42610)
This regression was introduced by Bug#29263.
With the ONLY_FULL_GROUP_BY SQL mode enabled, some legal queries failed. (Bug#42567)
Tables could enter open table cache for a thread without being properly cleaned up, leading to a server crash. (Bug#42419)
For InnoDB tables, inserting into floating-point AUTO_INCREMENT columns failed. (Bug#42400)
The InnoDB btr_search_drop_page_hash_when_freed() function had a race condition. (Bug#42279)
For InnoDB tables, there was a race condition for ALTER TABLE, OPTIMIZE TABLE, CREATE INDEX, and DROP INDEX
operations when periodically checking whether table copying can be committed. (Bug#42152)
Parsing of the optional microsecond component of DATETIME values did not fail gracefully when that component width was larger
than the allowed six places. (Bug#42146)
In InnoDB recovery after a server crash, table lookup could fail and corrupt the data dictionary cache. (Bug#42075)
mysqldumpslow parsed the --debug and --verbose options incorrectly. (Bug#42027)
Queries that used the loose index scan access method could return no rows. (Bug#41610)
MySQL Change History
2845
In InnoDB recovery after a server crash, rollback of a transaction that updated a column from NULL to NULL could cause another
crash. (Bug#41571)
The error message for a too-long column comment was Unknown error rather than a more appropriate message. (Bug#41465)
Use of SELECT * allowed users with rights to only some columns of a view to access all columns. (Bug#41354)
If the tables underlying a MERGE table had a primary key but the MERGE table itself did not, inserting a duplicate row into the
MERGE table caused a server crash. (Bug#41305)
The server did not robustly handle problems hang if a table opened with HANDLER needed to be re-opened because it had been
altered to use a different storage engine that does not support HANDLER. The server also failed to set an error if the re-open attempt
failed. These problems could cause the server to crash or hang. (Bug#41110, Bug#41112)
SELECT statements executed concurrently with INSERT statements for a MyISAM table could cause incorrect results to be returned
from the query cache. (Bug#41098)
For prepared statements, multibyte character sets were not taking into account when calculating max_length for string values and
mysql_stmt_fetch() could return truncated strings. (Bug#41078)
Deprecation warnings that referred to MySQL 5.2 were changed to refer to MySQL 6.0. (Bug#41077)
For user-defined variables in a query result, incorrect length values were returned in the result metadata. (Bug#41030)
On Windows, starting the server with an invalid value for innodb_flush_method caused a crash. (Bug#40757)
MySQL 5.1 crashed with index merge algorithm and merge tables.
A query in the MyISAM merge table caused a crash if the index merge algorithm was being used. (Bug#40675)
With strict SQL mode enabled, setting a system variable to an out-of-bounds value caused an assertion failure. (Bug#40657)
Table temporary scans were slower than necessary due to use of mmap rather than caching, even with the myisam_use_mmap
system variable disabled. (Bug#40634)
For a view that references a table in another database, mysqldump wrote the view name qualified with the current database name.
This makes it impossible to reload the dump file into a different database. (Bug#40345)
On platforms where long and pointer variables have different sizes, MyISAM could copy key statistics incorrectly, resulting in a
server crash or incorrect cardinality values. (Bug#40321)
DELETE tried to acquire write (not read) locks for tables accessed within a subquery of the WHERE clause. (Bug#39843)
perror did not produce correct output for error codes 153 to 163. (Bug#39370)
Several functions in libmysqld called exit() when an error occurred rather than returning an error to the caller. (Bug#39289)
The innodb_log_arch_dir system variable is no longer available but was present in some of the sample option files included
with MySQL distributions (such as my-huge.cnf). The line was present as a comment but uncommenting it would cause server
startup failure so the line has been removed. (Bug#38249)
Setting a savepoint with the same name as an existing savepoint incorrectly deleted any other savepoints that had been set in the
meantime. For example, setting savepoints named a, b, c, b resulted in savepoints a, b, rather than the correct savepoints a, c, b.
(Bug#38187)
--help output for myisamchk did not list the --HELP option. (Bug#38103)
Comparisons between row constructors, such as (a, b) = (c, d) resulted in unnecessary Illegal mix of colla-
tions errors for string columns. (Bug#37601)
If a user created a view that referenced tables for which the user had disjoint privileges, an assertion failure occurred. (Bug#37191)
An argument to the MATCH() function that was an alias for an expression other than a column name caused a server crash.
(Bug#36737)
The event, general_log, and slow_log tables in the mysql database store server_id values, but did not use an UN-
MySQL Change History
2846
SIGNED column and thus were not able to store the full range of ID values. (Bug#36540)
On Windows, the _PC macro in my_global.h was causing problems for modern compilers. It has been removed because it is no
longer used. (Bug#34309)
For DROP FUNCTION with names that were qualified with a database name, the database name was handled in case-sensitive fash-
ion even with lower_case_table_names set to 1. (Bug#33813)
mysqldump --compatible=mysql40 emitted statements referring to the character_set_client system variable,
which is unknown before MySQL 4.1. Now the statements are enclosed in version-specific comments. (Bug#33550)
Detection by configure of several functions such as setsockopt(), bind(), sched_yield(), and gtty() could fail.
(Bug#31506)
Use of MBR spatial functions such as MBRTouches() with columns of InnoDB tables caused a server crash rather than an error.
(Bug#31435)
The mysql client mishandled input parsing if a delimiter command was not first on the line. (Bug#31060)
SHOW PRIVILEGES listed the CREATE ROUTINE privilege as having a context of Functions,Procedures, but it is a data-
base-level privilege. (Bug#30305)
mysqld --help did not work as root. (Bug#30261)
CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE erroneously reported a table to be corrupt if the
table did not exist or the statement was terminated with KILL. (Bug#29458)
SHOW TABLE STATUS could fail to produce output for tables with non-ASCII characters in their name. (Bug#25830)
Allocation of stack space for error messages could be too small on HP-UX, leading to stack overflow crashes. (Bug#21476)
Floating-point numbers could be handled with different numbers of digits depending on whether the text or prepared-statement pro-
tocol was used. (Bug#21205)
Incorrect length metadata could be returned for LONG TEXT columns when a multibyte server character set was used. (Bug#19829)
ROUND() sometimes returned different results on different platforms. (Bug#15936)
C.1.5. Changes in MySQL 5.1.32 (14 February 2009)
Functionality added or changed:
The libedit library was upgraded to version 2.11. (Bug#42433)
Bugs fixed:
Security Fix: Using an XPath expression employing a scalar expression as a FilterExpr with ExtractValue() or Upda-
teXML() caused the server to crash. Such expressions now cause an error instead. (Bug#42495)
Incompatible Change: The fix for Bug#33699 introduced a change to the UPDATE statement such that assigning NULL to a NOT
NULL column caused an error even when strict SQL mode was not enabled. The original behavior before was that such assignments
caused an error only in strict SQL mode, and otherwise set the column to the implicit default value for the column data type and
generated a warning. (For information about implicit default values, see Section 10.1.4, Data Type Default Values.)
The change caused compatibility problems for applications that relied on the original behavior. It also caused replication problems
between servers that had the original behavior and those that did not, for applications that assigned NULL to NOT NULL columns in
UPDATE statements without strict SQL mode enabled. This change has been reverted so that UPDATE again had the original behavi-
or. Problems can still occur if you replicate between servers that have the modified UPDATE behavior and those that do not.
(Bug#39265)
Replication: START SLAVE UNTIL did not work correctly with --replicate-same-server-id enabled; when started
with this option, the slave did not perform events recorded in the relay log and that originated from a different master.
MySQL Change History
2847
Log rotation events are automatically generated and written when rotating the binary log or relay log. Such events for relay logs are
usually ignored by the slave SQL thread because they have the same server ID as that of the slave. However, when -
-replicate-same-server-id was enabled, the rotation event for the relay log was treated as if it originated on the master,
because the log's name and position were incorrectly updated. This caused the MASTER_POS_WAIT() function always to return
NULL and thus to fail. (Bug#38734, Bug#38934)
Replication: TRUNCATE statements failed to replicate when statement-based binary logging mode was not available. The issue was
observed when using InnoDB with the transaction isolation level set to READ UNCOMMITTED (thus forcing InnoDB not to allow
statement-based logging). However, the same behavior could be reproduced using any transactional storage engine supporting only
row-based logging, regardless of the isolation level. This was due to two separate problems:
1. An error was printed by InnoDB for TRUNCATE when using statement-based logging mode where the transaction isolation
level was set to READ COMMITTED or READ UNCOMMITTED, because InnoDB permits statement-based replication for
DML statements. However, TRUNCATE is not transactional; since it is the equivalent of DROP TABLE followed by CREATE
TABLE, it is actually DDL, and should therefore be allowed to be replicated as a statement.
2. TRUNCATE was not logged in mixed mode because of the error just described; however, this error was not reported to the cli-
ent.
As a result of this fix, TRUNCATE is now treated as DDL for purposes of binary logging and replication; that is, it is always logged
as a statement and so no longer causes an error when replicated using a transactional storage engine such as InnoDB. (Bug#36763)
See also Bug#42643.
Replication: mysqlbinlog replay of CREATE TEMPORARY TABLE ... LIKE statements and of TRUNCATE statements
used on temporary tables failed with Error 1146 (TABLE ... DOESN'T EXIST). (Bug#35583)
Replication: In statement mode, mysqlbinlog failed to issue a SET @@autommit statement when the autocommit mode was
changed. (Bug#34541)
Replication: LOAD DATA INFILE statements did not replicate correctly from a master running MySQL 4.1 to a slave running
MySQL 5.1 or later. (Bug#31240)
The use by libedit of the __weak_reference() macro caused compilation failure on FreeBSD. (Bug#42817)
A '%' character in SQL statements could cause the server to crash. (Bug#42634)
An optimization introduced for Bug#37553 required an explicit cast to be added for some uses of TIMEDIFF() because automatic
casting could produce incorrect results. (It was necessary to use TIME(TIMEDIFF(...)).) (Bug#42525)
On the IBM i5 platform, the MySQL configuration process caused the system version of pthread_setschedprio() to be
used. This function returns SIGILL on i5 because it is not supported, causing the server to crash. Now the
my_pthread_setprio() function in the mysys library is used instead. (Bug#42524)
The SSL certficates included with MySQL distributions were regenerated because the previous ones had expired. (Bug#42366)
User variables within triggers could cause a crash if the mysql_change_user() C API function was invoked. (Bug#42188)
Dependent subqueries such as the following caused a memory leak proportional to the number of outer rows:
SELECT COUNT(*) FROM t1, t2 WHERE t2.b
IN (SELECT DISTINCT t2.b FROM t2 WHERE t2.b = t1.a);
(Bug#42037)
Some queries using NAME_CONST(.. COLLATE ...) led to a server crash due to a failed type cast. (Bug#42014)
On Mac OS X, some of the universal client libraries were not actually universal and were missing code for one or more architec-
tures. (Bug#41940)
String reallocation could cause memory overruns. (Bug#41868)
mysql_install_db did not pass some relevant options to mysqld. (Bug#41828)
Setting innodb_locks_unsafe_for_binlog should be equivalent to setting the transaction isolation level to READ COM-
MySQL Change History
2848
MITTED. However, if both of those things were done, nonmatching semi-consistently read rows were not unlocked when they
should have been. (Bug#41671)
REPAIR TABLE crashed for compressed MyISAM tables. (Bug#41574)
For a TIMESTAMP NOT NULL DEFAULT ... column, storing NULL as the return value from some functions caused a cannot
be NULL error. NULL returns now correctly cause the column default value to be stored. (Bug#41370)
The server cannot execute INSERT DELAYED statements when statement-based binary logging is enabled, but the error message
displayed only the table name, not the entire statement. (Bug#41121)
FULLTEXT indexes did not work for Unicode columns that used a custom UCA collation. (Bug#41084)
The Windows installer displayed incorrect product names in some images. (Bug#40845)
Changing innodb_thread_concurrency at runtime could cause errors. (Bug#40760)
SELECT statements could be blocked by INSERT DELAYED statements that were waiting for a lock, even with
low_priority_updates enabled. (Bug#40536)
For InnoDB tables that used ROW_FORMAT=REDUNDANT, storage size of NULL columns could be determined incorrectly.
(Bug#40369)
The query cache stored only partial query results if a statement failed while the results were being sent to the client. This could
cause other clients to hang when trying to read the cached result. Now if a statement fails, the result is not cached. (Bug#40264)
When a MEMORY table became full, the error generated was returned to the client but was not written to the error log. (Bug#39886)
With row-based binary logging, replication of InnoDB tables containing NULL-valued BIT columns could fail. (Bug#39648)
The expression ROW(...) IN (SELECT ... FROM DUAL) always returned TRUE. (Bug#39069)
The greedy optimizer could cause a server crash due to improper handling of nested outer joins. (Bug#38795)
Use of COUNT(DISTINCT) prevented NULL testing in the HAVING clause. (Bug#38637)
The innodb_stats_on_metadata system variable was not displayed by SHOW VARIABLES and was not settable at runtime.
(Bug#38189)
Enabling the sync_frm system variable had no effect on the handling of .frm files for views. (Bug#38145)
For comparison of NULL to a subquery result inside IS NULL, the comparison could evaluate to NULL rather than to TRUE or
FALSE. This occurred for expressions such as:
SELECT ... WHERE NULL IN (SELECT ...) IS NULL
(Bug#37822)
Setting myisam_repair_threads greater than 1 caused a server crash for table repair or alteration operations for MyISAM
tables with multiple FULLTEXT indexes. (Bug#37756)
The mysql client sometimes improperly interpreted string escape sequences in nonstring contexts. (Bug#36391)
The query cache stored packets containing the server status of the time when the cached statement was run. This might lead to an in-
correct transaction status on the client side if a statement was cached during a transaction and later served outside a transaction con-
text (or vice versa). (Bug#36326)
If the system time was adjusted backward during query execution, the apparent execution time could be negative. But in some cases
these queries would be written to the slow query log, with the negative execution time written as a large unsigned number. Now
statements with apparent negative execution time are not written to the slow query log. (Bug#35396)
libmysqld was not built with all character sets. (Bug#32831)
For mysqld_multi, using the --mysqld=mysqld_safe option caused the --defaults-file and -
-defaults-extra-file options to behave the same way. (Bug#32136)
MySQL Change History
2849
Attempts to open a valid MERGE table sometimes resulted in a ER_WRONG_MRG_TABLE error. This happened after failure to
open an invalid MERGE table had also generated an ER_WRONG_MRG_TABLE error. (Bug#32047)
For Solaris package installation using pkgadd, the postinstall script failed, causing the system tables in the mysql database not to
be created. (Bug#31164)
If the default database was dropped, the value of character_set_database was not reset to character_set_server as
it should have been. (Bug#27208)
C.1.6. Release Notes for MySQL Enterprise 5.1.31sp1 [QSP] (19 March 2009)
This is a Service Pack release of the MySQL Enterprise Server 5.1.
This section documents all changes and bugfixes that have been applied since the last MySQL Enterprise Server release (5.1.31).
If you would like to receive more fine-grained and personalized update alerts about fixes that are relevant to the version and features
you use, please consider subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise/advisors.html.
Functionality added or changed:
The libedit library was upgraded to version 2.11. (Bug#42433)
Bugs fixed:
Security Fix: Using an XPath expression employing a scalar expression as a FilterExpr with ExtractValue() or Upda-
teXML() caused the server to crash. Such expressions now cause an error instead. (Bug#42495)
On the IBM i5 platform, the MySQL configuration process caused the system version of pthread_setschedprio() to be
used. This function returns SIGILL on i5 because it is not supported, causing the server to crash. Now the
my_pthread_setprio() function in the mysys library is used instead. (Bug#42524)
The SSL certficates included with MySQL distributions were regenerated because the previous ones had expired. (Bug#42366)
User variables within triggers could cause a crash if the mysql_change_user() C API function was invoked. (Bug#42188)
Some queries using NAME_CONST(.. COLLATE ...) led to a server crash due to a failed type cast. (Bug#42014)
C.1.7. Changes in MySQL 5.1.31 (19 January 2009)
Functionality added or changed:
A new status variable, Queries, indicates the number of statements executed by the server. This includes statements executed
within stored programs, unlike the Questions variable which includes only statements sent to the server by clients. (Bug#41131)
Performance of SELECT * retrievals from INFORMATION_SCHEMA.COLUMNS was improved slightly. (Bug#38918)
Previously, index hints did not work for FULLTEXT searches. Now they work as follows:
For natural language mode searches, index hints are silently ignored. For example, IGNORE INDEX(i) is ignored with no warn-
ing and the index is still used.
For boolean mode searches, index hints with FOR ORDER BY or FOR GROUP BY are silently ignored. Index hints with FOR
JOIN or no FOR modifier are honored. In contrast to how hints apply for non-FULLTEXT searches, the hint is used for all phases of
query execution (finding rows and retrieval, grouping, and ordering). This is true even if the hint is given for a non-FULLTEXT in-
dex. (Bug#38842)
Bugs fixed:
MySQL Change History
2850
Important Change: Replication: If a trigger was defined on an InnoDB table and this trigger updated a nontransactional table,
changes performed on the InnoDB table were replicated and were visible on the slave before they were committed on the master,
and were not rolled back on the slave after a successful rollback of those changes on the master.
As a result of the fix for this issue, the semantics of mixing nontransactional and transactional tables in a transaction in the first
statement of a transaction have changed. Previously, if the first statement in a transaction contained nontransactional changes, the
statement was written directly to the binary log. Now, any statement appearing after a BEGIN (or immediately following a COMMIT
if AUTOCOMMIT = 0) is always considered part of the transaction and cached. This means that nontransactional changes do not
propagate to the slave until the transaction is committed and thus written to the binary log.
See Section 16.3.1.25, Replication and Transactions, for more information about this change in behavior. (Bug#40116)
Partitioning: Replication: Changing the transaction isolation level while replicating partitioned InnoDB tables could cause state-
ment-based logging to fail. (Bug#39084)
Partitioning: A comparison with an invalid DATE value in a query against a partitioned table could lead to a crash of the MySQL
server.
Note
Invalid DATE and DATETIME values referenced in the WHERE clause of a query on a partitioned table are treated as
NULL. See Section 18.4, Partition Pruning, for more information.
(Bug#40972)
Partitioning: This bug was introduced in MySQL 5.1.29. (Bug#40954)
This regression was introduced by Bug#30573, Bug#33257, Bug#33555.
Partitioning: With READ COMMITTED transaction isolation level, InnoDB uses a semi-consistent read that releases nonmatching
rows after MySQL has evaluated the WHERE clause. However, this was not happening if the table used partitions. (Bug#40595)
Partitioning: A query that timed out when run against a partitioned table failed silently, without providing any warnings or errors,
rather than returning LOCK WAIT TIMEOUT EXCEEDED. (Bug#40515)
Partitioning: ALTER TABLE ... REORGANIZE PARTITION could crash the server when the number of partitions was not
changed. (Bug#40389)
See also Bug#41945.
Partitioning: For a partitioned table having an AUTO_INCREMENT column: If the first statement following a start of the server or a
FLUSH TABLES statement was an UPDATE statement, the AUTO_INCREMENT column was not incremented correctly.
(Bug#40176)
Partitioning: The server attempted to execute the statements ALTER TABLE ... ANALYZE PARTITION, ALTER TABLE
... CHECK PARTITION, ALTER TABLE ... OPTIMIZE PARTITION, and ALTER TABLE ... REORGANIZE PAR-
TITION on tables that were not partitioned. (Bug#39434)
See also Bug#20129.
Partitioning: The value of the CREATE_COLUMNS column in INFORMATION_SCHEMA.TABLES was not partitioned for
partitioned tables. (Bug#38909)
Partitioning: When executing an ORDER BY query on a partitioned InnoDB table using an index that was not in the partition ex-
pression, the results were sorted on a per-partition basis rather than for the table as a whole. (Bug#37721)
Partitioning: Dropping or creating an index on a partitioned table managed by the InnoDB Plugin locked the table. (Bug#37453)
Partitioning: Partitioned table checking sometimes returned a warning with an error code of 0, making proper response to errors
impossible. The fix also renders the error message subject to translation in non-English deployments. (Bug#36768)
Partitioning: SHOW TABLE STATUS could show a nonzero value for the Mean record length of a partitioned InnoDB ta-
ble, even if the table contained no rows. (Bug#36312)
Partitioning: When SHOW CREATE TABLE was used on a partitioned table, all of the table's PARTITION and SUBPARTITION
clauses were output on a single line, making it difficult to read or parse. (Bug#14326)
MySQL Change History
2851
Replication: Per-table AUTO_INCREMENT option values were not replicated correctly for InnoDB tables. (Bug#41986)
Replication: Some log_event types did not skip the post-header when reading. (Bug#41961)
Replication: Attempting to read a binary log containing an Incident_log_event having an invalid incident number could
cause the debug server to crash. (Bug#40482)
Replication: When using row-based replication, an update of a primary key that was rolled back on the master due to a duplicate
key error was not rolled back on the slave. (Bug#40221)
Replication: When rotating relay log files, the slave deletes relay log files and then edits the relay log index file. Formerly, if the
slave shut down unexpectedly between these two events, the relay log index file could then reference relay logs that no longer exis-
ted. Depending on the circumstances, this could when restarting the slave cause either a race condition or the failure of replication.
(Bug#38826, Bug#39325)
Replication: With row-based replication, UPDATE and DELETE statements using LIMIT and a table's primary key could produce
different results on the master and slave. (Bug#38230)
resolve_stack_dump was unable to resolve the stack trace format produced by mysqld in MySQL 5.1 and up (see Sec-
tion 22.5.1.5, Using a Stack Trace). (Bug#41612)
In example option files provided in MySQL distributions, the thread_stack value was increased from 64K to 128K.
(Bug#41577)
The optimizer could ignore an error and rollback request during a filesort, causing an assertion failure. (Bug#41543)
DATE_FORMAT() could cause a server crash for year-zero dates. (Bug#41470)
SET PASSWORD caused a server crash if the account name was given as CURRENT_USER(). (Bug#41456)
When a repair operation was carried out on a CSV table, the debug server crashed. (Bug#41441)
When substituting system constant functions with a constant result, the server was not expecting NULL function return values and
could crash. (Bug#41437)
Queries such as SELECT ... CASE AVG(...) WHEN ... that used aggregate functions in a CASE expression crashed the
server. (Bug#41363)
INSERT INTO .. SELECT ... FROM and CREATE TABLE ... SELECT ... FROM a TEMPORARY table could in-
advertently change the locking type of the temporary table from a write lock to a read lock, causing statement failure. (Bug#41348)
The INFORMATION_SCHEMA.SCHEMA_PRIVILEGES table was limited to 7680 rows. (Bug#41079)
In debug builds, obsolete debug code could be used to crash the server. (Bug#41041)
Some queries that used a range checked for each record scan could return incorrect results. (Bug#40974)
Certain SELECT queries could fail with a Duplicate entry error. (Bug#40953)
For debug servers, OPTIMIZE TABLE on a compressed table caused a server crash. (Bug#40949)
Accessing user variables within triggers could cause a server crash. (Bug#40770)
IF(..., CAST(longtext_val AS UNSIGNED), signed_val) as an argument to an aggregate function could cause an
assertion failure. (Bug#40761)
For single-table UPDATE statements, an assertion failure resulted from a runtime error in a stored function (such as a recursive func-
tion call or an attempt to update the same table as in the UPDATE statement). (Bug#40745)
TRUNCATE TABLE for an InnoDB table did not flush cached queries for the table. (Bug#40386)
Prepared statements allowed invalid dates to be inserted when the ALLOW_INVALID_DATES SQL mode was not enabled.
(Bug#40365)
mc.exe is no longer needed to compile MySQL on Windows. This makes it possible to build MySQL from source using Visual
Studio Express 2008. (Bug#40280)
MySQL Change History
2852
The ':' character was incorrectly disallowed in table names. (Bug#40104)
Support for the revision field in .frm files has been removed. This addresses the downgrading problem introduced by the fix
for Bug#17823. (Bug#40021)
Retrieval speed from the following INFORMATION_SCHEMA tables was improved by shortening the VARIABLE_VALUE column
to 1024 characters: GLOBAL_VARIABLES, SESSION_VARIABLES, GLOBAL_STATUS, and SESSION_STATUS.
As a result of this change, any variable value longer than 1024 characters will be truncated with a warning. This affects only the
init_connect system variable. (Bug#39955)
For an InnoDB table, DROP TABLE or ALTER TABLE ... DISCARD TABLESPACE could take a long time or cause a server
crash. (Bug#39939)
If the operating system is configured to return leap seconds from OS time calls or if the MySQL server uses a time zone definition
that has leap seconds, functions such as NOW() could return a value having a time part that ends with :59:60 or :59:61. If such
values are inserted into a table, they would be dumped as is by mysqldump but considered invalid when reloaded, leading to
backup/restore problems.
Now leap second values are returned with a time part that ends with :59:59. This means that a function such as NOW() can return
the same value for two or three consecutive seconds during the leap second. It remains true that literal temporal values having a time
part that ends with :59:60 or :59:61 are considered invalid.
For additional details about leap-second handling, see Section 9.7.2, Time Zone Leap Second Support. (Bug#39920)
The server could crash during a sort-order optimization of a dependent subquery. (Bug#39844)
For a server started with the --temp-pool option on Windows, temporary file creation could fail. This option now is ignored ex-
cept on Linux systems, which was its original intended scope. (Bug#39750)
ALTER TABLE on a table with FULLTEXT index that used a pluggable FULLTEXT parser could cause debug servers to crash.
(Bug#39746)
With the ONLY_FULL_GROUP_BY SQL mode enabled, the check for nonaggregated columns in queries with aggregate functions,
but without a GROUP BY clause was treating all the parts of the query as if they were in the select list. This is fixed by ignoring the
nonaggregated columns in the WHERE clause. (Bug#39656)
The server crashed if an integer field in a CSV file did not have delimiting quotes. (Bug#39616)
Creating a table with a comment of 62 characters or longer caused a server crash. (Bug#39591)
The do_abi_check program run during the build process depends on mysql_version.h but that file was not created first,
resulting in build failure. (Bug#39571)
CHECK TABLE failed for MyISAM INFORMATION_SCHEMA tables. (Bug#39541)
On 64-bit Windows systems, the server accepted key_buffer_size values larger than 4GB, but allocated less. (For example,
specifying a value of 5GB resulted in 1GB being allocated.) (Bug#39494)
InnoDB could hang trying to open an adaptive hash index. (Bug#39483)
Following ALTER TABLE ... DISCARD TABLESPACE for an InnoDB table, an attempt to determine the free space for the
table before the ALTER TABLE operation had completely finished could cause a server crash. (Bug#39438)
Use of the PACK_KEYS or MAX_ROWS table option in ALTER TABLE should have triggered table reconstruction but did not.
(Bug#39372)
The server returned a column type of VARBINARY rather than DATE as the result from the COALESCE(), IFNULL(), IF(),
GREATEST(), or LEAST() functions or CASE expression if the result was obtained using filesort in an anonymous tempor-
ary table during the query execution. (Bug#39283)
A server built using yaSSL for SSL support would crash if configured to use an RSA key and a client sent a cipher list containing a
non-RSA key as acceptable. (Bug#39178)
When built with Valgrind, the server failed to access tables created with the DATA DIRECTORY or INDEX DIRECTORY table op-
tion. (Bug#39102)
MySQL Change History
2853
With binary logging enabled CREATE VIEW was subject to possible buffer overwrite and a server crash. (Bug#39040)
The fast mutex implementation was subject to excessive lock contention. (Bug#38941)
Use of InnoDB monitoring (SHOW ENGINE INNODB STATUS or one of the InnoDB Monitor tables) could cause a server crash
due to invalid access to a shared variable in a concurrent environment. (Bug#38883)
InnoDB could fail to generate AUTO_INCREMENT values after an UPDATE statement for the table. (Bug#38839)
If delayed insert failed to upgrade the lock, it did not free the temporary memory storage used to keep newly constructed BLOB val-
ues in memory, resulting in a memory leak. (Bug#38693)
On Windows, a five-second delay occurred at shutdown of applications that used the embedded server. (Bug#38522)
On Solaris, a scheduling policy applied to the main server process could be unintentionally overwritten in client-servicing threads.
(Bug#38477)
Building MySQL on FreeBSD would result in a failure during the gen_lex_hash phase of the build. (Bug#38364)
On Windows, the embedded server would crash in mysql_library_init() if the language file was missing. (Bug#38293)
A mix of TRUNCATE TABLE with LOCK TABLES and UNLOCK TABLES for an InnoDB could cause a server crash.
(Bug#38231)
The ExtractValue() function did not work correctly with XML documents containing a DOCTYPE declaration. (Bug#38227)
Queries with a HAVING clause could return a spurious row. (Bug#38072)
The Event Scheduler no longer logs started in thread or executed successfully messages to the error log. (Bug#38066)
Use of spatial data types in prepared statements could cause memory leaks or server crashes. (Bug#37956, Bug#37671)
An error in a debugging check caused crashes in debug servers. (Bug#37936)
A SELECT with a NULL NOT IN condition containing a complex subquery from the same table as in the outer select caused an as-
sertion failure. (Bug#37894)
The presence of a /* ... */ comment preceding a query could cause InnoDB to use unnecessary gap locks. (Bug#37885)
Use of an uninitialized constant in EXPLAIN evaluation caused an assertion failure. (Bug#37870)
When using ALTER TABLE on an InnoDB table, the AUTO_INCREMENT value could be changed to an incorrect value.
(Bug#37788)
Primary keys were treated as part of a covering index even if only a prefix of a key column was used. (Bug#37742)
Renaming an ARCHIVE table to the same name with different lettercase and then selecting from it could cause a server crash.
(Bug#37719)
The MONTHNAME() and DAYNAME() functions returned a binary string, so that using LOWER() or UPPER() had no effect. Now
MONTHNAME() and DAYNAME() return a value in character_set_connection character set. (Bug#37575)
TIMEDIFF() was erroneously treated as always returning a positive result. Also, CAST() of TIME values to DECIMAL dropped
the sign of negative values. (Bug#37553)
See also Bug#42525.
SHOW PROCESSLIST displayed copy to tmp table when no such copy was occurring. (Bug#37550)
mysqlcheck used SHOW FULL TABLES to get the list of tables in a database. For some problems, such as an empty .frm file
for a table, this would fail and mysqlcheck then would neglect to check other tables in the database. (Bug#37527)
Updating a view with a subquery in the CHECK option could cause an assertion failure. (Bug#37460)
Statements that displayed the value of system variables (for example, SHOW VARIABLES) expect variable values to be encoded in
character_set_system. However, variables set from the command line such as basedir or datadir were encoded using
MySQL Change History
2854
character_set_filesystem and not converted correctly. (Bug#37339)
CREATE INDEX could crash with InnoDB plugin 1.0.1. (Bug#37284)
Certain boolean-mode FULLTEXT searches that used the truncation operator did not return matching records and calculated relev-
ance incorrectly. (Bug#37245)
On a 32-bit server built without big tables support, the offset argument in a LIMIT clause might be truncated due to a 64-bit to
32-bit cast. (Bug#37075)
For an InnoDB table with a FOREIGN KEY constraint, TRUNCATE TABLE may be performed using row by row deletion. If an
error occurred during this deletion, the table would be only partially emptied. Now if an error occurs, the truncation operation is
rolled back and the table is left unchanged. (Bug#37016)
The code for the ut_usectime() function in InnoDB did not handle errors from the gettimeofday() system call. Now it
retries gettimeofday() several times and updates the value of the Innodb_row_lock_time_max status variable only if
ut_usectime() was successful. (Bug#36819)
Use of CONVERT() with GROUP BY to convert numeric values to CHAR could return truncated results. (Bug#36772)
The mysql client, when built with Visual Studio 2005, did not display Japanese characters. (Bug#36279)
CREATE INDEX for InnoDB tables could under very rare circumstances cause the server to crash.. (Bug#36169)
A read past the end of the string could occur while parsing the value of the --innodb-data-file-path option. (Bug#36149)
Setting the slave_compressed_protocol system variable to DEFAULT failed in the embedded server. (Bug#35999)
For upgrades to MySQL 5.1 or higher, mysql_upgrade did not re-encode database or table names that contained nonalphanu-
meric characters. (They would still appear after the upgrade with the #mysql50# prefix described in Section 8.2.3, Mapping of
Identifiers to File Names.) To correct this problem, it was necessary to run mysqlcheck --all-databases -
-check-upgrade --fix-db-names --fix-table-names manually. mysql_upgrade now runs that command auto-
matically after performing the initial upgrade. (Bug#35934)
SHOW CREATE TABLE did not display a printable value for the default value of BIT columns. (Bug#35796)
The columns that store character set and collation names in several INFORMATION_SCHEMA tables were lengthened because they
were not long enough to store some possible values: SCHEMATA, TABLES, COLUMNS, CHARACTER_SETS, COLLATIONS, and
COLLATION_CHARACTER_SET_APPLICABILITY. (Bug#35789)
The max_length metadata value was calculated incorrectly for the FORMAT() function, which could cause incorrect result set
metadata to be sent to clients. (Bug#35558)
InnoDB was not updating the Handler_delete or Handler_update status variables. (Bug#35537)
InnoDB could fail to generate AUTO_INCREMENT values if rows previously had been inserted containing literal values for the
AUTO_INCREMENT column. (Bug#35498, Bug#36411, Bug#39830)
The CREATE_OPTIONS column for INFORMATION_SCHEMA.TABLES did not display the KEY_BLOCK_SIZE option.
(Bug#35275)
Selecting from an INFORMATION_SCHEMA table into an incorrectly defined MERGE table caused an assertion failure.
(Bug#35068)
perror on Windows did not know about Win32 system error codes. (Bug#34825)
EXPLAIN EXTENDED evaluation of aggregate functions that required a temporary table caused a server crash. (Bug#34773)
SHOW GLOBAL STATUS shows values that aggregate the session status values for all threads. This did not work correctly for the
embedded server. (Bug#34517)
mysqldumpslow did not aggregate times. (Bug#34129)
mysql_config did not output -ldl (or equivalent) when needed for --libmysqld-libs, so its output could be insufficient
to build applications that use the embedded server. (Bug#34025)
MySQL Change History
2855
The mysql client incorrectly parsed statements containing the word delimiter in mid-statement.
This fix is different from the one applied for this bug in MySQL 5.1.26. (Bug#33812)
See also Bug#38158.
For a stored procedure containing a SELECT * ... RIGHT JOIN query, execution failed for the second call. (Bug#33811)
Previously, use of index hints with views (which do not have indexes) produced the error ERROR 1221 (HY000): INCORRECT
USAGE OF USE/IGNORE INDEX AND VIEW. Now this produces ERROR 1176 (HY000): KEY '...' DOESN'T EXIST
IN TABLE '...', the same error as for base tables without an appropriate index. (Bug#33461)
Three conditions were discovered that could cause an upgrade from MySQL 5.0 to 5.1 to fail: 1) Triggers associated with a table
that had a #mysql50# prefix in the name could cause assertion failure. 2) ALTER DATABASE ... UPGRADE DATA DIR-
ECTORY NAME failed for databases that had a #mysql50# prefix if there were triggers in the database. 3) mysqlcheck -
-fix-table-name didn't use UTF8 as the default character set, resulting in parsing errors for tables with nonlatin symbols in
their names and trigger definitions. (Bug#33094, Bug#41385)
Execution of a prepared statement that referred to a system variable caused a server crash. (Bug#32124)
Some division operations produced a result with incorrect precision. (Bug#31616)
Queries executed using join buffering of BIT columns could produce incorrect results. (Bug#31399)
ALTER TABLE CONVERT TO CHARACTER SET did not convert TINYTEXT or MEDIUMTEXT columns to a longer text type if
necessary when converting the column to a different character set. (Bug#31291)
Server variables could not be set to their current values on Linux platforms. (Bug#31177)
See also Bug#6958.
For installation on Solaris using pkgadd packages, the mysql_install_db script was generated in the scripts directory, but
the temporary files used during the process were left there and not deleted. (Bug#31052)
Static storage engines and plugins that were disabled and dynamic plugins that were installed but disabled were not listed in the IN-
FORMATION_SCHEMA appropriate PLUGINS or ENGINES table. (Bug#29263)
Some SHOW statements and retrievals from the INFORMATION_SCHEMA TRIGGERS and EVENTS tables used a temporary table
and incremented the Created_tmp_disk_tables status variable, due to the way that TEXT columns are handled. The TRIG-
GERS.SQL_MODE, TRIGGERS.DEFINER, and EVENTS.SQL_MODE columns now are VARCHAR to avoid this problem.
(Bug#29153)
For several read only system variables that were viewable with SHOW VARIABLES, attempting to view them with SELECT
@@var_name or set their values with SET resulted in an unknown system variable error. Now they can be viewed with
SELECT @@var_name and attempting to set their values results in a message indicating that they are read only. (Bug#28234)
On Windows, Visual Studio does not take into account some x86 hardware limitations, which led to incorrect results converting
large DOUBLE values to unsigned BIGINT values. (Bug#27483)
SSL support was not included in some generic RPM packages. (Bug#26760)
The Questions status variable is intended as a count of statements sent by clients to the server, but was also counting statements
executed within stored routines. (Bug#24289)
Setting the session value of the max_allowed_packet or net_buffer_length system variable was allowed but had no ef-
fect. The session value of these variables is now read only. (Bug#22891)
A race condition between the mysqld.exe server and the Windows service manager could lead to inability to stop the server from
the service manager. (Bug#20430)
On Windows, moving an InnoDB .ibd file and then symlinking to it in the database directory using a .sym file caused a server
crash. (Bug#11894)
C.1.8. Changes in MySQL 5.1.30 (14 November 2008 General Availability)
MySQL Change History
2856
Bugs fixed:
Partitioning: A SELECT using a range WHERE condition with an ORDER BY on a partitioned table caused a server crash.
(Bug#40494)
Replication: Row-based replication failed with nonpartitioned MyISAM tables having no indexes. (Bug#40004)
With statement-based binary logging format and a transaction isolation level of READ COMMITTED or stricter, InnoDB printed an
error because statement-based logging might lead to inconsistency between master and slave databases. However, this error was
printed even when binary logging was not enabled (in which case, no such inconsistency can occur). (Bug#40360)
The CHECK TABLE ... FOR UPGRADE statement did not check for incompatible collation changes made in MySQL 5.1.24
(Bug#27877). This also affects mysqlcheck and mysql_upgrade, which cause that statement to be executed. See Sec-
tion 2.12.3, Checking Whether Table Indexes Must Be Rebuilt.
Prior to this fix, a binary upgrade (performed without dumping tables with mysqldump before the upgrade and reloading the dump
file after the upgrade) would corrupt tables that have indexes that use the utf8_general_ci or ucs2_general_ci collation
for columns that contain '' LATIN SMALL LETTER SHARP S (German). After the fix, CHECK TABLE ... FOR UP-
GRADE properly detects the problem and warns about tables that need repair.
However, the fix is not backward compatible and can result in a downgrading problem under these circumstances:
1. Perform a binary upgrade to a version of MySQL that includes the fix.
2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or mysql_upgrade) to upgrade tables.
3. Perform a binary downgrade to a version of MySQL that does not include the fix.
The solution is to dump tables with mysqldump before the downgrade and reload the dump file after the downgrade. Alternatively,
drop and recreate affected indexes. (Bug#40053)
Some recent releases for Solaris 10 were built on Solaris 10 U5, which included a new version of libnsl.so that does not work
on U4 or earlier. To correct this, Solaris 10 builds now are created on machines that do not have that upgraded libnsl.so, so that
they will work on Solaris 10 installations both with and without the upgraded libnsl.so. (Bug#39074)
XA transaction rollbacks could result in corrupted transaction states and a server crash. (Bug#28323)
ALTER TABLE for an ENUM column could change column values. (Bug#23113)
C.1.9. Changes in MySQL 5.1.29 (11 October 2008)
Functionality added or changed:
Important Change: The --skip-thread-priority option is now deprecated in MySQL 5.1 and is removed in MySQL 6.0
such that the server won't change the thread priorities by default. Giving threads different priorities might yield marginal improve-
ments in some platforms (where it actually works), but it might instead cause significant degradation depending on the thread count
and number of processors. Meddling with the thread priorities is a not a safe bet as it is very dependent on the behavior of the CPU
scheduler and system where MySQL is being run. (Bug#35164, Bug#37536)
Important Change: The --log option now is deprecated and will be removed (along with the log system variable) in the future.
Instead, use the --general_log option to enable the general query log and the --general_log_file=file_name option
to set the general query log file name. The values of these options are available in the general_log and general_log_file
system variables, which can be changed at runtime.
Similar changes were made for the --log-slow-queries option and log_slow_queries system variable. You should use
the --slow_query_log and --slow_query_log_file=file_name options instead (and the slow_query_log and
slow_query_log_file system variables).
The BUILD/compile-solaris-* scripts now compile MySQL with the mtmalloc library rather than malloc. (Bug#38727)
Bugs fixed:
MySQL Change History
2857
Incompatible Change: Replication: The default binary logging mode has been changed from MIXED to STATEMENT for compat-
ibility with MySQL 5.0. (Bug#39812)
Incompatible Change: CHECK TABLE ... FOR UPGRADE did not check for incompatible collation changes made in MySQL
5.1.21 (Bug#29499) and 5.1.23 (Bug#27562, Bug#29461). This also affects mysqlcheck and mysql_upgrade, which cause
that statement to be executed. See Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt. (Bug#39585)
See also Bug#40984.
Incompatible Change: In connection with view creation, the server created arc directories inside database directories and main-
tained useless copies of .frm files there. Creation and renaming procedures of those copies as well as creation of arc directories
has been discontinued.
This change does cause a problem when downgrading to older server versions which manifests itself under these circumstances:
1. Create a view v_orig in MySQL 5.1.29 or higher.
2. Rename the view to v_new and then back to v_orig.
3. Downgrade to an older 5.1.x server and run mysql_upgrade.
4. Try to rename v_orig to v_new again. This operation fails.
As a workaround to avoid this problem, use either of these approaches:
Dump your data using mysqldump before downgrading and reload the dump file after downgrading.
Instead of renaming a view after the downgrade, drop it and recreate it.
The downgrade problem introduced by the fix for this bug has been addressed as Bug#40021. (Bug#17823)
Important Change: Replication: The SUPER privilege is now required to change the session value of binlog_format as well
as its global value. For more information about binlog_format, see Section 16.1.2, Replication Formats. (Bug#39106)
Partitioning: Replication: Replication to partitioned MyISAM tables could be slow with row-based binary logging. (Bug#35843)
Partitioning: If an error occurred when evaluating a column of a partitioned table for the partitioning function, the row could be in-
serted anyway. (Bug#38083)
Partitioning: Using INSERT ... SELECT to insert records into a partitioned MyISAM table could fail if some partitions were
empty and others are not. (Bug#38005)
Partitioning: Ordered range scans on partitioned tables were not always handled correctly. In some cases this caused some rows to
be returned twice. The same issue also caused GROUP BY query results to be aggregated incorrectly. (Bug#30573, Bug#33257,
Bug#33555)
Replication: Server code used in binary logging could in some cases be invoked even though binary logging was not actually en-
abled, leading to asserts and other server errors. (Bug#38798)
Replication: Replication of BLACKHOLE tables did not work with row-based binary logging. (Bug#38360)
Replication: In some cases, a replication master sent a special event to a reconnecting slave to keep the slave's temporary tables, but
they still had references to the old slave SQL thread and used them to access that thread's data. (Bug#38269)
Replication: Replication filtering rules were inappropiately applied when executing BINLOG pseudo-queries. One way in which
this problem showed itself was that, when replaying a binary log with mysqlbinlog, RBR events were sometimes not executed if
the --replicate-do-db option was specified. Now replication rules are applied only to those events executed by the slave SQL
thread. (Bug#36099)
Replication: For a CREATE TABLE ... SELECT statement that creates a table in a database other than the current one, the table
could be created in the wrong database on replication slaves if row-based binary logging is used. (Bug#34707)
Replication: A statement did not always commit or roll back correctly when the server was shut down; the error could be triggered
by having a failing UPDATE or INSERT statement on a transactional table, causing an implicit rollback. (Bug#32709)
See also Bug#38262.
MySQL Change History
2858
The Sun Studio compiler failed to build debug versions of the server due to use of features specific to gcc. (Bug#39451)
For a TIMESTAMP column in an InnoDB table, testing the column with multiple conditions in the WHERE clause caused a server
crash. (Bug#39353)
References to local variables in stored procedures are replaced with NAME_CONST(name, value) when written to the binary
log. However, an illegal mix of collation error might occur when executing the log contents if the value's collation differed from
that of the variable. Now information about the variable collation is written as well. (Bug#39182)
Queries of the form SELECT ... REGEXP BINARY NULL could lead to a hung or crashed server. (Bug#39021)
Statements of the form INSERT ... SELECT .. ON DUPLICATE KEY UPDATE col_name = DEFAULT could result in
a server crash. (Bug#39002)
Column names constructed due to wild-card expansion done inside a stored procedure could point to freed memory if the expansion
was performed after the first call to the stored procedure. (Bug#38823)
Repeated CREATE TABLE ... SELECT statements, where the created table contained an AUTO_INCREMENT column, could
lead to an assertion failure. (Bug#38821)
For deadlock between two transactions that required a timeout to resolve, all server tables became inaccessible for the duration of
the deadlock. (Bug#38804)
When inserting a string into a duplicate-key error message, the server could improperly interpret the string, resulting in a crash.
(Bug#38701)
A race condition between threads sometimes caused unallocated memory to be addressed. (Bug#38692)
A server crash resulted from concurrent execution of a multiple-table UPDATE that used a NATURAL or USING join together with
FLUSH TABLES WITH READ LOCK or ALTER TABLE for the table being updated. (Bug#38691)
On ActiveState Perl, mysql-test-run.pl --start-and-exit started but did not exit. (Bug#38629)
An uninitialized variable in the query profiling code was corrected (detected by Valgrind). (Bug#38560)
A server crash resulted from execution of an UPDATE that used a derived table together with FLUSH TABLES. (Bug#38499)
Stored procedures involving substrings could crash the server on certain platforms due to invalid memory reads. (Bug#38469)
The handlerton-to-plugin mapping implementation did not free handler plugin references when the plugin was uninstalled, resulting
in a server crash after several install/uninstall cycles. Also, on Mac OS X, the server crashed when trying to access an EXAMPLE ta-
ble after the EXAMPLE plugin was installed. (Bug#37958)
The server crashed if an argument to a stored procedure was a subquery that returned more than one row. (Bug#37949)
When analyzing the possible index use cases, the server was incorrectly reusing an internal structure, leading to a server crash.
(Bug#37943)
Access checks were skipped for SHOW PROCEDURE STATUS and SHOW FUNCTION STATUS, which could lead to a server
crash or insufficient access checks in subsequent statements. (Bug#37908)
The <=> operator could return incorrect results when comparing NULL to DATE, TIME, or DATETIME values. (Bug#37526)
The combination of a subquery with a GROUP BY, an aggregate function calculated outside the subquery, and a GROUP BY on the
outer SELECT could cause the server to crash. (Bug#37348)
The NO_BACKSLASH_ESCAPES SQL mode was ignored for LOAD DATA INFILE and SELECT INTO ... OUTFILE. The
setting is taken into account now. (Bug#37114)
In some cases, references to views were confused with references to anonymous tables and privilege checking was not performed.
(Bug#36086)
For crash reports on Windows, symbol names in stack traces were not correctly resolved. (Bug#35987)
ALTER EVENT changed the PRESERVE attribute of an event even when PRESERVE was not specified in the statement.
(Bug#35981)
MySQL Change History
2859
Host name values in SQL statements were not being checked for '@', which is illegal according to RFC952. (Bug#35924)
mysql_install_db failed on machines that had the host name set to localhost. (Bug#35754)
Dynamic plugins failed to load on i5/OS. (Bug#35743)
With the PAD_CHAR_TO_FULL_LENGTH SQL mode enabled, a ucs2 CHAR column returned additional garbage after trailing
space characters. (Bug#35720)
With binary logging enabled, CREATE TABLE ... SELECT failed if the source table was a log table. (Bug#34306)
A trigger for an InnoDB table activating multiple times could lead to AUTO_INCREMENT gaps. (Bug#31612)
mysqldump could fail to dump views containing a large number of columns. (Bug#31434)
The server could improperly type user-defined variables used in the select list of a query. (Bug#26020)
For access to the INFORMATION_SCHEMA.VIEWS table, the server did not check the SHOW VIEW and SELECT privileges, lead-
ing to inconsistency between output from that table and the SHOW CREATE VIEW statement. (Bug#22763)
mysqld_safe would sometimes fail to remove the pid file for the old mysql process after a crash. As a result, the server would
fail to start due to a false A mysqld process already exists... error. (Bug#11122)
C.1.10. Changes in MySQL 5.1.28 (28 August 2008)
Functionality added or changed:
Important Change: mysqlbinlog now supports --verbose and --base64-output=DECODE-ROWS options to display
row events as commented SQL statements. (The default otherwise is to display row events encoded as base-64 strings using BIN-
LOG statements.) See Section 4.6.7.2, mysqlbinlog Row Event Display. (Bug#31455)
MySQL source distributions are now available in Zip format. (Bug#27742)
Added the SHOW PROFILES and SHOW PROFILE statements to display statement profile data, and the accompanying INFORM-
ATION_SCHEMA.PROFILING table. Profiling is controlled via the profiling and profiling_history_size session
variables. see Section 12.5.5.33, SHOW PROFILES Syntax, and Section 20.26, The INFORMATION_SCHEMA PROFILING
Table. (Community contribution by Jeremy Cole)
The profiling feature is enabled via the --enable-community-features and --enable-profiling options to con-
figure. These options are enabled by default; to disable them, use --disable-community-features and -
-disable-profiling. (Bug#24795)
Bugs fixed:
Important Change: Security Fix: Additional corrections were made for the symlink-related privilege problem originally addressed
in MySQL 5.1.24. The original fix did not correctly handle the data directory path name if it contained symlinked directories in its
path, and the check was made only at table-creation time, not at table-opening time later. (Bug#32167, CVE-2008-2079)
See also Bug#39277.
Security Enhancement: The server consumed excess memory while parsing statements with hundreds or thousands of nested
boolean conditions (such as OR (OR ... (OR ... ))). This could lead to a server crash or incorrect statement execution, or
cause other client statements to fail due to lack of memory. The latter result constitutes a denial of service. (Bug#38296)
Incompatible Change: There were some problems using DllMain() hook functions on Windows that automatically do global
and per-thread initialization for libmysqld.dll:
Per-thread initialization: MySQL internally counts the number of active threads, which causes a delay in my_end() if not all
threads have exited. But there are threads that can be started either by Windows internally (often in TCP/IP scenarios) or by
users. Those threads do not necessarily use libmysql.dll functionality but still contribute to the open-thread count. (One
symptom is a five-second delay in times for PHP scripts to finish.)
MySQL Change History
2860
Process-initialization: my_init() calls WSAStartup that itself loads DLLs and can lead to a deadlock in the Windows load-
er.
To correct these problems, DLL initialization code now is not invoked from libmysql.dll by default. To obtain the previous be-
havior (DLL initialization code will be called), set the LIBMYSQL_DLLINIT environment variable to any value. This variable ex-
ists only to prevent breakage of existing Windows-only applications that do not call mysql_thread_init() and work okay
today. Use of LIBMYSQL_DLLINIT is discouraged and is removed in MySQL 6.0. (Bug#37226, Bug#33031)
Incompatible Change: Some performance problems of SHOW ENGINE INNODB STATUS were reduced by removing used
cells and Total number of lock structs in row lock hash table from the output. Now these values are
present only if the UNIV_DEBUG symbol is defined at MySQL build time. (Bug#36941, Bug#36942)
Incompatible Change: SHOW STATUS took a lot of CPU time for calculating the value of the In-
nodb_buffer_pool_pages_latched status variable. Now this variable is calculated and included in the output of SHOW
STATUS only if the UNIV_DEBUG symbol is defined at MySQL build time. (Bug#36600)
Incompatible Change: An additional correction to the original MySQL 5.1.23 fix was made to normalize directory names before
adding them to the list of directories. This prevents /etc/ and /etc from being considered different, for example. (Bug#20748)
See also Bug#38180.
Partitioning: When a partitioned table had a TIMESTAMP column defined with CURRENT_TIMESTAMP as the default but with no
ON UPDATE clause, the column's value was incorrectly set to CURRENT_TIMESTAMP when updating across partitions.
(Bug#38272)
Partitioning: myisamchk failed with an assertion error when analyzing a partitioned MyISAM table. (Bug#37537)
Partitioning: A LIST partitioned MyISAM table returned erroneous results when an index was present on a column in the WHERE
clause and NOT IN was used on that column.
Searches using the index were also much slower then if the index were not present. (Bug#35931)
Partitioning: SELECT COUNT(*) was not correct for some partitioned tables using a storage engine that did not support
HA_STATS_RECORDS_IS_EXACT. Tables using the ARCHIVE storage engine were known to be affected.
This was because ha_partition::records() was not implemented, and so the default handler::records() was used
in its place. However, this is not correct behavior if the storage engine does not support HA_STATS_RECORDS_IS_EXACT.
The solution was to implement ha_partition::records() as a wrapper around the underlying partition records.
As a result of this fix, the rows column in the output of EXPLAIN PARTITIONS now includes the total number of records in the
partitioned table. (Bug#35745)
Partitioning: MyISAM recovery enabled with the --myisam-recover option did not work for partitioned MyISAM tables.
(Bug#35161)
Partitioning: When one user was in the midst of a transaction on a partitioned table, a second user performing an ALTER TABLE
on this table caused the server to hang. (Bug#34604)
Replication: Some kinds of internal errors, such as OUT OF MEMORY errors, could cause the server to crash when replicating state-
ments with user variables.
certain internal errors. (Bug#37150)
Replication: Row-based replication did not correctly copy TIMESTAMP values from a big-endian storage engine to a little-endian
storage engine. (Bug#37076)
Replication: INSTALL PLUGIN and UNINSTALL PLUGIN caused row-based replication to fail.
Note
These statements are not replicated; however, when using row-based logging, the changes they introduce in the mysql
system tables are written to the binary log.
(Bug#35807)
MySQL Change History
2861
Server-side cursors were not initialized properly, which could cause a server crash. (Bug#38486)
A server crash or Valgrind warnings could result when a stored procedure selected from a view that referenced a function.
(Bug#38291)
A failure to clean up binary log events was corrected (detected by Valgrind). (Bug#38290)
Incorrect handling of aggregate functions when loose index scan was used caused a server crash. (Bug#38195)
Queries containing a subquery with DISTINCT and ORDER BY could cause a server crash. (Bug#38191)
Over-aggressive lock acquisition by InnoDB when calculating free space for tablespaces could result in performance degradation
when multiple threads were executing statements on multi-core machines. (Bug#38185)
The fix for Bug#20748 caused a problem such that on Unix, MySQL programs looked for options in ~/my.cnf rather than the
standard location of ~/.my.cnf. (Bug#38180)
If the table definition cache contained tables with many BLOB columns, much memory could be allocated to caching BLOB values.
Now a size limit on the cached BLOB values is enforced. (Bug#38002)
For InnoDB tables, ORDER BY ... DESC sometimes returned results in ascending order. (Bug#37830)
If a table has a BIT NOT NULL column c1 with a length shorter than 8 bits and some additional NOT NULL columns c2, ..., and
a SELECT query has a WHERE clause of the form (c1 = constant) AND c2 ..., the query could return an unexpected res-
ult set. (Bug#37799)
The server returned unexpected results if a right side of the NOT IN clause consisted of the NULL value and some constants of the
same type. For example, this query might return 3, 4, 5, and so forth if a table contained those values:
SELECT * FROM t WHERE NOT t.id IN (NULL, 1, 2);
(Bug#37761)
Setting the session value of the innodb_table_locks system variable caused a server crash. (Bug#37669)
Nesting of IF() inside of SUM() could cause an extreme server slowdown. (Bug#37662)
Killing a query that used an EXISTS subquery as the argument to SUM() or AVG() caused a server crash. (Bug#37627)
When using indexed ORDER BY sorting, incorrect query results could be produced if the optimizer switched from a covering index
to a noncovering index. (Bug#37548)
After TRUNCATE TABLE for an InnoDB table, inserting explicit values into an AUTO_INCREMENT column could fail to incre-
ment the counter and result in a duplicate-key error for subsequent insertion of NULL. (Bug#37531)
Within stored programs or prepared statements, REGEXP could return incorrect results due to improper initialization. (Bug#37337)
For a MyISAM table with CHECKSUM = 1 and ROW_FORMAT = DYNAMIC table options, a data consistency check (maximum
record length) could fail and cause the table to be marked as corrupted. (Bug#37310)
The max_length result set metadata value was calculated incorrectly under some circumstances. (Bug#37301)
If the length of a field was 3, internal InnoDB to integer type conversion didn't work on big-endian machines in the
row_search_autoinc_column() function. (Bug#36793)
A query which had an ORDER BY DESC clause that is satisfied with a reverse range scan could cause a server crash for some spe-
cific CPU/compiler combinations. (Bug#36639)
The CSV storage engine returned success even when it failed to open a table's data file. (Bug#36638)
SELECT DISTINCT from a simple view on an InnoDB table, where all selected columns belong to the same unique index key,
returned incorrect results. (Bug#36632)
Dumping information about locks in use by sending a SIGHUP signal to the server or by invoking the mysqladmin debug com-
mand could lead to a server crash in debug builds or to undefined behavior in production builds. (Bug#36579)
MySQL Change History
2862
If initialization of an INFORMATION_SCHEMA plugin failed, INSTALL PLUGIN freed some internal plugin data twice.
(Bug#36399)
For InnoDB tables, the DATA_FREE column of the INFORMATION_SCHEMA.TABLES displayed free space in kilobytes rather
than bytes. Now it displays bytes. (Bug#36278)
When the fractional part in a multiplication of DECIMAL values overflowed, the server truncated the first operand rather than the
longest. Now the server truncates so as to produce more precise multiplications. (Bug#36270)
The mysql client failed to recognize comment lines consisting of -- followed by a newline. (Bug#36244)
The server could crash with an assertion failure (or cause the client to get a Packets out of order error) when the expected query
result was that it should terminate with a Subquery returns more than 1 row error. (Bug#36135)
The UUID() function returned UUIDs with the wrong time; this was because the offset for the time part in UUIDs was miscalcu-
lated. (Bug#35848)
The configure script did not allow utf8_hungarian_ci to be specified as the default collation. (Bug#35808)
On 64-bit systems, assigning values of 2
63
1 or larger to key_buffer_size caused memory overruns. (Bug#35616)
For InnoDB tables, REPLACE statements used traditional style locking, regardless of the setting of in-
nodb_autoinc_lock_mode. Now REPLACE works the same way as simple inserts instead of using the old locking al-
gorithm. (REPLACE statements are treated in the same way as as INSERT statements.) (Bug#35602)
Freeing of an internal parser stack during parsing of complex stored programs caused a server crash. (Bug#35577, Bug#37269,
Bug#37228)
mysqlbinlog left temporary files on the disk after shutdown, leading to the pollution of the temporary directory, which eventu-
ally caused mysqlbinlog to fail. This caused problems in testing and other situations where mysqlbinlog might be invoked
many times in a relatively short period of time. (Bug#35543)
Index scans performed with the sort_union() access method returned wrong results, caused memory to be leaked, and caused
temporary files to be deleted when the limit set by sort_buffer_size was reached. (Bug#35477, Bug#35478)
Table checksum calculation could cause a server crash for FEDERATED tables with BLOB columns containing NULL values.
(Bug#34779)
A significant slowdown occurred when many SELECT statements that return many rows from InnoDB tables were running concur-
rently. (Bug#34409)
mysql_install_db failed if the server was running with an SQL mode of TRADITIONAL. This program now resets the SQL
mode internally to avoid this problem. (Bug#34159)
Changes to build files were made to enable the MySQL distribution to compile on Microsoft Visual C++ Express 2008.
(Bug#33907)
Fast ALTER TABLE operations were not fast for columns that used multibyte character sets. (Bug#33873)
The internal functions my_getsystime(), my_micro_time(), and my_micro_time_and_time() did not work cor-
rectly on Windows. One symptom was that uniqueness of UUID() values could be compromised. (Bug#33748)
Cached queries that used 256 or more tables were not properly cached, so that later query invalidation due to a TRUNCATE TABLE
for one of the tables caused the server to hang. (Bug#33362)
mysql_upgrade attempted to use the /proc file system even on systems that do not have it. (Bug#31605)
mysql_install_db failed if the default storage engine was NDB. Now it explicitly uses MyISAM as the storage engine when
running mysqld --bootstrap. (Bug#31315)
Several MySQL programs could fail if the HOME environment variable had an empty value. (Bug#30394)
On NetWare, mysql_install_db could appear to execute normally even if it failed to create the initial databases. (Bug#30129)
The Serbian translation for the ER_INCORRECT_GLOBAL_LOCAL_VAR error was corrected. (Bug#29738)
MySQL Change History
2863
TRUNCATE TABLE for InnoDB tables returned a count showing too many rows affected. Now the statement returns 0 for In-
noDB tables. (Bug#29507)
The BUILD/check-cpu build script failed if gcc had a different name (such as gcc.real on Debian). (Bug#27526)
In some cases, the parser interpreted the ; character as the end of input and misinterpreted stored program definitions. (Bug#26030)
The FLUSH PRIVILEGES statement did not produce an error when it failed. (Bug#21226)
After executing a prepared statement that accesses a stored function, the next execution would fail to find the function if the stored
function cache was flushed in the meantime. (Bug#12093, Bug#21294)
C.1.11. Changes in MySQL 5.1.27 (Not released)
Functionality added or changed:
mysqltest now installs signal handlers and generates a stack trace if it crashes. (Bug#37003)
mysql-test-run.pl now supports --client-bindir and --client-libdir options for specifying the directory where
client binaries and libraries are located. (Bug#34995)
Bugs fixed:
Partitioning: Incompatible Change: On Mac OS X with lower_case_table_names = 2, the server could not read parti-
tioned tables whose names contained uppercase letters.
Partitioned tables using mixed case names should be renamed or dropped before upgrading to this version of the server on Mac OS
X. (Bug#37402)
Partitioning: Important Note: The statements ANALYZE TABLE, CHECK TABLE, OPTIMIZE TABLE, and REPAIR TABLE
are now supported for partitioned tables.
Also as a result of this fix, the following statements which were disabled in MySQL 5.1.24 have been re-enabled:
ALTER TABLE ... ANALYZE PARTITION
ALTER TABLE ... CHECK PARTITION
ALTER TABLE ... OPTIMIZE PARTITION
ALTER TABLE ... REPAIR PARTITION
(Bug#20129)
See also Bug#39434.
Replication: Issuing a DROP DATABASE while any temporary tables were open caused the server to switch to statement-based
mode. (Bug#38773)
Replication: The --replicate-*-table options were not evaluated correctly when replicating multi-table updates.
As a result of this fix, replication of multi-table updates no longer fails when an update references a missing table but does not up-
date any of its columns. (Bug#37051)
The fix for Bug#33812 had the side effect of causing the mysql client not to be able to read some dump files produced with
mysqldump. To address this, that fix was reverted. (Bug#38158)
C.1.12. Changes in MySQL 5.1.26 (30 June 2008)
Functionality added or changed:
MySQL Change History
2864
Important Change: Incompatible Change: The FEDERATED storage engine is now disabled by default in binary distributions.
The engine is still available and can be enabled by starting the server with the --federated option. (Bug#37069)
mysqltest was changed to be more robust in the case of a race condition that can occur for rapid disconnect/connect sequences
with the server. The account used by mysqltest could reach its allowed simultaneous-sessions user limit if the connect attempt
occurred before the server had fully processed the preceding disconnect. mysqltest now checks specificaly for a user-limits error
when it connects; if that error occurs, it delays briefly before retrying. (Bug#23921)
Bugs fixed:
Replication: Row-based replication broke for utf8 CHAR columns longer than 85 characters. (Bug#37426)
Replication: Performing an insert on a table having an AUTO_INCREMENT column and an INSERT trigger that was being replic-
ated from a master running MySQL 5.0 or any version of MySQL 5.1 up to and including MySQL 5.1.11 to a slave running MySQL
5.1.12 or later caused the replication slave to crash. (Bug#36443)
See also Bug#33029.
Some binary distributions had a duplicate -64bit suffix in the file name. (Bug#37623)
NOT IN subqueries that selected MIN() or MAX() values but produced an empty result could cause a server crash. (Bug#37004)
ha_innodb.so was incorrectly installed in the lib/mysql directory rather than in lib/mysql/plugin. (Bug#36434)
An empty bit-string literal (b'') caused a server crash. Now the value is parsed as an empty bit value (which is treated as an empty
string in string context or 0 in numeric context). (Bug#35658)
The code for detecting a byte order mark (BOM) caused mysql to crash for empty input. (Bug#35480)
The mysql client incorrectly parsed statements containing the word delimiter in mid-statement.
The fix for this bug had the side effect of causing the problem reported in Bug#38158, so it was reverted in MySQL 5.1.27.
(Bug#33812)
C.1.13. Changes in MySQL 5.1.25 (28 May 2008)
Functionality added or changed:
Incompatible Change: A change has been made to the way that the server handles prepared statements. This affects prepared state-
ments processed at the SQL level (using the PREPARE statement) and those processed using the binary client-server protocol (using
the mysql_stmt_prepare() C API function).
Previously, changes to metadata of tables or views referred to in a prepared statement could cause a server crash when the statement
was next executed, or perhaps an error at execute time with a crash occurring later. For example, this could happen after dropping a
table and recreating it with a different definition.
Now metadata changes to tables or views referred to by prepared statements are detected and cause automatic repreparation of the
statement when it is next executed. Metadata changes occur for DDL statements such as those that create, drop, alter, rename, or
truncate tables, or that analyze, optimize, or repair tables. Repreparation also occurs after referenced tables or views are flushed
from the table definition cache, either implicitly to make room for new entries in the cache, or explicitly due to FLUSH TABLES.
Repreparation is automatic, but to the extent that it occurs, performance of prepared statements is diminished.
Table content changes (for example, with INSERT or UPDATE) do not cause repreparation, nor do SELECT statements.
An incompatibility with previous versions of MySQL is that a prepared statement may now return a different set of columns or dif-
ferent column types from one execution to the next. For example, if the prepared statement is SELECT * FROM t1, altering t1
to contain a different number of columns causes the next execution to return a number of columns different from the previous exe-
cution.
Older versions of the client library cannot handle this change in behavior. For applications that use prepared statements with the new
server, an upgrade to the new client library is strongly recommended.
MySQL Change History
2865
Along with this change to statement repreparation, the default value of the table_definition_cache system variable has
been increased from 128 to 256. The purpose of this increase is to lessen the chance that prepared statements will need repreparation
due to referred-to tables/views having been flushed from the cache to make room for new entries.
A new status variable, Com_stmt_reprepare, has been introduced to track the number of repreparations. (Bug#27420,
Bug#27430, Bug#27690)
Important Change: Some changes were made to CHECK TABLE ... FOR UPGRADE and REPAIR TABLE with respect to de-
tection and handling of tables with incompatible .frm files (files created with a different version of the MySQL server). These
changes also affect mysqlcheck because that program uses CHECK TABLE and REPAIR TABLE, and thus also
mysql_upgrade because that program invokes mysqlcheck.
If your table was created by a different version of the MySQL server than the one you are currently running, CHECK TABLE
... FOR UPGRADE indicates that the table has an .frm file with an incompatible version. In this case, the result set returned
by CHECK TABLE contains a line with a Msg_type value of error and a Msg_text value of Table upgrade re-
quired. Please do "REPAIR TABLE `tbl_name`" to fix it!
REPAIR TABLE without USE_FRM upgrades the .frm file to the current version.
If you use REPAIR TABLE ...USE_FRM and your table was created by a different version of the MySQL server than the
one you are currently running, REPAIR TABLE will not attempt to repair the table. In this case, the result set returned by RE-
PAIR TABLE contains a line with a Msg_type value of error and a Msg_text value of Failed repairing incom-
patible .FRM file.
Previously, use of REPAIR TABLE ...USE_FRM with a table created by a different version of the MySQL server risked the
loss of all rows in the table.
(Bug#36055)
mysql_upgrade now has a --tmpdir option to enable the location of temporary files to be specified. (Bug#36469)
mysqldump now adds the LOCAL qualifier to the FLUSH TABLES statement that is sent to the server when the -
-master-data option is enabled. This prevents the FLUSH TABLES statement from replicating to slaves, which is disadvant-
ageous because it would cause slaves to block while the statement executes. (Bug#35157)
See also Bug#38303.
Bugs fixed:
Important Change: The server no longer issues warnings for truncation of excess spaces for values inserted into CHAR columns.
This reverts a change in the previous release that caused warnings to be issued. (Bug#30059)
Replication: CREATE PROCEDURE and CREATE FUNCTION statements containing extended comments were not written to the
binary log correctly, causing parse errors on the slave. (Bug#36570)
See also Bug#32575.
Replication: When flushing tables, there was a slight chance that the flush occurred between the processing of one table map event
and the next. Since the tables were opened one by one, subsequent locking of tables would cause the slave to crash. This problem
was observed when replicating NDBCLUSTER or InnoDB tables, when executing multi-table updates, and when a trigger or a
stored routine performed an (additional) insert on a table so that two tables were effectively being inserted into in the same state-
ment. (Bug#36197)
Replication: CREATE VIEW statements containing extended comments were not written to the binary log correctly, causing parse
errors on the slave. Now, all comments are stripped from such statements before being written to the binary log. (Bug#32575)
See also Bug#36570.
On Windows 64-bit systems, temporary variables of long types were used to store ulong values, causing key cache initialization
to receive distorted parameters. The effect was that setting key_buffer_size to values of 2GB or more caused memory exhaus-
tion to due allocation of too much memory. (Bug#36705)
Multiple-table UPDATE statements that used a temporary table could fail to update all qualifying rows or fail with a spurious duplic-
MySQL Change History
2866
ate-key error. (Bug#36676)
A REGEXP match could return incorrect rows when the previous row matched the expression and used CONCAT() with an empty
string. (Bug#36488)
mysqltest ignored the value of --tmpdir in one place. (Bug#36465)
When updating an existing instance (for example, from MySQL 5.0 to 5.1, or 5.1 to 6.0), the Instance Configuration Wizard unne-
cessarily prompted for a root password when there was an existing root password. (Bug#36305)
Conversion of a FLOAT ZEROFILL value to string could cause a server crash if the value was NULL. (Bug#36139)
On Windows, the installer attempted to use JScript to determine whether the target data directory already existed. On Windows
Vista x64, this resulted in an error because the installer was attempting to run the JScript in a 32-bit engine, which wasn't registered
on Vista. The installer no longer uses JScript but instead relies on a native WiX command. (Bug#36103)
mysqltest was performing escape processing for the --replace_result command, which it should not have been.
(Bug#36041)
An error in calculation of the precision of zero-length items (such as NULL) caused a server crash for queries that employed tempor-
ary tables. (Bug#36023)
For EXPLAIN EXTENDED, execution of an uncorrelated IN subquery caused a crash if the subquery required a temporary table for
its execution. (Bug#36011)
The MERGE storage engine did a table scan for SELECT COUNT(*) statements when it could calculate the number of records
from the underlying tables. (Bug#36006)
The server crashed inside NOT IN subqueries with an impossible WHERE or HAVING clause, such as NOT IN (SELECT ...
FROM t1, t2, ... WHERE 0). (Bug#36005)
The Event Scheduler was not designed to work under the embedded server. It is now disabled for the embedded server, and the
event_scheduler system variable is not displayed. (Bug#35997)
Grouping or ordering of long values in unindexed BLOB or TEXT columns with the gbk or big5 character set crashed the server.
(Bug#35993)
SET GLOBAL debug='' resulted in a Valgrind warning in DbugParse(), which was reading beyond the end of the control
string. (Bug#35986)
The prefer full scan on clustered primary key over full scan of any secondary key optimizer rule introduced by Bug#26447 caused
a performance regression for some queries, so it has been disabled. (Bug#35850)
The server ignored any covering index used for ref access of a table in a query with ORDER BY if this index was incompatible
with the ORDER BY list and there was another covering index compatible with this list. As a result, suboptimal execution plans
were chosen for some queries that used an ORDER BY clause. (Bug#35844)
mysql_upgrade did not properly update the mysql.event table. (Bug#35824)
An incorrect error and message was produced for attempts to create a MyISAM table with an index (.MYI) file name that was
already in use by some other MyISAM table that was open at the same time. For example, this might happen if you use the same
value of the INDEX DIRECTORY table option for tables belonging to different databases. (Bug#35733)
Enabling the read_only system variable while autocommit mode was enabled caused SELECT statements for transactional stor-
age engines to fail. (Bug#35732)
The combination of GROUP_CONCAT(), DISTINCT, and LEFT JOIN could crash the server when the right table is empty.
(Bug#35298)
Some binaries produced stack corruption messages due to being built with versions of bison older than 2.1. Builds are now created
using bison 2.3. (Bug#34926)
The log_output system variable could be set to an illegal value. (Bug#34820)
On Windows 64-bit builds, an apparent compiler bug caused memory overruns for code in innobase/mem/*. Removed optimiz-
ations so as not to trigger this problem. (Bug#34297)
MySQL Change History
2867
Several additional configuration scripts in the BUILD directory now are included in source distributions. These may be useful for
users who wish to build MySQL from source. (See Section 2.10.3, Installing from the Development Source Tree, for information
about what they do.) (Bug#34291)
Executing a FLUSH PRIVILEGES statement after creating a temporary table in the mysql database with the same name as one of
the MySQL system tables caused the server to crash.
Note
While it is possible to shadow a system table in this way, the temporary table exists only for the current user and connec-
tion, and does not effect any user privileges.
(Bug#33275)
UNION constructs cannot contain SELECT ... INTO except in the final SELECT. However, if a UNION was used in a subquery
and an INTO clause appeared in the top-level query, the parser interpreted it as having appeared in the UNION and raised an error.
(Bug#32858)
Assignment of relative path names to general_log_file or slow_query_log_file did not always work. (Bug#32748)
The mysql.servers table was not created during installation on Windows. (Bug#28680, Bug#32797)
The jp test suite was not working. (Bug#28563)
The internal init_time() library function was renamed to my_init_time() to avoid conflicts with external libraries.
(Bug#26294)
The parser used signed rather than unsigned values in some cases that caused legal lengths in column declarations to be rejected.
(Bug#15776)
C.1.14. Changes in MySQL 5.1.24 (08 April 2008)
Functionality added or changed:
Important Change: MySQL Cluster: Packaging: Beginning with this release, standard MySQL 5.1 binaries are no longer built
with support for the NDBCLUSTER storage engine, and the NDBCLUSTER code included in 5.1 mainline sources is no longer guar-
anteed to be maintained or supported. Those using MySQL Cluster in MySQL 5.1.23 and earlier MySQL 5.1 mainline releases
should upgrade to MySQL Cluster NDB 6.2.15 or a later MySQL Cluster NDB 6.2 or 6.3 release. (Bug#36193)
Important Change: The FEDERATED storage engine is not included in binary distributions of MySQL 5.1.24. (It will be included
again in 5.1.25.)
Replication: Introduced the slave_exec_mode system variable to control whether idempotent or strict mode is used for replica-
tion conflict resolution. Idempotent mode suppresses duplicate-key, no-key-found, and some other errors, and is needed for circular
replication, multi-master replication, and some other complex replication setups when using MySQL Cluster. Strict mode is the de-
fault. (Bug#31609)
Replication: When running the server with --binlog-format=MIXED or --binlog-format=STATEMENT, a query that re-
ferred to a system variable used the slave's value when replayed on the slave. This meant that, if the value of a system variable was
inserted into a table, the slave differed from the master. Now, statements that refer to a system variable are marked as unsafe,
which means that:
When the server is using --binlog-format=MIXED, the row-based format is used automatically to replicate these state-
ments.
When the server is using --binlog-format=STATEMENT, these statements produce a warning.
(Bug#31168)
See also Bug#34732.
The PROCESS privilege now is required to start or stop the InnoDB monitor tables (see Section 13.6.13.2, SHOW ENGINE IN-
NODB STATUS and the InnoDB Monitors). Previously, no privilege was required. (Bug#34053)
For binary .tar.gz packages, mysqld and other binaries now are compiled with debugging symbols included to enable easier
MySQL Change History
2868
use with a debugger. If you do not need debugging symbols and are short on disk space, you can use strip to remove the symbols
from the binaries. (Bug#33252)
Formerly, when the MySQL server crashed, the generated stack dump was numeric and required external tools to properly resolve
the names of functions. This is not very helpful to users having a limited knowledge of debugging techniques. In addition, the gener-
ated stack trace contained only the names of functions and was formatted differently for each platform due to different stack layouts.
Now it is possible to take advantage of newer versions of the GNU C Library provide a set of functions to obtain and manipulate
stack traces from within the program. On systems that use the ELF binary format, the stack trace contains important information
such as the shared object where the call was generated, an offset into the function, and the actual return address. Having the function
name also makes possible the name demangling of C++ functions.
The library generates meaningful stack traces on the following platforms: i386, x86_64, PowerPC, IA64, Alpha, and S390. On other
platforms, a numeric stack trace is still produced, and the use of the resolve_stack_dump utility is still required. (Bug#31891)
mysqltest now has mkdir and rmdir commands for creating and removing directories. (Bug#31004)
The server uses less memory when loading privileges containing table grants. (Patch provided by Google.) (Bug#25175)
Added the Uptime_since_flush_status status variable, which indicates the number of seconds since the most recent
FLUSH STATUS statement. (Community contribution by Jeremy Cole) (Bug#24822)
SHOW OPEN TABLES now supports FROM and LIKE clauses. (Bug#12183)
The new read-only global system variables report_host, report_password, report_port, and report_user system
variables provide runtime access to the values of the corresponding --report-host, --report-password, -
-report-port, and --report-user options.
Formerly it was possible to specify an innodb_flush_method value of fdatasync to obtain the default flush behavior of us-
ing fdatasync() for flushing. This is no longer possible because it can be confusing that a value of fdatasync causes use of
fsync() rather than fdatasync().
The use of InnoDB hash indexes now can be controlled by setting the new innodb_adaptive_hash_index system variable
at server startup. By default, this variable is enabled. See Section 13.6.10.4, Adaptive Hash Indexes.
Bugs fixed:
Important Change: Security Fix: It was possible to circumvent privileges through the creation of MyISAM tables employing the
DATA DIRECTORY and INDEX DIRECTORY options to overwrite existing table files in the MySQL data directory. Use of the
MySQL data directory in DATA DIRECTORY and INDEX DIRECTORY is now disallowed. This is now also true of these options
when used with partitioned tables and individual partitions of such tables.
Note
Additional fixes were made in MySQL 5.1.28.
(Bug#32167, CVE-2008-2079)
See also Bug#39277.
Security Fix: A client that connects to a malicious server could be tricked by the server into sending files from the client host to the
server. This occurs because the libmysqlclient client library would respond to a FETCH LOCAL FILE request from the
server even if the request is sent for statements from the client other than LOAD DATA LOCAL INFILE. The client library has
been modified to respond to a FETCH LOCAL FILE request from the server only if is is sent in response to a LOAD DATA LOC-
AL INFILE statement from the client.
The client library now also checks whether CLIENT_LOCAL_FILE is set and refuses to send a local file if not.
Note
Binary distributions ship with the local-infile capability enabled. Applications that do not use this functionality
should disable it to be safe.
(Bug#29605)
MySQL Change History
2869
Important Change: Security Enhancement: On Windows Vista and Windows Server 2008, a user without administrative priv-
ileges does not have write permissions to the Program Files directory where MySQL and the associated data files are normally
installed. Using data files located in the standard Program Files installation directory could therefore cause MySQL to fail, or
lead to potential security issues in an installed instance.
To address the problem, on Windows XP, Windows Vista and Windows Server 2008, the datafiles and data file configuration are
now set to the Microsoft recommended AppData folder. The AppData folder is typically located within the user's home directory.
Important
When upgrading an existing 5.1.23 or 6.0.4 installation of MySQL you must take a backup of your data and configuration
file (my.ini before installing the new version. To migrate your data, either extract the data and re-import (using mysql-
dump, then upgrade and re-import using mysql), or back up your data, upgrade to the new version, and copy your exist-
ing data files from your old datadir directory to the new directory located within AppData.
Failure to back up your data and follow these procedures may lead to data loss.
(Bug#34593)
Incompatible Change: In MySQL 5.1.23, the last_errno and last_error members of the NET structure in mysql_com.h
were renamed to client_last_errno and client_last_error. This was found to cause problems for connectors that use
the internal NET structure for error handling. The change has been reverted. (Bug#34655)
See also Bug#12713.
Incompatible Change: It was possible to use FRAC_SECOND as a synonym for MICROSECOND with DATE_ADD(),
DATE_SUB(), and INTERVAL; now, using FRAC_SECOND with anything other than TIMESTAMPADD() or TIMESTAMP-
DIFF() produces a syntax error.
It is now possible (and preferable) to use MICROSECOND with TIMESTAMPADD() and TIMESTAMPDIFF(), and
FRAC_SECOND is now deprecated. (Bug#33834)
Incompatible Change: The UPDATE statement allowed NULL to be assigned to NOT NULL columns (the implicit default value for
the column data type was assigned). This was changed so that on error occurs.
This change was reverted, because the original report was determined not to be a bug: Assigning NULL to a NOT NULL column in
an UPDATE statement should produce an error only in strict SQL mode and set the column to the implicit default with a warning
otherwise, which was the original behavior. See Section 10.1.4, Data Type Default Values, and Bug#39265. (Bug#33699)
Incompatible Change: For packages that are built within their own prefix (for example, /usr/local/mysql) the plugin direct-
ory will be lib/plugin. For packages that are built to be installed into a system-wide prefix (such as RPM packages with a prefix
of /usr), the plugin directory will be lib/mysql/plugin to ensure a clean /usr/lib hierarchy. In both cases, the
$pkglibdir configuration setting is used at build time to set the plugin directory.
The current plugin directory location is available as the value of the plugin_dir system variable as before, but the
mysql_config script now has a --plugindir option that can be used externally to the server by third-party plugin writers to
obtain the default plugin directory path name and configure their installation directory appropriately. (Bug#31736)
Incompatible Change: The utf8_general_ci and ucs2_general_ci collations did not sort the letter "U+00DF SHARP S"
equal to 's'.
As a result of this bug fix, indexes must be rebuilt for columns that use the utf8_general_ci or ucs2_general_ci collation
for columns that contain SHARP S. See Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt. (Bug#27877)
See also Bug#37046.
Important Change: Replication: When the master crashed during an update on a transactional table while in autocommit mode,
the slave failed. This fix causes every transaction (including autocommit transactions) to be recorded in the binlog as starting
with a BEGIN and ending with a COMMIT or ROLLBACK. (Bug#26395)
Important Change: InnoDB free space information is now shown in the Data_free column of SHOW TABLE STATUS and in
the DATA_FREE column of the INFORMATION_SCHEMA.TABLES table. (Bug#32440)
See also Bug#11379.
Important Change: The server handled truncation of values having excess trailing spaces into CHAR, VARCHAR, and TEXT
MySQL Change History
2870
columns in different ways. This behavior has now been made consistent for columns of all three of these types, and now follows the
existing behavior of VARCHAR columns in this regard; that is, a Note is always issued whenever such truncation occurs.
This change does not affect columns of these three types when using a binary encoding; BLOB columns are also unaffected by the
change, since they always use a binary encoding. (Bug#30059)
Important Change: An AFTER UPDATE trigger was not invoked when the UPDATE did not make any changes to the table for
which the trigger was defined. Now AFTER UPDATE triggers behave the same in this regard as do BEFORE UPDATE triggers,
which are invoked whether the UPDATE makes any changes in the table or not. (Bug#23771)
Partitioning: Important Note: The following statements did not function correctly with corrupted or crashed tables and have been
disabled:
ALTER TABLE ... ANALYZE PARTITION
ALTER TABLE ... CHECK PARTITION
ALTER TABLE ... OPTIMIZE PARTITION
ALTER TABLE ... REPAIR PARTITION
ALTER TABLE ... REBUILD PARTITION is unaffected by this change and continues to be available. This statement and
ALTER TABLE ... REORGANIZE PARTITION may be used to analyze and optimize partitioned tables, since these operations
cause the partition files to be rebuilt. (Bug#20129)
See also Bug#39434.
Replication: Important Note: Network timeouts between the master and the slave could result in corruption of the relay log. This
fix rectifies a long-standing replication issue when using unreliable networks, including replication over wide area networks such as
the Internet. If you experience reliability issues and see many YOU HAVE AN ERROR IN YOUR SQL SYNTAX errors on replication
slaves, we strongly recommend that you upgrade to a MySQL version which includes this fix. (Bug#26489)
Partitioning: In some cases, matching rows from a partitioned MyISAM using a BIT column as the primary key were not found by
queries. (Bug#34358)
Partitioning: Enabling innodb_file_per_table produced problems with partitioning and tablespace operations on parti-
tioned InnoDB tables, in some cases leading to corrupt partitions or causing the server to crash. (Bug#33429)
Partitioning: A table defined using PARTITION BY KEY and having a BIT column referenced in the partitioning key did not be-
have correctly; some rows could be inserted into the wrong partition, causing wrong results to be returned from queries.
(Bug#33379)
Partitioning: For InnoDB tables, there was a race condition involving the data dictionary and repartitioning. (Bug#33349)
Partitioning: When ALTER TABLE DROP PARTITION was executed on a table on which there was a trigger, the statement
failed with an error. This occurred even if the trigger did not reference any tables. (Bug#32943)
Partitioning: Currently, all partitions of a partitioned table must use the same storage engine. One may optinally specify the storage
engine on a per-partition basis; however, where this is the done, the storage engine must be the same as used by the table as a whole.
ALTER TABLE did not enforce these rules correctly, the result being that incaccurate error messages were shown when trying to
use the statement to change the storage engine used by an individual partition or partitions. (Bug#31931)
Partitioning: Using the DATA DIRECTORY and INDEX DIRECTORY options for partitions with CREATE TABLE or ALTER
TABLE statements appeared to work on Windows, although they are not supported by MySQL on Windows systems, and sub-
sequent attempts to use the tables referenced caused errors. Now these options are disabled on Windows, and attempting to use them
generates a warning. (Bug#30459)
Replication: The failure of a CREATE TABLE ... ENGINE=InnoDB ... SELECT statement caused the slave to lose data.
(Bug#35762)
Replication: When using row-based replication, a slave could crash at startup because it received a row-based replication event that
InnoDB could not handle due to an incorrect test of the query string provided by MySQL, which was NULL for row-based replica-
tion events. (Bug#35226)
Replication: insert_id was not written to the binary log for inserts into BLACKHOLE tables. (Bug#35178)
MySQL Change History
2871
Replication: When using statement-based replication and a DELETE, UPDATE, or INSERT ... SELECT statement using a
LIMIT clause is encountered, a warning that the statement is not safe to replicate in statement mode is now issued; when using
MIXED mode, the statement is now replicated using the row-based format. (Bug#34768)
Replication: mysqlbinlog did not output the values of auto_increment_increment and auto_increment_offset
when both were equal to their default values (for both of these variables, the default is 1). This meant that a binary log recorded by a
client using the defaults for both variables and then replayed on another client using its own values for either or both of these vari-
ables produced erroneous results. (Bug#34732)
See also Bug#31168.
Replication: When the Windows version of mysqlbinlog read 4.1 binlogs containing LOAD DATA INFILE statements, it out-
put backslashes as path separators, causing problems for client programs expecting forward slashes. In such cases, it now converts
\\ to / in directory paths. (Bug#34355)
Replication: SHOW SLAVE STATUS failed when slave I/O was about to terminate. (Bug#34305)
Replication: The character sets and collations used for constant identifiers in stored procedures were not replicated correctly.
(Bug#34289)
Replication: mysqlbinlog from a 5.1 or later MySQL distribution could not read binary logs generated by a 4.1 server when the
logs contained LOAD DATA INFILE statements. (Bug#34141)
This regression was introduced by Bug#32407.
Replication: A CREATE USER, DROP USER, or RENAME USER statement that fails on the master, or that is a duplicate of any of
these statements, is no longer written to the binlog; previously, either of these occurrences could cause the slave to fail.
(Bug#33862)
See also Bug#29749.
Replication: SHOW BINLOG EVENTS could fail when the binlog contained one or more events whose size was close to the value
of max_allowed_packet. (Bug#33413)
Replication: An extraneous ROLLBACK statement was written to the binary log by a connection that did not use any transactional
tables. (Bug#33329)
Replication: mysqlbinlog failed to release all of its memory after terminating abnormally. (Bug#33247)
Replication: When a stored routine or trigger, running on a master that used MySQL 5.0 or MySQL 5.1.11 or earlier, performed an
insert on an AUTO_INCREMENT column, the insert_id value was not replicated correctly to a slave running MySQL 5.1.12 or
later (including any MySQL 6.0 release). (Bug#33029)
See also Bug#19630.
Replication: The error message generated due to lack of a default value for an extra column was not sufficiently informative.
(Bug#32971)
Replication: When a user variable was used inside an INSERT statement, the corresponding binlog event was not written to the
binlog correctly. (Bug#32580)
Replication: When using row-based replication, deletes from a table with a foreign key constraint failed on the slave. (Bug#32468)
Replication: The --base64-output option for mysqlbinlog was not honored for all types of events. This interfered in some
cases with performing point-in-time recovery. (Bug#32407)
Replication: SQL statements containing comments using -- syntax were not replayable by mysqlbinlog, even though such
statements replicated correctly. (Bug#32205)
Replication: When using row-based replication from a master running MySQL 5.1.21 or earlier to a slave running 5.1.22 or later,
updates of integer columns failed on the slave with ERROR IN UNKNOWN EVENT: ROW APPLICATION FAILED. (Bug#31583)
This regression was introduced by Bug#21842.
Replication: Replicating write, update, or delete events from a master running MySQL 5.1.15 or earlier to a slave running 5.1.16 or
MySQL Change History
2872
later caused the slave to crash. (Bug#31581)
Replication: When using row-based replication, the slave stopped when attempting to delete nonexistent rows from a slave table
without a primary key. In addition, no error was reported when this occurred. (Bug#31552)
Replication: Errors due to server ID conflicts were reported only in the slave's error log; now these errors are also shown in the
Server_IO_State column in the output of SHOW SLAVE STATUS. (Bug#31316)
Replication: STOP SLAVE did not stop connection attempts properly. If the IO slave thread was attempting to connect, STOP
SLAVE waited for the attempt to finish, sometimes for a long period of time, rather than stopping the slave immediately.
(Bug#31024)
See also Bug#30932.
Replication: Issuing a DROP VIEW statement caused replication to fail if the view did not actually exist. (Bug#30998)
Replication: Replication of LOAD DATA INFILE could fail when read_buffer_size was larger than
max_allowed_packet. (Bug#30435)
Replication: Replication crashed with the NDB storage engine when mysqld was started with -
-character-set-server=ucs2. (Bug#29562)
Replication: The effects of scheduled events were not always correctly reproduced on the slave when using row-based replication.
(Bug#29020)
Replication: Setting server_id did not update its value for the current session. (Bug#28908)
Replication: Some older servers wrote events to the binary log using different numbering from what is currently used, even though
the file format number in the file is the same. Slaves running MySQL 5.1.18 and later could not read these binary logs properly.
Binary logs from these older versions now are recognized and event numbers are mapped to the current numbering so that they can
be interpreted properly. (Bug#27779, Bug#32434)
This regression was introduced by Bug#22583.
Replication: MASTER_POS_WAIT() did not return NULL when the server was not a slave. (Bug#26622)
Replication: The inspecific error message WRONG PARAMETERS TO FUNCTION REGISTER_SLAVE resulted when START SLAVE
failed to register on the master due to excess length of any the slave server options --report-host, --report-user, or -
-report-password. An error message specific to each of these options is now returned in such cases. The new error messages
are:
FAILED TO REGISTER SLAVE: TOO LONG 'REPORT-HOST'
FAILED TO REGISTER SLAVE: TOO LONG 'REPORT-USER'
FAILED TO REGISTER SLAVE; TOO LONG 'REPORT-PASSWORD'
(Bug#22989)
See also Bug#19328.
Replication: START SLAVE UNTIL MASTER_LOG_POS=position issued on a slave that was using -
-log-slave-updates and that was involved in circular replication would cause the slave to run and stop one event later than
that specified by the value of position. (Bug#13861)
Replication: PURGE BINARY LOGS TO and PURGE BINARY LOGS BEFORE did not handle missing binary log files cor-
rectly or in the same way. Now for both of these statements, if any files listed in the .index file are missing from the file system,
the statement fails with an error.
Manually replacing a binary log file with a directory having the same name caused an error that was not handled correctly.
(Bug#35675)
Using LOAD DATA INFILE with a view could crash the server. (Bug#35469)
Selecting from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS could cause a server crash. (Bug#35406)
See also Bug#35108.
MySQL Change History
2873
For a TEMPORARY table, DELETE with no WHERE clause could fail when preceded by DELETE statements with a WHERE clause.
(Bug#35392)
If the server crashed with an InnoDB error due to unavailability of undo slots, errors could persist during rollback when the server
was restarted: There are two UNDO slot caches (for INSERT and UPDATE). If all slots end up in one of the slot caches, a request for
a slot from the other slot cache would fail. This can happen if the request is for an UPDATE slot and all slots are in the INSERT slot
cache, or vice versa. (Bug#35352)
In some cases, when too many clients tried to connect to the server, the proper SQLSTATE code was not returned. (Bug#35289)
Memory-allocation failures for attempts to set key_buffer_size to large values could result in a server crash. (Bug#35272)
For InnoDB tables, ALTER TABLE DROP failed if the name of the column to be dropped began with foreign. (Bug#35220)
Queries could return different results depending on whether ORDER BY columns were indexed. (Bug#35206)
When a view containing a reference to DUAL was created, the reference was removed when the definition was stored, causing some
queries against the view to fail with invalid SQL syntax errors. (Bug#35193)
SELECT ... FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS caused the server to crash if the table refer-
enced by a foreign key had been dropped. This issue was observed on Windows platforms only. (Bug#35108)
See also Bug#35406.
Debugging symbols were missing for some executables in Windows binary distributions. (Bug#35104)
Nonconnection threads were being counted in the value of the Max_used_connections status variable. (Bug#35074)
A query that performed a ref_or_null join where the second table used a key having one or columns that could be NULL and
had a column value that was NULL caused the server to crash. (Bug#34945)
This regression was introduced by Bug#12144.
For some queries, the optimizer used an ordered index scan for GROUP BY or DISTINCT when it was supposed to use a loose in-
dex scan, leading to incorrect results. (Bug#34928)
Creating a foreign key on an InnoDB table that was created with an explicit AUTO_INCREMENT value caused that value to be re-
set to 1. (Bug#34920)
mysqldump failed to return an error code when using the --master-data option without binary logging being enabled on the
server. (Bug#34909)
Under some circumstances, the value of mysql_insert_id() following a SELECT ... INSERT statement could return an
incorrect value. This could happen when the last SELECT ... INSERT did not involve an AUTO_INCREMENT column, but the
value of mysql_insert_id() was changed by some previous statements. (Bug#34889)
Table and database names were mixed up in some places of the subquery transformation procedure. This could affect debugging
trace output and further extensions of that procedure. (Bug#34830)
If fsync() returned ENOLCK, InnoDB could treat this as fatal and cause abnormal server termination. InnoDB now retries the
operation. (Bug#34823)
CREATE SERVER and ALTER SERVER could crash the server if out-of-memory conditions occurred. (Bug#34790)
DROP SERVER does not release memory cached for server structures created by CREATE SERVER, so repeated iterations of these
statements resulted in a memory leak. FLUSH PRIVILEGES now releases the memory allocated for CREATE SERVER.
(Bug#34789)
A malformed URL used for a FEDERATED table's CONNECTION option value in a CREATE TABLE statement was not handled
correctly and could crash the server. (Bug#34788)
Queries such as SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a (combining row constructors
and subqueries in the FROM clause) could lead to assertion failure or unexpected error messages. (Bug#34763)
Using NAME_CONST() with a negative number and an aggregate function caused MySQL to crash. This could also have a negative
impact on replication. (Bug#34749)
MySQL Change History
2874
A memory-handling error associated with use of GROUP_CONCAT() in subqueries could result in a server crash. (Bug#34747)
For an indexed integer column col_name and a value N that is one greater than the maximum value allowed for the data type of
col_name, conditions of the form WHERE col_name < N failed to return rows where the value of col_name is N - 1.
(Bug#34731)
A server running with the --debug option could attempt to dereference a null pointer when opening tables, resulting in a crash.
(Bug#34726)
Assigning an incremental value to the debug system variable did not add the new value to the current value. For example, if the
current debug value was 'T', the statement SET debug = '+P' resulted in a value of 'P' rather than the correct value of
'P:T'. (Bug#34678)
For debug builds, reading from INFORMATION_SCHEMA.TABLES or INFORMATION_SCHEMA.COLUMNS could cause asser-
tion failures. This could happen under rare circumstances when INFORMATION_SCHEMA fails to get information about a table (for
example, when a connection is killed). (Bug#34656)
Executing a TRUNCATE statement on a table having both a foreign key reference and a DELETE trigger crashed the server.
(Bug#34643)
Some subqueries using an expression that included an aggregate function could fail or in some cases lead to a crash of the server.
(Bug#34620)
Dangerous pointer arithmetic crashed the server on some systems. (Bug#34598)
Creating a view inside a stored procedure could lead to a crash of the MySQL Server. (Bug#34587)
A server crash could occur if INFORMATION_SCHEMA tables built in memory were swapped out to disk during query execution.
(Bug#34529)
CAST(AVG(arg) AS DECIMAL) produced incorrect results for non-DECIMAL arguments. (Bug#34512)
The per-thread debugging settings stack was not being deallocated before thread termination, resulting in a stack memory leak.
(Bug#34424)
Executing an ALTER VIEW statement on a table crashed the server. (Bug#34337)
InnoDB could crash if overflow occurred for an AUTO_INCREMENT column. (Bug#34335)
For InnoDB, exporting and importing a table could corrupt TINYBLOB columns, and a subsequent ALTER TABLE could corrupt
TINYTEXT columns as well. (Bug#34300)
DEFAULT 0 was not allowed for the YEAR data type. (Bug#34274)
Under some conditions, a SET GLOBAL innodb_commit_concurrency or SET GLOBAL in-
nodb_autoextend_increment statement could fail. (Bug#34223)
mysqldump attempts to set the character_set_results system variable after connecting to the server. This failed for pre-
4.1 servers that have no such variable, but mysqldump did not account for this and 1) failed to dump database contents; 2) failed to
produce any error message alerting the user to the problem. (Bug#34192)
Use of stored functions in the WHERE clause for SHOW OPEN TABLES caused a server crash. (Bug#34166)
For a FEDERATED table with an index on a nullable column, accessing the table could crash a server, return an incorrect result set,
or return ERROR 1030 (HY000): Got error 1430 from storage engine. (Bug#33946)
Passing anything other than a integer to a LIMIT clause in a prepared statement would fail. (This limitation was introduced to avoid
replication problems; for example, replicating the statement with a string argument would cause a parse failure in the slave). Now,
arguments to the LIMIT clause are converted to integer values, and these converted values are used when logging the statement.
(Bug#33851)
An internal buffer in mysql was too short. Overextending it could cause stack problems or segmentation violations on some archi-
tectures. (This is not a problem that could be exploited to run arbitrary code.) (Bug#33841)
A query using WHERE (column1='string1' AND column2=constant1) OR (column1='string2' AND
column2=constant2), where col1 used a binary collation and string1 matched string2 except for case, failed to match
MySQL Change History
2875
any records even when matches were found by a query using the equivalent clause WHERE column2=constant1 OR
column2=constant2. (Bug#33833)
Large unsigned integers were improperly handled for prepared statements, resulting in truncation or conversion to negative num-
bers. (Bug#33798)
Reuse of prepared statements could cause a memory leak in the embedded server. (Bug#33796)
The server crashed when executing a query that had a subquery containing an equality X=Y where Y referred to a named select list
expression from the parent select. The server crashed when trying to use the X=Y equality for ref-based access. (Bug#33794)
Some queries using a combination of IN, CONCAT(), and an implicit type conversion could return an incorrect result. (Bug#33764)
In some cases a query that produced a result set when using ORDER BY ASC did not return any results when this was changed to
ORDER BY DESC. (Bug#33758)
Disabling concurrent inserts caused some cacheable queries not to be saved in the query cache. (Bug#33756)
ORDER BY ... DESC sorts could produce misordered results. (Bug#33697)
The server could crash when REPEAT or another control instruction was used in conjunction with labels and a LEAVE instruction.
(Bug#33618)
The parser allowed control structures in compound statements to have mismatched beginning and ending labels. (Bug#33618)
make_binary_distribution passed the --print-libgcc-file option to the C compiler, but this does not work with
the ICC compiler. (Bug#33536)
Threads created by the event scheduler were incorrectly counted against the max_connections thread limit, which could lead to
client lockout. (Bug#33507)
Dropping a function after dropping the function's creator could cause the server to crash. (Bug#33464)
Certain combinations of views, subselects with outer references and stored routines or triggers could cause the server to crash.
(Bug#33389)
SET GLOBAL myisam_max_sort_file_size=DEFAULT set myisam_max_sort_file_size to an incorrect value.
(Bug#33382)
See also Bug#31177.
ENUM- or SET-valued plugin variables could not be set from the command line. (Bug#33358)
Loading plugins via command-line options to mysqld could cause an assertion failure. (Bug#33345)
SLEEP(0) failed to return on 64-bit Mac OS X due to a bug in pthread_cond_timedwait(). (Bug#33304)
Using Control-R in the mysql client caused it to crash. (Bug#33288)
For MyISAM tables, CHECK TABLE (non-QUICK) and any form of REPAIR TABLE incorrected treated rows as corrupted under
the combination of the following conditions:
The table had dynamic row format
The table had a CHAR (not VARCHAR) column longer than 127 bytes (for multi-byte character sets this could be less than 127
characters)
The table had rows with a signifcant length of more than 127 bytes significant length in that CHAR column (that is, a byte bey-
ond byte position 127 must be a nonspace character)
This problem affected CHECK TABLE, REPAIR TABLE, OPTIMIZE TABLE, ALTER TABLE. CHECK TABLE reported and
marked the table as crashed if any row was present that fulfilled the third condition. The other statements deleted these rows.
(Bug#33222)
Granting the UPDATE privilege on one column of a view caused the server to crash. (Bug#33201)
MySQL Change History
2876
For DECIMAL columns used with the ROUND(X,D) or TRUNCATE(X,D) function with a nonconstant value of D, adding an OR-
DER BY for the function result produced misordered output. (Bug#33143)
See also Bug#33402, Bug#30617.
The CSV engine did not honor update requests for BLOB columns when the new column value had the same length as the value to
be updated. (Bug#33067)
After receiving a SIGHUP signal, the server could crash, and user-specified log options were ignored when reopening the logs.
(Bug#33065)
When MySQL was built with OpenSSL, the SSL library was not properly initialized with information of which endpoint it was
(server or client), causing connection failures. (Bug#33050)
Under some circumstances a combination of aggregate functions and GROUP BY in a SELECT query over a view could lead to in-
correct calculation of the result type of the aggregate function. This in turn could lead to incorrect results, or to crashes on debug
builds of the server. (Bug#33049)
For DISTINCT queries, 4.0 and 4.1 stopped reading joined tables as soon as the first matching row was found. However, this op-
timization was lost in MySQL 5.0, which instead read all matching rows. This fix for this regression may result in a major improve-
ment in performance for DISTINCT queries in cases where many rows match. (Bug#32942)
Repeated creation and deletion of views within prepared statements could eventually crash the server. (Bug#32890)
See also Bug#34587.
Incorrect assertions could cause a server crash for DELETE triggers for transactional tables. (Bug#32790)
In some cases where setting a system variable failed, no error was sent to the client, causing the client to hang. (Bug#32757)
Enabling the PAD_CHAR_TO_FULL_LENGTH SQL mode caused privilege-loading operations (such as FLUSH PRIVILEGES) to
include trailing spaces from grant table values stored in CHAR columns. Authentication for incoming connections failed as a result.
Now privilege loading does not include trailing spaces, regardless of SQL mode. (Bug#32753)
The SHOW ENGINE INNODB STATUS and SHOW ENGINE INNODB MUTEX statements incorrectly required the SUPER priv-
ilege rather than the PROCESS privilege. (Bug#32710)
Inserting strings with a common prefix into a table that used the ucs2 character set corrupted the table. (Bug#32705)
Tables in the mysql database that stored the current sql_mode value as part of stored program definitions were not updated with
newer mode values (NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH). This causes various problems defining
stored programs if those modes were included in the current sql_mode value. (Bug#32633)
A view created with a string literal for one of the columns picked up the connection character set, but not the collation. Comparison
to that field therefore used the default collation for that character set, causing an error if the connection collation was not compatible
with the default collation. The problem was caused by text literals in a view being dumped with a character set introducer even
when this was not necessary, sometimes leading to a loss of collation information. Now the character set introducer is dumped only
if it was included in the original query. (Bug#32538)
See also Bug#21505.
Queries using LIKE on tables having indexed CHAR columns using either of the eucjpms or ujis character sets did not return
correct results. (Bug#32510)
Executing a prepared statement associated with a materialized cursor sent to the client a metadata packet with incorrect table and
database names. The problem occurred because the server sent the name of the temporary table used by the cursor instead of the ta-
ble name of the original table.
The same problem occured when selecting from a view, in which case the name of the table name was sent, rather than the name of
the view. (Bug#32265)
InnoDB adaptive hash latches could be held too long during filesort operations, resulting in a server crash. Now the hash latch is re-
leased when a query on InnoDB tables performs a filesort. This eliminates the crash and may provide significant performance im-
provements on systems on which many queries using filesorts with temporary tables are being performed. (Bug#32149)
On Windows, mysqltest_embedded.exe did not properly execute the send command. (Bug#32044)
MySQL Change History
2877
A variable named read_only could be declared even though that is a reserved word. (Bug#31947)
On Windows, the build process failed with four parallel build threads. (Bug#31929)
Queries testing numeric constants containing leading zeroes against ZEROFILL columns were not evaluated correctly.
(Bug#31887)
If an error occurred during file creation, the server sometimes did not remove the file, resulting in an unused file in the file system.
(Bug#31781)
The mysqld crash handler failed on Windows. (Bug#31745)
When upgrading from MySQL 5.1.19 to any version between MySQL 5.1.20 to MySQL 5.1.23, the MySQL Instance Configuration
Wizard would fail to account for the change in name for the mysqld-nt.exe to mysqld.exe, causing MySQL to fail to start
properly after the upgrade. (Bug#31674)
The server returned the error message OUT OF MEMORY; RESTART SERVER AND TRY AGAIN when the actual problem was that the
sort buffer was too small. Now an appropriate error message is returned in such cases. (Bug#31590)
A table having an index that included a BLOB or TEXT column, and that was originally created with a MySQL server using version
4.1 or earlier, could not be opened by a 5.1 or later server. (Bug#31331)
The -, *, and / operators and the functions POW() and EXP() could misbehave when used with floating-point numbers. Previ-
ously they might return +INF, -INF, or NaN in cases of numeric overflow (including that caused by division by zero) or when in-
valid arguments were used. Now NULL is returned in all such cases. (Bug#31236)
The mysql_change_user() C API function caused global Com_xxx status variable values to be incorrect. (Bug#31222)
When sorting privilege table rows, the server treated escaped wildcard characters (\% and \_) the same as unescaped wildcard char-
acters (% and _), resulting in incorrect row ordering. (Bug#31194)
On Windows, SHOW PROCESSLIST could display process entries with a State value of *** DEAD ***. (Bug#30960)
ROUND(X,D) or TRUNCATE(X,D) for nonconstant values of D could crash the server if these functions were used in an ORDER
BY that was resolved using filesort. (Bug#30889)
Resetting the query cache by issuing a SET GLOBAL query_cache_size=0 statement caused the server to crash if it concur-
rently was saving a new result set to the query cache. (Bug#30887)
Manifest problems prevented MySQLInstanceConfig.exe from running on Windows Vista. (Bug#30823)
If an alias was used to refer to the value returned by a stored function within a subselect, the outer select recognized the alias but
failed to retrieve the value assigned to it in the subselect. (Bug#30787)
Binary logging for a stored procedure differed depending on whether or not execution occurred in a prepared statement.
(Bug#30604)
An orphaned PID file from a no-longer-running process could cause mysql.server to wait for that process to exit even though it
does not exist. (Bug#30378)
The Table_locks_waited waited variable was not incremented in the cases that a lock had to be waited for but the waiting
thread was killed or the request was aborted. (Bug#30331)
The Com_create_function status variable was not incremented properly. (Bug#30252)
View metadata returned from INFORMATION_SCHEMA.VIEWS was changed by the fix for Bug#11986, causing the information
returned in MySQL 5.1 to differ from that returned in 5.0. (Bug#30217)
mysqld displayed the --enable-pstack option in its help message even if MySQL was configured without -
-with-pstack. (Bug#29836)
The mysql_config command would output CFLAGS values that were incompatible with C++ for the HP-UX platform.
(Bug#29645)
Views were treated as insertable even if some base table columns with no default value were omitted from the view definition. (This
is contrary to the condition for insertability that a view must contain all columns in the base table that do not have a default value.)
MySQL Change History
2878
Bug#29477)
myisamchk always reported the character set for a table as latin1_swedish_ci (8) regardless of the table' actual character
set. (Bug#29182)
InnoDB could return an incorrect rows-updated value for UPDATE statements. (Bug#29157)
The MySQL preferences pane did not work to start or stop MySQL on Mac OS X 10.5 (Leopard). (Bug#28854)
For upgrading to a new major version using RPM packages (such as 4.1 to 5.0), if the installation procedure found an existing
MySQL server running, it could fail to shut down the old server, but also erroneously removed the server's socket file. Now the pro-
cedure checks for an existing server package from a different vendor or major MySQL version. In such case, it refuses to install the
server and recommends how to safely remove the old packages before installing the new ones. (Bug#28555)
mysqlhotcopy silently skipped databases with names consisting of two alphanumeric characters. (Bug#28460)
No information was written to the general query log for the COM_STMT_CLOSE, COM_STMT_RESET, and
COM_STMT_SEND_LONG_DATA commands. (These occur when a client invokes the mysql_stmt_close(),
mysql_stmt_reset() and mysql_stmt_send_long_data() C API functions.) (Bug#28386)
Previously, the parser accepted the ODBC { OJ ... LEFT OUTER JOIN ...} syntax for writing left outer joins. The parser
now allows { OJ ... } to be used to write other types of joins, such as INNER JOIN or RIGHT OUTER JOIN. This helps
with compatibility with some third-party applications, but is not official ODBC syntax. (Bug#28317)
The FEDERATED storage engine did not perform identifier quoting for column names that are reserved words when sending state-
ments to the remote server. (Bug#28269)
The SQL parser did not accept an empty UNION=() clause. This meant that, when there were no underlying tables specified for a
MERGE table, SHOW CREATE TABLE and mysqldump both output statements that could not be executed.
Now it is possible to execute a CREATE TABLE or ALTER TABLE statement with an empty UNION=() clause. However, SHOW
CREATE TABLE and mysqldump do not output the UNION=() clause if there are no underlying tables specified for a MERGE ta-
ble. This also means it is now possible to remove the underlying tables for a MERGE table using ALTER TABLE ...
UNION=(). (Bug#28248)
It was possible to exhaust memory by repeatedly running index_merge queries and never performing any FLUSH TABLES
statements. (Bug#27732)
When utf8 was set as the connection character set, using SPACE() with a non-Unicode column produced an error. (Bug#27580)
See also Bug#23637.
The parser rules for the SHOW PROFILE statement were revised to work with older versions of bison. (Bug#27433)
resolveip failed to produce correct results for host names that begin with a digit. (Bug#27427)
In ORDER BY clauses, mixing aggregate functions and nongrouping columns is not allowed if the ONLY_FULL_GROUP_BY SQL
mode is enabled. However, in some cases, no error was thrown because of insufficient checking. (Bug#27219)
For the --record_log_pos option, mysqlhotcopy now determines the slave status information from the result of SHOW
SLAVE STATUS by using the Relay_Master_Log_File and Exec_Master_Log_Pos values rather than the Mas-
ter_Log_File and Read_Master_Log_Pos values. This provides a more accurate indication of slave execution relative to
the master. (Bug#27101)
The MySQL Instance Configuration Wizard would not allow you to choose a service name, even though the criteria for the service
name were valid. The code that checks the name has been updated to support the correct criteria of any string less than 256 character
and not containing either a forward or backward slash character. (Bug#27013)
Memory corruption, a crash of the MySQL server, or both, could take place if a low-level I/O error occurred while an ARCHIVE ta-
ble was being opened. (Bug#26978)
DROP DATABASE failed for attempts to drop databases with names that contained the legacy #mysql50# name prefix.
(Bug#26703)
config-win.h unconditionally defined bool as BOOL, causing problems on systems where bool is 1 byte and BOOL is 4 bytes.
(Bug#26461)
MySQL Change History
2879
On Windows, for distributions built with debugging support, mysql could crash if the user typed Control-C. (Bug#26243)
The XPath boolean() function did not cast string and nodeset values correctly in some cases. It now returns TRUE for any
nonempty string or nodeset and 0 for a NULL string, as specified in the XPath standard.. (Bug#26051)
When symbolic links were disabled, either with a server startup option or by enabling the NO_DIR_IN_CREATE SQL mode, CRE-
ATE TABLE silently ignored the DATA DIRECTORY and INDEX DIRECTORY table options. Now the server issues a warning if
symbolic links are disabled when these table options are used. (Bug#25677)
Attempting to create an index with a prefix on a DECIMAL column appeared to succeed with an inaccurate warning message. Now,
this action fails with the error INCORRECT PREFIX KEY; THE USED KEY PART ISN'T A STRING, THE USED LENGTH IS LONGER
THAN THE KEY PART, OR THE STORAGE ENGINE DOESN'T SUPPORT UNIQUE PREFIX KEYS. (Bug#25426)
mysqlcheck -A -r did not correctly identify all tables that needed repairing. (Bug#25347)
On Windows, an error in configure.js caused installation of source distributions to fail. (Bug#25340)
The Qcache_free_blocks status variable did not display a value of 0 if the query cache was disabled. (Bug#25132)
The client library had no way to return an error if no connection had been established. This caused problems such as
mysql_library_init() failing silently if no errmsg.sys file was available. (Bug#25097)
On Mac OS X, the StartupItem for MySQL did not work. (Bug#25008)
For Windows 64-bit builds, enabling shared-memory support caused client connections to fail. (Bug#24992)
mysql did not use its completion table. Also, the table contained few entries. (Bug#24624)
If a user installed MySQL Server and set a password for the root user, and then uninstalled and reinstalled MySQL Server to the
same location, the user could not use the MySQL Instance Config wizard to configure the server because the uninstall operation left
the previous data directory intact. The config wizard assumed that any new install (not an upgrade) would have the default data dir-
ectory where the root user has no password. The installer now writes a registry key named FoundExistingDataDir. If the in-
staller finds an existing data directory, the key will have a value of 1, otherwise it will have a value of 0. When MySQLInstance-
Config.exe is run, it will attempt to read the key. If it can read the key, and the value is 1 and there is no existing instance of the
server (indicating a new installation), the Config Wizard will allow the user to input the old password so the server can be con-
figured. (Bug#24215)
Logging of statements to log tables was incorrect for statements that contained utf8-incompatible binary strings. Incompatible se-
quences are hex-encoded now. (Bug#23924)
The MySQL header files contained some duplicate macro definitions that could cause compilation problems. (Bug#23839)
SHOW COLUMNS on a TEMPOARY table caused locking issues. (Bug#23588)
For distributions compiled with the bundled libedit library, there were difficulties using the mysql client to enter input for non-
ASCII or multi-byte characters. (Bug#23097)
perror reported incomplete or inaccurate information. (Bug#23028, Bug#25177)
InnoDB exhibited thread thrashing with more than 50 concurrent connections under an update-intensive workload. (Bug#22868)
After stopping and starting the event scheduler, disabled events could remain in the execution queue. (Bug#22738)
The server produced a confusing error message when attempting to open a table that required a storage engine that was not loaded.
(Bug#22708)
For views or stored programs created with an invalid DEFINER value, the error message was confusing (did not tie the problem to
the DEFINER clause) and has been improved. (Bug#21854)
Warnings for deprecated syntax constructs used in stored routines make sense to report only when the routine is being created, but
they were also being reported when the routine was parsed for loading into the execution cache. Now they are reported only at
routine creation time. (Bug#21801)
On Mac OS X, mysqld did not react to Ctrl-C when run under gdb, even when run with the --gdb option. (Bug#21567)
CREATE ... SELECT did not always set DEFAULT column values in the new table. (Bug#21380)
MySQL Change History
2880
mysql_config output did not include -lmygcc on some platforms when it was needed. (Bug#21158)
mysql-stress-test.pl and mysqld_multi.server.sh were missing from some binary distributions. (Bug#21023,
Bug#25486)
The BENCHMARK() function, invoked with more than 2147483648 iterations (the size of a signed 32-bit integer), terminated pre-
maturely. (Bug#20752)
mysqldumpslow returned a confusing error message when no configuration file was found. (Bug#20455)
MySQLInstanceConfig.exe could lose the innodb_data_home_dir setting when reconfiguring an instance.
(Bug#19797)
DROP DATABASE did not drop orphaned FOREIGN KEY constraints. (Bug#18942)
CREATE TABLE allowed 0 as the default value for a TIMESTAMP column when the server was running in NO_ZERO_DATE
mode. (Bug#18834)
A SET column whose definition specified 64 elements could not be updated using integer values. (Bug#15409)
If a SELECT calls a stored function in a transaction, and a statement within the function fails, that statement should roll back. Fur-
thermore, if ROLLBACK is executed after that, the entire transaction should be rolled back. Before this fix, the failed statement did
not roll back when it failed (even though it might ultimately get rolled back by a ROLLBACK later that rolls back the entire transac-
tion). (Bug#12713)
See also Bug#34655.
The parser incorrectly allowed SQLSTATE '00000' to be specified for a condition handler. (This is incorrect because the condi-
tion must be a failure condition and '00000' indicates success.) (Bug#8759)
MySQLInstanceConfig.exe did not save the innodb_data_home_dir value to the my.ini file under certain circum-
stances. (Bug#6627)
C.1.15. Changes in MySQL 5.1.23 (29 January 2008)
Functionality added or changed:
Important Change: Partitioning: Security Fix: It was possible, by creating a partitioned table using the DATA DIRECTORY and
INDEX DIRECTORY options to gain privileges on other tables having the same name as the partitioned table. As a result of this
fix, any table-level DATA DIRECTORY or INDEX DIRECTORY options are now ignored for partitioned tables. (Bug#32091,
CVE-2007-5970)
See also Bug#29325, Bug#32111.
Incompatible Change: In MySQL 5.1.6, when log tables were implemented, the default log destination for the general query and
slow query log was TABLE. This default has been changed to FILE, which is compatible with MySQL 5.0, but incompatible with
earlier releases of MySQL 5.1 from 5.1.6 to 5.1.20. If you are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging option
changes should be necessary. However, if you are upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and were using TABLE
logging, use the --log-output=TABLE option explicitly to preserve your server's table-logging behavior.
The MySQL 5.1.23 fix is in addition to a fix in 5.1.21 because it turned out that the default was set in two places, only one of which
was fixed the first time. (Bug#29993)
Incompatible Change
The parser accepted statements that contained /* ... */ that were not properly closed with */, such as SELECT 1 /* + 2.
Statements that contain unclosed /*-comments now are rejected with a syntax error.
This fix has the potential to cause incompatibilities. Because of Bug#26302, which caused the trailing */ to be truncated from com-
ments in views, stored routines, triggers, and events, it is possible that objects of those types may have been stored with definitions
that now will be rejected as syntactically invalid. Such objects should be dropped and re-created so that their definitions do not con-
tain truncated comments. (Bug#28779)
MySQL Change History
2881
MySQL Cluster: The following improvements have been made in the ndb_size.pl utility:
The script can now be used with multiple databases; lists of databases and tables can also be excluded from analysis.
Schema name information has been added to index table calculations.
The database name is now an optional parameter, the exclusion of which causes all databases to be examined.
If selecting from INFORMATION_SCHEMA fails, the script now attempts to fall back to SHOW TABLES.
A --real_table_name option has been added; this designates a table to handle unique index size calculations.
The report title has been amended to cover cases where more than one database is being analyzed.
Support for a --socket option was also added.
For more information, see Section 17.6.21, ndb_size.pl NDBCLUSTER Size Requirement Estimator. (Bug#28683,
Bug#28253)
MySQL Cluster: Mapping of NDB error codes to MySQL storage engine error codes has been improved. (Bug#28423)
MySQL Cluster: The output from the cluster management client showing the progress of data node starts has been improved.
(Bug#23354)
Partitioning: Error messages for partitioning syntax errors have been made more descriptive. (Bug#29368)
Replication: Replication of the following SQL functions now switches to row-based logging in MIXED mode, and generates a
warning in STATEMENT mode:
USER()
CURRENT_USER() and its alias CURRENT_USER
FOUND_ROWS()
ROW_COUNT()
See Section 5.2.4.3, Mixed Binary Logging Format, for more information. (Bug#12092, Bug#28086, Bug#30244)
mysqltest now has a change_user command to change the user for the current connection. (It invokes the
mysql_change_user() C API function.) (Bug#31608)
mysql-test-run.pl now allows a suite name prefix to be specified in command-line arguments that name test cases. The test
name syntax now is [suite_name.]test_name[.suffix]. For example, mysql-test-run.pl binlog.mytest
runs the mytest.test test in the binlog test suite. (Bug#31400)
The --event-scheduler option without a value disabled the event scheduler. Now it enables the event scheduler. (Bug#31332)
mysqldump produces a -- Dump completed on DATE comment at the end of the dump if --comments is given. The date
causes dump files for identical data take at different times to appear to be different. The new options --dump-date and -
-skip-dump-date control whether the date is added to the comment. --skip-dump-date suppresses date printing. The de-
fault is --dump-date (include the date in the comment). (Bug#31077)
Server parser performance was improved for expression parsing by lowering the number of state transitions and reductions needed.
(Bug#30625)
Server parser performance was improved for identifier lists, expression lists, and UDF expression lists. (Bug#30333)
Server parser performance was improved for boolean expressions. (Bug#30237)
The LAST_EXECUTED column of the INFORMATION_SCHEMA.EVENTS table now indicates when the event started executing
rather than when it finished executing. As a result, the ENDS column is never less than LAST_EXECUTED. (Bug#29830)
The mysql_odbc_escape_string() C API function has been removed. It has multi-byte character escaping issues, doesn't
honor the NO_BACKSLASH_ESCAPES SQL mode and is not needed anymore by Connector/ODBC as of 3.51.17. (Bug#29592)
MySQL Change History
2882
If a MyISAM table is created with no DATA DIRECTORY option, the .MYD file is created in the database directory. By default, if
MyISAM finds an existing .MYD file in this case, it overwrites it. The same applies to .MYI files for tables created with no INDEX
DIRECTORY option. To suppress this behavior, start the server with the new --keep_files_on_create option, in which case
MyISAM will not overwrite existing files and returns an error instead. (Bug#29325)
The default value of the connect_timeout system variable was increased from 5 to 10 seconds. This might help in cases where
clients frequently encounter errors of the form Lost connection to MySQL server at 'XXX', system error:
errno. (Bug#28359)
MySQL now can be compiled with gcc 4.2.x. There was a problem involving a conflict with the min() and max() macros in
my_global.h. (Bug#28184)
mysql-test-run.pl now supports a --combination option for specifying options to the mysqld server. This option is
similar to --mysqld but should be given two or more times. mysql-test-run.pl executes multiple test runs, using the op-
tions for each instance of --combination in successive runs.
For test runs specific to a given test suite, an alternative to the use of --combination is to create a combinations file in the
suite directory. The file should contain a section of options for each test run.
The argument for the mysql-test-run.pl --do-test and --skip-test options is now interpreted as a Perl regular ex-
pression if there is a pattern metacharacter in the argument value. This allows more flexible specification of which tests to perform
or skip.
Bugs fixed:
Security Fix: Replication: It was possible for any connected user to issue a BINLOG statement, which could be used to escalate
privileges.
Use of the BINLOG statement now requires the SUPER privilege. (Bug#31611, CVE-2007-6313)
Security Fix: Three vulnerabilities in yaSSL versions 1.7.5 and earlier were discovered that could lead to a server crash or execu-
tion of unauthorized code. The exploit requires a server with yaSSL enabled and TCP/IP connections enabled, but does not require
valid MySQL account credentials. The exploit does not apply to OpenSSL.
Note
The proof-of-concept exploit is freely available on the Internet. Everyone with a vulnerable MySQL configuration is ad-
vised to upgrade immediately.
(Bug#33814, CVE-2008-0226, CVE-2008-0227)
Security Fix: Using RENAME TABLE against a table with explicit DATA DIRECTORY and INDEX DIRECTORY options can be
used to overwrite system table information by replacing the symbolic link points. the file to which the symlink points.
MySQL will now return an error when the file to which the symlink points already exists. (Bug#32111, CVE-2007-5969)
Security Fix: ALTER VIEW retained the original DEFINER value, even when altered by another user, which could allow that user
to gain the access rights of the view. Now ALTER VIEW is allowed only to the original definer or users with the SUPER privilege.
(Bug#29908)
Security Fix: When using a FEDERATED table, the local server could be forced to crash if the remote server returned a result with
fewer columns than expected. (Bug#29801)
Security Enhancement: It was possible to force an error message of excessive length which could lead to a buffer overflow. This
has been made no longer possible as a security precaution. (Bug#32707)
Incompatible Change: It is no longer possible to create CSV tables with NULL columns. However, for backwards compatibility,
you can continue to use such tables that were created in previous MySQL releases. (Bug#32050)
Incompatible Change: With ONLY_FULL_GROUP_BY SQL mode enabled, queries such as SELECT a FROM t1 HAVING
COUNT(*)>2 were not being rejected as they should have been.
This fix results in the following behavior:
MySQL Change History
2883
There is a check against mixing group and nongroup columns only when ONLY_FULL_GROUP_BY is enabled.
This check is done both for the select list and for the HAVING clause if there is one.
This behavior differs from previous versions as follows:
Previously, the HAVING clause was not checked when ONLY_FULL_GROUP_BY was enabled; now it is checked.
Previously, the select list was checked even when ONLY_FULL_GROUP_BY was not enabled; now it is checked only when
ONLY_FULL_GROUP_BY is enabled.
(Bug#31794)
Incompatible Change: Inserting a row with a NULL value for a DATETIME column results in a CSV file that the storage engine
cannot read.
All CSV tables now need to be defined with each column marked as NOT NULL. An error is raised if you try to create a CSV table
with columns that are not defined with NOT NULL. (Bug#31473, Bug#32817)
Incompatible Change: SET PASSWORD statements now cause an implicit commit, and thus are prohibited within stored functions
and triggers. (Bug#30904)
Incompatible Change: The mysql_install_db script could fail to locate some components (including resolveip) during
execution if the --basedir option was specified on the command-line or within the my.cnf file. This was due to a conflict when
comparing the compiled-in values and the supplied values.
The --source-install command-line option to the script has been removed and replaced with the --srcdir option.
mysql_install_db now locates components either using the compiled-in options, the --basedir option or --srcdir op-
tion. (Bug#30759)
Incompatible Change: Multiple-table DELETE statements containing ambiguous aliases could have unintended side effects such as
deleting rows from the wrong table. Example:
DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
Now alias declarations can be declared only in the table_references part. Elsewhere in the statement, alias references are al-
lowed but not alias declarations. Statements containing aliases that are no longer allowed must be rewritten. (Bug#30234)
See also Bug#27525.
Incompatible Change: Within a stored routine, it is no longer allowable to declare a cursor for a SHOW or DESCRIBE statement.
This happened to work in some instances, but is no longer supported. In many cases, a workaround for this change is to use the curs-
or with a SELECT query to read from an INFORMATION_SCHEMA table that produces the same information as the SHOW state-
ment. (Bug#29223)
Incompatible Change: It was possible to create a view having a column whose name consisted of an empty string or space charac-
ters only.
One result of this bug fix is that aliases for columns in the view SELECT statement are checked to ensure that they are legal column
names. In particular, the length must be within the maximum column length of 64 characters, not the maximum alias length of 256
characters. This can cause problems for replication or loading dump files. For additional information and workarounds, see Sec-
tion D.4, Restrictions on Views. (Bug#27695)
See also Bug#31202.
Incompatible Change: Several type-preserving functions and operators returned an incorrect result type that does not match their
argument types: COALESCE(), IF(), IFNULL(), LEAST(), GREATEST(), CASE. These now aggregate using the precise SQL
types of their arguments rather than the internal type. In addition, the result type of the STR_TO_DATE() function is now DATE-
TIME by default. (Bug#27216)
Incompatible Change: GRANT and REVOKE statements now cause an implicit commit, and thus are prohibited within stored func-
tions and triggers. (Bug#21975, Bug#21422, Bug#17244)
Incompatible Change: It was possible for option files to be read twice at program startup, if some of the standard option file loca-
MySQL Change History
2884
tions turned out to be the same directory. Now duplicates are removed from the list of files to be read.
Also, users could not override system-wide settings using ~/.my.cnf because SYSCONFDIR/my.cnf was read last. The latter
file now is read earlier so that ~/.my.cnf can override system-wide settings.
The fix for this problem had a side effect such that on Unix, MySQL programs looked for options in ~/my.cnf rather than the
standard location of ~/.my.cnf. That problem was addressed as Bug#38180. (Bug#20748)
Incompatible Change: A number of problems existed in the implementation of MERGE tables that could cause problems. The prob-
lems are summarized below:
Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table. This was caused in a number of
situations:
1. A thread trying to lock a MERGE table performs busy waiting while REPAIR TABLE or a similar table administration task
is ongoing on one or more of its MyISAM tables.
2. A thread trying to lock a MERGE table performs busy waiting until all threads that did REPAIR TABLE or similar table ad-
ministration tasks on one or more of its MyISAM tables in LOCK TABLES segments do UNLOCK TABLES. The differ-
ence against problem #1 is that the busy waiting takes place after the administration task. It is terminated by UNLOCK
TABLES only.
3. Two FLUSH TABLES within a LOCK TABLES segment can invalidate the lock. This does not require a MERGE table. The
first FLUSH TABLES can be replaced by any statement that requires other threads to reopen the table. In 5.0 and 5.1 a
single FLUSH TABLES can provoke the problem.
Bug#26867 - Simultaneously executing LOCK TABLES and REPAIR TABLE on a MERGE table would result in memory/cpu
hogging.
Trying DML on a MERGE table, which has a child locked and repaired by another thread, made an infinite loop in the server.
Bug#26377 - Deadlock with MERGE and FLUSH TABLE
Locking a MERGE table and its children in parent-child order and flushing the child deadlocked the server.
Bug#25038 - Waiting TRUNCATE
Truncating a MERGE child, while the MERGE table was in use, let the truncate fail instead of waiting for the table to become
free.
Bug#25700 - MERGE base tables get corrupted by OPTIMIZE/ANALYZE/REPAIR TABLE
Repairing a child of an open MERGE table corrupted the child. It was necessary to FLUSH the child first.
Bug#30275 - MERGE tables: FLUSH TABLES or UNLOCK TABLES causes server to crash.
Flushing and optimizing locked MERGE children crashed the server.
Bug#19627 - temporary merge table locking
Use of a temporary MERGE table with nontemporary children could corrupt the children.
Temporary tables are never locked. Creation of tables with nontemporary children of a temporary MERGE table is now prohib-
ited.
Bug#27660 - Falcon: MERGE table possible
It was possible to create a MERGE table with non-MyISAM children.
Bug#30273 - MERGE tables: Can't lock file (errno: 155)
This was a Windows-only bug. Table administration statements sometimes failed with "Can't lock file (errno: 155)".
The fix introduces the following changes in behavior:
This patch changes the behavior of temporary MERGE tables. Temporary MERGE must have temporary children. The old behavi-
MySQL Change History
2885
or was wrong. A temporary table is not locked. Hence even nontemporary children were not locked. See Bug#19627.
You cannot change the union list of a nontemporary MERGE table when LOCK TABLES is in effect. The following does not
work:
CREATE TABLE m1 ... ENGINE=MRG_MYISAM ...;
LOCK TABLES t1 WRITE, t2 WRITE, m1 WRITE;
ALTER TABLE m1 ... UNION=(t1,t2) ...;
However, you can do this with a temporary MERGE table.
You cannot create a MERGE table with CREATE ... SELECT, neither as a temporary MERGE table, nor as a nontemporary
MERGE table. For example, CREATE TABLE m1 ... ENGINE=MRG_MYISAM ... SELECT ...; causes the error
message: TABLE IS NOT BASE TABLE.
(Bug#19627, Bug#25038, Bug#25700, Bug#26377, Bug#26379, Bug#26867, Bug#27660, Bug#30275, Bug#30491)
Important Change: MySQL Cluster: AUTO_INCREMENT columns had the following problems when used in NDB tables:
The AUTO_INCREMENT counter was not updated correctly when such a column was updated.
AUTO_INCREMENT values were not prefetched beyond statement boundaries.
AUTO_INCREMENT values were not handled correctly with INSERT IGNORE statements.
After being set, ndb_autoincrement_prefetch_sz showed a value of 1, regardless of the value it had actually been set
to.
As part of this fix, the behavior of ndb_autoincrement_prefetch_sz has changed. Setting this to less than 32 no longer has
any effect on prefetching within statements (where IDs are now always obtained in batches of 32 or more), but only between state-
ments. The default value for this variable has also changed, and is now 1. (Bug#25176, Bug#31956, Bug#32055)
Partitioning: Important Note: An apostrophe or single quote character (') used in the DATA DIRECTORY, INDEX
DIRECTORY, or COMMENT for a PARTITION clause caused the server to crash. When used as part of a CREATE TABLE state-
ment, the crash was immediate. When used in an ALTER TABLE statement, the crash did not occur until trying to perform a SE-
LECT or DML statement on the table. In either case, the server could not be completely restarted until the .FRM file corresponding
to the newly created or altered table was deleted.
Note
Upgrading to the current (or later) release solves this problem only for tables that are newly created or altered. Tables cre-
ated or altered in previous versions of the server to include ' characters in PARTITION options must still be removed by
deleting the corresponding .FRM files and re-creating them afterwards.
(Bug#30695)
Important Note: The RENAME DATABASE statement was removed and replaced with ALTER DATABASE db_name UP-
GRADE DATA DIRECTORY NAME. The RENAME DATABASE statement was intended for upgrading database directory names to
the encoding format used in 5.1 for representing identifiers in the file system (see Section 8.2.3, Mapping of Identifiers to File
Names). However, the statement was found to be dangerous because it could result in loss of database contents. See Sec-
tion 12.1.32, RENAME DATABASE Syntax, and Section 12.1.1, ALTER DATABASE Syntax. (Bug#17565, Bug#21741,
Bug#28360)
Replication: MySQL Cluster: Row-based replication from or to a big-endian machine where the table used the NDB storage engine
failed, if the same table on the other machine was either non-NDB or the other machine was little-endian. (Bug#29549, Bug#30790)
See also Bug#24231, Bug#30024, Bug#30133, Bug#30134.
MySQL Cluster: An improperly reset internal signal was observed as a hang when using events in the NDB API but could result in
various errors. (Bug#33206)
MySQL Cluster: Incorrectly handled parameters could lead to a crash in the Transaction Coordinator during a node failure, causing
other data nodes to fail. (Bug#33168)
MySQL Cluster: A memory leak occurred if a subscription start request was received by the subscription manager before the node
making the request was fully connected to the cluster. (Bug#32652)
MySQL Change History
2886
MySQL Cluster: A local checkpoint could sometimes be started before the previous LCP was restorable from a global checkpoint.
(Bug#32519)
MySQL Cluster: High numbers of API nodes on a slow or congested network could cause connection negotiation to time out pre-
maturely, leading to the following issues:
Excessive retries
Excessive CPU usage
Partially connected API nodes
(Bug#32359)
MySQL Cluster: When a mysqld acting as a cluster SQL node starts the NDBCLUSTER storage engine, there is a delay during
which some necessary data structures cannot be initialized until after it has connected to the cluster, and all MySQL Cluster tables
should be opened as read-only. This worked correctly when the NDB binlog thread was running, but when it was not running,
Cluster tables were not opened as read-only even when the data structures had not yet been set up. (Bug#32275, Bug#33763)
MySQL Cluster: The failure of a master node could lead to subsequent failures in local checkpointing. (Bug#32160)
MySQL Cluster: The management server was slow to respond when no data nodes were connected to the cluster. This was most
noticeable when running SHOW in the management client. (Bug#32023)
MySQL Cluster: An error with an if statement in sql/ha_ndbcluster.cc could potentially lead to an infinite loop in case
of failure when working with AUTO_INCREMENT columns in NDB tables. (Bug#31810)
MySQL Cluster: The NDB storage engine code was not safe for strict-alias optimization in gcc 4.2.1. (Bug#31761)
MySQL Cluster: It was possible in some cases for a node group to be lost due to missed local checkpoints following a system re-
start. (Bug#31525)
MySQL Cluster: A query against a table with TEXT or BLOB columns that would return more than a certain amount of data failed
with GOT ERROR 4350 'TRANSACTION ALREADY ABORTED' FROM NDBCLUSTER. (Bug#31482)
This regression was introduced by Bug#29102.
MySQL Cluster: NDB tables having names containing nonalphanumeric characters (such as $ ) were not discovered correctly.
(Bug#31470)
MySQL Cluster: A node failure during a local checkpoint could lead to a subsequent failure of the cluster during a system restart.
(Bug#31257)
MySQL Cluster: A cluster restart could sometimes fail due to an issue with table IDs. (Bug#30975)
MySQL Cluster: When handling BLOB columns, the addition of read locks to the lock queue was not handled correctly.
(Bug#30764)
MySQL Cluster: Discovery of NDB tables did not work correctly with INFORMATION_SCHEMA. (Bug#30667)
MySQL Cluster: A file system close operation could fail during a node or system restart. (Bug#30646)
MySQL Cluster: Transaction timeouts were not handled well in some circumstances, leading to excessive number of transactions
being aborted unnecessarily. (Bug#30379)
MySQL Cluster: The cluster management client could not connect, and would hang instead. This issue affected Mac OS X 64-bit
only. (Bug#30366)
MySQL Cluster: Attempting to restore a backup made on a cluster host using one endian to a machine using the other endian could
cause the cluster to fail. (Bug#29674)
MySQL Cluster: Log event requests to ndb_mgmd could time out, causing it to fail. (Bug#29621)
MySQL Cluster: In some cases, the cluster managment server logged entries multiple times following a restart of mgmd.
(Bug#29565)
MySQL Cluster: ndb_mgm --help did not display any information about the -a option. (Bug#29509)
MySQL Change History
2887
MySQL Cluster: An interpreted program of sufficient size and complexity could cause all cluster data nodes to shut down due to
buffer overruns. (Bug#29390)
MySQL Cluster: ndb_size.pl failed on tables with FLOAT columns whose definitions included commas (for example,
FLOAT(6,2)). (Bug#29228)
MySQL Cluster: The error message for NDB error code 275 (OUT OF TRANSACTION RECORDS FOR COMPLETE PHASE) was missing.
(Bug#29139)
MySQL Cluster: Reads on BLOB columns were not locked when they needed to be to guarantee consistency. (Bug#29102)
See also Bug#31482.
MySQL Cluster: A query using joins between several large tables and requiring unique index lookups failed to complete, eventu-
ally returning UKNOWN ERROR after a very long period of time. This occurred due to inadequate handling of instances where the
Transaction Coordinator ran out of TransactionBufferMemory, when the cluster should have returned NDB error code 4012
(REQUEST NDBD TIME-OUT). (Bug#28804)
MySQL Cluster: There was a short interval during the startup process prior to the beginning of heartbeat detection such that, were
an API or management node to reboot or a network failure to occur, data nodes could not detect this, with the result that there could
be a lingering connection. (Bug#28445)
MySQL Cluster: The description of the --print option provided in the output from ndb_restore --help was incorrect.
(Bug#27683)
MySQL Cluster: Restoring a backup made on a cluster host using one endian to a machine using the other endian failed for BLOB
and DATETIME columns. (Bug#27543, Bug#30024)
MySQL Cluster: An invalid subselect on an NDB table could cause mysqld to crash. (Bug#27494)
MySQL Cluster: An attempt to perform a SELECT ... FROM INFORMATION_SCHEMA.TABLES whose result included in-
formation about NDB tables for which the user had no privileges crashed the MySQL Server on which the query was performed.
(Bug#26793)
MySQL Cluster: Performing DELETE operations after a data node had been shut down could lead to inconsistent data following a
restart of the node. (Bug#26450)
MySQL Cluster: UPDATE IGNORE could sometimes fail on NDB tables due to the use of unitialized data when checking for du-
plicate keys to be ignored. (Bug#25817)
MySQL Cluster: The cluster log was formatted inconsistently and contained extraneous newline characters. (Bug#25064)
MySQL Cluster: A restart of the cluster failed when more than 1 REDO phase was in use. (Bug#22696)
MySQL Cluster: When inserting a row into an NDB table with a duplicate value for a nonprimary unique key, the error issued
would reference the wrong key.
This improves on an initial fix for this issue made in MySQL 5.1.13. (Bug#21072)
MySQL Cluster: An insufficiently descriptive and potentially misleading Error 4006 (CONNECT FAILURE - OUT OF CONNECTION
OBJECTS...) was produced when either of the following two conditions occurred:
1. There were no more transaction records in the transaction coordinator
2. An NDB object in the NDB API was initialized with insufficient parallelism
Separate error messages are now generated for each of these two cases. (Bug#11313)
Partitioning: Replication: Replication of partitioned tables using the InnoDB storage engine failed with binlog-format=ROW
or binlog-format=MIXED. (Bug#28430)
Partitioning: It was possible to partition a table to which a foreign key referred. (Bug#32948)
Partitioning: A query of the form SELECT col1 FROM table GROUP BY (SELECT col2 FROM table LIMIT 1);
against a partitioned table having a SET column crashed the server. (Bug#32772)
Partitioning: SHOW CREATE TABLE misreported the value of AUTO_INCREMENT for partitioned tables using either of the In-
MySQL Change History
2888
noDB or ARCHIVE storage engines. (Bug#32247)
Partitioning: Selecting from INFORMATION_SCHEMA.PARTITIONS while partition management statements (for example, AL-
TER TABLE ... ADD PARTITION) were executing caused the server to crash. (Bug#32178)
Partitioning: An error in the internal function mysql_unpack_partition() led to a fatal error in subsequent calls to
open_table_from_share(). (Bug#32158)
Partitioning: Repeated updates of a table that was partitioned by KEY on a TIMESTAMP column eventually crashed the server.
(Bug#32067)
Partitioning: Changing the storage engine used by a table having subpartitions led to a server crash. (Bug#31893)
Partitioning: ORDER BY ... DESC did not always work correctly when selecting from partitioned tables. (Bug#31890)
See also Bug#31001.
Partitioning: Selecting from a table partitioned by KEY on a VARCHAR column whose size was greater than 65530 caused the serv-
er to crash. (Bug#31705)
Partitioning: INSERT DELAYED on a partitioned table crashed the server. The server now rejects the statement with an error.
(Bug#31210)
Partitioning: Using ALTER TABLE to partition an existing table having an AUTO_INCREMENT column could crash the server.
(Bug#30878)
This regression was introduced by Bug#27405.
Partitioning: ALTER TABLE ... COALESCE PARTITION on a table partitioned by [LINEAR] HASH or [LINEAR] KEY
caused the server to crash. (Bug#30822)
Partitioning: LIKE queries on tables partitioned by KEY and using third-party storage engines could return incomplete results.
(Bug#30480)
See also Bug#29320, Bug#29493, Bug#30563.
Partitioning: It was not possible to insert the greatest possible value for a given data type into a partitioned table. For example, con-
sider a table defined as shown here:
CREATE TABLE t (c BIGINT UNSIGNED)
PARTITION BY RANGE(c) (
PARTITION p0 VALUES LESS THAN MAXVALUE
);
The largest possible value for a BIGINT UNSIGNED column is 18446744073709551615, but the statement INSERT INTO t
VALUES (18446744073709551615); would fail, even though the same statement succeeded were t not a partitioned table.
In other words, MAXVALUE was treated as being equal to the greatest possible value, rather than as a least upper bound.
(Bug#29258)
Cluster Replication: Replication: A node failure during replication could lead to buckets out of order; now active subscribers are
checked for, rather than empty buckets. (Bug#31701)
Cluster Replication: Replication: Incorrect handling of INSERT plus DELETE operations with regard to local checkpoints caused
data node failures in multi-master replication setups. (Bug#30914)
Replication: When dropping a database containing a stored procedure while using row-cased replication, the delete of the stored
procedure from the mysql.proc table was recorded in the binary log following the DROP DATABASE statement. To correct this
issue, DROP DATABASE now uses statement-based replication. (Bug#32435)
Replication: It was possible for the name of the relay log file to exceed the amount of memory reserved for it, possibly leading to a
crash of the server. (Bug#31836)
See also Bug#28597.
Replication: Corruption of log events caused the server to crash on 64-bit Linux systems having 4 GB of memory or more.
(Bug#31793)
MySQL Change History
2889
Replication: Trying to replicate an update of a row that was missing on the slave led to a failure on the slave. (Bug#31702)
Replication: Use of the @@hostname system variable in inserts in mysql_system_tables_data.sql did not replicate. The
workaround is to select its value into a user variable (which does replicate) and insert that. (Bug#31167)
Replication: Table names were displayed as binary garbage characters in slave error messages. The issue was observed on 64-bit
Windows but may have effected other platforms. (Bug#30854)
Replication: One thread could read uninitialized memory from the stack of another thread. This issue was only known to occur in a
mysqld process acting as both a master and a slave. (Bug#30752)
Replication: It was possible to set SQL_SLAVE_SKIP_COUNTER such that the slave would jump into the middle of a transaction.
This fix improves on one made for this bug in MySQL 5.1.20; the previous fix insured that the slave could not be made to jump into
the middle of an event group, but the slave failed to recognize that BEGIN, COMMIT, and ROLLBACK statements could begin or end
an event group. (Bug#28618)
See also Bug#12691.
Replication: Due a previous change in how the default name and location of the binary log file were determined, replication failed
following some upgrades. (Bug#28597, Bug#28603)
See also Bug#31836.
This regression was introduced by Bug#20166.
Replication: Stored procedures having BIT parameters were not replicated correctly. (Bug#26199)
Replication: Issuing SHOW SLAVE STATUS as mysqld was shutting down could cause a crash. (Bug#26000)
Replication: If a temporary error occured inside an event group on an event that was not the first event of the group, the slave could
get caught in an endless loop because the retry counter was reset whenever an event was executed successfully. (Bug#24860)
See also Bug#12691, Bug#23171.
Replication: An UPDATE statement using a stored function that modified a nontransactional table was not logged if it failed. This
caused the copy of the nontransactional table on the master have a row that the copy on the slave did not.
In addition, when an INSERT ... ON DUPLICATE KEY UPDATE statement encountered a duplicate key constraint, but the
UPDATE did not actually change any data, the statement was not logged. As a result of this fix, such statements are now treated the
same for logging purposes as other UPDATE statements, and so are written to the binary log. (Bug#23333)
See also Bug#12713.
Replication: A replication slave sometimes failed to reconnect because it was unable to run SHOW SLAVE HOSTS. It was not ne-
cessary to run this statement on slaves (since the master should track connection IDs), and the execution of this statement by slaves
was removed. (Bug#21132)
See also Bug#13963, Bug#21869.
Replication: A replication slave sometimes stopped for changes that were idempotent (that is, such changes should have been con-
sidered safe), even though it should have simply noted that the change was already done, and continued operation. (Bug#19958)
Replication: Replicating from a master table to a slave table where the size of a CHAR or VARCHAR column was a different size
would cause mysqld to crash. For more information on replicating with different column definitions, see Section 16.3.1.4,
Replication with Differing Tables on Master and Slave.
Cluster Replication: A replication slave could return garbage data that was not in recognizable row format due to a problem with
the internal all_set() method. (Bug#33375)
Cluster Replication: Memory was mistakenly freed for NdbBlob objects when adding an index while replicating the cluster,
which could cause mysqld to crash. (Bug#33142)
See also Bug#18106.
Cluster Replication: Under certain conditions, the slave stopped processing relay logs. This resulted in the logs never being cleared
and the slave eventually running out of disk space. (Bug#31958)
MySQL Change History
2890
Cluster Replication: Replicating NDB tables with extra VARCHAR columns on the master caused the slave to fail. (Bug#31646)
See also Bug#29549.
Cluster Replication: When the master mysqld crashed or was restarted, no LOST_EVENTS entry was made in the binlog.
(Bug#31484)
See also Bug#21494.
Cluster Replication: An issue with the mysql.ndb_apply_status table could cause NDB schema autodiscovery to fail in cer-
tain rare circumstances. (Bug#20872)
Cluster API: A call to CHECK_TIMEDOUT_RET() in mgmapi.cpp should have been a call to
DBUG_CHECK_TIMEDOUT_RET(). (Bug#30681)
API: When the language option was not set correctly, API programs calling mysql_server_init() crashed. This issue was
observed only on Windows platforms. (Bug#31868)
Corrected a typecast involving bool on Mac OS X 10.5 (Leopard), which evaluated differently from earlier Mac OS X versions.
(Bug#38217)
Use of uninitialized memory for filesort in a subquery caused a server crash. (Bug#33675)
CREATE TABLE ... SELECT created tables that for date columns used the obsolete Field_date type instead of
Field_newdate. (Bug#33256)
Some valid SELECT statements could not be used as views due to incorrect column reference resolution. (Bug#33133)
The fix for Bug#11230 and Bug#26215 introduced a significant input-parsing slowdown for the mysql client. This has been cor-
rected. (Bug#33057)
The correct data type for a NULL column resulting from a UNION could be determined incorrectly in some cases: 1) Not correctly
inferred as NULL depending on the number of selects; 2) Not inferred correctly as NULL if one select used a subquery. (Bug#32848)
For queries containing GROUP_CONCAT(DISTINCT col_list ORDER BY col_list), there was a limitation that the
DISTINCT columns had to be the same as ORDER BY columns. Incorrect results could be returned if this was not true.
(Bug#32798)
SHOW EVENTS and selecting from the INFORMATION_SCHEMA.EVENTS table failed if the current database was INFORMA-
TION_SCHEMA. (Bug#32775)
Use of the cp932 character set with CAST() in an ORDER BY clause could cause a server crash. (Bug#32726)
A subquery using an IS NULL check of a column defined as NOT NULL in a table used in the FROM clause of the outer query pro-
duced an invalid result. (Bug#32694)
mysqld_safe looked for error messages in the wrong location. (Bug#32679)
Specifying a nonexistent column for an INSERT DELAYED statement caused a server crash rather than producing an error.
(Bug#32676)
An issue with the NO_ENGINE_SUBSTITUTION sql_mode database can cause the creation of stored routines to fail. If you are
having problems with creating stored routines while using this sql_mode value, remove this value from your sql_mode setting.
(Bug#32633)
Use of CLIENT_MULTI_QUERIES caused libmysqld to crash. (Bug#32624)
The INTERVAL() function incorrectly handled NULL values in the value list. (Bug#32560)
Use of a NULL-returning GROUP BY expression in conjunction with WITH ROLLUP could cause a server crash. (Bug#32558)
See also Bug#31095.
ORDER BY UpdateXML(...) caused the server to crash in queries where UpdateXML() returned NULL. (Bug#32557)
A SELECT ... GROUP BY bit_column query failed with an assertion if the length of the BIT column used for the GROUP
MySQL Change History
2891
BY was not an integer multiple of 8. (Bug#32556)
Using SELECT INTO OUTFILE with 8-bit ENCLOSED BY characters led to corrupted data when the data was reloaded using
LOAD DATA INFILE. This was because SELECT INTO OUTFILE failed to escape the 8-bit characters. (Bug#32533)
For FLUSH TABLES WITH READ LOCK, the server failed to properly detect write-locked tables when running with low-priority
updates, resulting in a crash or deadlock. (Bug#32528)
The rules for valid column names were being applied differently for base tables and views. (Bug#32496)
A query of the form SELECT @user_variable := constant AS alias FROM table GROUP BY alias WITH
ROLLUP crashed the server. (Bug#32482)
Sending several KILL QUERY statements to target a connection running SELECT SLEEP() could freeze the server. (Bug#32436)
ssl-cipher values in option files were not being read by libmysqlclient. (Bug#32429)
Repeated execution of a query containing a CASE expression and numerous AND and OR relations could crash the server. The root
cause of the issue was determined to be that the internal SEL_ARG structure was not properly initialized when created. (Bug#32403)
Referencing within a subquery an alias used in the SELECT list of the outer query was incorrectly permitted. (Bug#32400)
If a global read lock acquired with FLUSH TABLES WITH READ LOCK was in effect, executing ALTER TABLE could cause a
server crash. (Bug#32395)
An ORDER BY query on a view created using a FEDERATED table as a base table caused the server to crash. (Bug#32374)
The mysqldump utility did not print enough version information about itself at the top of its output. The output now shows the
same information as mysqldump invoked with the -V option, namely the mysqldump version number, the MySQL server ver-
sion, and the distribution. (Bug#32350)
Comparison of a BIGINT NOT NULL column with a constant arithmetic expression that evaluated to NULL mistakenly caused the
error COLUMN '...' CANNOT BE NULL (error 1048). (Bug#32335)
Assigning a 65,536-byte string to a TEXT column (which can hold a maximum of 65,535 bytes) resulted in truncation without a
warning. Now a truncation warning is generated. (Bug#32282)
The LAST_DAY() function returns a DATE value, but internally the value did not have the time fields zeroed and calculations in-
volving the value could return incorrect results. (Bug#32270)
MIN() and MAX() could return incorrect results when an index was present if a loose index scan was used. (Bug#32268)
Some uses of user variables in a query could result in a server crash. (Bug#32260)
Memory corruption could occur due to large index map in Range checked for each record status reported by EXPLAIN
SELECT. The problem was based in an incorrectly calculated length of the buffer used to store a hexadecimal representation of an
index map, which could result in buffer overrun and stack corruption under some circumstances. (Bug#32241)
Various test program cleanups were made: 1) mytest and libmysqltest were removed. 2) bug25714 displays an error mes-
sage when invoked with incorrect arguments or the --help option. 3) mysql_client_test exits cleanly with a proper error
status. (Bug#32221)
The default grant tables on Windows contained information for host production.mysql.com, which should not be there.
(Bug#32219)
Under certain conditions, the presence of a GROUP BY clause could cause an ORDER BY clause to be ignored. (Bug#32202)
For comparisons of the form date_col OP datetime_const (where OP is =, <, >, <=, or >=), the comparison is done using
DATETIME values, per the fix for Bug#27590. However that fix caused any index on date_col not to be used and compromised
performance. Now the index is used again. (Bug#32198)
DATETIME arguments specified in numeric form were treated by DATE_ADD() as DATE values. (Bug#32180)
Killing a statement could lead to a race condition in the server. (Bug#32148)
InnoDB does not support SPATIAL indexes, but could crash when asked to handle one. Now an error is returned. (Bug#32125)
MySQL Change History
2892
The server crashed on optimizations involving a join of INT and MEDIUMINT columns and a system variable in the WHERE clause.
(Bug#32103)
mysql-test-run.pl used the --user option when starting mysqld, which produces warnings if the current user is not
root. Now --user is added only for root. (Bug#32078)
mysqlslap was missing from the MySQL 5.1.22 Linux RPM packages. (Bug#32077)
With lower_case_table_names set, CREATE TABLE LIKE was treated differently by libmysqld than by the nonembed-
ded server. (Bug#32063)
Within a subquery, UNION was handled differently than at the top level, which could result in incorrect results or a server crash.
(Bug#32036, Bug#32051)
On 64-bit platforms, assignments of values to enumeration-valued storage engine-specific system variables were not validated and
could result in unexpected values. (Bug#32034)
A DELETE statement with a subquery in the WHERE clause would sometimes ignore an error during subquery evaluation and pro-
ceed with the delete operation. (Bug#32030)
Using dates in the range '0000-00-01' to '0000-00-99' range in the WHERE clause could result in an incorrect result set.
(These dates are not in the supported range for DATE, but different results for a given query could occur depending on position of
records containing the dates within a table.) (Bug#32021)
User-defined functions are not loaded if the server is started with the --skip-grant-tables option, but the server did not
properly handle this case and issued an OUT OF MEMORY error message instead. (Bug#32020)
If a user-defined function was used in a SELECT statement, and an error occurred during UDF initialization, the error did not ter-
minate execution of the SELECT, but rather was converted to a warning. (Bug#32007)
HOUR(), MINUTE(), and SECOND() could return nonzero values for DATE arguments. (Bug#31990)
Changing the SQL mode to cause dates with zero parts to be considered invalid (such as '1000-00-00') could result in in-
dexed and nonindexed searches returning different results for a column that contained such dates. (Bug#31928)
The server used unnecessarily large amounts of memory when user variables were used as an argument to CONCAT() or CON-
CAT_WS(). (Bug#31898)
In debug builds, testing the result of an IN subquery against NULL caused an assertion failure. (Bug#31884)
mysql-test-run.pl sometimes set up test scenarios in which the same port number was passed to multiple servers, causing
one of them to be unable to start. (Bug#31880)
SHOW CREATE TRIGGER caused a server crash. (Bug#31866)
The server crashed after insertion of a negative value into an AUTO_INCREMENT column of an InnoDB table. (Bug#31860)
For libmysqld applications, handling of mysql_change_user() calls left some pointers improperly updated, leading to
server crashes. (Bug#31850)
Using ORDER BY led to the wrong result when using the ARCHIVE on a table with a BLOB when the table cache was full. The ta-
ble could also be reported as crashed after the query had completed, even though the table data was intact. (Bug#31833)
Comparison results for BETWEEN were different from those for operators like < and > for DATETIME-like values with trailing extra
characters such as '2007-10-01 00:00:00 GMT-6'. BETWEEN treated the values as DATETIME, whereas the other operat-
ors performed a binary-string comparison. Now they all uniformly use a DATETIME comparison, but generate warnings for values
with trailing garbage. (Bug#31800)
Name resolution for correlated subqueries and HAVING clauses failed to distinguish which of two was being performed when there
was a reference to an outer aliased field. This could result in error messages about a HAVING clause for queries that had no such
clause. (Bug#31797)
The server could crash during filesort for ORDER BY based on expressions with INET_NTOA() or OCT() if those functions
returned NULL. (Bug#31758)
For tables with certain definitions, UPDATE statements could fail to find the correct record to update and report an error when the
MySQL Change History
2893
record did in fact exist. (Bug#31747)
For a fatal error during a filesort in find_all_keys(), the error was returned without the necessary handler uninitialization,
causing an assertion failure. (Bug#31742)
mysqlslap failed to commit after the final record load. (Bug#31704)
The examined-rows count was not incremented for const queries. (Bug#31700)
The server crashed if a thread was killed while locking the general_log table at the beginning of statement processing.
(Bug#31692)
The mysql_change_user() C API function was subject to buffer overflow. (Bug#31669)
For SELECT ... INTO OUTFILE, if the ENCLOSED BY string is empty and the FIELDS TERMINATED BY string started
with a special character (one of n, t, r, b, 0, Z, or N), every occurrence of the character within field values would be duplicated.
(Bug#31663)
SHOW COLUMNS and DESCRIBE displayed null as the column type for a view with no valid definer. This caused mysqldump
to produce a nonreloadable dump file for the view. (Bug#31662)
The mysqlbug script did not include the correct values of CFLAGS and CXXFLAGS that were used to configure the distribution.
(Bug#31644)
Queries that include a comparison of an INFORMATION_SCHEMA table column to NULL caused a server crash. (Bug#31633)
EXPLAIN EXTENDED for SELECT from INFORMATION_SCHEMA tables caused an assertion failure. (Bug#31630)
ucs2 does not work as a client character set, but attempts to use it as such were not rejected. Now character_set_client
cannot be set to ucs2. This also affects statements such as SET NAMES and SET CHARACTER SET. (Bug#31615)
A buffer used when setting variables was not dimensioned to accommodate the trailing '\0' byte, so a single-byte buffer overrun
was possible. (Bug#31588)
HAVING could treat lettercase of table aliases incorrectly if lower_case_table_names was enabled. (Bug#31562)
Spurious duplicate-key errors could occur for multiple-row inserts into an InnoDB table that activate a trigger. (Bug#31540)
Using ALTER EVENT to rename a disabled event caused it to become enabled. (Bug#31539)
The fix for Bug#24989 introduced a problem such that a NULL thread handler could be used during a rollback operation. This prob-
lem is unlikely to be seen in practice. (Bug#31517)
The length of the result from IFNULL() could be calculated incorrectly because the sign of the result was not taken into account.
(Bug#31471)
Queries that used the ref access method or index-based subquery execution over indexes that have DECIMAL columns could fail
with an error Column col_name cannot be null. (Bug#31450)
InnoDB now tracks locking and use of tables by MySQL only after a table has been successfully locked on behalf of a transaction.
Previously, the locked flag was set and the table in-use counter was updated before checking whether the lock on the table suc-
ceeded. A subsequent failure in obtaining a lock on the table led to an inconsistent state as the table was neither locked nor in use.
(Bug#31444)
SELECT 1 REGEX NULL caused an assertion failure for debug servers. (Bug#31440)
The UpdateXML() function did not check for the validity of all its arguments; in some cases, this could lead to a crash of the serv-
er. (Bug#31438)
The mysql_change_user() C API function caused advisory locks (obtained with GET_LOCK()) to malfunction.
(Bug#31418)
NDB libraries and include files were missing from some binary tar file distributions. (Bug#31414)
Executing RENAME while tables were open for use with HANDLER statements could cause a server crash. (Bug#31409)
MySQL Change History
2894
mysql-test-run.pl tried to create files in a directory where it could not be expected to have write permission. mysqltest
created .reject files in a directory other than the one where test results go. (Bug#31398)
For a table that had been opened with HANDLER and marked for reopening after being closed with FLUSH TABLES, DROP TA-
BLE did not properly discard the handler. (Bug#31397)
Automatically allocated memory for string options associated with a plugin was not freed if the plugin did not get installed.
(Bug#31382)
INFORMATION_SCHEMA.TABLES was returning incorrect information. (Bug#31381)
DROP USER caused an increase in memory usage. (Bug#31347)
For InnoDB tables with READ COMMITTED isolation level, semi-consistent reads used for UPDATE statements skipped rows
locked by another transaction, rather than waiting for the locks to be released. Consequently, rows that possibly should have been
updated were never examined. (Bug#31310)
For an almost-full MyISAM table, an insert that failed could leave the table in a corrupt state. (Bug#31305)
myisamchk --unpack could corrupt a table that when unpacked has static (fixed-length) row format. (Bug#31277)
CONVERT(val, DATETIME) would fail on invalid input, but processing was not aborted for the WHERE clause, leading to a
server crash. (Bug#31253)
Allocation of an insufficiently large group-by buffer following creation of a temporary table could lead to a server crash.
(Bug#31249)
Use of DECIMAL(n, n) ZEROFILL in GROUP_CONCAT() could cause a server crash. (Bug#31227)
When a TIMESTAMP with a nonzero time part was converted to a DATE value, no warning was generated. This caused index look-
ups to assume that this is a valid conversion and was returning rows that match a comparison between a TIMESTAMP value and a
DATE keypart. Now a warning is generated so that TIMESTAMP with a nonzero time part will not match DATE values.
(Bug#31221)
Server variables could not be set to their current values on Linux platforms. (Bug#31177)
See also Bug#6958.
WIth small values of myisam_sort_buffer_size, REPAIR TABLE for MyISAM tables could cause a server crash.
(Bug#31174)
If MAKETIME() returned NULL when used in an ORDER BY that was evaluated using filesort, a server crash could result.
(Bug#31160)
Data in BLOB or GEOMETRY columns could be cropped when performing a UNION query. (Bug#31158)
LAST_INSERT_ID() execution could be handled improperly in subqueries. (Bug#31157)
An assertion designed to detect a bug in the ROLLUP implementation would incorrectly be triggered when used in a subquery con-
text with noncacheable statements. (Bug#31156)
Selecting spatial types in a UNION could cause a server crash. (Bug#31155)
Use of GROUP_CONCAT(DISTINCT bit_column) caused an assertion failure. (Bug#31154)
The server crashed in the parser when running out of memory. Memory handling in the parser has been improved to gracefully re-
turn an error when out-of-memory conditions occur in the parser. (Bug#31153)
MySQL declares a UNIQUE key as a PRIMARY key if it doesn't have NULL columns and is not a partial key, and the PRIMARY key
must alway be the first key. However, in some cases, a nonfirst key could be reported as PRIMARY, leading to an assert failure by
InnoDB. This is fixed by correcting the key sort order. (Bug#31137)
mysqldump failed to handle databases containing a - character in the name. (Bug#31113)
Starting the server using --read-only and with the Event Scheduler enabled caused it to crash.
MySQL Change History
2895
Note
This issue occurred only when the server had been built with certain nonstandard combinations of configure options.
(Bug#31111)
GROUP BY NULL WITH ROLLUP could cause a server crash. (Bug#31095)
See also Bug#32558.
A rule to prefer filesort over an indexed ORDER BY when accessing all rows of a table was being used even if a LIMIT clause
was present. (Bug#31094)
REGEXP operations could cause a server crash for character sets such as ucs2. Now the arguments are converted to utf8 if pos-
sible, to allow correct results to be produced if the resulting strings contain only 8-bit characters. (Bug#31081)
Expressions of the form WHERE col NOT IN (col, ...), where the same column was named both times, could cause a
server crash in the optimizer. (Bug#31075)
Internal conversion routines could fail for several multi-byte character sets (big5, cp932, euckr, gb2312, sjis) for empty
strings or during evaluation of SOUNDS LIKE. (Bug#31069, Bug#31070)
Many nested subqueries in a single query could led to excessive memory consumption and possibly a crash of the server.
(Bug#31048)
Using ORDER BY with ARCHIVE tables caused a server crash. (Bug#31036)
A server crash could occur when a non-DETERMINISTIC stored function was used in a GROUP BY clause. (Bug#31035)
The MOD() function and the % operator crashed the server for a divisor less than 1 with a very long fractional part. (Bug#31019)
Transactions were committed prematurely when LOCK TABLE and SET autocommit = 0 were used together. (Bug#30996)
On Windows, the pthread_mutex_trylock() implementation was incorrect. (Bug#30992)
A character set introducer followed by a hexadecimal or bit-value literal did not check its argument and could return an ill-formed
result for invalid input. (Bug#30986)
CHAR(str USING charset) did not check its argument and could return an ill-formed result for invalid input. (Bug#30982)
The result from CHAR(str USING ucs2) did not add a leading 0x00 byte for input strings with an odd number of bytes.
(Bug#30981)
The GeomFromText() function could cause a server crash if the first argument was NULL or the empty string. (Bug#30955)
MAKEDATE() incorrectly moved year values in the 100-200 range into the 1970-2069 range. (This is legitimate for 00-99, but
three-digit years should be used unchanged.) (Bug#30951)
When invoked with constant arguments, STR_TO_DATE() could use a cached value for the format string and return incorrect res-
ults. (Bug#30942)
GROUP_CONCAT() returned ',' rather than an empty string when the argument column contained only empty strings.
(Bug#30897)
For MEMORY tables, lookups for NULL values in BTREE indexes could return incorrect results. (Bug#30885)
A server crash could occur if a stored function that contained a DROP TEMPORARY TABLE statement was invoked by a CREATE
TEMPORARY TABLE statement that created a table of the same name. (Bug#30882)
Calling NAME_CONST() with nonconstant arguments triggered an assertion failure. Nonconstant arguments are now disallowed.
(Bug#30832)
For a spatial column with a regular (non-SPATIAL) index, queries failed if the optimizer tried to use the index. (Bug#30825)
Values for the --tc-heuristic-recover option incorrectly were treated as values for the --myisam-stats-method op-
MySQL Change History
2896
tion. (Bug#30821)
INFORMATION_SCHEMA.SCHEMATA was returning incorrect information. (Bug#30795)
The optimizer incorrectly optimized conditions out of the WHERE clause in some queries involving subqueries and indexed columns.
(Bug#30788)
Improper calculation of CASE expression results could lead to value truncation. (Bug#30782)
On Windows, the pthread_mutex_trylock() implementation was incorrect. One symptom was that invalidating the query
cache could cause a server crash. (Bug#30768)
A multiple-table UPDATE involving transactional and nontransactional tables caused an assertion failure. (Bug#30763)
User-supplied names foreign key names might not be set to the right key, leading to foreign keys with no name. (Bug#30747)
Under some circumstances, CREATE TABLE ... SELECT could crash the server or incorrectly report that the table row size
was too large. (Bug#30736)
Using the MIN() or MAX() function to select one part of a multi-part key could cause a crash when the function result was NULL.
(Bug#30715)
The embedded server did not properly check column-level privileges. (Bug#30710)
INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION was incorrect for views that were defined to select from other IN-
FORMATION_SCHEMA tables. (Bug#30689)
Issuing an ALTER SERVER statement to update the settings for a FEDERATED server would cause the mysqld to crash.
(Bug#30671)
The optimizer could ignore ORDER BY in cases when the result set is ordered by filesort, resulting in rows being returned in
incorrect order. (Bug#30666)
A different execution plan was displayed for EXPLAIN than would actually have been used for the SELECT because the test of sort
keys for ORDER BY did not consider keys mentioned in IGNORE KEYS FOR ORDER BY. (Bug#30665)
The thread_handling system variable was treated as having a SESSION value and as being settable at runtime. Now it has
only a GLOBAL read-only value. (Bug#30651)
On Windows, LIMIT arguments greater than 2^32 did not work correctly. (Bug#30639)
MyISAM tables could not exceed 4294967295 (2^32 - 1) rows on Windows. (Bug#30638)
A failed HANDLER ... READ operation could leave the table in a locked state. (Bug#30632)
mysql-test-run.pl could not run mysqld with root privileges. (Bug#30630)
The mysqld_safe script contained a syntax error. (Bug#30624)
The optimization that uses a unique index to remove GROUP BY did not ensure that the index was actually used, thus violating the
ORDER BY that is implied by GROUP BY. (Bug#30596)
SHOW STATUS LIKE 'Ssl_cipher_list' from a MySQL client connected via SSL returned an empty string rather than a
list of available ciphers. (Bug#30593)
For MEMORY tables, DELETE statements that remove rows based on an index read could fail to remove all matching rows.
(Bug#30590)
Using GROUP BY on an expression of the form timestamp_col DIV number caused a server crash due to incorrect calcula-
tion of number of decimals. (Bug#30587)
Executing a SELECT COUNT(*) query on an InnoDB table partitioned by KEY that used a DOUBLE column as the partitioning
key caused the server to crash. (Bug#30583)
The options available to the CHECK TABLE statement were also allowed in OPTIMIZE TABLE and ANALYZE TABLE state-
ments, but caused corruption during their execution. These options were never supported for these statements, and an error is now
MySQL Change History
2897
raised if you try to apply these options to these statements. (Bug#30495)
A self-referencing trigger on a partitioned table caused the server to crash instead of failing with an error. (Bug#30484)
The mysql_change_user() C API function did not correctly reset the character set variables to the values they had just after
initially connecting. (Bug#30472)
When expanding a * in a USING or NATURAL join, the check for table access for both tables in the join was done using only the
grant information of the first table. (Bug#30468)
When casting a string value to an integer, cases where the input string contained a decimal point and was long enough to overrun the
unsigned long long type were not handled correctly. The position of the decimal point was not taken into account which res-
ulted in miscalculated numbers and incorrect truncation to appropriate SQL data type limits. (Bug#30453)
Versions of mysqldump from MySQL 4.1 or higher tried to use START TRANSACTION WITH CONSISTENT SNAPSHOT if
the --single-transaction and --master-data options were given, even with servers older than 4.1 that do not support
consistent snapshots. (Bug#30444)
With libmysqld, use of prepared statements and the query cache at the same time caused problems. (Bug#30430)
Issuing a DELETE statement having both an ORDER BY clause and a LIMIT clause could cause mysqld to crash. (Bug#30385)
For CREATE ... SELECT ... FROM, where the resulting table contained indexes, adding SQL_BUFFER_RESULT to the
SELECT part caused index corruption in the table. (Bug#30384)
The Last_query_cost status variable value can be computed accurately only for simple flat queries, not complex queries
such as those with subqueries or UNION. However, the value was not consistently being set to 0 for complex queries. (Bug#30377)
The optimizer made incorrect assumptions about the value of the is_member value for user-defined functions, sometimes result-
ing in incorrect ordering of UDF results. (Bug#30355)
Queries that had a GROUP BY clause and selected COUNT(DISTINCT bit_column) returned incorrect results. (Bug#30324)
Some valid euc-kr characters having the second byte in the ranges [0x41..0x5A] and [0x61..0x7A] were rejected.
(Bug#30315)
When loading a dynamic plugin on FreeBSD, the plugin would fail to load. This was due to a build error where the required sym-
bols would be not exported correctly. (Bug#30296)
Simultaneous ALTER TABLE statements for BLACKHOLE tables caused 100% CPU use due to locking problems. (Bug#30294)
Setting certain values on a table using a spatial index could cause the server to crash. (Bug#30286)
Tables with a GEOMETRY column could be marked as corrupt if you added a non-SPATIAL index on a GEOMETRY column.
(Bug#30284)
Flushing a merge table between the time it was opened and its child table were actually attached caused the server to crash.
(Bug#30273)
This regression was introduced by Bug#26379.
The query cache does not support retrieval of statements for which column level access control applies, but the server was still cach-
ing such statements, thus wasting memory. (Bug#30269)
Using DISTINCT or GROUP BY on a BIT column in a SELECT statement caused the column to be cast internally as an integer,
with incorrect results being returned from the query. (Bug#30245)
GROUP BY on BIT columns produced incorrect results. (Bug#30219)
Short-format mysql commands embedded within /*! ... */ comments were parsed incorrectly by mysql, which discarded
the rest of the comment including the terminating */ characters. The result was a malformed (unclosed) comment. Now mysql
does not discard the */ characters. (Bug#30164)
If the server crashed during an ALTER TABLE statement, leaving a temporary file in the database directory, a subsequent DROP
DATABASE statement failed due to the presence of the temporary file. (Bug#30152)
MySQL Change History
2898
When mysqldump wrote DROP DATABASE statements within version-specific comments, it included the terminating semicolon
in the wrong place, causing following statements to fail when the dump file was reloaded. (Bug#30126)
It was not possible for client applications to distinguish between auto-set and auto-updated TIMESTAMP column values.
To rectify this problem, a new ON_UPDATE_NOW_FLAG flag is set by Field_timestamp constructors whenever a column should be
set to NOW on UPDATE, and the get_schema_column_record() function now reports whether a timestamp column is set to
NOW on UPDATE. In addition, such columns now display on update CURRENT_TIMESTAMP in the Extra column in the out-
put from SHOW COLUMNS. (Bug#30081)
Some INFORMATION_SCHEMA tables are intended for internal use, but could be accessed by using SHOW statements.
(Bug#30079)
On some 64-bit systems, inserting the largest negative value into a BIGINT column resulted in incorrect data. (Bug#30069)
mysqlslap did not properly handle multiple result sets from stored procedures. (Bug#29985)
Specifying the --without-geometry option for configure caused server compilation to fail. (Bug#29972)
Statements within stored procedures ignored the value of the low_priority_updates system variable. (Bug#29963)
See also Bug#26162.
With auto-reconnect enabled, row fetching for a prepared statement could crash after reconnect occurred because loss of the state-
ment handler was not accounted for. (Bug#29948)
mysqldump --skip-events --all-databases dumped data from the mysqld.event table, and when restoring from
this dump, events were created in spite of the --skip-events option. (Bug#29938)
When mysqlslap was given a query to execute from a file via a --query=file_name option, it executed the query one too
many times. (Bug#29803)
configure did not find nss on some Linux platforms. (Bug#29658)
It was possible when creating a partitioned table using CREATE TABLE ... SELECT to refer in the PARTITION BY clause to
columns in the table being selected from, which could cause the server to crash. An example of such a statement is:
CREATE TABLE t1 (b INT)
PARTITION BY RANGE(t2.b) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
) SELECT * FROM t2;
The fix is to disallow references in PARTITION BY clauses to columns not in the table being created. (Bug#29444)
If a view used a function in its SELECT statement, the columns from the view were not inserted into the INFORMA-
TION_SCHEMA.COLUMNS table. (Bug#29408)
The mysql client program now ignores Unicode byte order mark (BOM) characters at the beginning of input files. Previously, it
read them and sent them to the server, resulting in a syntax error.
Presence of a BOM does not cause mysql to change its default character set. To do that, invoke mysql with an option such as -
-default-character-set=utf8. (Bug#29323)
For transactional tables, an error during a multiple-table DELETE statement did not roll back the statement. (Bug#29136)
The log and log_slow_queries system variables were displayed by SHOW VARIABLES but could not be accessed in expres-
sions as @@log and @@log_slow_queries. Also, attempting to set them with SET produced an incorrect Unknown system
variable message. Now these variables are treated as synonyms for general_log and slow_query_log, which means that
they can be accessed in expressions and their values can be changed with SET. (Bug#29131)
Denormalized double-precision numbers cannot be handled properly by old MIPS pocessors. For IRIX, this is now handled by en-
abling a mode to use a software workaround. (Bug#29085)
SHOW VARIABLES did not display the relay_log, relay_log_index, or relay_log_info_file system variables.
(Bug#28893)
When doing a DELETE on a table that involved a JOIN with MyISAM or MERGE tables and the JOIN referred to the same table,
MySQL Change History
2899
the operation could fail reporting ERROR 1030 (HY000): Got error 134 from storage engine. This was because
scans on the table contents would change because of rows that had already been deleted. (Bug#28837)
Killing an SSL connection on platforms where MySQL is compiled with -DSIGNAL_WITH_VIO_CLOSE (Windows, Mac OS X,
and some others) could crash the server. (Bug#28812)
SHOW VARIABLES did not correctly display the value of the thread_handling system variable. (Bug#28785)
On Windows, mysql_upgrade created temporary files in C:\ and did not clean them up. (Bug#28774)
Index hints specified in view definitions were ignored when using the view to select from the base table. (Bug#28702)
Views do not have indexes, so index hints do not apply. Use of index hints when selecting from a view is now disallowed.
(Bug#28701)
After changing the SQL mode to a restrictive value that would make already-inserted dates in a column be considered invalid,
searches returned different results depending on whether the column was indexed. (Bug#28687)
When running the MySQL Instance Configuration Wizard, a race condition could exist that would fail to connect to a newly con-
figured instance. This was because mysqld had not completed the startup process before the next stage of the installation process.
(Bug#28628)
A SELECT in one connection could be blocked by INSERT ... ON DUPLICATE KEY UPDATE in another connection even
when low_priority_updates is set. (Bug#28587)
mysql_upgrade could run binaries dynamically linked against incorrect versions of shared libraries. (Bug#28560)
The result from CHAR() was incorrectly assumed in some contexts to return a single-byte result. (Bug#28550)
mysqldump reversed the event name and program name in one of its error messages. (Bug#28535)
If a LIMIT clause was present, the server could fail to consider indexes that could be used for ORDER BY or GROUP BY.
(Bug#28404)
The parser confused user-defined function (UDF) and stored function creation for CREATE FUNCTION and required that there be a
default database when creating UDFs, although there is no such requirement. (Bug#28318, Bug#29816)
Fast-mutex locking was not thread-safe and optimization-safe on some platforms, which could cause program failures such as out-
of-memory errors. (Bug#28284)
The result of a comparison between VARBINARY and BINARY columns differed depending on whether the VARBINARY column
was indexed. (Bug#28076)
The metadata in some MYSQL_FIELD members could be incorrect when a temporary table was used to evaluate a query.
(Bug#27990)
Partition pruning was not used for queries having <= or >= conditions in the WHERE clause on a table using TO_DAYS() in the
partitioning expression. (Bug#27927)
mysqlbinlog produced incorrectly formatted DATETIME and TIMESTAMP values. (Bug#27894)
Failure to log to the general_log or slow_log log tables were not logged to the error log at all or were logged incorrectly.
(Bug#27858)
An ORDER BY at the end of a UNION affected individual SELECT statements rather than the overall query result. (Bug#27848)
comp_err created files with permissions such that they might be inaccessible during make install operations. (Bug#27789)
SHOW COLUMNS returned NULL instead of the empty string for the Default value of columns that had no default specified.
(Bug#27747)
With recent versions of DBD::mysql, mysqlhotcopy generated table names that were doubly qualified with the database name.
(Bug#27694)
The anonymous accounts were not being created during MySQL installation. (Bug#27692)
MySQL Change History
2900
Some SHOW statements and INFORMATION_SCHEMA queries could expose information not allowed by the user's access privileges.
(Bug#27629)
ALTER TABLE tbl_name ROW_FORMAT=format_type did not cause the table to be rebuilt. (Bug#27610)
A race condition between killing a statement and the thread executing the statement could lead to a situation such that the binary log
contained an event indicating that the statement was killed, whereas the statement actually executed to completion. (Bug#27571)
Some character mappings in the ascii.xml file were incorrect.
As a result of this bug fix, indexes must be rebuilt for columns that use the ascii_general_ci collation for columns that con-
tain any of these characters: '`', '[', '\', ']', '~'. See Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt.
(Bug#27562)
Some queries using the NAME_CONST() function failed to return either a result or an error to the client, causing it to hang. This
was due to the fact that there was no check to insure that both arguments to this function were constant expressions. (Bug#27545,
Bug#32559)
With the read_only system variable enabled, CREATE DATABASE and DROP DATABASE were allowed to users who did not
have the SUPER privilege. (Bug#27440)
For an event with an ON COMPLETION value of PRESERVE, an ALTER EVENT statement that specified no ON COMPLETION
option caused the value to become NOT PRESERVE. (Bug#27407)
MySQL failed to generate or retrieve an AUTO_INCREMENT primary key for InnoDB tables with user-defined partitioning.
(Bug#27405)
Changes to the sql_mode system variable were not tracked by INSERT DELAYED. (Bug#27358)
A SELECT with more than 31 nested dependent subqueries returned an incorrect result. (Bug#27352)
The ExtractValue() and UpdateXML() functions performed extremely slowly for large amounts of XML data (greater than
64 KB). These functions now execute approximately 2000 times faster than previously. (Bug#27287)
On Windows, writes to the debug log were using freopen() instead of fflush(), resulting in slower performance.
(Bug#27099)
For a table that used different full-text parsers for different FULLTEXT indexes, SHOW CREATE TABLE displayed the first parser
name for all of them. (Bug#27040)
STR_TO_DATE() displayed an error message that referred to STR_TO_TIME(). (Bug#27014)
The mysql_insert_id() C API function sometimes returned different results for libmysqld and libmysqlclient.
(Bug#26921)
Symbolic links on Windows could fail to work. (Bug#26811)
mysqld sometimes miscalculated the number of digits required when storing a floating-point number in a CHAR column. This
caused the value to be truncated, or (when using a debug build) caused the server to crash. (Bug#26788)
See also Bug#12860.
LOAD DATA INFILE ran very slowly when reading large files into partitioned tables. (Bug#26527)
It makes no sense to attempt to use ALTER TABLE ... ORDER BY to order an InnoDB table if there is a user-defined clustered
index, because rows are always ordered by the clustered index. Such attempts now are ignored and produce a warning.
Also, in some cases, InnoDB incorrectly used a secondary index when the clustered index would produce a faster scan. EXPLAIN
output now indicates use of the clustered index (for tables that have one) as lines with a type value of index, a key value of
PRIMARY, and without Using index in the Extra value. (Bug#26447)
See also Bug#35850.
Using HANDLER to open a table having a storage engine not supported by HANDLER properly returned an error, but also improperly
prevented the table from being dropped by other connections. (Bug#25856)
MySQL Change History
2901
For a prepared statement stmt, changing the default database following PREPARE stmt but before EXECUTE stmt caused
stmt to be recorded incorrectly in the binary log. (Bug#25843)
CREATE TABLE LIKE did not work when the source table was an INFORMATION_SCHEMA table. (Bug#25629)
Threads that were calculating the estimated number of records for a range scan did not respond to the KILL statement. That is, if a
range join type is possible (even if not selected by the optimizer as a join type of choice and thus not shown by EXPLAIN), the
query in the statistics state (shown by the SHOW PROCESSLIST) did not respond to the KILL statement. (Bug#25421)
For InnoDB tables, CREATE TABLE a AS SELECT * FROM A would fail. (Bug#25164)
For mysql --show-warnings, warnings were in some cases not displayed. (Bug#25146)
The returns column of the mysql.proc table was CHAR(64), which is not long enough to store long data types such as ENUM
types. The column has been changed to LONGBLOB and a warning is generated if truncation occurs when storing a row into the
proc table. (Bug#24923)
If the expected precision of an arithmetic expression exceeded the maximum precision supported by MySQL, the precision of the
result was reduced by an unpredictable or arbitrary amount, rather than to the maximum precision. In some cases, exceeding the
maximum supported precision could also lead to a crash of the server. (Bug#24907)
For Vista installs, MySQLInstanceConfig.exe did not add the default MySQL port to the firewall exceptions. It now provides
a checkbox that enables the user a choice of whether to do this. (Bug#24853)
A CREATE TRIGGER statement could cause a deadlock or server crash if it referred to a table for which a table lock had been ac-
quired with LOCK TABLES. (Bug#23713)
For storage engines that do not redefine handler::index_next_same() and are capable of indexes, statements that include a
WHERE clause might select incorrect data. (Bug#22351)
The parser treated the INTERVAL() function incorrectly, leading to situations where syntax errors could result depending on which
side of an arithmetic operator the function appeared. (Bug#22312)
Entries in the general query log were truncated at 1000 characters. (Bug#21557)
A memory leak occurred when CREATE TEMPORARY TABLE .. SELECT was invoked from a stored function that in turn was
called from CREATE TABLE ... SELECT. (Bug#21136)
It was possible to execute CREATE TABLE t1 ... SELECT ... FROM t2 with the CREATE privilege for t1 and SELECT
privilege for t2, even in the absence of the INSERT privilege for t1. (Bug#20901)
Worked around an icc problem with an incorrect machine instruction being generated in the context of software pre-fetching after
a subroutine got in-lined. (Upgrading to icc 10.0.026 makes the workaround unnecessary.) (Bug#20803)
If a column selected by a view referred to a stored function, the data type reported for the column in INFORMA-
TION_SCHEMA.COLUMNS could be incorrect. (Bug#20550)
The mysql_change_user() C API function changed the value of the sql_big_selects session variable. (Bug#20023)
See also Bug#40363.
Host names sometimes were treated as case sensitive in account-management statements (CREATE USER, GRANT, REVOKE, and
so forth). (Bug#19828)
Issuing an SQL KILL of the active connection caused an error on Mac OS X. (Bug#19723)
The readline library has been updated to version 5.2. This addresses issues in the mysql client where history and editing within
the client would fail to work as expected. (Bug#18431)
The -lmtmalloc library was removed from the output of mysql_config on Solaris, as it caused problems when building
DBD::mysql (and possibly other applications) on that platform that tried to use dlopen() to access the client library.
(Bug#18322)
MySQLInstanceConfig.exe failed to grant certain privileges to the 'root'@'%' account. (Bug#17303)
The Aborted_clients status variable was incremented twice if a client exited without calling mysql_close(). (Bug#16918)
MySQL Change History
2902
Use of GRANT statements with grant tables from an old version of MySQL could cause a server crash. (Bug#16470)
Clients were ignoring the TCP/IP port number specified as the default port via the --with-tcp-port configuration option.
(Bug#15327)
Parameters of type DATETIME or DATE in stored procedures were silently converted to VARBINARY. (Bug#13675)
Zero-padding of exponent values was not the same across platforms. (Bug#12860)
Values of types REAL ZEROFILL, DOUBLE ZEROFILL, FLOAT ZEROFILL, were not zero-filled when converted to a charac-
ter representation in the C prepared statement API. (Bug#11589)
mysql stripped comments from statements sent to the server. Now the --comments or --skip-comments option can be used
to control whether to retain or strip comments. The default is --skip-comments. (Bug#11230, Bug#26215)
Several buffer-size system variables were either being handled incorrectly for large values (for settings larger than 4GB, they were
truncated to values less than 4GB without a warning), or were limited unnecessarily to 4GB even on 64-bit systems. The following
changes were made:
For key_buffer_size, values larger than 4GB are allowed on 64-bit platforms.
For join_buffer_size, sort_buffer_size, and myisam_sort_buffer_size, values larger than 4GB are al-
lowed on 64-bit platforms (except Windows, for which large values are truncated to 4GB with a warning).
In addition, settings for read_buffer_size and read_rnd_buffer_size are limited to 2GB on all platforms. Larger val-
ues are truncated to 2GB with a warning. (Bug#5731, Bug#29419, Bug#29446)
Executing DISABLE KEYS and ENABLE KEYS on a nonempty table would cause the size of the index file for the table to grow
considerable. This was because the DISABLE KEYS operation would only mark the existing index, without deleting the index
blocks. The ENABLE KEYS operation would re-create the index, adding new blocks, while the previous index blocks would re-
main. Existing indexes are now dropped and recreated when the ENABLE KEYS statement is executed. (Bug#4692)
Grant table checks failed in libmysqld.
C.1.16. Changes in MySQL 5.1.22 (24 September 2007 Release Candidate)
Functionality added or changed:
There is a new innodb_autoinc_lock_mode system variable to configure the locking behavior that InnoDB uses for generat-
ing auto-increment values. The default behavior now is slightly different from before, which involves a minor incompatibility for
multiple-row inserts that specify an explicit value for the auto-increment column in some but not all rows. See Section 13.6.4.3,
AUTO_INCREMENT Handling in InnoDB.
Bugs fixed:
MySQL Cluster: Replication: (Replication): Multi-master replication setups did not handle --log-slave-updates correctly.
(Bug#30017)
MySQL Cluster: Backups of TIMESTAMP columns made with ndb_restore on a MySQL Cluster using data nodes hosts of one
endian could not be used to restore the cluster's data to data node hosts of the other endian. (Bug#30134)
Replication: Row-based replication from a pre-5.1.22 MySQL Server to a MySQL 5.1.22 was unstable due to an uninitialized vari-
able. (Bug#31076)
Replication: Operations that used the time zone replicated the time zone only for successful operations, but did not replicate the
time zone for errors that need to know it. (Bug#29536)
For an InnoDB table if a SELECT was ordered by the primary key and also had a WHERE field = value clause on a different
field that was indexed, a DESC order instruction would be ignored. (Bug#31001)
mysql_install_db could fail to find its message file. (Bug#30678)
MySQL Change History
2903
Memory corruption occurred for some queries with a top-level OR operation in the WHERE condition if they contained equality pre-
dicates and other sargable predicates in disjunctive parts of the condition. (Bug#30396)
CONNECTION_ID() always returned 0 for the embedded server (libmysqld). (Bug#30389)
The server created temporary tables for filesort operations in the working directory, not in the directory specified by the tmpdir
system variable. (Bug#30287)
Using KILL QUERY or KILL CONNECTION to kill a SELECT statement caused a server crash if the query cache was enabled.
(Bug#30201)
mysqldump from the MySQL 5.1.21 distribution could not be used to create a dump from a MySQL 5.1.20 or older server.
(Bug#30123)
Under some circumstances, a UDF initialization function could be passed incorrect argument lengths. (Bug#29804)
When using a combination of HANDLER... READ and DELETE on a table, MySQL continued to open new copies of the table
every time, leading to an exhaustion of file descriptors. (Bug#29474)
This regression was introduced by Bug#21587.
The mysql_list_fields() C API function incorrectly set MYSQL_FIELD::decimals for some view columns.
(Bug#29306)
Tables using the InnoDB storage engine incremented AUTO_INCREMENT values incorrectly with ON DUPLICATE KEY UP-
DATE. (Bug#28781)
Nonrange queries of the form SELECT ... FROM ... WHERE keypart1=constant, ..., keypartN=constant
ORDER BY ... FOR UPDATE sometimes were unnecessarily blocked waiting for a lock if another transaction was using SE-
LECT ... FOR UPDATE on the same table. (Bug#28570)
On Windows, symbols for yaSSL and taocrypt were missing from mysqlclient.lib, resulting in unresolved symbol errors for
clients linked against that library. (Bug#27861)
Read lock requests that were blocked by a pending write lock request were not allowed to proceed if the statement requesting the
write lock was killed. (Bug#21281)
C.1.17. Changes in MySQL 5.1.21 (16 August 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Note
Subsequent to release, it was discovered that on some platforms, mysql_install_db could fail to find its message file,
resulting in error messages of the following form:
shell> mysql_install_db
Installing MySQL system tables...
070830 9:33:24 [ERROR] Can't find messagefile 'path/share/english/errmsg.sys'
070830 9:33:24 [ERROR] Aborting
To deal with this problem, specify a --language option to specify the proper path name to the language file directory.
For example:
shell> mysql_install_db --language=/path/to/share/english/
MySQL Change History
2904
This problem is corrected in MySQL 5.1.22.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: In MySQL 5.1.6, when log tables were implemented, the default log destination for the general query and
slow query log was TABLE. This default has been changed to FILE, which is compatible with MySQL 5.0, but incompatible with
earlier releases of MySQL 5.1 from 5.1.6 to 5.1.20. If you are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging option
changes should be necessary. However, if you are upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and were using TABLE
logging, use the --log-output=TABLE option explicitly to preserve your server's table-logging behavior.
A further fix for this issue was made in MySQL 5.1.23. (Bug#29993)
Incompatible Change: The innodb_log_arch_dir system variable (which has been deprecated since MySQL 5.0.24) has
been removed and should no longer be used.
Incompatible Change: On Windows only, the mysqld-nt has been removed from this release and all future releases. The
mysqld server now includes named-pipe support as standard, and you do not have to use the mysqld-nt version to enable
named-pipe support.
Important Change: The default mysqld_safe logging behavior now is --skip-syslog rather than --syslog, which is
compatible with the default behavior of writing an error log file for releases prior to 5.1.20.
Replication: The SQL thread on a slave now is always allowed to enter InnoDB even if this would exceed the limit imposed by the
innodb_thread_concurrency system variable. In cases of high load on the slave server (when in-
nodb_thread_concurrency is reached), this change helps the slave stay more up to date with the master; in the previous be-
havior, the SQL thread was competing for resources with all client threads active on the slave server. (Bug#25078)
Replication: Replication between master and slaves now supports different column numbers within a table on both master and
slave. The rules for replication where the table definitions are different has also changed. This supercedes the functionality for rep-
lication from the master table to a slave table with more columns that was added in MySQL 5.1.12. For more information, see Sec-
tion 16.3.1.4, Replication with Differing Tables on Master and Slave.
Several programs now accept --debug-check and --debug-info options: mysql, mysqladmin, mysqlbinlog,
mysqlcheck, mysqldump, mysqlimport, mysqlshow, mysqlslap, mysqltest, mysql_upgrade. (Note: mysql,
mysqladmin, mysqlcheck, mysqldump, mysqlimport, mysqlshow, and mysqltest already accepted -
-debug-info.) --debug-check prints debugging information at program exit. --debug-info is similar but also prints
memory and CPU usage statistics. This patch also corrects a problem for mysql that --debug-info did not display statistics at
exit time. (Bug#30127)
The --syslog option that was introduced in 5.1.20 for mysqld_safe (to send error output to syslog) did not work correctly:
Error output was buffered and not logged immediately. This has been corrected. In addition, some feature changes were made:

Important
The default mysqld_safe logging behavior now is --skip-syslog rather than --syslog, which is compatible
with the default behavior of writing an error log file for releases prior to 5.1.20.
A new option, --syslog-tag=tag , modifies the default tags written by mysqld_safe and mysqld to syslog to be
mysqld_safe-tag and mysqld-tag rather than the default tags of mysqld_safe and mysqld.
(Bug#29992)
Transaction support in the FEDERATED storage engine has been disabled due to issues with multiple active transactions and ses-
sions on the same FEDERATED table. (Bug#29875)
Previously, prepared statements processed using PREPARE and EXECUTE were not subject to caching in the query cache if they
contained any ? parameter markers. This limitation has been lifted. (Bug#29318)
It is now possible to set long_query_time in microseconds or to 0. Setting this value to 0 causes all queries to be recorded in
MySQL Change History
2905
the slow query log.
Currently, fractional values can be used only when logging to files. We plan to provide this functionality for logging to tables when
time-related data types are enhanced to support microsecond resolution. (Bug#25412)
INFORMATION_SCHEMA implementation changes were made that optimize certain types of queries for INFORMATION_SCHEMA
tables so that they execute more quickly. Section 7.2.20, INFORMATION_SCHEMA Optimization, provides guidelines on how to
take advantage of these optimizations by writing queries that minimize the need for the server to access the file system to obtain the
information contained in INFORMATION_SCHEMA tables. By writing queries that enable the server to avoid directory scans or
opening table files, you will obtain better performance. (Bug#19588)
Log table locking was redesigned, eliminating several lock-related problems:
Truncating mysql.slow_log in a stored procedure after use of a cursor caused the thread to lock.
Flushing a log table resulted in unnecessary warnings.
The server would hang when performing concurrent ALTER TABLE or TRUNCATE TABLE statements against the log tables.
Changing the value of the general_log system variable while a global read lock was in place resulted in deadlock.
The changes provide better-defined interface characteristics. See Section 5.2.1, Selecting General Query and Slow Query Log Out-
put Destinations. (Bug#17876, Bug#23044, Bug#25422, Bug#29129)
Added the --commit, --detach, --post-system, and --pre-system options for mysqlslap.
A new option, --syslog-tag=tag , modifies the default tags written by mysqld_safe and mysqld to syslog to be
mysqld_safe-tag and mysqld-tag rather than the default tags of mysqld_safe and mysqld.
Two options relating to slow query logging have been added for mysqld. --log-slow-slave-statements causes slow
statements executed by a replication slave to be written to the slow query log; min_examined_row_limit can be used to cause
queries which examine fewer than the stated number of rows not to be logged.
Bugs fixed:
Incompatible Change: Failure to consider collation when comparing space characters could result in incorrect index entry order,
leading to incorrect comparisons, inability to find some index values, misordered index entries, misordered ORDER BY results, or
tables that CHECK TABLE reports as having corrupt indexes.
As a result of this bug fix, indexes must be rebuilt for columns that use any of these character sets: eucjpms, euc_kr, gb2312,
latin7, macce, ujis. See Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt. (Bug#29461)
Incompatible Change: Several issues were identified for stored programs (stored procedures and functions, triggers, and events)
and views containing non-ASCII symbols. These issues involved conversion errors due to incomplete character set information
when translating these objects to and from stored format, such as:
Parsing the original object definition so that it can be stored.
Compiling the stored definition into executable form when the object is invoked.
Retrieval of object definitions from INFORMATION_SCHEMA tables.
Displaying the object definition in SHOW statements. This issue also affected mysqldump, which uses SHOW.
The fix for the problems is to store character set information from the object creation context so that this information is available
when the object needs to be used later. The context includes the client character set, the connection character set and collation, and
the collation of the database with which the object is associated.
As a result of the patch, several tables have new columns:
In the mysql database, the proc and event tables now have these columns: character_set_client, colla-
tion_connection, db_collation, body_utf8.
In INFORMATION_SCHEMA, the VIEWS table now has these columns: CHARACTER_SET_CLIENT, COLLA-
MySQL Change History
2906
TION_CONNECTION. The ROUTINES, TRIGGERS, and EVENTS tables now have these columns: CHARAC-
TER_SET_CLIENT, COLLATION_CONNECTION, DATABASE_COLLATION.
These columns store the session values of the character_set_client and collation_connection system variables,
and the collation of the database with which the object is associated. The values are those in effect at object creation time. (The
saved database collation is not the value of the collation_database system variable, which applies to the default database; the
database that contains the object is not necessarily the default database.)
Several SHOW statements now display additional columns corresponding to the new table columns. These statements are: SHOW
CREATE EVENT, SHOW CREATE FUNCTION, SHOW CREATE PROCEDURE, SHOW CREATE VIEW, SHOW EVENTS, SHOW
FUNCTION STATUS, SHOW PROCEDURE STATUS, SHOW TRIGGERS.
A new statement, SHOW CREATE TRIGGER is introduced and is used by mysqldump for producing CREATE TRIGGER state-
ments.
Subsequent to the patch just described, it was discovered that the patch broke mysql_upgrade; this has been corrected.
Important
The fixes for the problems just describe affect all existing stored programs and views. (For example, you will see warnings
about no creation context.) To avoid warnings from the server about the use of old definitions from any release prior to
5.1.21, you should dump stored programs and views with mysqldump after upgrading to 5.1.21, and then reload them to
recreate them with new definitions. Invoke mysqldump with a --default-character-set option that names the
non-ASCII character set that was used for the definitions when the objects were originally defined.
(Bug#25221, Bug#21249, Bug#30027, Bug#16291, Bug#11986, Bug#25212, Bug#19443, Bug#30029)
MySQL Cluster: Replication: (Replication): Inconsistencies could occur between the master and the slave when replicating Disk
Data tables. (Bug#19259, Bug#19227)
MySQL Cluster: DELETE FROM table WHERE primary_key IN (value_list), where the value_list contained
more than one value, called from an AFTER DELETE trigger on an NDB table, caused mysqld to crash. (Bug#30337)
MySQL Cluster: When restarting a data node, queries could hang during that node's start phase 5, and continue only after the node
had entered phase 6. (Bug#29364)
MySQL Cluster: Replica redo logs were inconsistently handled during a system restart. (Bug#29354)
MySQL Cluster: When a node failed to respond to a COPY_GCI signal as part of a global checkpoint, the master node was killed
instead of the node that actually failed. (Bug#29331)
MySQL Cluster: An invalid comparison made during REDO validation that could lead to an ERROR WHILE READING REDO LOG
condition. (Bug#29118)
MySQL Cluster: The wrong data pages were sometimes invalidated following a global checkpoint. (Bug#29067)
MySQL Cluster: If at least 2 files were involved in REDO invalidation, then file 0 of page 0 was not updated and so pointed to an
invalid part of the redo log. (Bug#29057)
MySQL Cluster: If a storage engine has its own logging capability, then any statement using both this engine and some other en-
gine not having its own logging could not be correctly logged, due to the fact that entries from one engine could be logged before
entries from the other engine were. This did not generate any error messages when it occurred.
Now, if multiple storage engines are used in a statement and at least one of them has its own logging capability, then an error mes-
sage is generated and the statement is not executed.
Note
Currently, the only storage engine to have its own logging capability is NDBCLUSTER.
(Bug#28722)
MySQL Cluster: Warnings and errors generated by ndb_config --config-file=file were sent to stdout, rather than
to stderr. (Bug#25941)
MySQL Change History
2907
MySQL Cluster: When a cluster backup was terminated using the ABORT BACKUP command in the management client, a mis-
leading error message BACKUP ABORTED BY APPLICATION: PERMANENT ERROR: INTERNAL ERROR was returned. The error mes-
sage returned in such cases now reads BACKUP ABORTED BY USER REQUEST. (Bug#21052)
MySQL Cluster: Large file support did not work in AIX server binaries. (Bug#10776)
Replication: The thread ID was not reset properly after execution of mysql_change_user(), which could cause replication
failure when replicating temporary tables. (Bug#29734)
Replication: Storage engine error conditions in row-based replication were not correctly reported to the user. (Bug#29570)
Replication: INSERT DELAYED statements on a master server are replicated as non-DELAYED inserts on slaves (which is normal,
to preserve serialization), but the inserts on the slave did not use concurrent inserts. Now INSERT DELAYED on a slave is conver-
ted to a concurrent insert when possible, and to a normal insert otherwise. (Bug#29152)
Replication: An error that happened inside INSERT, UPDATE, or DELETE statements performed from within a stored function or
trigger could cause inconsistency between master and slave servers. (Bug#27417)
Replication: Slave servers could incorrectly interpret an out-of-memory error from the master and reconnect using the wrong binary
log position. (Bug#24192)
Replication: Using the READ COMMITTED transaction isolation level caused mixed and statement-based replication to fail.
(Bug#23051)
Disk Data: Performing Disk Data schema operations during a node restart could cause forced shutdowns of other data nodes.
(Bug#29501)
Disk Data: When dropping a page, the stack's bottom entry could sometime be left cold rather than hot, violating the rules for
stack pruning. (Bug#29176)
Disk Data: Disk data meta-information that existed in ndbd might not be visible to mysqld. (Bug#28720)
Disk Data: The number of free extents was incorrectly reported for some tablespaces. (Bug#28642)
Cluster Replication: When executing a statement where binlog_format = statement, the result of the statement was
logged both as a statement and as rows. (Bug#29222)
Cluster Replication: mysqld would segfault on startup when the NDB storage engine was enabled and the default character set
was a strictly multi-byte character set such as UCS2.
This issue does not apply to character sets that can contain single-byte characters in addition to multi-byte characters such as UTF-8.
Additional issues remain with regard to the use of multi-byte character sets in MySQL Cluster Replication; see Section 17.9.3,
Known Issues in MySQL Cluster Replication, for more information. (Bug#27404)
Prepared statements containing CONNECTION_ID() could be written improperly to the binary log. (Bug#30200)
Use of local variables with non-ASCII names in stored procedures crashed the server. (Bug#30120)
On Windows, client libraries lacked symbols required for linking. (Bug#30118)
--myisam-recover='' (empty option value) did not disable MyISAM recovery. (Bug#30088)
For the SHOW TABLE TYPES statement, the server sent incorrect output to clients, possibly causing them to crash. (Bug#30036)
The IS_UPDATABLE column in the INFORMATION_SCHEMA.VIEWS table was not always set correctly. (Bug#30020)
SHOW statements were being written to the slow query log that should not have been. (Bug#30000)
REPAIR TABLE ... USE_FRM could corrupt tables. (Bug#29980)
For MyISAM tables on Windows, INSERT, DELETE, or UPDATE followed by ALTER TABLE within LOCK TABLES could cause
table corruption. (Bug#29957)
LOCK TABLES did not pre-lock tables used in triggers of the locked tables. Unexpected locking behavior and statement failures
similar to FAILED: 1100: TABLE 'XX' WAS NOT LOCKED WITH LOCK TABLES could result. (Bug#29929)
MySQL Change History
2908
INSERT ... VALUES(CONNECTION_ID(), ...) statements were written to the binary log in such a way that they could
not be properly restored. (Bug#29928)
Adding DISTINCT could cause incorrect rows to appear in a query result. (Bug#29911)
On Windows, the CMake build process did not produce the embedded server library or related binaries. (Bug#29903)
Using the DATE() function in a WHERE clause did not return any records after encountering NULL. However, using TRIM or CAST
produced the correct results. (Bug#29898)
SESSION_USER() returned garbage data (rather than the correct value of the empty string) when executed by a slave SQL thread.
(Bug#29878)
Very long prepared statements in stored procedures could cause a server crash. (Bug#29856)
If query execution involved a temporary table, GROUP_CONCAT() could return a result with an incorrect character set.
(Bug#29850)
If one thread was performing concurrent inserts, other threads reading from the same table using equality key searches could see the
index values for new rows before the data values had been written, leading to reports of table corruption. (Bug#29838)
Repeatedly accessing a view in a stored procedure (for example, in a loop) caused a small amount of memory to be allocated per ac-
cess. Although this memory is deallocated on disconnect, it could be a problem for a long running stored procedures that make re-
peated access of views. (Bug#29834)
mysqldump produced output that incorrectly discarded the NO_AUTO_VALUE_ON_ZERO value of the sql_mode variable after
dumping triggers. (Bug#29788)
An assertion failure occurred within yaSSL for very long keys. (Bug#29784)
For MEMORY tables, the index_merge union access method could return incorrect results. (Bug#29740)
Comparison of TIME values using the BETWEEN operator led to string comparison, producing incorrect results in some cases. Now
the values are compared as integers. (Bug#29739)
For a table with a DATE column date_col such that selecting rows with WHERE date_col = 'date_val 00:00:00'
yielded a nonempty result, adding GROUP BY date_col caused the result to be empty. (Bug#29729)
In some cases, INSERT INTO ... SELECT ... GROUP BY could insert rows even if the SELECT by itself produced an
empty result. (Bug#29717)
Single-row inserts could report a row count greater than one. (Bug#29692)
For the embedded server, the mysql_stmt_store_result() C API function caused a memory leak for empty result sets.
(Bug#29687)
EXPLAIN produced Impossible where for statements of the form SELECT ... FROM t WHERE c=0, where c was an
ENUM column defined as a primary key. (Bug#29661)
On Windows, ALTER TABLE hung if records were locked in share mode by a long-running transaction. (Bug#29644)
mysqld_safe produced error messages and did not create the error log file under some circumstances. (Bug#29634)
On 64-bit platforms, the filesort code (for queries with GROUP BY or ORDER BY) could crash due to an incorrect pointer size.
(Bug#29610)
A left join between two views could produce incorrect results. (Bug#29604)
Certain statements with unions, subqueries, and joins could result in huge memory consumption. (Bug#29582)
Clients using SSL could hang the server. (Bug#29579)
A slave running with --log-slave-updates would fail to write INSERT DELAY IGNORE statements to its binary log, res-
ulting in different binary log contents on the master and slave. (Bug#29571)
An incorrect result was returned when comparing string values that were converted to TIME values with CAST(). (Bug#29555)
MySQL Change History
2909
gcov coverage-testing information was not written if the server crashed. (Bug#29543)
In the ascii character set, conversion of DEL (0x7F) to Unicode incorrectly resulted in QUESTION MARK (0x3F) rather than
DEL. (Bug#29499)
A field packet with NULL fields caused a libmysqlclient crash. (Bug#29494)
On Windows, the mysql client died if the user entered a statement and Return after entering Control-C. (Bug#29469)
The full-text parser could enter an infinite loop if it encountered an illegal multi-byte sequence or a sequence that has no mapping to
Unicode. (Bug#29464)
Searching a FULLTEXT index for a word with the boolean mode truncation operator could cause an infinite loop. (Bug#29445)
Corrupt data resulted from use of SELECT ... INTO OUTFILE 'file_name' FIELDS ENCLOSED BY 'c', where c is
a digit or minus sign, followed by LOAD DATA INFILE 'file_name' FIELDS ENCLOSED BY 'c'. (Bug#29442)
Killing an INSERT DELAYED thread caused a server crash. (Bug#29431)
Use of SHOW BINLOG EVENTS for a nonexistent log file followed by PURGE BINARY LOGS caused a server crash.
(Bug#29420)
Assertion failure could occur for grouping queries that employed DECIMAL user variables with assignments to them. (Bug#29417)
For CAST(expr AS DECIMAL(M,D)), the limits of 65 and 30 on the precision (M) and scale (D) were not enforced.
(Bug#29415)
Deleting from a CSV table could corrupt it. (Bug#29411)
Results for a select query that aliases the column names against a view could duplicate one column while omitting another. This bug
could occur for a query over a multiple-table view that includes an ORDER BY clause in its definition. (Bug#29392)
mysqldump created a stray file when a given a too-long file name argument. (Bug#29361)
The special zero ENUM value was coerced to the normal empty string ENUM value during a column-to-column copy. This affected
CREATE ... SELECT statements and SELECT statements with aggregate functions on ENUM columns in the GROUP BY clause.
(Bug#29360)
Inserting a negative number into a CSV table could corrupt it. (Bug#29353)
Optimization of queries with DETERMINISTIC stored functions in the WHERE clause was ineffective: A sequential scan was al-
ways used. (Bug#29338)
MyISAM corruption could occur with the cp932_japanese_ci collation for the cp932 character set due to incorrect comparis-
on for trailing space. (Bug#29333)
For updates to InnoDB tables, a TIMESTAMP column with the ON UPDATE CURRENT_TIMESTAMP attribute could be updated
even when no values actually changed. (Bug#29310)
FULLTEXT indexes could be corrupted by certain gbk characters. (Bug#29299)
SELECT ... INTO OUTFILE followed by LOAD DATA could result in garbled characters when the FIELDS ENCLOSED BY
clause named a delimiter of '0', 'b', 'n', 'r', 't', 'N', or 'Z' due to an interaction of character encoding and doubling for
data values containing the enclosed-by character. (Bug#29294)
Sort order of the collation wasn't used when comparing trailing spaces. This could lead to incorrect comparison results, incorrectly
created indexes, or incorrect result set order for queries that include an ORDER BY clause. (Bug#29261)
CHECK TABLE could erroneously report table corruption for a CSV table if multiple threads were modifying the table at the same
time. (Bug#29253)
Many threads accessing a CSV table simultaneously could cause an assertion failure. (Bug#29252)
If an ENUM column contained '' as one of its members (represented with numeric value greater than 0), and the column contained
error values (represented as 0 and displayed as ''), using ALTER TABLE to modify the column definition caused the 0 values to
be given the numeric value of the nonzero '' member. (Bug#29251)
MySQL Change History
2910
Calling mysql_options() after mysql_real_connect() could cause clients to crash. (Bug#29247)
CHECK TABLE for ARCHIVE tables could falsely report table corruption or cause a server crash. (Bug#29207)
Mixing binary and utf8 columns in a union caused field lengths to be calculated incorrectly, resulting in truncation. (Bug#29205)
AsText() could fail with a buffer overrun. (Bug#29166)
Under some circumstances, a SELECT ... FROM mysql.event could cause the server to crash. (Bug#29156)
InnoDB refused to start on some versions of FreeBSD with LinuxThreads. This is fixed by enabling file locking on FreeBSD.
(Bug#29155)
LOCK TABLES was not atomic when more than one InnoDB tables were locked. (Bug#29154)
mysqld failed to exit during shutdown. (Bug#29133)
A network structure was initialized incorrectly, leading to embedded server crashes. (Bug#29117)
An assertion failure occurred if a query contained a conjunctive predicate of the form view_column = constant in the
WHERE clause and the GROUP BY clause contained a reference to a different view column. The fix also enables application of an
optimization that was being skipped if a query contained a conjunctive predicate of the form view_column = constant in the
WHERE clause and the GROUP BY clause contained a reference to the same view column. (Bug#29104)
A maximum of 4TB InnoDB free space was reported by SHOW TABLE STATUS, which is incorrect on systems with more than
4TB space. (Bug#29097)
If an INSERT INTO ... SELECT statement inserted into the same table that the SELECT retrieved from, and the SELECT in-
cluded ORDER BY and LIMIT clauses, different data was inserted than the data produced by the SELECT executed by itself.
(Bug#29095)
Queries that performed a lookup into a BINARY index containing key values ending with spaces caused an assertion failure for de-
bug builds and incorrect results for nondebug builds. (Bug#29087)
The semantics of BIGINT depended on platform-specific characteristics. (Bug#29079)
A byte-order issue in writing a spatial index to disk caused bad index files on some systems. (Bug#29070)
Creation of a legal stored procedure could fail if no default database had been selected. (Bug#29050)
REPLACE, INSERT IGNORE, and UPDATE IGNORE did not work for FEDERATED tables. (Bug#29019)
Inserting into InnoDB tables and executing RESET MASTER in multiple threads cause assertion failure in debug server binaries.
(Bug#28983)
Updates to a CSV table could cause a server crash or update the table with incorrect values. (Bug#28971)
For a ucs2 column, GROUP_CONCAT() did not convert separators to the result character set before inserting them, producing a
result containing a mixture of two different character sets. (Bug#28925)
Dropping the definer of an active event caused the server to crash. (Bug#28924)
For a join with GROUP BY and/or ORDER BY and a view reference in the FROM list, the query metadata erroneously showed empty
table aliases and database names for the view columns. (Bug#28898)
Creating an event using ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL ... could in some cases cause mysqld
to crash. (Bug#28881)
Coercion of ASCII values to character sets that are a superset of ASCII sometimes was not done, resulting in ILLEGAL MIX OF
COLLATIONS errors. These cases now are resolved using repertoire, a new string expression attribute (see Section 9.1.7, String Rep-
ertoire). (Bug#28875)
Executing ALTER EVENT on an event whose definer's event creation privileges had been revoked cause the server to crash.
(Bug#28873)
ALTER VIEW is not supported as a prepared statement but was not being rejected. ALTER VIEW is now prohibited as a prepared
MySQL Change History
2911
statement or when called within stored routines. (Bug#28846)
In strict SQL mode, errors silently stopped the SQL thread even for errors named using the --slave-skip-errors option.
(Bug#28839)
Fast ALTER TABLE (that works without rebuilding the table) acquired duplicate locks in the storage engine. In MyISAM, if ALTER
TABLE was issued under LOCK TABLE, it caused all data inserted after LOCK TABLE to disappear. (Bug#28838)
Runtime changes to the log_queries_not_using_indexes system variable were ignored. (Bug#28808)
Selecting a column not present in the selected-from table caused an extra error to be produced by SHOW ERRORS. (Bug#28677)
Creating an event to be executed at a time close to the end of the allowed range (2038-01-19 03:14:07 UTC) would cause the server
to crash. (Bug#28641)
For a statement of the form CREATE t1 SELECT integer_constant, the server created the column using the DECIMAL
data type for large negative values that are within the range of BIGINT. (Bug#28625)
Starting the server with an innodb_force_recovery value of 4 did not work. (Bug#28604)
For InnoDB tables, MySQL unnecessarily sorted records in certain cases when the records were retrieved by InnoDB in the proper
order already. (Bug#28591)
mysql_install_db could fail to find script files that it needs. (Bug#28585)
If a stored procedure was created and invoked prior to selecting a default database with USE, a NO DATABASE SELECTED error oc-
curred. (Bug#28551)
On Mac OS X, shared-library installation path names were incorrect. (Bug#28544)
Using the --skip-add-drop-table option with mysqldump generated incorrect SQL if the database included any views.
The recreation of views requires the creation and removal of temporary tables. This option suppressed the removal of those tempor-
ary tables. The same applied to --compact since this option also invokes --skip-add-drop-table. (Bug#28524)
mysqlbinlog --hexdump generated incorrect output due to omission of the # comment character for some comment lines.
(Bug#28293)
InnoDB could crash if the server was shut down while innodb_table_monitor was running. (Bug#28254)
A race condition in the interaction between MyISAM and the query cache code caused the query cache not to invalidate itself for
concurrently inserted data. (Bug#28249)
A duplicate-key error message could display an incorrect key value when not all columns of the key were used to select rows for up-
date. (Bug#28158)
Indexing column prefixes in InnoDB tables could cause table corruption. (Bug#28138)
Index creation could fail due to truncation of key values to the maximum key length rather than to a mulitiple of the maximum char-
acter length. (Bug#28125)
Instance Manager had a race condition when it received a shutdown request while a guarded mysqld instance was starting such
that it could fail to stop the mysqld instance. (Bug#28030)
SELECT ... FOR UPDATE with partitioned tables could cause a server crash. (Bug#28026)
On Windows, Instance Manager would crash if an instance object failed to initialize during startup. This could happen if an incor-
rect mysqld path was supplied in the configuration file. (Bug#28012)
The LOCATE() function returned NULL if any of its arguments evaluated to NULL. Likewise, the predicate,
LOCATE(str,NULL) IS NULL, erroneously evaluated to FALSE. (Bug#27932)
Dropping a user-defined function could cause a server crash if the function was still in use by another thread. (Bug#27564)
For some event-creation problems, the server displayed messages that implied the problems were errors when they were only warn-
ings. (Bug#27406)
MySQL Change History
2912
Unsafe aliasing in the source caused a client library crash when compiled with gcc 4 at high optimization levels. (Bug#27383)
Index-based range reads could fail for comparisons that involved contraction characters (such as ch in Czech or ll in Spanish).
(Bug#27345)
Aggregations in subqueries that refer to outer query columns were not always correctly referenced to the proper outer query.
(Bug#27333)
Error returns from the time() system call were ignored. (Bug#27198)
Phantom reads could occur under InnoDB SERIALIZABLE isolation level. (Bug#27197)
The SUBSTRING() function returned the entire string instead of an empty string when it was called from a stored procedure and
when the length parameter was specified by a variable with the value 0 . (Bug#27130)
Some functions when used in partitioning expressions could cause mysqld to crash. (Bug#27084)
The server acquired a global mutex for temporary tables, although such tables are thread-specific. This affected performance by
blocking other threads. (Bug#27062)
FEDERATED tables had an artificially low maximum of key length. (Bug#26909)
Updates to rows in a partitioned table could update the wrong column. (Bug#26827)
Index creation could corrupt the table definition in the .frm file: 1) A table with the maximum number of key segments and max-
imum length key name would have a corrupted .frm file, due to incorrect calculation of the total key length. 2) MyISAM would re-
ject a table with the maximum number of keys and the maximum number of key segments in all keys. (It would allow one less than
this total maximum.) Now MyISAM accepts a table defined with the maximum. (Bug#26642)
The Windows implementation of pthread_join() was incorrect and could cause crashes. (Bug#26564)
After the first read of a TEMPORARY table, CHECK TABLE could report the table as being corrupt. (Bug#26325)
If an operation had an InnoDB table, and two triggers, AFTER UPDATE and AFTER INSERT, competing for different resources
(such as two distinct MyISAM tables), the triggers were unable to execute concurrently. In addition, INSERT and UPDATE state-
ments for the InnoDB table were unable to run concurrently. (Bug#26141)
A number of unsupported constructs including prohibited constructs, the UCASE() function, and nested function calls were
permitted in partitioning expressions. (Bug#26082, Bug#18198, Bug#29308)
ALTER DATABASE did not require at least one option. (Bug#25859)
The index merge union access algorithm could produce incorrect results with InnoDB tables. The problem could also occur for
queries that used DISTINCT. (Bug#25798)
When using a FEDERATED table, the value of LAST_INSERT_ID() would not correctly update the C API interface, which would
affect the autogenerated ID returned both through the C API and the MySQL protocol, affecting Connectors that used the protocol
and/or C API. (Bug#25714)
The server was blocked from opening other tables while the FEDERATED engine was attempting to open a remote table. Now the
server does not check the correctness of a FEDERATED table at CREATE TABLE time, but waits until the table actually is accessed.
(Bug#25679)
Under ActiveState Perl, mysql-test-run.pl could kill itself when attempting to kill other processes. (Bug#25657)
Several InnoDB assertion failures were corrected. (Bug#25645)
A query with DISTINCT in the select list to which the loose-scan optimization for grouping queries was applied returned an incor-
rect result set when the query was used with the SQL_BIG_RESULT option. (Bug#25602)
For a multiple-row insert into a FEDERATED table that refers to a remote transactional table, if the insert failed for a row due to
constraint failure, the remote table would contain a partial commit (the rows preceding the failed one) instead of rolling back the
statement completely. This occurred because the rows were treated as individual inserts.
Now FEDERATED performs bulk-insert handling such that multiple rows are sent to the remote table in a batch. This provides a per-
formance improvement and enables the remote table to perform statement rollback properly should an error occur. This capability
MySQL Change History
2913
has the following limitations:
The size of the insert cannot exceed the maximum packet size between servers. If the insert exceeds this size, it is broken into
multiple packets and the rollback problem can occur.
Bulk-insert handling does not occur for INSERT ... ON DUPLICATE KEY UPDATE.
(Bug#25513)
The FEDERATED storage engine failed silently for INSERT ... ON DUPLICATE KEY UPDATE if a duplicate key violation
occurred. FEDERATED does not support ON DUPLICATE KEY UPDATE, so now it correctly returns an ER_DUP_KEY error if a
duplicate key violation occurs. (Bug#25511)
In a stored function or trigger, when InnoDB detected deadlock, it attempted rollback and displayed an incorrect error message
(EXPLICIT OR IMPLICIT COMMIT IS NOT ALLOWED IN STORED FUNCTION OR TRIGGER). Now InnoDB returns an error under
these conditions and does not attempt rollback. Rollback is handled outside of InnoDB above the function/trigger level.
(Bug#24989)
Dropping a temporary InnoDB table that had been locked with LOCK TABLES caused a server crash. (Bug#24918)
On Windows, executables did not include Vista manifests. (Bug#24732)
See also Bug#22563.
If MySQL/InnoDB crashed very quickly after starting up, it would not force a checkpoint. In this case, InnoDB would skip crash
recovery at next startup, and the database would become corrupt. Now, if the redo log scan at InnoDB startup goes past the last
checkpoint, crash recovery is forced. (Bug#23710)
SHOW INNODB STATUS caused an assertion failure under high load. (Bug#22819)
SHOW BINLOG EVENTS displayed incorrect values of End_log_pos for events associated with transactional storage engines.
(Bug#22540)
When determining which transaction to kill after deadlock has been detected, InnoDB now adds the number of locks to a transac-
tion's weight, and avoids killing transactions that mave modified nontransactional tables. This should reduce the likelihood of killing
long-running transactions containing SELECT ... FOR UPDATE or INSERT/REPLACE INTO ... SELECT statements,
and of causing partial updates if the target is a MyISAM table. (Bug#21293)
InnoDB displayed an incorrect error message when a CREATE TABLE statement exceeded the InnoDB maximum allowable row
size. (Bug#21101)
Under heavy load with a large query cache, invalidating part of the cache could cause the server to freeze (that is, to be unable to
service other operations until the invalidation was complete). (Bug#21074)
On Windows, the server used 10MB of memory for each connection thread, resulting in memory exhaustion. Now each thread uses
1MB. (Bug#20815)
InnoDB produced an unnecessary (and harmless) warning: InnoDB: Error: trying to declare trx to enter
InnoDB, but InnoDB: it already is declared. (Bug#20090)
If a slave timed out while registering with the master to which it was connecting, auto-reconnect failed thereafter. (Bug#19328)
If InnoDB reached its limit on the number of concurrent transactions (1023), it wrote a descriptive message to the error log but re-
turned a misleading error message to the client, or an assertion failure occurred. (Bug#18828)
Under ActiveState Perl, mysql-test-run.pl would not run. (Bug#18415)
The server crashed when the size of an ARCHIVE table grew larger than 2GB. (Bug#15787)
SQL_BIG_RESULT had no effect for CREATE TABLE ... SELECT SQL_BIG_RESULT ... statements. (Bug#15130)
On 64-bit Windows systems, the Config Wizard failed to complete the setup because 64-bit Windows does not resolve dynamic
linking of the 64-bit libmysql.dll to a 32-bit application like the Config Wizard. (Bug#14649)
mysql_setpermission tried to grant global-only privileges at the database level. (Bug#14618)
MySQL Change History
2914
For the general query log, logging of prepared statements executed via the C API differed from logging of prepared statements per-
formed with PREPARE and EXECUTE. Logging for the latter was missing the Prepare and Execute lines. (Bug#13326)
The TABLE_COMMENT column of INFORMATION_SCHEMA.TABLES and the Comment column in the output of SHOW TABLE
STATUS displayed extraneous information for InnoDB and NDBCLUSTER tables. (Bug#11379)
See also Bug#32440.
The server returned data from SHOW CREATE TABLE statement or a SELECT statement on an INFORMATION_SCHEMA table
using the binary character set. (Bug#10491)
Backup software can cause ERROR_SHARING_VIOLATION or ERROR_LOCK_VIOLATION conditions during file operations.
InnoDB now retries forever until the condition goes away. (Bug#9709)
C.1.18. Changes in MySQL 5.1.20 (25 June 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: It is no longer possible to partition the log tables. (Bug#27816)
Incompatible Change: mysqld_safe now supports error logging to syslog on systems that support the logger command.
The new --syslog and --skip-syslog options can be used instead of the --log-error option to control logging behavior,
as described in Section 4.3.2, mysqld_safe MySQL Server Startup Script. The default is to use syslog, which differs
from the previous default behavior of writing an error log file.
Currently, logging to syslog may fail to operate correctly in some cases; if so, use --skip-syslog or --log-error. To
maintain the older behavior if you were using no error-logging option, use --skip-syslog. If you were using --log-error,
continue to use it.
Note: In 5.1.21, the default is changed to --skip-syslog, which is compatible with releases prior to 5.1.20. (Bug#4858)
Important Change: MySQL Cluster: The TimeBetweenWatchdogCheckInitial configuration parameter was added to al-
low setting of a separate watchdog timeout for memory allocation during startup of the data nodes. See Section 17.3.4.6, Defining
MySQL Cluster Data Nodes, for more information. (Bug#28899)
MySQL Cluster: The cluster management client now stores command history between sessions. (Bug#29073)
MySQL Cluster: auto_increment_increment and auto_increment_offset are now supported for NDB tables.
(Bug#26342)
MySQL Cluster: The server source tree now includes scripts to simplify building MySQL with SCI support. For more information
about SCI interconnects and these build scripts, see Section 17.11.1, Configuring MySQL Cluster to use SCI Sockets.
(Bug#25470)
MySQL Cluster: A new configuration parameter ODirect causes NDB to attempt using O_DIRECT writes for LCP, backups, and
redo logs, often lowering CPU usage.
Replication: The sql_mode, foreign_key_checks, unique_checks, character set/collations, and sql_auto_is_null
MySQL Change History
2915
session variables are written to the binary log and honored during replication. See Section 5.2.4, The Binary Log.
If a MERGE table cannot be opened or used because of a problem with an underlying table, CHECK TABLE now displays informa-
tion about which table caused the problem. (Bug#26976)
User variables and stored procedure variables are now supported for use in XPath expressions employed as arguments to the Ex-
tractValue() and UpdateXML() functions.
This means that:
XPath can now be used to load data from XML files using virtually any format, and so able to import data from most third party
software which either has XML export functionality, or uses XML natively as a storage format.
Various complex conditions can be put on rows and columns, so one can filter for desired rows (or skip unwanted rows) when
loading XML.
Various types of preprocessing using SQL functions are now possible when loading XML. For example, you can concatenate
two XML tag or attribute values into a single column value using CONCAT(), or remove some parts of the data using RE-
PLACE().
See Section 11.10, XML Functions, for more information. (Bug#26518)
Binary distributions for some platforms did not include shared libraries; now shared libraries are shipped for all platforms except
AIX 5.2 64-bit. Exception: The library for the libmysqld embedded server is not shared except on Windows. (Bug#16520,
Bug#26767, Bug#13450)
Added a new PAD_CHAR_TO_FULL_LENGTH SQL mode. By default, trailing spaces are trimmed from CHAR column values on
retrieval. If PAD_CHAR_TO_FULL_LENGTH is enabled, trimming does not occur and retrieved CHAR values are padded to their
full length. This mode does not apply to VARCHAR columns, for which trailing spaces are retained on retrieval.
XPath can now be used to load data from XML files using virtually any format, and so able to import data from most third party
software which either has XML export functionality, or uses XML natively as a storage format.
Various complex conditions can be put on rows and columns, so one can filter for desired rows (or skip unwanted rows) when load-
ing XML.
Various types of preprocessing using SQL functions are now possible when loading XML. For example, you can concatenate two
XML tag or attribute values into a single column value using CONCAT(), or remove some parts of the data using REPLACE().
Bugs fixed:
Security Fix: A malformed password packet in the connection protocol could cause the server to crash. Thanks for Dormando for
reporting this bug, and for providing details and a proof of concept. (Bug#28984, CVE-2007-3780)
Security Fix: CREATE TABLE LIKE did not require any privileges on the source table. Now it requires the SELECT privilege.
In addition, CREATE TABLE LIKE was not isolated from alteration by other connections, which resulted in various errors and in-
correct binary log order when trying to execute concurrently a CREATE TABLE LIKE statement and either DDL statements on the
source table or DML or DDL statements on the target table. (Bug#23667, Bug#25578, CVE-2007-3781)
Incompatible Change: Some error codes had error numbers in MySQL 5.1 different from the numbers in MySQL 5.0. In MySQL
5.1, error numbers have been changed to match the MySQL 5.0 values: Error codes with value of 1458 or higher have changed in
MySQL 5.1 now. Client applications designed to work with MySQL 5.1 with hard-coded error code values (for example, in state-
ments such as if (mysql_errno(mysql) == 1463) { ... }) need to be updated in the source code. All clients de-
signed to work with MySQL 5.1 that test error codes (for example, in statements such as if (mysql_errno(mysql) ==
ER_VIEW_RECURSIVE) { ... }) should be recompiled. Existing 5.0 clients should now work, without changes or recompila-
tion, against servers for MySQL 5.1.20 or higher. (Bug#29245)
Incompatible Change: When mysqldump was run with the --delete-master-logs option, binary log files were deleted be-
fore it was known that the dump had succeeded, not after. (The method for removing log files used RESET MASTER prior to the
dump. This also reset the binary log sequence numbering to .000001.) Now mysqldump flushes the logs (which creates a new
binary log number with the next sequence number), performs the dump, and then uses PURGE BINARY LOGS to remove the log
files older than the new one. This also preserves log numbering because the new log with the next number is generated and only the
preceding logs are removed. However, this may affect applications if they rely on the log numbering sequence being reset.
MySQL Change History
2916
Bug#24733)
Incompatible Change: The use of an ORDER BY or DISTINCT clause with a query containing a call to the GROUP_CONCAT()
function caused results from previous queries to be redisplayed in the current result. The fix for this includes replacing a BLOB
value used internally for sorting with a VARCHAR. This means that for long results (more than 65,535 bytes), it is possible for trun-
cation to occur; if so, an appropriate warning is issued. (Bug#23856, Bug#28273)
MySQL Cluster: Replication: (Replication): A replicated unique key allowed duplicate key inserts on the slave. (Bug#27044)
MySQL Cluster: Memory corruption could occur due to a problem in the DBTUP kernel block. (Bug#29229)
MySQL Cluster: A query having a large IN(...) or NOT IN(...) list in the WHERE condition on an NDB table could cause
mysqld to crash. (Bug#29185)
MySQL Cluster: In the event that two data nodes in the same node group and participating in a GCP crashed before they had writ-
ten their respective P0.sysfile files, QMGR could refuse to start, issuing an invalid INSUFFICIENT NODES FOR RESTART error in-
stead. (Bug#29167)
MySQL Cluster: Attempting to restore a NULL row to a VARBINARY column caused ndb_restore to fail. (Bug#29103)
MySQL Cluster: ndb_error_reporter now preserves timestamps on files. (Bug#29074)
MySQL Cluster: It is now possible to set the maximum size of the allocation unit for table memory using the MaxAllocate con-
figuration parameter. (Bug#29044)
MySQL Cluster: When shutting down mysqld, the NDB binlog process was not shut down before log cleanup began.
(Bug#28949)
MySQL Cluster: ndb_mgm could hang when connecting to a nonexistent host. (Bug#28847)
MySQL Cluster: A regression in the heartbeat monitoring code could lead to node failure under high load. This issue affected
MySQL 5.1.19 and MySQL Cluster NDB 6.1.10 only. (Bug#28783)
MySQL Cluster: A corrupt schema file could cause a FILE ALREADY OPEN error. (Bug#28770)
MySQL Cluster: Having large amounts of memory locked caused swapping to disk. (Bug#28751)
MySQL Cluster: Setting InitialNoOpenFiles equal to MaxNoOfOpenFiles caused an error. This was due to the fact that
the actual value of MaxNoOfOpenFiles as used by the cluster was offset by 1 from the value set in config.ini. (Bug#28749)
MySQL Cluster: LCP files were not removed following an initial system restart. (Bug#28726)
MySQL Cluster: UPDATE IGNORE statements involving the primary keys of multiple tables could result in data corruption.
(Bug#28719)
MySQL Cluster: A race condition could result when nonmaster nodes (in addition to the master node) tried to update active status
due to a local checkpoint (that is, between NODE_FAILREP and COPY_GCIREQ events). Now only the master updates the active
status. (Bug#28717)
MySQL Cluster: A fast global checkpoint under high load with high usage of the redo buffer caused data nodes to fail.
(Bug#28653)
MySQL Cluster: The management client's response to START BACKUP WAIT COMPLETED did not include the backup ID.
(Bug#27640)
Cluster Replication: Replication: When replicating MyISAM or InnoDB tables to a MySQL Cluster, it was not possible to de-
termine exactly what had been applied following a shutdown of the slave cluster or mysqld process. (Bug#26783)
Replication: DROP USER statements that named multiple users, only some of which could be dropped, were replicated incorrectly.
(Bug#29030)
Replication: Using events in replication could cause the slave to crash. (Bug#28953)
Replication: It was possible to set SQL_SLAVE_SKIP_COUNTER such that the slave would jump into the middle of an event
group. (Bug#28618)
MySQL Change History
2917
See also Bug#12691.
Replication: The result of executing of a prepared statement created with PREPARE s FROM "SELECT 1 LIMIT ?" was not
replicated correctly. (Bug#28464)
Replication: Recreating a view that already exists on the master would cause a replicating slave to terminate replication with a 'dif-
ferent error message on slave and master' error. (Bug#28244)
Replication: Binary logging of prepared statements could produce syntactically incorrect queries in the binary log, replacing some
parameters with variable names rather than variable values. This could lead to incorrect results on replication slaves. (Bug#26842,
Bug#12826)
Replication: Connections from one mysqld server to another failed on Mac OS X, affecting replication and FEDERATED tables.
(Bug#26664)
See also Bug#29083.
Replication: When using transactions and replication, shutting down the master in the middle of a transaction would cause all slaves
to stop replicating. (Bug#22725)
Replication: Using CREATE TABLE LIKE ... would raise an assertion when replicated to a slave. (Bug#18950)
Disk Data: When loading data into a cluster following a version upgrade, the data nodes could forcibly shut down due to page and
buffer management failures (that is, ndbrequire failures in PGMAN). (Bug#28525)
Disk Data: Repeated INSERT and DELETE operations on a Disk Data table having one or more large VARCHAR columns could
cause data nodes to fail. (Bug#20612)
Cluster API: The timeout set using the MGM API ndb_mgm_set_timeout() function was incorrectly interpreted as seconds
rather than as milliseconds. (Bug#29063)
Cluster API: An invalid error code could be set on transaction objects by BLOB handling code. (Bug#28724)
The TRUNCATE statement was handled differently by the server when row-based logging was in effect, even though the binlogging
format in effect does not effect the fact that TRUNCATE is always logged as a statement. (Bug#29130)
If one of the queries in a UNION used the SQL_CACHE option and another query in the UNION contained a nondeterministic func-
tion, the result was still cached. For example, this query was incorrectly cached:
SELECT NOW() FROM t1 UNION SELECT SQL_CACHE 1 FROM t1;
(Bug#29053)
Long path names for internal temporary tables could cause stack overflows. (Bug#29015)
Using an INTEGER column from a table to ROUND() a number produced different results than using a constant with the same
value as the INTEGER column. (Bug#28980)
If a program binds a given number of parameters to a prepared statement handle and then somehow changes stmt-
>param_count to a different number, mysql_stmt_execute() could crash the client or server. (Bug#28934)
Queries using UDFs or stored functions were cached. (Bug#28921)
INSERT .. ON DUPLICATE KEY UPDATE could under some circumstances silently update rows when it should not have.
(Bug#28904)
Queries that used UUID() were incorrectly allowed into the query cache. (This should not happen because UUID() is non-
deterministic.) (Bug#28897)
Using a VIEW created with a nonexisting DEFINER could lead to incorrect results under some circumstances. (Bug#28895)
For InnoDB tables that use the utf8 character set, incorrect results could occur for DML statements such as DELETE or UPDATE
that use an index on character-based columns. (Bug#28878)
See also Bug#29449, Bug#30485, Bug#31395.
MySQL Change History
2918
This regression was introduced by Bug#13195.
Non-utf8 characters could get mangled when stored in CSV tables. (Bug#28862)
On Windows, USE_TLS was not defined for mysqlclient.lib. (Bug#28860)
In MySQL 5.1.15, a new error code ER_DUP_ENTRY_WITH_KEY_NAME (1582) was introduced to replace ER_DUP_ENTRY
(1062) so that the key name could be provided instead of the key number. This was unnecessary, so ER_DUP_ENTRY is used again
and the key name is printed. The incompatibility introduced in 5.1.15 no longer applies. (Bug#28842)
A subquery with ORDER BY and LIMIT 1 could cause a server crash. (Bug#28811)
Running SHOW TABLE STATUS while performing a high number of inserts on partitioned tables with a great many partitions
could cause the server to crash. (Bug#28806)
Using BETWEEN with nonindexed date columns and short formats of the date string could return incorrect results. (Bug#28778)
Selecting GEOMETRY columns in a UNION caused a server crash. (Bug#28763)
When constructing the path to the original .frm file, ALTER .. RENAME was unnecessarily (and incorrectly) lowercasing the en-
tire path when not on a case-insensitive file system, causing the statement to fail. (Bug#28754)
The binlog_format system variable value was empty if the server was started with binary logging disabled. Now it is set to
MIXED. (Bug#28752)
Searches on indexed and nonindexed ENUM columns could return different results for empty strings. (Bug#28729)
Executing EXPLAIN EXTENDED on a query using a derived table over a grouping subselect could lead to a server crash. This oc-
curred only when materialization of the derived tables required creation of an auxiliary temporary table, an example being when a
grouping operation was carried out with usage of a temporary table. (Bug#28728)
The result of evaluation for a view's CHECK OPTION option over an updated record and records of merged tables was arbitrary and
dependant on the order of records in the merged tables during the execution of the SELECT statement. (Bug#28716)
The manager thread of the LinuxThreads implementation was unintentionally started before mysqld had dropped privileges (to
run as an unprivileged user). This caused signaling between threads in mysqld to fail when the privileges were finally dropped.
(Bug#28690)
Setting an interval of EVERY 0 SECOND for a scheduled event caused the server to crash. (Bug#28666)
For debug builds, ALTER TABLE could trigger an assertion failure due to occurrence of a deadlock when committing changes.
(Bug#28652)
Attempting to create an index on a BIT column failed after modifying the column. (Bug#28631)
After an upgrade, the names of stored routines referenced by views were no longer displayed by SHOW CREATE VIEW.
(Bug#28605)
This regression was introduced by Bug#23491.
Conversion of U+00A5 YEN SIGN and U+203E OVERLINE from ucs2 to ujis produced incorrect results. (Bug#28600)
Killing from one connection a long-running EXPLAIN QUERY started from another connection caused mysqld to crash.
(Bug#28598)
SHOW GLOBAL VARIABLES repeated some variable names. (Bug#28580)
When one thread attempts to lock two (or more) tables and another thread executes a statement that aborts these locks (such as RE-
PAIR TABLE, OPTIMIZE TABLE, or CHECK TABLE), the thread might get a table object with an incorrect lock type in the ta-
ble cache. The result is table corruption or a server crash. (Bug#28574)
Outer join queries with ON conditions over constant outer tables did not return NULL-complemented rows when conditions were
evaluated to FALSE. (Bug#28571)
An update on a multiple-table view with the CHECK OPTION clause and a subquery in the WHERE condition could cause an as-
MySQL Change History
2919
sertion failure. (Bug#28561)
Calling the UpdateXML() function using invalid XPath syntax caused memory corruption possibly leading to a crash of the serv-
er. (Bug#28558)
PURGE MASTER LOGS BEFORE (subquery) caused a server crash. Subqueries are forbidden in the BEFORE clause now.
(Bug#28553)
mysqldump calculated the required memory for a hex-blob string incorrectly causing a buffer overrun. This in turn caused
mysqldump to crash silently and produce incomplete output. (Bug#28522)
When upgrading from MySQL 5.1.17 to 5.1.18, mysql_upgrade and mysql_fix_privilege_tables did not upgrade the
system tables relating to the Event Scheduler correctly. (Bug#28521)
Passing a DECIMAL value as a parameter of a statement prepared with PREPARE resulted in an error. (Bug#28509)
mysql_affected_rows() could return an incorrect result for INSERT ... ON DUPLICATE KEY UPDATE if the CLI-
ENT_FOUND_ROWS flag was set. (Bug#28505)
A query that grouped by the result of an expression returned a different result when the expression was assigned to a user variable.
(Bug#28494)
Subselects returning LONG values in MySQL versions later than 5.0.24a returned LONGLONG prior to this. The previous behavior
was restored. (Bug#28492)
This regression was introduced by Bug#19714.
Performing ALTER TABLE ... ADD PARTITION or ALTER TABLE DROP PARTITION could result in inconsistent data,
or cause the server to crash, if done concurrently with other accesses to the table. (Bug#28477, Bug#28488)
Forcing the use of an index on a SELECT query when the index had been disabled would raise an error without running the query.
The query now executes, with a warning generated noting that the use of a disabled index has been ignored. (Bug#28476)
The query SELECT '2007-01-01' + INTERVAL column_name DAY FROM table_name caused mysqld to fail.
(Bug#28450)
A server crash could happen under rare conditions such that a temporary table outgrew heap memory reserved for it and the remain-
ing disk space was not big enough to store the table as a MyISAM table. (Bug#28449)
Using ALTER TABLE to move columns resulted only in the columns being renamed. The table contents were not changed.
(Bug#28427)
The test case for mysqldump failed with bin-log disabled. (Bug#28372)
Attempting to LOAD_FILE from an empty floppy drive under Windows, caused the server to hang. For example, if you opened a
connection to the server and then issued the command SELECT LOAD_FILE('a:test');, with no floppy in the drive, the
server was inaccessible until the modal pop-up dialog box was dismissed. (Bug#28366)
mysqltest used a too-large stack size on PPC/Debian Linux, causing thread-creation failure for tests that use many threads.
(Bug#28333)
When using a MEMORY table on Mac OS X, dropping a table and than creating a table with the same name could cause the informa-
tion of the deleted table to remain accessible, leading to index errors. (Bug#28309)
The IS_UPDATABLE column in the INFORMATION_SCHEMA.VIEWS table was not always set correctly. (Bug#28266)
For CAST() of a NULL value with type DECIMAL, the return value was incorrectly initialized, producing a runtime error for binar-
ies built using Visual C++ 2005. (Bug#28250)
When the query cache was fully used, issuing RENAME DATABASE or RENAME SCHEMA could cause the server to hang, with
100% CPU usage. (Bug#28211)
The Bytes_received and Bytes_sent status variables could hold only 32-bit values (not 64-bit values) on some platforms.
(Bug#28149)
Some valid identifiers were not parsed correctly. (Bug#28127)
MySQL Change History
2920
Storing a large number into a FLOAT or DOUBLE column with a fixed length could result in incorrect truncation of the number if
the column's length was greater than 31. (Bug#28121)
Sending debugging information from a dump of the Event Scheduler to COM_DEBUG could cause the server to crash. (Bug#28075)
The PARTITION_COMMENT column of the INFORMATION_SCHEMA.PARTITIONS table had the wrong default value.
(Bug#28007)
DECIMAL values beginning with nine 9 digits could be incorrectly rounded. (Bug#27984)
For attempts to open a nonexistent table, the server should report ER_NO_SUCH_TABLE but sometimes reported
ER_TABLE_NOT_LOCKED. (Bug#27907)
Following an invalid call to UpdateXML(), calling the function again (even if valid) crashed the server. (Bug#27898)
A stored program that uses a variable name containing multibyte characters could fail to execute. (Bug#27876)
The server made strong assumptions about the structure of the general_log and slow_log log tables: It supported only the ta-
ble structure defined in the mysql database creation scripts. The server also allowed limited ALTER TABLE operations on the log
tables, but adding an AUTO_INCREMENT column did not properly initialize the column, and subsequent inserts into the table could
fail to generate correct sequence numbers. Now an ALTER TABLE statement that adds an AUTO_INCREMENT column populates
the column correctly. In addition, when the server writes a log table row, it will set columns not present in the original table struc-
ture to their default values. (Bug#27857)
ON conditions from JOIN expressions were ignored when checking the CHECK OPTION clause while updating a multiple-table
view that included such a clause. (Bug#27827)
On some systems, udf_example.c returned an incorrect result length. Also on some systems, mysql-test-run.pl could
not find the shared object built from udf_example.c. (Bug#27741)
The modification of a table by a partially completed multi-column update was not recorded in the binlog, rather than being marked
by an event and a corresponding error code. (Bug#27716)
SHOW ENGINES and queries on INFORMATION_SCHEMA.ENGINES did not use the same values for representing the same stor-
age engine states. (Bug#27684)
HASH indexes on VARCHAR columns with binary collations did not ignore trailing spaces from strings before comparisons. This
could result in duplicate records being successfully inserted into a MEMORY table with unique key constraints. A consequence was
that internal MEMORY tables used for GROUP BY calculation contained duplicate rows that resulted in duplicate-key errors when
converting those temporary tables to MyISAM, and that error was incorrectly reported as a table is full error. (Bug#27643)
An error occurred trying to connect to mysqld-debug.exe. (Bug#27597)
A stack overrun could occur when storing DATETIME values using repeated prepared statements. (Bug#27592)
If a stored function or trigger was killed, it aborted but no error was thrown, allowing the calling statement to continue without noti-
cing the problem. This could lead to incorrect results. (Bug#27563)
When ALTER TABLE was used to add a new DATE column with no explicit default value, '0000-00-00' was used as the de-
fault even if the SQL mode included the NO_ZERO_DATE mode to prohibit that value. A similar problem occurred for DATETIME
columns. (Bug#27507)
ALTER TABLE ... ENABLE KEYS could cause mysqld to crash when executed on a table containing on a MyISAM table
containing billions of rows. (Bug#27029)
Binary content 0x00 in a BLOB column sometimes became 0x5C 0x00 following a dump and reload, which could cause prob-
lems with data using multi-byte character sets such as GBK (Chinese). This was due to a problem with SELECT INTO OUTFILE
whereby LOAD DATA later incorrectly interpreted 0x5C as the second byte of a multi-byte sequence rather than as the SOLIDUS
(\) character, used by MySQL as the escape character. (Bug#26711)
The server crashed when attempting to open a table having a #mysql50# prefix in the database or table name. The server now will
not open such tables. (This prefix is reserved by mysql_upgrade for accessing 5.0 tables that have names not yet encoded for
5.1.) (Bug#26402)
A FLUSH TABLES WITH READ LOCK statement followed by a FLUSH LOGS statement caused a deadlock if the general log or
the slow query log was enabled. (Bug#26380)
MySQL Change History
2921
The query SELECT /*2*/ user, host, db, info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
(command!='Daemon' || user='event_scheduler') AND (info IS NULL OR info NOT LIKE
'%processlist%') ORDER BY INFO yielded inconsistent results. (Bug#26338)
For a given user variable @v, the statements SELECT @v and CREATE TABLE ... AS SELECT @v did not return the same
data type. (Bug#26277)
Statements within triggers ignored the value of the low_priority_updates system variable. (Bug#26162)
See also Bug#29963.
The embedded server library displayed error messages at startup if the mysql.plugin table was not present. This no longer oc-
curs. (Bug#25800)
On Windows, an application that called mysql_thread_init() but forgot to call mysql_thread_end() would get this er-
ror: ERROR IN MY_THREAD_GLOBAL_END(). (Bug#25621)
Embedded /* ... */ comments were handled incorrectly within the definitions of stored programs and views, resulting in mal-
formed definitions (the trailing */ was stripped). This also affected binary log contents. (Bug#25411, Bug#26302)
Due to a race condition, executing FLUSH PRIVILEGES in one thread could cause brief table unavailability in other threads.
(Bug#24988)
In SHOW SLAVE STATUS output, Last_Errno and Last_Error were not set after master_retry_count errors had oc-
curred. To provide additional information, the statement now displays four additional columns:
Last_IO_Errno: The number of the last error that caused the I/O thread to stop
Last_IO_Error: A description of the last error that caused the I/O thread to stop
Last_SQL_Errno: The number of the last error that caused the SQL thread to stop
Last_SQL_Error: A description of the last error that caused the SQL thread to stop
Also, Last_Errno and Last_Error now are aliases for Last_SQL_Errno and Last_SQL_Error. (Bug#24954)
A too-long shared-memory-base-name value could cause a buffer overflow and crash the server or clients. (Bug#24924)
When mysqld was run as a Windows service, shared memory objects were not created in the global namespace and could not be
used by clients to connect. (Bug#24731)
On some Linux distributions where LinuxThreads and NPTL glibc versions both are available, statically built binaries can crash
because the linker defaults to LinuxThreads when linking statically, but calls to external libraries (such as libnss) are resolved to
NPTL versions. This cannot be worked around in the code, so instead if a crash occurs on such a binary/OS combination, print an
error message that provides advice about how to fix the problem. (Bug#24611)
A number of SHOW statements caused mysqld to crash on recent versions of Solaris. This issue is believed to be present only in
MySQL 5.1.12 and later. (Bug#23810)
The server deducted some bytes from the key_cache_block_size option value and reduced it to the next lower 512 byte
boundary. The resulting block size was not a power of two. Setting the key_cache_block_size system variable to a value that
is not a power of two resulted in MyISAM table corruption. (Bug#23068, Bug#28478, Bug#25853)
Conversion errors could occur when constructing the condition for an IN predicate. The predicate was treated as if the affected
column contains NULL, but if the IN predicate is inside NOT, incorrect results could be returned. (Bug#22855)
Linux binaries were unable to dump core after executing a setuid() call. (Bug#21723)
Stack overflow caused server crashes. (Bug#21476)
The server was ignoring the return value of the parse() function for full-text parser plugins. (Bug#18839)
Granting access privileges to an individual table where the database or table name contained an underscore would fail. (Bug#18660)
The -lmtmalloc library was removed from the output of mysql_config on Solaris, as it caused problems when building
DBD::mysql (and possibly other applications) on that platform that tried to use dlopen() to access the client library.
MySQL Change History
2922
Bug#18322)
The check-cpu script failed to detect AMD64 Turion processors correctly. (Bug#17707)
When using mysqlbinlog with --read-from-remote-server to load the data direct from a remote MySQL server would
cause a core dump when dumping certain binary log events. (Bug#17654)
Trying to shut down the server following a failed LOAD DATA INFILE caused mysqld to crash. (Bug#17233)
The omission of leading zeros in dates could lead to erroneous results when these were compared with the output of certain date and
time functions. (Bug#16377)
Using up-arrow for command-line recall in mysql could cause a segmentation fault. (Bug#10218)
The result for CAST() when casting a value to UNSIGNED was limited to the maximum signed BIGINT value
(9223372036854775808), rather than the maximum unsigned value (18446744073709551615). (Bug#8663)
The internal functions for table preparation, creation, and alteration were not re-execution friendly, causing problems in code that:
repeatedly altered a table; repeatedly created and dropped a table; opened and closed a cursor on a table, altered the table, and then
reopened the cursor; used ALTER TABLE to change a table's current AUTO_INCREMENT value; created indexes on utf8
columns.
Re-execution of CREATE DATABASE, CREATE TABLE, and ALTER TABLE statements in stored routines or as prepared state-
ments also caused incorrect results or crashes. (Bug#4968, Bug#6895, Bug#19182, Bug#19733, Bug#22060, Bug#24879)
C.1.19. Changes in MySQL 5.1.19 (25 May 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: INSERT DELAYED is now downgraded to a normal INSERT if the statement uses functions that access
tables or triggers, or that is called from a function or a trigger.
This was done to resolve the following interrelated issues:
The server could abort or deadlock for INSERT DELAYED statements for which another insert was performed implicitly (for
example, via a stored function that inserted a row).
A trigger using an INSERT DELAYED caused the error INSERT DELAYED CAN'T BE USED WITH TABLE ... BECAUSE
IT IS LOCKED WITH LOCK TABLES although the target table was not actually locked.
INSERT DELAYED into a table with a BEFORE INSERT or AFTER INSERT trigger gave an incorrect NEW pseudocolumn
value and caused the server to deadlock or abort.
(Bug#21483)
See also Bug#20497, Bug#21714.
MySQL Cluster: Formerly, restoring a cluster backup made on a MySQL 5.0 Cluster to a 5.1 cluster using a 5.1 version of
MySQL Change History
2923
ndb_restore did not resize VARCHAR columns as might be expected; now, the default behavior of ndb_restore in such cases
is to resize the VARCHAR columns. This changed default behavior can be overridden using the --no-upgrade (or -u) option
when invoking ndb_restore. (Bug#22240)
The BLACKHOLE storage engine now supports INSERT DELAYED. Previously, INSERT DELAYED statements for BLACKHOLE
tables were not supported, and caused the server to crash. (Bug#27998)
A new status variable, Com_call_procedure, indicates the number of calls to stored procedures. (Bug#27994)
The BLACKHOLE storage engine now supports LOCK TABLES and UNLOCK TABLES. (Bug#26241)
GLOBAL_STATUS
GLOBAL_VARIABLES
SESSION_VARIABLES
The data type used for the VARIABLE_VALUE column of the following INFORMATION_SCHEMA tables has been changed to
VARCHAR:
GLOBAL_STATUS
SESSION_STATUS
GLOBAL_VARIABLES
SESSION_VARIABLES
For more information, see Section 20.24, The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables,
and Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables.
See also Bug#26994.
SESSION_STATUS
Bugs fixed:
Security Fix: UDFs are supposed to be loadable only from the plugin directory, but this restriction was not being enforced.
(Bug#28341)
Security Fix: Use of a view could allow a user to gain update privileges for tables in other databases. (Bug#27878,
CVE-2007-3782)
MySQL Cluster: When an API node sent more than 1024 signals in a single batch, NDB would process only the first 1024 of these,
and then hang. (Bug#28443)
MySQL Cluster: A delay in obtaining AUTO_INCREMENT IDs could lead to excess temporary errors. (Bug#28410)
MySQL Cluster: Local checkpoint files relating to dropped NDB tables were not removed. (Bug#28348)
MySQL Cluster: Multiple operations involving deletes followed by reads were not handled correctly.
Note
This issue could also affect MySQL Cluster Replication.
(Bug#28276)
MySQL Cluster: Repeated insertion of data generated by mysqldump into NDB tables could eventually lead to failure of the
cluster. (Bug#27437)
MySQL Cluster: Restarting a data node caused SQL nodes to log repeatedly and unnecessarily the status of the event buffer, caus-
ing a memory leak of approximately 4 MB for each mysqld process each time this occurred.
(This issue was known to occur in MySQL 5.1.16 and later only.) (Bug#27292)
MySQL Change History
2924
MySQL Cluster: ndb_mgmd failed silently when the cluster configuration file contained invalid [tcp] entries. (Bug#27207)
MySQL Cluster: ndb_connectstring did not appear in the output of SHOW VARIABLES. (Bug#26675)
MySQL Cluster: A failure to release internal resources following an error could lead to problems with single user mode.
(Bug#25818)
MySQL Cluster: DDL operations were not supported on a partially started cluster. (Bug#24631)
Disk Data: Extremely large inserts into Disk Data tables could lead to data node failure in some circumstances. (Bug#27942)
Cluster API: In a multi-operation transaction, a delete operation followed by the insertion of an implicit NULL failed to overwrite
an existing value. (Bug#20535)
Some ALTER TABLE statements that worked in MySQL 5.0 did not work in 5.1. (Bug#28415)
mysql_upgrade failed if certain SQL modes were set. Now it sets the mode itself to avoid this problem. (Bug#28401)
A query with a NOT IN subquery predicate could cause a crash when the left operand of the predicate evaluated to NULL.
(Bug#28375)
A buffer overflow could occur when using DECIMAL columns on Windows operating systems. (Bug#28361)
libmysql.dll could not be dynamically loaded on Windows. (Bug#28358)
Grouping queries with correlated subqueries in WHERE conditions could produce incorrect results. (Bug#28337)
EXPLAIN for a query on an empty table immediately after its creation could result in a server crash. (Bug#28272)
Comparing a DATETIME column value with a user variable yielded incorrect results. (Bug#28261)
Portability problems caused by use of isinf() were corrected. (Bug#28240)
When dumping procedures, mysqldump --compact generated output that restored the session variable sql_mode without
first capturing it. When dumping routines, mysqldump --compact neither set nor retrieved the value of sql_mode.
(Bug#28223)
Comparison of the string value of a date showed as unequal to CURTIME(). Similar behavior was exhibited for DATETIME values.
(Bug#28208)
For InnoDB, in some rare cases the optimizer preferred a more expensive ref access to a less expensive range access.
(Bug#28189)
Comparisons of DATE or DATETIME values for the IN() function could yield incorrect results. (Bug#28133)
It was not possible to use the value 9223372036854775808 (that is, MAXVALUE + 1) when specifying a LIST partition.
(Bug#28005)
The server could hang for INSERT IGNORE ... ON DUPLICATE KEY UPDATE if an update failed. (Bug#28000)
CAST() to DECIMAL did not check for overflow. (Bug#27957)
The second execution of a prepared statement from a UNION query with ORDER BY RAND() caused the server to crash. This
problem could also occur when invoking a stored procedure containing such a query. (Bug#27937)
Views ignored precision for CAST() operations. (Bug#27921)
Changes to some system variables should invalidate statements in the query cache, but invalidation did not happen. (Bug#27792)
LOAD DATA did not use CURRENT_TIMESTAMP as the default value for a TIMESTAMP column for which no value was provided.
(Bug#27670)
Selecting MIN() on an indexed column that contained only NULL values caused NULL to be returned for other result columns.
(Bug#27573)
Using a TEXT local variable in a stored routine in an expression such as SET var = SUBSTRING(var, 3) produced an incor-
MySQL Change History
2925
rect result. (Bug#27415)
The error message for error number 137 did not report which database/table combination reported the problem. (Bug#27173)
A large filesort could result in a division by zero error and a server crash. (Bug#27119)
Some InnoDB variables were missing from the output of mysqld --verbose --help. (Bug#26987)
Flow control optimization in stored routines could cause exception handlers to never return or execute incorrect logic. (Bug#26977)
Some test suite files were missing from some MySQL-test packages. (Bug#26609)
Running CHECK TABLE concurrently with a SELECT, INSERT or other statement on Windows could corrupt a MyISAM table.
(Bug#25712)
Concurrent execution of CREATE TABLE ... SELECT and other statements involving the target table suffered from various
race conditions, some of which might have led to deadlocks. (Bug#24738)
An attempt to execute CREATE TABLE ... SELECT when a temporary table with the same name already existed led to the in-
sertion of data into the temporary table and creation of an empty nontemporary table. (Bug#24508)
A statement of the form CREATE TABLE IF NOT EXISTS t1 SELECT f1() AS i failed with a deadlock error if the
stored function f1() referred to a table with the same name as the to-be-created table. Now it correctly produces a message that the
table already exists. (Bug#22427)
Quoted labels in stored routines were mishandled, rendering the routines unusable. (Bug#21513)
CURDATE() is less than NOW(), either when comparing CURDATE() directly (CURDATE() < NOW() is true) or when casting
CURDATE() to DATE (CAST(CURDATE() AS DATE) < NOW() is true). However, storing CURDATE() in a DATE column
and comparing col_name < NOW() incorrectly yielded false. This is fixed by comparing a DATE column as DATETIME for
comparisons to a DATETIME constant. (Bug#21103)
CREATE TABLE IF NOT EXISTS ... SELECT caused a server crash if the target table already existed and had a BEFORE
INSERT trigger. (Bug#20903)
Deadlock occurred for attempts to execute CREATE TABLE IF NOT EXISTS ... SELECT when LOCK TABLES had been
used to acquire a read lock on the target table. (Bug#20662, Bug#15522)
For dates with 4-digit year parts less than 200, an incorrect implicit conversion to add a century was applied for date arithmetic per-
formed with DATE_ADD(), DATE_SUB(), + INTERVAL, and - INTERVAL. (For example, DATE_ADD('0050-01-01
00:00:00', INTERVAL 0 SECOND) became '2050-01-01 00:00:00'.) (Bug#18997)
Changing the size of a key buffer that is under heavy use could cause a server crash. The fix partially removes the limitation that
LOAD INDEX INTO CACHE fails unless all indexes in a table have the same block size. Now the statement fails only if IGNORE
LEAVES is specified. (Bug#17332)
C.1.20. Changes in MySQL 5.1.18 (08 May 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
MySQL Change History
2926
Incompatible Change: MySQL Cluster: The internal specifications for columns in NDB tables has changed to allow compatibility
with future MySQL Cluster releases that are expected to implement online adding and dropping of columns. This change is not
backward compatible with earlier versions of MySQL Cluster.
See the related note in Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x Upgrade and Downgrade Compatibil-
ity, for important information prior to upgrading a MySQL Cluster to MySQL 5.1.18 or later from MySQL 5.1.17 or earlier.
See also Bug#28205.
Incompatible Change: Replication: The INFORMATION_SCHEMA.EVENTS and mysql.event tables have been changed to
facilitate replication of events. When upgrading to MySQL 5.1.18, you must run mysql_upgrade prior to working with events.
Until you have done so, any statement relating to the Event Scheduler or these tables (including SHOW EVENTS) will fail with the
errors EXPECTED FIELD STATUS AT POSITION 12 TO HAVE TYPE ENUM
('ENABLED','SLAVESIDE_DISABLED','DISABLED'), FOUND ENUM('ENABLED','DISABLED') and TABLE
MYSQL.EVENT IS DAMAGED. CAN NOT OPEN.
These changes were made as part of fixes for the following bugs:
The effects of scheduled events were not replicated (that is, binary logging of scheduled events did not work).
Effects of scheduled events on a replication master were both replicated and executed on the slave, causing double execution of
events.
CREATE FUNCTION statements and their effects were not replicated correctly.
For more information, see Section 16.3.1.7, Replication of Invoked Features. (Bug#17857, Bug#16421, Bug#20384, Bug#17671)
Cluster Replication: Incompatible Change: The definition of the mysql.ndb_apply_status table has changed such that an
online upgrade is not possible from MySQL 5.1.17 or earlier for a replication slave cluster; you must shut down all SQL nodes as
part of the upgrade procedure. See Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x Upgrade and Downgrade
Compatibility before upgrading for details.
For more information about the changes to mysql.ndb_apply_status see Section 17.9.4, MySQL Cluster Replication
Schema and Tables.
Incompatible Change: Prior to this release, when DATE values were compared with DATETIME values, the time portion of the
DATETIME value was ignored, or the comparison could be performed as a string compare. Now a DATE value is coerced to the
DATETIME type by adding the time portion as 00:00:00. To mimic the old behavior, use the CAST() function as shown in this
example: SELECT date_col = CAST(NOW() AS DATE) FROM table;. (Bug#28929)
Important Change: When upgrading to MySQL 5.1.18 or later from a previous MySQL version and scheduled events have been
used, the upgrade utilities do not accomodate changes in event-related system tables. As a workaround, you can dump events before
the upgrade, then restore them from the dump afterwards. This issue was fixed in MySQL 5.1.20.
See also Bug#28521.
MySQL Cluster: The behavior of the ndb_restore utility has been changed as follows:
It is now possible to restore selected databases or tables using ndb_restore.
Several options have been added for use with ndb_restore --print_data to facilitate the creation of structured data
dump files. These options can be used to make dumps made using ndb_restore more like those produced by mysqldump.
For details of these changes, see Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup. (Bug#26899,
Bug#26900)
MySQL Cluster: The following changes were made in the ndb_size.pl utility:
When ndb_size.pl calculates a value for a given configuration parameter that is less than the default value, it now suggests
the default value instead.
The dependency on HTML::Template was removed, with the result that the file ndb_size.tmpl is no longer needed or in-
cluded.
(Bug#24227, Bug#24228)
Cluster Replication: Replication: Some circular replication setups are now supported for MySQL Cluster. See Section 17.9.3,
Known Issues in MySQL Cluster Replication, for detailed information. (Bug#17095, Bug#25688)
MySQL Change History
2927
Cluster API: The MGM API now supports explicit setting of network timeouts using the ndb_mgm_set_timeout() function.
A utility function ndb_mgm_number_of_mgmd_in_connect_string() is also implemented to facilitate calculation of
timeouts based on the number of management servers in the cluster.
For more information, see ndb_mgm_set_timeout(), and ndb_mgm_number_of_mgmd_in_connect_string().
mysqld_multi now understands the --no-defaults, --defaults-file, and --defaults-extra-file options.
The --config-file option is deprecated; if given, it is treated like --defaults-extra-file. (Bug#27390)
If a set function S with an outer reference S(outer_ref) cannot be aggregated in the outer query against which the outer refer-
ence has been resolved, MySQL interprets S(outer_ref) the same way that it would interpret S(const). However, standard
SQL requires throwing an error in this situation. An error now is thrown for such queries if the ANSI SQL mode is enabled.
(Bug#27348)
Several additional data types are supported for columns in INFORMATION_SCHEMA tables: DATE, TIME, BLOB, FLOAT, and all
integer types. (Bug#27047)
The output of mysql --xml and mysqldump --xml now includes a valid XML namespace. (Bug#25946)
If you use SSL for a client connection, you can tell the client not to authenticate the server certificate by specifying neither -
-ssl-ca nor --ssl-capath. The server still verifies the client according to any applicable requirements established via GRANT
statements for the client, and it still uses any --ssl-ca/--ssl-capath values that were passed to server at startup time.
(Bug#25309)
Added a MASTER_SSL_VERIFY_SERVER_CERT option for the CHANGE MASTER TO statement, and a Mas-
ter_SSL_Verify_Server_Cert output column to the SHOW SLAVE STATUS statement. The option value also is written to
the master.info file. (Bug#19991)
The innodb_log_archive system variable has been removed. The impact of this change should be low because the variable
was unused, anyway.
Added the --auto-generate-sql-add-autoincrement, --auto-generate-sql-execute-number, -
-auto-generate-sql-guid-primary, --auto-generate-sql-secondary-indexes, -
-auto-generate-sql-unique-query-number, --auto-generate-sql-unique-write-number, -
-post-query, and --pre-query, options for mysqlslap. Removed the --lock-directory, --slave, and -
-use-threads options.
Added --write-binlog option for mysqlbinlog. This option is enabled by default, but can be given as -
-skip-write-binlog to cause ANALYZE TABLE, OPTIMIZE TABLE, and REPAIR TABLE statements generated by
mysqlcheck not to be written to the binary log. (Bug#26262)
New command-line options: To alleviate ambiguities in variable names, all variables related to plugins can be specified using a
plugin part in the name. For example, every time where we used to have innodb in the command-line options, you can now
write plugin-innodb:
--skip-plugin-innodb
--plugin-innodb-buffer-pool-size=#
Furthermore, this is the preferred syntax. It helps to avoid ambiguities when a plugin, say, wait, has an option called timeout. -
-wait-timeout will still set a system variable, but --plugin-wait-timeout will set the plugin variable. Also, there is a
new command-line option --plugin-load to install or load plugins at initialization time without using the mysql.plugin ta-
ble.
The plugin interface and its handling of system variables was changed. Command-line options such as --skip-innodb now
cause an error if InnoDB is not built-in or plugin-loaded. You should use --loose-skip-innodb if you do not want any error
even if InnoDB is not available. The --loose prefix modifier should be used for all command-line options where you are uncer-
tain whether the plugin exists and when you want the operation to proceed even if the option is necessarily ignored due to the ab-
sence of the plugin. (For a desecription of how --loose works, see Section 4.2.3.1, Using Options on the Command Line.)
Storage engine plugins may now be uninstalled at run time. However, a plugin is not actually uninstalled until after its reference
count drops to zero. The default_storage_engine system variable consumes a reference count, so uninstalling will not com-
plete until said reference is removed.
The mysql_create_system_tables script was removed because mysql_install_db no longer uses it in MySQL 5.1.
MySQL Change History
2928
Renamed the old_mode system variable to old.
Bugs fixed:
Security Fix: The requirement of the DROP privilege for RENAME TABLE was not enforced. (Bug#27515, CVE-2007-2691)
Security Fix: If a stored routine was declared using SQL SECURITY INVOKER, a user who invoked the routine could gain priv-
ileges. (Bug#27337, CVE-2007-2692)
Security Fix: A user with only the ALTER privilege on a partitioned table could obtain information about the table that should re-
quire the SELECT privilege. (Bug#23675, CVE-2007-2693)
MySQL Cluster: Replication: (Replication): An UPDATE on the master became a DELETE on slaves. (Bug#27378)
MySQL Cluster: The cluster waited 30 seconds instead of 30 milliseconds before reading table statistics. (Bug#28093)
MySQL Cluster: Under certain rare circumstances, ndbd could get caught in an infinite loop when one transaction took a read lock
and then a second transaction attempted to obtain a write lock on the same tuple in the lock queue. (Bug#28073)
MySQL Cluster: Under some circumstances, a node restart could fail to update the Global Checkpoint Index (GCI). (Bug#28023)
MySQL Cluster: INSERT IGNORE wrongly ignored NULL values in unique indexes. (Bug#27980)
MySQL Cluster: The name of the month March was given incorrectly in the cluster error log. (Bug#27926)
MySQL Cluster: NDB tables having MEDIUMINT AUTO_INCREMENT columns were not restored correctly by ndb_restore,
causing spurious duplicate key errors. This issue did not affect TINYINT, INT, or BIGINT columns with AUTO_INCREMENT.
(Bug#27775)
MySQL Cluster: NDB tables with indexes whose names contained space characters were not restored correctly by ndb_restore
(the index names were truncated). (Bug#27758)
MySQL Cluster: An INSERT followed by a delete DELETE on the same NDB table caused a memory leak. (Bug#27756)
This regression was introduced by Bug#20612.
MySQL Cluster: It was not possible to add a unique index to an NDB table while in single user mode. (Bug#27710)
MySQL Cluster: Under certain rare circumstances performing a DROP TABLE or TRUNCATE on an NDB table could cause a node
failure or forced cluster shutdown. (Bug#27581)
MySQL Cluster: Memory usage of a mysqld process grew even while idle. (Bug#27560)
MySQL Cluster: Using more than 16GB for DataMemory caused problems with variable-size columns. (Bug#27512)
MySQL Cluster: A data node failing while another data node was restarting could leave the cluster in an inconsistent state. In cer-
tain rare cases, this could lead to a race condition and the eventual forced shutdown of the cluster. (Bug#27466)
MySQL Cluster: When using the MemReportFrequency configuration parameter to generate periodic reports of memory usage
in the cluster log, DataMemory usage was not always reported for all data nodes. (Bug#27444)
MySQL Cluster: When trying to create an NDB table after the server was started with --ndbcluster but without -
-ndb-connectstring, mysqld produced a memory allocation error. (Bug#27359)
MySQL Cluster: Performing a delete followed by an insert during a local checkpoint could cause a ROWID ALREADY ALLOCATED er-
ror. (Bug#27205)
MySQL Cluster: In an NDB table having a TIMESTAMP column using DEFAULT CURRENT_TIMESTAMP, that column would
assume a random value when another column in the same row was updated. (Bug#27127)
MySQL Cluster: Error messages displayed when running in single user mode were inconsistent. (Bug#27021)
MySQL Cluster: On Solaris, the value of an NDB table column declared as BIT(33) was always displayed as 0. (Bug#26986)
MySQL Cluster: Performing ALTER TABLE ... ENGINE=MERGE on an NDB table caused mysqld to crash. (Bug#26898)
MySQL Change History
2929
MySQL Cluster: The NDBCLUSTER table handler did not set bits in null bytes correctly. (Bug#26591)
MySQL Cluster: In some cases, AFTER UPDATE and AFTER DELETE triggers on NDB tables that referenced subject table did
not see the results of operation which caused invocation of the trigger, but rather saw the row as it was prior to the update or delete
operation.
This was most noticeable when an update operation used a subquery to obtain the rows to be updated. An example would be UP-
DATE tbl1 SET col2 = val1 WHERE tbl1.col1 IN (SELECT col3 FROM tbl2 WHERE c4 = val2) where
there was an AFTER UPDATE trigger on table tbl1. In such cases, the trigger would fail to execute.
The problem occurred because the actual update or delete operations were deferred to be able to perform them later as one batch.
The fix for this bug solves the problem by disabling this optimization for a given update or delete if the table has an AFTER trigger
defined for this operation. (Bug#26242)
MySQL Cluster: Joins on multiple tables containing BLOB columns could cause data nodes run out of memory, and to crash with
the error NDBOBJECTIDMAP::EXPAND UNABLE TO EXPAND. (Bug#26176)
MySQL Cluster: START BACKUP NOWAIT caused a spurious OUT OF BACKUP RECORD error in the management client (START
BACKUP and START BACKUP WAIT STARTED performed normally). (Bug#25446)
MySQL Cluster: Adding of indexes online failed for NDB tables having BLOB or TEXT columns. (Bug#25431)
MySQL Cluster: When a cluster data node suffered a hard failure (such as a power failure or loss of a network connection) TCP
sockets to the missing node were maintained indefinitely. Now socket-based transporters check for a response and terminate the
socket if there is no activity on the socket after 2 hours. (Bug#24793)
MySQL Cluster: The ndb_resize.pl utility did not calculate memory usage for indexes correctly. (Bug#24229)
MySQL Cluster: While a data node was stopped, dropping a table then creating an index on a different table caused that node to
fail during restart. This was due to the re-use of the dropped table's internal ID for the index without verifying that the index now re-
ferred to a different database object. (Bug#21755)
MySQL Cluster: When trying to create tables on an SQL node not connected to the cluster, a misleading error message TABLE
'TBL_NAME' ALREADY EXISTS was generated. The error now generated is COULD NOT CONNECT TO STORAGE ENGINE.
(Bug#11217, Bug#18676)
Cluster Replication: Replication: An SQL node acting as a replication master server could be a single point of failure; that is, if it
failed, the replication slave had no way of knowing this, which could result in a mismatch of data between the master and the slave.
(Bug#21494)
Replication: Out-of-memory errors were not reported. Now they are written to the error log. (Bug#26844)
Replication: Improved out-of-memory detection when sending logs from a master server to slaves, and log a message when alloca-
tion fails. (Bug#26837)
Replication: Aborting a statement on the master that applied to a nontransactional statement broke replication. The statement was
written to the binary log but not completely executed on the master. Slaves receiving the statement executed it completely, resulting
in loss of data synchrony. Now an error code is written to the error log so that the slaves stop without executing the aborted state-
ment. (That is, replication stops, but synchrony to the point of the stop is preserved and you can investigate the problem.)
(Bug#26551)
Replication: When RAND() was called multiple times inside a stored procedure, the server did not write the correct random seed
values to the binary log, resulting in incorrect replication. (Bug#25543)
Replication: GRANT statements were not replicated if the server was started with the --replicate-ignore-table or -
-replicate-wild-ignore-table option. (Bug#25482)
Replication: Restoration of the default database after stored routine or trigger execution on a slave could cause replication to stop if
the database no longer existed. (Bug#25082)
Replication: If a rotate event occured in the middle of a nontransaction group, the group position would be updated by the rotate
event indicating an illegal group start position that was effectively inside a group. This can happen if, for example, a rotate occurs
between an Intvar event and the associated Query event, or between the table map events and the rows events when using row-
based replication. (Bug#23171)
Replication: Row-based replication of MyISAM to non-MyISAM tables did not work correctly for BIT columns. This has been cor-
MySQL Change History
2930
rected, but the fix introduces an incompatibility into the binary log format. (The incompatibility is corrected by the fix for
Bug#27779.) (Bug#22583)
Cluster Replication: Disk Data: An issue with replication of Disk Data tables could in some cases lead to node failure.
(Bug#28161)
Disk Data: Changes to a Disk Data table made as part of a transaction could not be seen by the client performing the changes until
the transaction had been committed. (Bug#27757)
Disk Data: When in single user mode, it was possible to create log file groups and tablespaces from any SQL node connected to the
cluster. (Bug#27712)
Disk Data: CREATE TABLE ... LIKE disk_data_table created an in-memory NDB table. (Bug#25875)
Disk Data: When restarting a data node following the creation of a large number of Disk Data objects (approximately 200 such ob-
jects), the cluster could not assign a node ID to the restarting node. (Bug#25741)
Disk Data: Creating an excessive number of Disk Data tables (1000 or more) could cause data nodes to fail. (Bug#24951)
Disk Data: Changing a column specification or issuing a TRUNCATE statement on a Disk Data table caused the table to become an
in-memory table.
This fix supersedes an incomplete fix that was made for this issue in MySQL 5.1.15. (Bug#24667, Bug#25296)
Disk Data: Setting the value of the UNDO BUFFER SIZE to 64K or less in a CREATE LOGFILE GROUP statement led to failure
of cluster data nodes. (Bug#24560)
Disk Data: Creating an excessive number of data files for a single tablespace caused data nodes to crash. (Bug#24521)
Disk Data: It was possible to drop the last remaining datafile in a tablespace using ALTER TABLESPACE, even when there was
still an empty table using the tablespace.
Note
The datafile could be not dropped if the table still contained any rows, so this bug involved no loss of data.
(Bug#21699)
Cluster Replication: Some queries that updated multiple tables were not backed up correctly. (Bug#27748)
Cluster Replication: It was possible for API nodes to begin interacting with the cluster subscription manager before they were fully
connected to the cluster. (Bug#27728)
Cluster Replication: Under very high loads, checkpoints could be read or written with checkpoint indexes out of order.
(Bug#27651)
Cluster Replication: Trying to replicate a large number of frequent updates with a relatively small relay log (max-re-
lay-log-size set to 1M or less) could cause the slave to crash. (Bug#27529)
Cluster Replication: Setting sql_log_bin to zero did not disable binary logging.
This issue affected only the NDB storage engine. (Bug#27076)
Cluster API: For BLOB reads on operations with lock mode LM_CommittedRead, the lock mode was not upgraded to LM_Read
before the state of the BLOB had already been calculated. The NDB API methods affected by this problem included the following:
NdbOperation::readTuple()
NdbScanOperation::readTuples()
NdbIndexScanOperation::readTuples()
(Bug#27320)
Cluster API: Using NdbBlob::writeData() to write data in the middle of an existing blob value (that is, updating the value)
could overwrite some data past the end of the data to be changed. (Bug#27018)
MySQL Change History
2931
A performance degradation was observed for outer join queries to which a not-exists optimization was applied. (Bug#28188)
SELECT * INTO OUTFILE ... FROM INFORMATION_SCHEMA.SCHEMATA failed with an ACCESS DENIED error, even
for a user who had the FILE privilege. (Bug#28181)
Early NULL-filtering optimization did not work for eq_ref table access. (Bug#27939)
Nongrouped columns were allowed by * in ONLY_FULL_GROUP_BY SQL mode. (Bug#27874)
Some equi-joins containing a WHERE clause that included a NOT IN subquery caused a server crash. (Bug#27870)
An error message suggested the use of mysql_fix_privilege_tables after an upgrade, but the recommended program is
now mysql_upgrade. (Bug#27818)
Debug builds on Windows generated false alarms about uninitialized variables with some Visual Studio runtime libraries.
(Bug#27811)
Certain queries that used uncorrelated scalar subqueries caused EXPLAIN to crash. (Bug#27807)
Performing a UNION on two views that had ORDER BY clauses resulted in an Unknown column error. (Bug#27786)
mysql_install_db is supposed to detect existing system tables and create only those that do not exist. Instead, it was exiting
with an error if tables already existed. (Bug#27783)
The LEAST() and GREATEST() functions compared DATE and DATETIME values as strings, which in some cases could lead to
an incorrect result. (Bug#27759)
A memory leak in the event scheduler was uncovered by Valgrind. (Bug#27733)
mysqld did not check the length of option values and could crash with a buffer overflow for long values. (Bug#27715)
Comparisons using row constructors could fail for rows containing NULL values. (Bug#27704)
mysqldump could not connect using SSL. (Bug#27669)
SELECT DISTINCT could return incorrect results if the select list contained duplicated columns. (Bug#27659)
On Linux, the server could not create temporary tables if lower_case_table_names was set to 1 and the value of tmpdir
was a directory name containing any uppercase letters. (Bug#27653)
For InnoDB tables, a multiple-row INSERT of the form INSERT INTO t (id...) VALUES (NULL...) ON DUPLIC-
ATE KEY UPDATE id=VALUES(id), where id is an AUTO_INCREMENT column, could cause ERROR 1062 (23000):
Duplicate entry... errors or lost rows. (Bug#27650)
When MySQL logged slow query information to a CSV table, it used an incorrect formula to calculate the query_time and
lock_time values. (Bug#27638)
The XML output representing an empty result was an empty string rather than an empty <resultset/> element. (Bug#27608)
Comparison of a DATE with a DATETIME did not treat the DATE as having a time part of 00:00:00. (Bug#27590)
See also Bug#32198.
With NO_AUTO_VALUE_ON_ZERO SQL mode enabled, LOAD DATA operations could assign incorrect AUTO_INCREMENT val-
ues. (Bug#27586)
Group relay log rotation updated only the log position and not the name, causing the slave to stop. (Bug#27583)
Incorrect results could be returned for some queries that contained a select list expression with IN or BETWEEN together with an
ORDER BY or GROUP BY on the same expression using NOT IN or NOT BETWEEN. (Bug#27532)
The fix for Bug#17212 provided correct sort order for misordered output of certain queries, but caused significant overall query per-
formance degradation. (Results were correct (good), but returned much more slowly (bad).) The fix also affected performance of
queries for which results were correct. The performance degradation has been addressed. (Bug#27531)
The CRC32() function returns an unsigned integer, but the metadata was signed, which could cause certain queries to return incor-
MySQL Change History
2932
rect results. (For example, queries that selected a CRC32() value and used that value in the GROUP BY clause.) (Bug#27530)
An interaction between SHOW TABLE STATUS and other concurrent statements that modify the table could result in a divide-
by-zero error and a server crash. (Bug#27516)
Evaluation of an IN() predicate containing a decimal-valued argument caused a server crash. (Bug#27513, Bug#27362, CVE-
2007-2583)
A race condition between DROP TABLE and SHOW TABLE STATUS could cause the latter to display incorrect information.
(Bug#27499)
In out-of-memory conditions, the server might crash or otherwise not report an error to the Windows event log. (Bug#27490)
Passing nested row expressions with different structures to an IN predicate caused a server crash. (Bug#27484)
The decimal.h header file was incorrectly omitted from binary distributions. (Bug#27456)
With innodb_file_per_table enabled, attempting to rename an InnoDB table to a nonexistent database caused the server to
exit. (Bug#27381)
Nested aggregate functions could be improperly evaluated. (Bug#27363)
A stored function invocation in the WHERE clause was treated as a constant. (Bug#27354)
For the INFORMATION_SCHEMA SESSION_STATUS and GLOBAL_STATUS tables, some status values were incorrectly conver-
ted to the data type of the VARIABLE_VALUE column. (Bug#27327)
Failure to allocate memory associated with transaction_prealloc_size could cause a server crash. (Bug#27322)
A subquery could get incorrect values for references to outer query columns when it contained aggregate functions that were ag-
gregated in outer context. (Bug#27321)
The server did not shut down cleanly. (Bug#27310)
In a view, a column that was defined using a GEOMETRY function was treated as having the LONGBLOB data type rather than the
GEOMETRY type. (Bug#27300)
mysqldump crashed if it got no data from SHOW CREATE PROCEDURE (for example, when trying to dump a routine defined by
a different user and for which the current user had no privileges). Now it prints a comment to indicate the problem. It also returns an
error, or continues if the --force option is given. (Bug#27293)
Queries containing subqueries with COUNT(*) aggregated in an outer context returned incorrect results. This happened only if the
subquery did not contain any references to outer columns. (Bug#27257)
Use of an aggregate function from an outer context as an argument to GROUP_CONCAT() caused a server crash. (Bug#27229)
String truncation upon insertion into an integer or year column did not generate a warning (or an error in strict mode). (Bug#27176,
Bug#26359)
mysqlbinlog produced different output with the -R option than without it. (Bug#27171)
Storing NULL values in spatial fields caused excessive memory allocation and crashes on some systems. (Bug#27164)
Row equalities in WHERE clauses could cause memory corruption. (Bug#27154)
ON DUPLICATE KEY UPDATE failed for a table partitioned by KEY on a primary key VARCHAR column. (Bug#27123)
GROUP BY on a ucs2 column caused a server crash when there was at least one empty string in the column. (Bug#27079)
Duplicate members in SET or ENUM definitions were not detected. Now they result in a warning; if strict SQL mode is enabled, an
error occurs instead. (Bug#27069)
For FEDERATED tables, SHOW CREATE TABLE could fail when the table name was longer than the connection name.
(Bug#27036)
mysql_install_db could terminate with an error after failing to determine that a system table already existed. (Bug#27022)
MySQL Change History
2933
In a MEMORY table, using a BTREE index to scan for updatable rows could lead to an infinite loop. (Bug#26996)
make_win_bin_dist neglected to copy some required MyISAM table files. (Bug#26922)
For InnoDB tables having a clustered index that began with a CHAR or VARCHAR column, deleting a record and then inserting an-
other before the deleted record was purged could result in table corruption. (Bug#26835)
mysqldump would not dump a view for which the DEFINER no longer exists. (Bug#26817)
Duplicates were not properly identified among (potentially) long strings used as arguments for GROUP_CONCAT(DISTINCT).
(Bug#26815)
ALTER VIEW requires the CREATE VIEW and DROP privileges for the view. However, if the view was created by another user,
the server erroneously required the SUPER privilege. (Bug#26813)
If the name of a table given to myisamchk -rq was a packed table and the name included the .MYI extension, myisamchk in-
correctly created a file with a .MYI.MYI extension. (Bug#26782)
Creating a temporary table with InnoDB when using the one-file-per-table setting, and when the host file system for temporary
tables was tmpfs, would cause an assertion within mysqld. This was due to the use of O_DIRECT when opening the temporary
table file. (Bug#26662)
mysql_upgrade did not detect failure of external commands that it runs. (Bug#26639)
The range optimizer could cause the server to run out of memory. (Bug#26625)
The range optimizer could consume a combinatorial amount of memory for certain classes of WHERE clauses. (Bug#26624)
mysqldump could crash or exhibit incorrect behavior when some options were given very long values, such as -
-fields-terminated-by="some very long string". The code has been cleaned up to remove a number of fixed-
sized buffers and to be more careful about error conditions in memory allocation. (Bug#26346)
A possible buffer overflow in SHOW PROCEDURE CODE was removed. (Bug#26303)
The FEDERATED engine did not allow the local and remote tables to have different names. (Bug#26257)
The temporary file-creation code was cleaned up on Windows to improve server stability. (Bug#26233)
For MyISAM tables, COUNT(*) could return an incorrect value if the WHERE clause compared an indexed TEXT column to the
empty string (''). This happened if the column contained empty strings and also strings starting with control characters such as tab
or newline. (Bug#26231)
For INSERT INTO ... SELECT where index searches used column prefixes, insert errors could occur when key value type
conversion was done. (Bug#26207)
mysqlbinlog --base64-output produced invalid SQL. (Bug#26194)
For DELETE FROM tbl_name ORDER BY col_name (with no WHERE or LIMIT clause), the server did not check whether
col_name was a valid column in the table. (Bug#26186)
Executing an INSERT ... SELECT ... FROM INFORMATION_SCHEMA.GLOBAL_STATUS statement from within an
event caused a server crash. (Bug#26174)
mysqldump could not dump log tables. (Bug#26121)
On Windows, trying to use backslash (\) characters in paths for DATA DIRECTORY and INDEX DIRECTORY when creating par-
titioned tables caused MySQL to crash.
(You must use / characters when specifying paths for these options, regardless of platform. See Section 18.1, Overview of Parti-
tioning in MySQL, for an example using absolute paths for DATA DIRECTORY and INDEX DIRECTORY when creating a parti-
tioned table on Windows.) (Bug#26074, Bug#25141)
mysqldump crashed for MERGE tables if the --complete-insert (-c) option was given. (Bug#25993)
Index hints (USE INDEX, IGNORE INDEX, FORCE INDEX) cannot be used with FULLTEXT indexes, but were not being ig-
nored. (Bug#25951)
MySQL Change History
2934
Setting a column to NOT NULL with an ON DELETE SET NULL clause foreign key crashes the server. (Bug#25927)
Corrupted MyISAM tables that have different definitions in the .frm and .MYI tables might cause a server crash. (Bug#25908)
If CREATE TABLE t1 LIKE t2 failed due to a full disk, an empty t2.frm file could be created but not removed. This file
then caused subsequent attempts to create a table named t2 to fail. This is easily corrected at the file system level by removing the
t2.frm file manually, but now the server removes the file if the create operation does not complete successfully. (Bug#25761)
In certain situations, MATCH ... AGAINST returned false hits for NULL values produced by LEFT JOIN when no full-text in-
dex was available. (Bug#25729)
Concurrent CREATE SERVER and ALTER SERVER statements could cause a deadlock. (Bug#25721)
CREATE SERVER, DROP SERVER, and ALTER SERVER did not require any privileges. Now these statements require the SU-
PER privilege. (Bug#25671)
On Windows, connection handlers did not properly decrement the server's thread count when exiting. (Bug#25621)
OPTIMIZE TABLE might fail on Windows when it attempts to rename a temporary file to the original name if the original file had
been opened, resulting in loss of the .MYD file. (Bug#25521)
For SHOW ENGINE INNODB STATUS, the LATEST DEADLOCK INFORMATION was not always cleared properly.
(Bug#25494)
mysql_stmt_fetch() did an invalid memory deallocation when used with the embedded server. (Bug#25492)
mysql_upgrade did not pass a password to mysqlcheck if one was given. (Bug#25452)
On Windows, mysql_upgrade was sensitive to lettercase of the names of some required components. (Bug#25405)
During a call to mysql_change_user(), when authentication fails or the database to change to is unknown, a subsequent call to
any function that does network communication leads to packets out of order. This problem was introduced in MySQL 5.1.14.
(Bug#25371)
Difficult repair or optimization operations could cause an assertion failure, resulting in a server crash. (Bug#25289)
For storage engines that allow the current auto-increment value to be set, using ALTER TABLE ... ENGINE to convert a table
from one such storage engine to another caused loss of the current value. (For storage engines that do not support setting the value,
it cannot be retained anyway when changing the storage engine.) (Bug#25262)
Duplicate entries were not assessed correctly in a MEMORY table with a BTREE primary key on a utf8 ENUM column. (Bug#24985)
Several math functions produced incorrect results for large unsigned values. ROUND() produced incorrect results or a crash for a
large number-of-decimals argument. (Bug#24912)
The result set of a query that used WITH ROLLUP and DISTINCT could lack some rollup rows (rows with NULL values for group-
ing attributes) if the GROUP BY list contained constant expressions. (Bug#24856)
Selecting the result of AVG() within a UNION could produce incorrect values. (Bug#24791)
For queries that used ORDER BY with InnoDB tables, if the optimizer chose an index for accessing the table but found a covering
index that enabled the ORDER BY to be skipped, no results were returned. (Bug#24778)
The NO_DIR_IN_CREATE server SQL mode was not enforced for partitioned tables. (Bug#24633)
MBRDisjoint(), MBRequal(), MBRIntersects(), MBROverlaps(), MBRTouches(), and MBRWithin() were inad-
vertently omitted from recent versions of MySQL (5.1.14 to 5.1.17). (Bug#24588)
Access via my_pread() or my_pwrite() to table files larger than 2GB could fail on some systems. (Bug#24566)
MBROverlaps() returned incorrect values in some cases. (Bug#24563)
A problem in handling of aggregate functions in subqueries caused predicates containing aggregate functions to be ignored during
query execution. (Bug#24484)
The MERGE storage engine could return incorrect results when several index values that compare equality were present in an index
MySQL Change History
2935
(for example, 'gross' and 'gross ', which are considered equal but have different lengths). (Bug#24342)
Some upgrade problems are detected and better error messages suggesting that mysql_upgrade be run are produced.
(Bug#24248)
The test for the MYSQL_OPT_SSL_VERIFY_SERVER_CERT option for mysql_options() was performed incorrectly. Also
changed as a result of this bug fix: The arg option for the mysql_options() C API function was changed from char * to
void *. (Bug#24121)
Some views could not be created even when the user had the requisite privileges. (Bug#24040)
The values displayed for the Innodb_row_lock_time, Innodb_row_lock_time_avg, and In-
nodb_row_lock_time_max status variables were incorrect. (Bug#23666)
Using CAST() to convert DATETIME values to numeric values did not work. (Bug#23656)
A damaged or missing mysql.event table caused SHOW VARIABLES to fail. (Bug#23631)
SHOW CREATE VIEW qualified references to stored functions in the view definition with the function's database name, even when
the database was the default database. This affected mysqldump (which uses SHOW CREATE VIEW to dump views) because the
resulting dump file could not be used to reload the database into a different database. SHOW CREATE VIEW now suppresses the
database name for references to functions in the default database. (Bug#23491)
An INTO OUTFILE clause is allowed only for the final SELECT of a UNION, but this restriction was not being enforced correctly.
(Bug#23345)
The AUTO_INCREMENT value would not be correctly reported for InnoDB tables when using SHOW CREATE TABLE statement
or mysqldump command. (Bug#23313)
With the NO_AUTO_VALUE_ON_ZERO SQL mode enabled, LAST_INSERT_ID() could return 0 after INSERT ... ON DU-
PLICATE KEY UPDATE. Additionally, the next rows inserted (by the same INSERT, or the following INSERT with or without
ON DUPLICATE KEY UPDATE), would insert 0 for the auto-generated value if the value for the AUTO_INCREMENT column
was NULL or missing. (Bug#23233)
Implicit conversion of 9912101 to DATE did not match CAST(9912101 AS DATE). (Bug#23093)
SELECT COUNT(*) from a table containing a DATETIME NOT NULL column could produce spurious warnings with the
NO_ZERO_DATE SQL mode enabled. (Bug#22824)
Using SET GLOBAL to change the lc_time_names system variable had no effect on new connections. (Bug#22648)
SOUNDEX() returned an invalid string for international characters in multi-byte character sets. (Bug#22638)
A multiple-table UPDATE could return an incorrect rows-matched value if, during insertion of rows into a temporary table, the table
had to be converted from a MEMORY table to a MyISAM table. (Bug#22364)
COUNT(decimal_expr) sometimes generated a spurious truncation warning. (Bug#21976)
yaSSL crashed on pre-Pentium Intel CPUs. (Bug#21765)
A slave that used --master-ssl-cipher could not connect to the master. (Bug#21611)
Database and table names have a maximum length of 64 characters (even if they contain multi-byte characters), but were truncated
to 64 bytes.
Note
This improves on a previous fix made for this bug in MySQL 5.1.12.
(Bug#21432)
InnoDB: The first read statement, if served from the query cache, was not consistent with the READ COMMITTED isolation level.
(Bug#21409)
On Windows, if the server was installed as a service, it did not auto-detect the location of the data directory. (Bug#20376)
MySQL Change History
2936
Changing a utf8 column in an InnoDB table to a shorter length did not shorten the data values. (Bug#20095)
In some cases, the optimizer preferred a range or full index scan access method over lookup access methods when the latter were
much cheaper. (Bug#19372)
Conversion of DATETIME values in numeric contexts sometimes did not produce a double (YYYYMMDDHHMMSS.uuuuuu) value.
(Bug#16546)
INSERT...ON DUPLICATE KEY UPDATE could cause Error 1032: Can't find record in ... for inserts into
an InnoDB table unique index using key column prefixes with an underlying utf8 string column. (Bug#13191)
Having the EXECUTE privilege for a routine in a database should make it possible to USE that database, but the server returned an
error instead. This has been corrected. As a result of the change, SHOW TABLES for a database in which you have only the EX-
ECUTE privilege returns an empty set rather than an error. (Bug#9504)
C.1.21. Changes in MySQL 5.1.17 (04 April 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: Scheduled events now use the MySQL server time zone to determine their schedules, rather than UTC as in
previous releases. Because of this change, scheduled event metadata now includes time zone information, which can be seen in the
TIME_ZONE column of the INFORMATION_SCHEMA.EVENTS table and the Time zone column in the output of the SHOW
EVENTS statement. These columns have been added in this release, along with a time_zone column in the mysql.event table.
Due to these changes, events created in previous versions of MySQL cannot be created, viewed, or used until mysql.event has
been upgraded. (Bug#16420)
Important Change: Replication: The following options for controlling replication master configuration on a slave are now deprec-
ated.
--master-host
--master-user
--master-password
--master-port
--master-connect-retry
--master-ssl
--master-ssl-ca
--master-ssl-capath
--master-ssl-cert
--master-ssl-cipher
MySQL Change History
2937
--master-ssl-key
To change the master configuration on a slave you should use the CHANGE MASTER TO statement.
See also Bug#21490.
Important Change: The CREATE EVENT and ALTER EVENT statements now support a DEFINER clause, similar to that used in
the CREATE TRIGGER statement.
See Section 12.1.11, CREATE EVENT Syntax, for detailed information. (Bug#16425)
MySQL Cluster: Added the --skip-table-check option (short form -s) for ndb_restore, which causes the restoration
process to ignore any changes that may have occurred in table schemas after the backup was made. Previously, this was the default
behavior.
See Section 17.6.17, ndb_restore Restore a MySQL Cluster Backup, for more information. (Bug#24363)
Added a --no-beep option to mysqladmin. It suppresses the warning beep that is emitted by default for errors such as a failure
to connect to the server. (Bug#26964)
Added the --service-startup-timeout option for mysql.server to specify how long to wait for the server to start. If
the server does not start within the timeout period, mysql.server exits with an error. (Bug#26952)
Prefix lengths for columns in SPATIAL indexes can no longer be specified. For tables created in older versions of MySQL that
have SPATIAL indexes containing prefixed columns, dumping and reloading the table causes the indexes to be created with no pre-
fixes. (The full column width of each column is indexed.) (Bug#26794)
Added the innodb_stats_on_metadata system variable to enable control over whether InnoDB performs statistics gather-
ing when metadata statements are executed. See Section 13.6.3, InnoDB Startup Options and System Variables. (Bug#26598)
Statements that affect mysql database tables now are written to the binary log using the following rules:
Data manipulation statements such as INSERT that change data in mysql database tables directly are logged according to the
settings of the binlog_format system variable.
Statements such as GRANT that change the mysql database indirectly are logged as statements regardless of the value of bin-
log_format.
For more details, see Section 5.2.4.4, Logging Format for Changes to mysql Database Tables. (Bug#25091)
The server now includes a timestamp in error messages that are logged as a result of unhandled signals (such as mysqld got
signal 11 messages). (Bug#24878)
The syntax for index hints has been extended to enable more fine-grained control over the optimizer's selection of an execution plan
for various phases of query processing. See Section 12.2.8.2, Index Hint Syntax. (Bug#21174)
Added the --secure-file-priv option for mysqld, which limits the effect of the LOAD_FILE() function and the LOAD
DATA and SELECT ... INTO OUTFILE statements to work only with files in a given directory. (Bug#18628)
Prepared statements now use the query cache under the conditions described in Section 7.5.5.1, How the Query Cache Operates.
(Bug#735)
Added the thread_handling system variable to control whether the server use a single thread or one thread per connection. The
--one-thread option now is deprecated; use --thread_handling=one-thread instead.
Statements such as GRANT that change the mysql database indirectly are logged as statements regardless of the value of bin-
log_format.
Added the read-only hostname system variable, which the server sets at startup to the server host name.
Online (noncopying) ADD INDEX and DROP INDEX operations are now performed on dynamic (variable-width) columns. Re-
naming of NDB and MyISAM tables and of columns in such tables is now performed without copying or locking the tables. As a res-
ult, these operations are now performed much more quickly than previously.
See Section 12.1.7, ALTER TABLE Syntax, Section 12.1.13, CREATE INDEX Syntax, and Section 12.1.24, DROP INDEX
MySQL Change History
2938
Syntax, for more information.
Data manipulation statements such as INSERT that change data in mysql database tables directly are logged according to the set-
tings of the binlog_format system variable.
Added the old_mode system variable to cause the server to revert to certain behaviors present in older versions. Currently, this
variable affects handling of index hints. See Section 12.2.8.2, Index Hint Syntax.
Bugs fixed:
Incompatible Change: INSERT DELAYED statements are not supported for MERGE tables, but the MERGE storage engine was not
rejecting such statements, resulting in table corruption. Applications previously using INSERT DELAYED into MERGE table will
break when upgrading to versions with this fix. To avoid the problem, remove DELAYED from such statements. (Bug#26464)
Important Note: The parser accepted invalid code in SQL condition handlers, leading to server crashes or unexpected execution be-
havior in stored programs. Specifically, the parser allowed a condition handler to refer to labels for blocks that enclose the handler
declaration. This was incorrect because block label scope does not include the code for handlers declared within the labeled block.
The parser now rejects this invalid construct, but if you perform a binary upgrade (without dumping and reloading your databases),
existing handlers that contain the construct are still invalid and should be rewritten even if they appear to function as you expect.
To find affected handlers, use mysqldump to dump all stored procedures and functions, triggers, and events. Then attempt to re-
load them into an upgraded server. Handlers that contain illegal label references will be rejected.
For more information about condition handlers and writing them to avoid invalid jumps, see Section 12.8.4.2, DECLARE for Hand-
lers. (Bug#26503)
MySQL Cluster: It was not possible to set LockPagesInMainMemory equal to 0. (Bug#27291)
MySQL Cluster: A race condition could sometimes occur if the node acting as master failed while node IDs were still being alloc-
ated during startup. (Bug#27286)
MySQL Cluster: When a data node was taking over as the master node, a race condition could sometimes occur as the node was as-
suming responsibility for handling of global checkpoints. (Bug#27283)
MySQL Cluster: After putting the cluster in single user mode from one MySQL server, trying to drop an NDB table from a second
MySQL server also connected to the cluster would cause the second MySQL server to hang. (Bug#27254)
MySQL Cluster: mysqld could crash shortly after a data node failure following certain DML operations. (Bug#27169)
MySQL Cluster: (Disk Data): Under some circumstances, a data node could fail during restart while flushing Disk Data UNDO
logs. (Bug#27102)
MySQL Cluster: The same failed request from an API node could be handled by the cluster multiple times, resulting in reduced
performance. (Bug#27087)
MySQL Cluster: The failure of a data node while restarting could cause other data nodes to hang or crash. (Bug#27003)
MySQL Cluster: Creating a table on one SQL node while in single user mode caused other SQL nodes to crash. (Bug#26997)
MySQL Cluster: mysqld processes would sometimes crash under high load. (Bug#26825)
MySQL Cluster: Using only the --print_data option (and no other options) with ndb_restore caused ndb_restore to
fail. (Bug#26741)
This regression was introduced by Bug#14612.
MySQL Cluster: The output from ndb_restore --print_data was incorrect for a backup made of a database containing
tables with TINYINT or SMALLINT columns. (Bug#26740)
MySQL Cluster: An infinite loop in an internal logging function could cause trace logs to fill up with UNKNOWN SIGNAL TYPE error
messages and thus grow to unreasonable sizes. (Bug#26720)
MySQL Cluster: An invalid pointer was returned following a FSCLOSECONF signal when accessing the REDO logs during a node
MySQL Change History
2939
restart or system restart. (Bug#26515)
MySQL Cluster: The management client command node_id STATUS displayed the message Node node_id: not con-
nected when node_id was not the node ID of a data node.
Note
The ALL STATUS command in the cluster management client still displays status information for data nodes only. This is
by design. See Section 17.7.2, Commands in the MySQL Cluster Management Client, for more information.
(Bug#21715)
MySQL Cluster: When performing an upgrade or downgrade, no specific error information was made available when trying to up-
grade data nodes or SQL nodes before upgrading management nodes. (Bug#21296)
MySQL Cluster: Some values of MaxNoOfTables caused the error JOB BUFFER CONGESTION to occur. (Bug#19378)
Replication: A multiple-row delayed insert with an auto-increment column could cause duplicate entries to be created on the slave
in a replication environment. (Bug#26116, Bug#25507)
Replication: Duplicating the usage of a user variable in a stored procedure or trigger would not be replicated correctly to the slave.
(Bug#25167)
Replication: DROP TRIGGER statements would not be filtered on the slave when using the replication-wild-do-table
option. (Bug#24478)
Replication: For INSERT ... ON DUPLICATE KEY UPDATE statements where some AUTO_INCREMENT values were gen-
erated automatically for inserts and some rows were updated, one auto-generated value was lost per updated row, leading to faster
exhaustion of the range of the AUTO_INCREMENT column.
Because the original problem can affect replication (different values on master and slave), it is recommended that the master and its
slaves be upgraded to the current version. (Bug#24432)
Replication: Replication between master and slave would infinitely retry binary log transmission where the
max_allowed_packet on the master was larger than that on the slave if the size of the transfer was between these two values.
(Bug#23775)
Replication: Loading data using LOAD DATA INFILE may not replicate correctly (due to character set incompatibilities) if the
character_set_database variable is set before the data is loaded. (Bug#15126)
Replication: User defined variables used within stored procedures and triggers are not replicated correctly when operating in state-
ment-based replication mode. (Bug#14914, Bug#20141)
Disk Data: A memory overflow could occur with tables having a large amount of data stored on disk, or with queries using a very
high degree of parallelism on Disk Data tables. (Bug#26514)
Disk Data: Use of a tablespace whose INITIAL_SIZE was greater than 1 GB could cause the cluster to crash. (Bug#26487)
Disk Data: Creating multiple Disk Data tables using different tablespaces could sometimes cause the cluster to fail. (Bug#25992)
Disk Data: ALTER TABLE ... ADD COLUMN ... on a Disk Data table moved data for existing nonindexed columns from the
tablespace into memory. (Bug#25880)
Disk Data: DROP INDEX on a Disk Data table did not always move data from memory into the tablespace. (Bug#25877)
Disk Data: When creating a log file group, setting INITIAL_SIZE to less than UNDO_BUFFER_SIZE caused data nodes to
crash. (Bug#25743)
Cluster Replication: The simultaneous failure of a data node and an SQL node could cause replication to fail. (Bug#27005)
Cluster API: A delete operation using a scan followed by an insert using a scan could cause a data node to fail. (Bug#27203)
Cluster API: (Cluster APIs): NAND and NOR operations with NdbScanFilter did not perform correctly. (Bug#24568)
Cluster API: You can now use the ndb_mgm_check_connection() function to determine whether a management server is
running. See ndb_mgm_check_connection().
MySQL Change History
2940
MyISAM tables converted to ARCHIVE were excessively large. (Bug#27533)
SELECT ... INTO OUTFILE with a long FIELDS ENCLOSED BY value could crash the server. (Bug#27231)
An INSERT ... ON DUPLICATE KEY UPDATE statement might modify values in a table but not flush affected data from the
query cache, causing subsequent selects to return stale results. This made the combination of query cache plus ON DUPLICATE
KEY UPDATE very unreliable. (Bug#27210)
See also Bug#27006, Bug#27033.
This regression was introduced by Bug#19978.
For INSERT ... ON DUPLICATE KEY UPDATE statements on tables containing AUTO_INCREMENT columns,
LAST_INSERT_ID() was reset to 0 if no rows were successfully inserted or changed. Not changed includes the case where a
row was updated to its current values, but in that case, LAST_INSERT_ID() should not be reset to 0. Now
LAST_INSERT_ID() is reset to 0 only if no rows were successfully inserted or touched, whether or not touched rows were
changed. (Bug#27033)
See also Bug#27210, Bug#27006.
This regression was introduced by Bug#19978.
Invalid optimization of pushdown conditions for queries where an outer join was guaranteed to read only one row from the outer ta-
ble led to results with too few rows. (Bug#26963)
For MERGE tables defined on underlying tables that contained a short VARCHAR column (shorter than four characters), using AL-
TER TABLE on at least one but not all of the underlying tables caused the table definitions to be considered different from that of
the MERGE table, even if the ALTER TABLE did not change the definition. (Bug#26881)
Use of a subquery containing GROUP BY and WITH ROLLUP caused a server crash. (Bug#26830)
Setting event_scheduler = 1 or event_scheduler = ON caused the server to crash if the server had been started with -
-skip-grant-tables. Starting the server with --skip-grant-tables now causes event_scheduler to be set to
DISABLED automatically, overriding any other value that may have been set. (Bug#26807)
Added support for --debugger=dbx for mysql-test-run.pl and added support for --debugger=devenv, -
-debugger=DevEnv, and --debugger=/path/to/devenv. (Bug#26792)
A result set column formed by concatention of string literals was incomplete when the column was produced by a subquery in the
FROM clause. (Bug#26738)
SSL connections failed on Windows. (Bug#26678)
When using the result of SEC_TO_TIME() for time value greater than 24 hours in an ORDER BY clause, either directly or through
a column alias, the rows were sorted incorrectly as strings. (Bug#26672)
Use of a subquery containing a UNION with an invalid ORDER BY clause caused a server crash. (Bug#26661)
In some error messages, inconsistent format specifiers were used for the translations in different languages. comp_err (the error
message compiler) now checks for mismatches. (Bug#26571)
Views that used a scalar correlated subquery returned incorrect results. (Bug#26560)
UNHEX() IS NULL comparisons failed when UNHEX() returned NULL. (Bug#26537)
On 64-bit Windows, large timestamp values could be handled incorrectly. (Bug#26536)
SHOW CREATE EVENT failed to display the STARTS and ENDS clauses for an event defined with STARTS NOW(), ENDS
NOW(), or both. (Bug#26429)
If the server was started with --skip-grant-tables, Selecting from INFORMATION_SCHEMA tables causes a server crash.
(Bug#26285)
For some values of the position argument, the INSERT() function could insert a NUL byte into the result. (Bug#26281)
For an INSERT statement that should fail due to a column with no default value not being assigned a value, the statement succeeded
MySQL Change History
2941
with no error if the column was assigned a value in an ON DUPLICATE KEY UPDATE clause, even if that clause was not used.
(Bug#26261)
INSERT DELAYED statements inserted incorrect values into BIT columns. (Bug#26238)
A query of type index_merge, and with a WHERE clause having the form WHERE indexed_column_1=value_1 OR in-
dexed_column_2=value_2 on a partitioned table caused the server to crash. (Bug#26117)
BENCHMARK() did not work correctly for expressions that produced a DECIMAL result. (Bug#26093)
For MEMORY tables, extending the length of a VARCHAR column with ALTER TABLE might result in an unusable table.
(Bug#26080)
The server could hang during binary log rotation. (Bug#26079)
LOAD DATA INFILE sent an okay to the client before writing the binary log and committing the changes to the table had fin-
ished, thus violating ACID requirements. (Bug#26050)
X() IS NULL and Y() IS NULL comparisons failed when X() and Y() returned NULL. (Bug#26038)
Indexes on TEXT columns were ignored when ref accesses were evaluated. (Bug#25971)
If a thread previously serviced a connection that was killed, excessive memory and CPU use by the thread occurred if it later ser-
viced a connection that had to wait for a table lock. (Bug#25966)
VIEW restrictions were applied to SELECT statements after a CREATE VIEW statement failed, as though the CREATE had suc-
ceeded. (Bug#25897)
Several deficiencies in resolution of column names for INSERT ... SELECT statements were corrected. (Bug#25831)
Inserting utf8 data into a TEXT column that used a single-byte character set could result in spurious warnings about truncated data.
(Bug#25815)
On Windows, debug builds of mysqld could fail with heap assertions. (Bug#25765)
In certain cases it could happen that deleting a row corrupted an RTREE index. This affected indexes on spatial columns.
(Bug#25673)
Using mysqlbinlog on a binary log would crash if there were a large number of row-based events related to a single statement.
(Bug#25628)
Expressions involving SUM(), when used in an ORDER BY clause, could lead to out-of-order results. (Bug#25376)
Use of a GROUP BY clause that referred to a stored function result together with WITH ROLLUP caused incorrect results.
(Bug#25373)
A stored procedure that made use of cursors failed when the procedure was invoked from a stored function. (Bug#25345)
On Windows, the server exhibited a file-handle leak after reaching the limit on the number of open file descriptors. (Bug#25222)
The REPEAT() function did not allow a column name as the count parameter. (Bug#25197)
A reference to a nonexistent column in the ORDER BY clause of an UPDATE ... ORDER BY statement could cause a server
crash. (Bug#25126)
A view on a join is insertable for INSERT statements that store values into only one table of the join. However, inserts were being
rejected if the inserted-into table was used in a self-join because MySQL incorrectly was considering the insert to modify multiple
tables of the view. (Bug#25122)
Creating a table with latin characters in the name caused the output of SHOW FULL TABLES to have ERROR for the table type.
(Bug#25081)
MySQL would not compile when configured using --without-query-cache. (Bug#25075)
It was not possible to use XPath keywords as tag names for expressions used in the ExtractValue() function. (Bug#24747)
MySQL Change History
2942
Increasing the width of a DECIMAL column could cause column values to be changed. (Bug#24558)
IF(expr, unsigned_expr, unsigned_expr) was evaluated to a signed result, not unsigned. This has been corrected. The fix
also affects constructs of the form IS [NOT] {TRUE|FALSE}, which were transformed internally into IF() expressions that
evaluated to a signed result.
For existing views that were defined using IS [NOT] {TRUE|FALSE} constructs, there is a related implication. The definitions
of such views were stored using the IF() expression, not the original construct. This is manifest in that SHOW CREATE VIEW
shows the transformed IF() expression, not the original one. Existing views will evaluate correctly after the fix, but if you want
SHOW CREATE VIEW to display the original construct, you must drop the view and re-create it using its original definition. New
views will retain the construct in their definition. (Bug#24532)
SHOW ENGINE MUTEX STATUS failed to produce an UNKNOWN TABLE ENGINE error.
See Section 12.5.5.16, SHOW ENGINE Syntax. (Bug#24392)
A user-defined variable could be assigned an incorrect value if a temporary table was employed in obtaining the result of the query
used to determine its value. (Bug#24010)
mysqlimport used a variable of the wrong type for the --use-threads option, which could cause a crash on some architec-
tures. (Bug#23814)
Queries that used a temporary table for the outer query when evaluating a correlated subquery could return incorrect results.
(Bug#23800)
On Windows, debug builds of mysqlbinlog could fail with a memory error. (Bug#23736)
When using certain server SQL modes, the mysql.proc table was not created by mysql_install_db. (Bug#23669)
DOUBLE values such as 20070202191048.000000 were being treated as illegal arguments by WEEK(). (Bug#23616)
The server could crash if two or more threads initiated query cache resize operation at moments very close in time. (Bug#23527)
NOW() returned the wrong value in statements executed at server startup with the --init-file option. (Bug#23240)
Setting the slow_query_log_file system variable caused log output to go tothe general log, not the slow query log.
(Bug#23225)
When nesting stored procedures within a trigger on a table, a false dependency error was thrown when one of the nested procedures
contained a DROP TABLE statement. (Bug#22580)
Instance Manager did not remove the angel PID file on a clean shutdown. (Bug#22511)
EXPLAIN EXTENDED did not show WHERE conditions that were optimized away. (Bug#22331)
IN ((subquery)), IN (((subquery))), and so forth, are equivalent to IN (subquery), which is always interpreted as
a table subquery (so that it is allowed to return more than one row). MySQL was treating the over-parenthesized subquery as a
single-row subquery and rejecting it if it returned more than one row. This bug primarily affected automatically generated code
(such as queries generated by Hibernate), because humans rarely write the over-parenthesized forms. (Bug#21904)
An INSERT trigger invoking a stored routine that inserted into a table other than the one on which the trigger was defined would
fail with a TABLE '...' DOESN'T EXIST referring to the second table when attempting to delete records from the first table.
(Bug#21825)
CURDATE() is less than NOW(), either when comparing CURDATE() directly (CURDATE() < NOW() is true) or when casting
CURDATE() to DATE (CAST(CURDATE() AS DATE) < NOW() is true). However, storing CURDATE() in a DATE column
and comparing col_name < NOW() incorrectly yielded false. This is fixed by comparing a DATE column as DATETIME for
comparisons to a DATETIME constant. (Bug#21103)
When a stored routine attempted to execute a statement accessing a nonexistent table, the error was not caught by the routine's ex-
ception handler. (Bug#20713, Bug#8407)
For a stored procedure containing a SELECT statement that used a complicated join with an ON expression, the expression could be
ignored during re-execution of the procedure, yielding an incorrect result. (Bug#20492)
The conditions checked by the optimizer to allow use of indexes in IN predicate calculations were unnecessarily tight and were re-
MySQL Change History
2943
laxed. (Bug#20420)
When a TIME_FORMAT() expression was used as a column in a GROUP BY clause, the expression result was truncated.
(Bug#20293)
The creation of MySQL system tables was not checked for by mysql-test-run.pl. (Bug#20166)
For index reads, the BLACKHOLE engine did not return end-of-file (which it must because BLACKHOLE tables contain no rows),
causing some queries to crash. (Bug#19717)
For expr IN(value_list), the result could be incorrect if BIGINT UNSIGNED values were used for expr or in the value
list. (Bug#19342)
When attempting to call a stored procedure creating a table from a trigger on a table tbl in a database db, the trigger failed with
ERROR 1146 (42S02): TABLE 'DB.TBL' DOESN'T EXIST. However, the actual reason that such a trigger fails is due to the
fact that CREATE TABLE causes an implicit COMMIT, and so a trigger cannot invoke a stored routine containing this statement. A
trigger which does so now fails with ERROR 1422 (HY000): EXPLICIT OR IMPLICIT COMMIT IS NOT ALLOWED IN STORED
FUNCTION OR TRIGGER, which makes clear the reason for the trigger's failure. (Bug#18914)
While preparing prepared statements, the server acquired unnecessary table write locks. (Bug#18326)
The update columns for INSERT ... SELECT ... ON DUPLICATE KEY UPDATE could be assigned incorrect values if a
temporary table was used to evaluate the SELECT. (Bug#16630)
For SUBSTRING() evaluation using a temporary table, when SUBSTRING() was used on a LONGTEXT column, the
max_length metadata value of the result was incorrectly calculated and set to 0. Consequently, an empty string was returned in-
stead of the correct result. (Bug#15757)
Local variables in stored routines or triggers, when declared as the BIT type, were interpreted as strings. (Bug#12976)
For some operations, system tables in the mysql database must be accessed. For example, the HELP statement requires the contents
of the server-side help tables, and CONVERT_TZ() might need to read the time zone tables. However, to perform such operations
while a LOCK TABLES statement is in effect, the server required you to also lock the requisite system tables explicitly or a lock er-
ror occurred:
mysql> LOCK TABLE t1 READ;
Query OK, 0 rows affected (0.02 sec)
mysql> HELP HELP;
ERROR 1100 (HY000) at line 4: Table 'help_topic' was not
locked with LOCK TABLES
Now, the server implicitly locks the system tables for reading as necessary so that you need not lock them explicitly. These tables
are treated as just described:
mysql.help_category
mysql.help_keyword
mysql.help_relation
mysql.help_topic
mysql.proc
mysql.time_zone
mysql.time_zone_leap_second
mysql.time_zone_name
mysql.time_zone_transition
mysql.time_zone_transition_type
If you want to explicitly place a WRITE lock on any of those tables with a LOCK TABLES statement, the table must be the only one
locked; no other table can be locked with the same statement. (Bug#9953)
C.1.22. Changes in MySQL 5.1.16 (26 February 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
MySQL Change History
2944
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
Note
After release, a trigger failure problem was found to have been introduced. (Bug#27006) Users affected by this issue
should upgrade to MySQL 5.1.17, which corrects the problem.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Cluster API: Incompatible Change: The AbortOption type is now a member of the NdbOperation class; its values and be-
havior have also changed. NdbTransaction::AbortOption can no longer be used, and applications written against the NDB
API may need to be rewritten and recompiled to accomodate these changes. For more information about this change, see The Ndb-
Operation::AbortOption Type.
This also affects the behavior of the NdbTransaction::execute() method, which now reports failure only if the transaction
was actually aborted. See NdbTransaction::execute(), for more information.
MySQL Cluster: Previously, when a data node failed more than 8 times in succession to start, this caused a forced shutdown of the
cluster. Now, when a data node fails to start 7 consecutive times, the node will not start again until it is started with the -
-initial option, and a warning to this effect is written to the error log. (Bug#25984)
MySQL Cluster: In the event that all cluster management and API nodes are configured with ArbitrationRank = 0,
ndb_mgmd now issues the following warning when starting: CLUSTER CONFIGURATION WARNING: NEITHER MGM NOR API
NODES ARE CONFIGURED WITH ARBITRATOR, MAY CAUSE COMPLETE CLUSTER SHUTDOWN IN CASE OF HOST FAILURE.
(Bug#23546)
MySQL Cluster: A number of new and more descriptive error messages covering transporter errors were added. (Bug#22025)
MySQL Cluster: A new configuration parameter MemReportFrequency allows for additional control of data node memory us-
age. Previously, only warnings at predetermined percentages of memory allocation were given; setting this parameter allows for that
behavior to be overridden. For more information, see Section 17.3.4.6, Defining MySQL Cluster Data Nodes.
Cluster API: A new ndb_mgm_get_clusterlog_loglevel() function was added to the MGM API.
For more information, see ndb_mgm_get_clusterlog_loglevel().
The localhost anonymous user account created during MySQL installation on Windows now has no global privileges. Formerly
this account had all global privileges. For operations that require global privileges, the root account can be used instead.
(Bug#24496)
In the INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS table, the UNIQUE_CONSTRAINT_NAME column incorrectly
named the referenced table. Now it names the referenced constraint, and a new column, REFERENCED_TABLE_NAME, names the
referenced table. (Bug#21713)
RAND() now allows nonconstant initializers (such as a column name) as its argument. In this case, the seed is initialized with the
value for each invocation of RAND(). (One implication of this is that for equal argument values, RAND() will return the same
value each time.) (Bug#6172)
Added the --auto-generate-sql-load-type and --auto-generate-sql-write-number options for
mysqlslap.
The bundled yaSSL library was upgraded to version 1.5.8.
Bugs fixed:
Security Fix: Using an INFORMATION_SCHEMA table with ORDER BY in a subquery could cause a server crash.
We would like to thank Oren Isacson of Flowgate Security Consulting and Stefan Streichsbier of SEC Consult for informing us of
MySQL Change History
2945
this problem. (Bug#24630, Bug#26556, CVE-2007-1420)
Partitioning: MySQL Cluster: A query with an IN clause against an NDB table employing explicit user-defined partitioning did
not always return all matching rows. (Bug#25821)
MySQL Cluster: Replication: (Replication): Under some circumstances, the binary log thread could shut down while the slave
SQL thread was still using it. (Bug#26015, Bug#26019)
MySQL Cluster: Replication: (Replication): The error message LAST_ERRNO: 4294967295, ERROR IN WRITE_ROWS EVENT
now supplies a valid error code. (Bug#19896)
MySQL Cluster: An inadvertent use of unaligned data caused ndb_restore to fail on some 64-bit platforms, including Sparc
and Itanium-2. (Bug#26739)
MySQL Cluster: The InvalidUndoBufferSize error used the same error code (763) as the IncompatibleVersions er-
ror. InvalidUndoBufferSize now uses its own error code (779). (Bug#26490)
MySQL Cluster: The failure of a data node when restarting it with --initial could lead to failures of subsequent data node re-
starts. (Bug#26481)
MySQL Cluster: Takeover for local checkpointing due to multiple failures of master nodes was sometimes incorrectly handled.
(Bug#26457)
MySQL Cluster: The LockPagesInMainMemory parameter was not read until after distributed communication had already
started between cluster nodes. When the value of this parameter was 1, this could sometimes result in data node failure due to
missed heartbeats. (Bug#26454)
MySQL Cluster: Under some circumstances, following the restart of a management node, all data nodes would connect to it nor-
mally, but some of them subsequently failed to log any events to the management node. (Bug#26293)
MySQL Cluster: Condition pushdown did not work with prepared statements. (Bug#26225)
MySQL Cluster: A memory leak could cause problems during a node or cluster shutdown or failure. (Bug#25997)
MySQL Cluster: No appropriate error message was provided when there was insufficient REDO log file space for the cluster to
start. (Bug#25801)
MySQL Cluster: An UPDATE using an IN clause on an NDB table on which there was a trigger caused mysqld to crash.
(Bug#25522)
MySQL Cluster: A memory allocation failure in SUMA (the cluster Subscription Manager) could cause the cluster to crash.
(Bug#25239)
MySQL Cluster: The ndb_size.tmpl file (necessary for using the ndb_size.pl script) was missing from binary distribu-
tions. (Bug#24191)
MySQL Cluster: The message ERROR 0 IN READAUTOINCREMENTVALUE(): NO ERROR was written to the error log whenever
SHOW TABLE STATUS was performed on a Cluster table that did not have an AUTO_INCREMENT column.
Note
This improves on and supersedes an earlier fix that was made for this issue in MySQL 5.1.12.
(Bug#21033)
MySQL Cluster: When a node failed due to there being insufficient disk space to perform a local checkpoint, there was no indica-
tion that this was the source of the problem. Such a condition now produces an appropriate error message. (Bug#20121)
MySQL Cluster: In the event that cluster backup parameters such as BackupWriteSize were incorrectly set, no appropriate er-
ror was issued to indicate that this was the case. (Bug#19146)
Replication: If a slave server closed its relay log (for example, due to an error during log rotation), the I/O thread did not recognize
this and still tried to write to the log, causing a server crash. (Bug#10798)
Cluster API: Disk Data: A delete and a read performed in the same operation could cause one or more data nodes to crash. This
MySQL Change History
2946
could occur when the operation affected more than 5 columns concurrently, or when one or more of the columns was of the
VARCHAR type and was stored on disk. (Bug#25794)
Cluster API: After defining a delete operation (using NdbOperation::deleteTuple()) on a nonexistent primary key of a
table having a BLOB or TEXT column, invoking NdbTransaction::execute() caused the calling application to enter an end-
less loop rather than raising an error.
This issue also affected ndb_restore; when restoring tables containing BLOB or TEXT columns, this could cause it to consume
all available memory and then crash. (Bug#24028)
See also Bug#27308, Bug#30177.
Cluster API: libndbclient.so was not versioned. (Bug#13522)
Using ORDER BY or GROUP BY could yield different results when selecting from a view and selecting from the underlying table.
(Bug#26209)
DISTINCT queries that were executed using a loose scan for an InnoDB table that had been emptied caused a server crash.
(Bug#26159)
A WHERE clause that used BETWEEN for DATETIME values could be treated differently for a SELECT and a view defined as that
SELECT. (Bug#26124)
Collation for LEFT JOIN comparisons could be evaluated incorrectly, leading to improper query results. (Bug#26017)
The WITH CHECK OPTION clause for views was ignored for updates of multiple-table views when the updates could not be per-
formed on fly and the rows to update had to be put into temporary tables first. (Bug#25931)
LOAD DATA INFILE did not work with pipes. (Bug#25807)
The SEC_TO_TIME() and QUARTER() functions sometimes did not handle NULL values correctly. (Bug#25643)
View definitions that used the ! operator were treated as containing the NOT operator, which has a different precedence and can pro-
duce different results. . (Bug#25580)
An error in the name resolution of nested JOIN ... USING constructs was corrected. (Bug#25575)
GROUP BY and DISTINCT did not group NULL values for columns that have a UNIQUE index. . (Bug#25551)
The --with-readline option for configure did not work for commercial source packages, but no error message was printed
to that effect. Now a message is printed. (Bug#25530)
A yaSSL program named test was installed, causing conflicts with the test system utility. It is no longer installed. (Bug#25417)
For a UNIQUE index containing many NULL values, the optimizer would prefer the index for col IS NULL conditions over other
more selective indexes. . (Bug#25407)
An AFTER UPDATE trigger on an InnoDB table with a composite primary key caused the server to crash. (Bug#25398)
Passing a NULL value to a user-defined function from within a stored procedure crashes the server. (Bug#25382)
perror crashed on some platforms due to failure to handle a NULL pointer. (Bug#25344)
mysql.server stop timed out too quickly (35 seconds) waiting for the server to exit. Now it waits up to 15 minutes, to ensure
that the server exits. (Bug#25341)
A query that contained an EXIST subquery with a UNION over correlated and uncorrelated SELECT queries could cause the server
to crash. (Bug#25219)
mysql_kill() caused a server crash when used on an SSL connection. (Bug#25203)
yaSSL was sensitive to the presence of whitespace at the ends of lines in PEM-encoded certificates, causing a server crash.
(Bug#25189)
A query with ORDER BY and GROUP BY clauses where the ORDER BY clause had more elements than the GROUP BY clause
caused a memory overrun leading to a crash of the server. (Bug#25172)
MySQL Change History
2947
Use of ON DUPLICATE KEY UPDATE defeated the usual restriction against inserting into a join-based view unless only one of
the underlying tables is used. (Bug#25123)
ALTER TABLE ... ENABLE KEYS acquired a global lock, preventing concurrent execution of other statements that use tables.
. (Bug#25044)
OPTIMIZE TABLE caused a race condition in the I/O cache. (Bug#25042)
A return value of -1 from user-defined handlers was not handled well and could result in conflicts with server code. (Bug#24987)
Certain joins using Range checked for each record in the query execution plan could cause the server to crash.
(Bug#24776)
ALTER TABLE caused loss of CASCADE clauses for InnoDB tables. (Bug#24741)
If an ORDER BY or GROUP BY list included a constant expression being optimized away and, at the same time, containing single-
row subselects that returned more that one row, no error was reported. If a query required sorting by expressions containing single-
row subselects that returned more than one row, execution of the query could cause a server crash. (Bug#24653)
For ALTER TABLE, using ORDER BY expression could cause a server crash. Now the ORDER BY clause allows only column
names to be specified as sort criteria (which was the only documented syntax, anyway). (Bug#24562)
Within stored routines or prepared statements, inconsistent results occurred with multiple use of INSERT ... SELECT ... ON
DUPLICATE KEY UPDATE when the ON DUPLICATE KEY UPDATE clause erroneously tried to assign a value to a column
mentioned only in its SELECT part. (Bug#24491)
Expressions of the form (a, b) IN (SELECT a, MIN(b) FROM t GROUP BY a) could produce incorrect results when
column a of table t contained NULL values while column b did not. (Bug#24420)
If a prepared statement accessed a view, access to the tables listed in the query after that view was checked in the security context of
the view. (Bug#24404)
A nested query on a partitioned table returned fewer records than on the corresponding nonpartitioned table, when the subquery af-
fected more than one partition. (Bug#24186)
Expressions of the form (a, b) IN (SELECT c, d ...) could produce incorrect results if a, b, or both were NULL.
(Bug#24127)
Queries that evaluate NULL IN (SELECT ... UNION SELECT ...) could produce an incorrect result (FALSE instead of
NULL). (Bug#24085)
Some UPDATE statements were slower than in previous versions when the search key could not be converted to a valid value for the
type of the search column. (Bug#24035)
ISNULL(DATE(NULL)) and ISNULL(CAST(NULL AS DATE)) erroneously returned false. (Bug#23938)
Within a stored routine, accessing a declared routine variable with PROCEDURE ANALYSE() caused a server crash. (Bug#23782)
For an InnoDB table with any ON DELETE trigger, TRUNCATE TABLE mapped to DELETE and activated triggers. Now a fast
truncation occurs and triggers are not activated. .
Important
As a result of this fix, TRUNCATE TABLE now requires the DROP privilege rather than the DELETE privilege.
(Bug#23556)
With ONLY_FULL_GROUP_BY enables, the server was too strict: Some expressions involving only aggregate values were rejected
as nonaggregate (for example, MAX(a) MIN(a)). (Bug#23417)
The arguments to the ENCODE() and the DECODE() functions were not printed correctly, causing problems in the output of EX-
PLAIN EXTENDED and in view definitions. (Bug#23409)
Some queries against INFORMATION_SCHEMA that used subqueries failed. . (Bug#23299)
readline detection did not work correctly on NetBSD. (Bug#23293)
MySQL Change History
2948
The number of setsockopt() calls performed for reads and writes to the network socket was reduced to decrease system call
overhead. (Bug#22943)
Storing values specified as hexadecimal values 64 or more bits long in BIT(64), BIGINT, or BIGINT UNSIGNED columns did
not raise any warning or error if the value was out of range. (Bug#22533)
Type conversion errors during formation of index search conditions were not correctly checked, leading to incorrect query results.
(Bug#22344)
For the IF() and COALESCE() function and CASE expressions, large unsigned integer values could be mishandled and result in
warnings. (Bug#22026)
Inserting DEFAULT into a column with no default value could result in garbage in the column. Now the same result occurs as when
inserting NULL into a NOT NULL column. (Bug#20691)
Indexes disabled with ALTER TABLE ... DISABLE KEYS could in some cases be used by specifying FORCE INDEX.
(Bug#20604)
If a duplicate key value was present in the table, INSERT ... ON DUPLICATE KEY UPDATE reported a row count indicating
that a record was updated, even when no record actually changed due to the old and new values being the same. Now it reports a
row count of zero. (Bug#19978)
See also Bug#27006, Bug#27033, Bug#27210.
ORDER BY values of the DOUBLE or DECIMAL types could change the result returned by a query. (Bug#19690)
The readline library wrote to uninitialized memory, causing mysql to crash. (Bug#19474)
Use of already freed memory caused SSL connections to hang forever. (Bug#19209)
The server might fail to use an appropriate index for DELETE when ORDER BY, LIMIT, and a nonrestricting WHERE are present.
(Bug#17711)
The optimizer used a filesort rather than a const table read in some cases when the latter was possible. (Bug#16590)
To enable installation of MySQL RPMs on Linux systems running RHEL 4 (which includes SE-Linux) additional information was
provided to specify some actions that are allowed to the MySQL binaries. (Bug#12676)
CONNECTION is no longer treated as a reserved word. (Bug#12204)
The presence of ORDER BY in a view definition prevented the MERGE algorithm from being used to resolve the view even if noth-
ing else in the definition required the TEMPTABLE algorithm. (Bug#12122)
C.1.23. Changes in MySQL 5.1.15 (25 January 2007)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: MySQL Cluster: The LockPagesInMainMemory configuration parameter has changed its type and
MySQL Change History
2949
possible values. For more information, see LockPagesInMainMemory .
Important
The values true and false are no longer accepted for this parameter. If you were using this parameter and had it set to
false in a previous release, you must change it to 0. If you had this parameter set to true, you should instead use 1 to
obtain the same behavior as previously, or 2 to take advantage of new functionality introduced with this release, as de-
scribed in the section cited above.
(Bug#25686)
Incompatible Change: InnoDB rolls back only the last statement on a transaction timeout. A new option, -
-innodb_rollback_on_timeout, causes InnoDB to abort and roll back the entire transaction if a transaction timeout occurs
(the same behavior as in MySQL 5.0.13 and earlier). (Bug#24200)
Incompatible Change: Previously, the DATE_FORMAT() function returned a binary string. Now it returns a string with a character
set and collation given by character_set_connection and collation_connection so that it can return month and
weekday names containing non-ASCII characters. (Bug#22646)
Incompatible Change: The following conditions apply to enabling the read_only system variable:
If you attempt to enable read_only while you have any explicit locks (acquired with LOCK TABLES or have a pending
transaction, an error will occur.
If other clients hold explicit table locks or have pending transactions, the attempt to enable read_only blocks until the locks
are released and the transactions end. While the attempt to enable read_only is pending, requests by other clients for table
locks or to begin transactions also block until read_only has been set.
read_only can be enabled while you hold a global read lock (acquired with FLUSH TABLES WITH READ LOCK) because
that does not involve table locks.
Previously, the attempt to enable read_only would return immediately even if explicit locks or transactions were pending, so
some data changes could occur for statements executing in the server at the same time. (Bug#22009, Bug#11733)
Incompatible Change: Previously, the ARCHIVE storage engine created a metadata file with an extension of .ARM for each table.
The engine no longer creates this file.
Important Change: When using MERGE tables the definition of the MERGE table and the MyISAM tables are checked each time the
tables are opened for access (including any SELECT or INSERT statement. Each table is compared for column order, types, sizes
and associated. If there is a difference in any one of the tables then the statement will fail.
Important Change: Previously, duplicate-key errors were indicated by the ER_DUP_ENTRY error code (1062). This code is no
longer used. Instead, the server returns ER_DUP_ENTRY_WITH_KEY_NAME (1582), and the error message indicates the name of
the index for which the duplicate occurred. Applications that test for duplicate keys should look for both error codes if they need to
be compatible with current and older servers.
See also Bug#28842.
MySQL Cluster: The NDB storage engine could leak memory during file operations. (Bug#21858)
Replication: Calling a nondeterministic stored routine when using statement-based replication now throws an error. Formerly, de-
fining such a stored routine would cause an error to be thrown. (Bug#16456)
On Unix, when searching the standard locations for option files, MySQL programs now also look for /etc/mysql/my.cnf after check-
ing for /etc/my.cnf and before checking the remaining locations. (Bug#25104)
The default value of the max_connections variable has been increased to 151 in order that Websites running on Apache and us-
ing MySQL will not have more processes trying to access MySQL than the default number of connections available.
(The maximum number of Apache processes is determined by the Apache MaxClient, which defaults to 256, but is usually set to
150 in the httpd.conf commonly distributed with Apache. For more information about MaxClient, see ht-
tp://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients.) (Bug#23883)
The Com_create_user status variable was added (for counting CREATE USER statements). (Bug#22958)
The --memlock option relies on system calls that are unreliable on some operating systems. If a crash occurs, the server now
MySQL Change History
2950
checks whether --memlock was specified and if so issues some information about possible workarounds. (Bug#22860)
The (undocumented) UNIQUE_USERS() and GROUP_UNIQUE_USERS() functions were removed. (Bug#22687)
Partitioning of tables using the FEDERATED storage engine is no longer permitted. Attempting to create such a table or to modify
an existing table so that is uses both partitioning and FEDERATED now fails with an error. (Bug#22451)
The --skip-thread-priority option now is enabled by default for binary Mac OS X distributions. Use of thread priorities
degrades performance on Mac OS X. (Bug#18526)
read_only can be enabled while you hold a global read lock (acquired with FLUSH TABLES WITH READ LOCK) because
that does not involve table locks.
The bundled yaSSL library was upgraded to version 1.5.0.
Remote servers for use with the FEDERATED storage engine now can be managed with the new CREATE/ALTER/DROP SERVER
syntax.
Added the --disable-grant-options option to configure. If configure is run with this option, the --bootstrap,
--skip-grant-tables, and --init-file options for mysqld are disabled and cannot be used. For Windows, the con-
figure.js script recognizes the DISABLE_GRANT_OPTIONS flag, which has the same effect.
If other clients hold explicit table locks or have pending transactions, the attempt to enable read_only blocks until the locks are
released and the transactions end. While the attempt to enable read_only is pending, requests by other clients for table locks or to
begin transactions also block until read_only has been set.
If you attempt to enable read_only while you have any explicit locks (acquired with LOCK TABLES or have a pending transac-
tion, an error will occur.
Bugs fixed:
Incompatible Change: For ENUM columns that had enumeration values containing commas, the commas were mapped to 0xff in-
ternally. However, this rendered the commas indistinguishable from true 0xff characters in the values. This no longer occurs.
However, the fix requires that you dump and reload any tables that have ENUM columns containing any true 0xff values. Dump the
tables using mysqldump with the current server before upgrading from a version of MySQL 5.1 older than 5.1.15 to version 5.1.15
or newer. (Bug#24660)
Partitioning: MySQL Cluster: Non-32-bit, nonaligned columns were not handled correctly in explicitly partitioned NDB tables.
(Bug#25587)
MySQL Cluster: Replication: (Replication): Connecting a mysqld to a cluster where not all nodes were running, starting the re-
maining cluster nodes, and then disconnecting from the cluster caused the mysqld process to crash. (Bug#25387)
MySQL Cluster: It was not possible to create an NDB table with a key on two VARCHAR columns where both columns had a stor-
age length in excess of 256. (Bug#25746)
MySQL Cluster: Hosts in clusters with large numbers of nodes could experience excessive CPU usage while obtaining configura-
tion data. (Bug#25711)
MySQL Cluster: In some circumstances, shutting down the cluster could cause connected mysqld processes to crash.
(Bug#25668)
MySQL Cluster: Some aggregate queries such as SELECT COUNT(*) performed a table scan on NDB tables rather than checking
table statistics, causing such queries to perform much more slowly in MySQL Cluster 5.1 than in 5.0. (Bug#25567)
MySQL Cluster: Memory allocations for TEXT columns were calculated incorrectly, resulting in space being wasted and other is-
sues. (Bug#25562)
MySQL Cluster: The failure of a master node during a node restart could lead to a resource leak, causing later node failures.
(Bug#25554)
MySQL Cluster: The failure of a node during a local checkpoint could lead to other node failures. (Bug#25468)
MySQL Cluster: A node shutdown occurred if the master failed during a commit. (Bug#25364)
MySQL Change History
2951
MySQL Cluster: Creating a nonunique index with the USING HASH clause silently created an ordered index instead of issuing a
warning. (Bug#24820)
MySQL Cluster: ndb_config failed when trying to use 2 management servers and node IDs. (Bug#23887)
MySQL Cluster: When a data node was shut down using the management client STOP command, a connection event
(NDB_LE_Connected) was logged instead of a disconnection event (NDB_LE_Disconnected). (Bug#22773)
MySQL Cluster: The management server did not handle logging of node shutdown events correctly in certain cases. (Bug#22013)
MySQL Cluster: SELECT statements with a BLOB or TEXT column in the selected column list and a WHERE condition including a
primary key lookup on a VARCHAR primary key produced empty result sets. (Bug#19956)
MySQL Cluster: When stopping and restarting multiple data nodes, the last node to be restarted would sometimes hang in Phase
100. (Bug#19645)
Replication: Using row-based replication to replicate to a table having at least one extra BIT column with a default value on the
slave as compared to the master could cause the slave to fail. (Bug#24490)
Replication: When SET PASSWORD was written to the binary log double quotes were included in the statement. If the slave was
running in with the server SQL mode set to ANSI_QUOTES, then the event failed, which halted the replication process.
(Bug#24158)
Replication: A stored procedure, executed from a connection using a binary character set, and which wrote multibyte data, would
write incorrectly escaped entries to the binary log. This caused syntax errors, and caused replication to fail. (Bug#23619,
Bug#24492)
Replication: Using CREATE TABLE ... SELECT and rolling back the transaction would leave an empty table on the master,
but the instructions would not be recorded in the binary log and therefore replicated to the slave. This would result in a difference
between the master and slave databases. An implicit commit has been added to ensure consistency. (Bug#22865)
Replication: Changes to the lc_time_names system variable were not replicated. (Bug#22645)
Replication: For SET, SELECT, and DO statements that invoked a stored function from a database other than the default database,
the function invocation could fail to be replicated. (Bug#19725)
Disk Data: Following 3 or more missed local checkpoints by a cluster node, a restart of the node caused incorrect undo information
to be used for Disk Data tables. (Bug#25636)
Disk Data: MEDIUMTEXT columns of Disk Data tables were stored in memory rather than on disk, even if the columns were not in-
dexed. (Bug#25001)
Disk Data: Performing a node restart with a newly dropped Disk Data table could lead to failure of the node during the restart.
(Bug#24917)
Disk Data: Changing a column specification or issuing a TRUNCATE statement on a Disk Data table caused the table to become an
in-memory table. (Bug#24667, Bug#25296)
Disk Data: When restoring from backup a cluster containing any Disk Data tables with hidden primary keys, a node failure resulted
which could lead to a crash of the cluster. (Bug#24166)
Disk Data: Repeated CREATE, DROP, or TRUNCATE in various combinations with system restarts between these operations could
lead to the eventual failure of a system restart. (Bug#21948)
Disk Data: Extents that should have been available for re-use following a DROP TABLE operation were not actually made avail-
able again until after the cluster had performed a local checkpoint. (Bug#17605)
Cluster Replication: Certain errors in replication setups could lead to unexpected node failures. (Bug#25755)
Cluster Replication: Connecting an API node to the cluster during a node restart while performing database operations could cause
the restarting node to fail. (Bug#25329)
Cluster Replication: Following a restart of the master cluster, the latest GCI was set to 0 upon reconnection to the slave.
(Bug#21806)
Cluster API: Deletion of an Ndb_cluster_connection object took a very long time. (Bug#25487)
MySQL Change History
2952
Cluster API: Invoking the NdbTransaction::execute() method using execution type Commit and abort option
AO_IgnoreError could lead to a crash of the transaction coordinator (DBTC). (Bug#25090)
Cluster API: A unique index lookup on a nonexistent tuple could lead to a data node timeout (error 4012). (Bug#25059)
Cluster API: When using the NdbTransaction::execute() method, a very long timeout (greater than 5 minutes) could res-
ult if the last data node being polled was disconnected from the cluster. (Bug#24949)
Cluster API: Due to an error in the computation of table fragment arrays, some transactions were not executed from the correct
starting point. (Bug#24914)
mysqltest_embedded crashed at startup. (Bug#25890)
Referencing an ambiguous column alias in an expression in the ORDER BY clause of a query caused the server to crash.
(Bug#25427)
A number of issues were uncovered by Valgrind. (Bug#25396)
Using a view in combination with a USING clause caused column aliases to be ignored. (Bug#25106)
A multiple-table DELETE QUICK could sometimes cause one of the affected tables to become corrupted. (Bug#25048)
An assertion failed incorrectly for prepared statements that contained a single-row uncorrelated subquery that was used as an argu-
ment of the IS NULL predicate. (Bug#25027)
In the INFORMATION_SCHEMA.KEY_COLUMN_USAGE table, the value displayed for the REFERENCED_TABLE_NAME column
was the table name as encoded for disk storage, not the actual table name. (Bug#25026)
The REPEAT() function could return NULL when passed a column for the count argument. (Bug#24947)
mysql_upgrade failed if the --password (or -p) option was given. (Bug#24896)
Accessing a fixed record format table with a crashed key definition results in server/myisamchk segmentation fault. (Bug#24855)
mysqld_multi and mysqlaccess looked for option files in /etc even if the --sysconfdir option for configure had
been given to specify a different directory. (Bug#24780)
If there was insufficient memory available to mysqld, this could sometimes cause the server to hang during startup. (Bug#24751)
Optimizations that are legal only for subqueries without tables and WHERE conditions were applied for any subquery without tables.
(Bug#24670)
Under certain rare circumstances, local checkpoints were not performed properly, leading to an inability to restart one or more data
nodes. (Bug#24664)
A workaround was implemented to avoid a race condition in the NPTL pthread_exit() implementation. (Bug#24507)
Under some circumstances, a REORGANIZE PARTITION statement could crash mysqld. (Bug#24502)
mysqltest crashed with a stack overflow. (Bug#24498)
Attempts to access a MyISAM table with a corrupt column definition caused a server crash. (Bug#24401)
ALTER ENABLE KEYS or ALTER TABLE DISABLE KEYS combined with another ALTER TABLE option other than RE-
NAME TO did nothing. In addition, if ALTER TABLE was used on a table having disabled keys, the keys of the resulting table were
enabled. (Bug#24395)
When opening a corrupted .frm file during a query, the server crashes. (Bug#24358)
The --extern option for mysql-test-run.pl did not function correctly. (Bug#24354)
Some joins in which one of the joined tables was a view could return erroneous results or crash the server. (Bug#24345)
The mysql.server script used the source command, which is less portable than the . command; it now uses . instead.
(Bug#24294)
MySQL Change History
2953
A view was not handled correctly if the SELECT part contained \Z . (Bug#24293)
mysql_install_db did not create the mysql.plugin table if strict SQL mode was enabled. (Bug#24270)
A query using WHERE unsigned_column NOT IN ('negative_value') could cause the server to crash. (Bug#24261)
ALTER TABLE statements that performed both RENAME TO and {ENABLE|DISABLE} KEYS operations caused a server crash.
(Bug#24219)
A FETCH statement using a cursor on a table which was not in the table cache could sometimes cause the server to crash.
(Bug#24117)
Hebrew-to-Unicode conversion failed for some characters. Definitions for the following Hebrew characters (as specified by the
ISO/IEC 8859-8:1999) were added: LEFT-TO-RIGHT MARK (LRM), RIGHT-TO-LEFT MARK (RLM) (Bug#24037)
On HP-UX, mysqltest (nonthread-safe) crashed due to being linked against a thread-safe libmysys library. (Bug#23984)
The server was built even when configure was run with the --without-server option. (Bug#23973)
See also Bug#32898.
The MySQL 5.1.12 binaries for Windows were missing the FEDERATED, EXAMPLE, and BLACKHOLE storage engines.
(Bug#23900)
ROW_COUNT() did not work properly as an argument to a stored procedure. (Bug#23760)
When reading from the standard input on Windows, mysqlbinlog opened the input in text mode rather than binary mode and
consequently misinterpreted some characters such as Control-Z. (Bug#23735)
OPTIMIZE TABLE tried to sort R-tree indexes such as spatial indexes, although this is not possible (see Section 12.5.2.5, OP-
TIMIZE TABLE Syntax). (Bug#23578)
The row count for MyISAM tables was not updated properly, causing SHOW TABLE STATUS to report incorrect values.
(Bug#23526)
The Instance Manager DROP INSTANCE command did not work. (Bug#23476)
User-defined variables could consume excess memory, leading to a crash caused by the exhaustion of resources available to the
MEMORY storage engine, due to the fact that this engine is used by MySQL for variable storage and intermediate results of GROUP
BY queries. Where SET had been used, such a condition could instead give rise to the misleading error message YOU MAY ONLY USE
CONSTANT EXPRESSIONS WITH SET, rather than OUT OF MEMORY (NEEDED NNNNNN BYTES). (Bug#23443)
A table created with the ROW_FORMAT = FIXED table option lost the option if an index was added or dropped with CREATE
INDEX or DROP INDEX. (Bug#23404)
A deadlock could occur, with the server hanging on Closing tables, with a sufficient number of concurrent INSERT
DELAYED, FLUSH TABLES, and ALTER TABLE operations. (Bug#23312)
Accuracy was improved for comparisons between DECIMAL columns and numbers represented as strings. (Bug#23260)
The Instance Manager STOP INSTANCE command took too much time and caused Instance Manager to be unresponsive.
(Bug#23215)
If there was insufficient memory to store or update a blob record in a MyISAM table then the table will marked as crashed.
(Bug#23196)
A compressed MyISAM table that became corrupted could crash myisamchk and possibly the MySQL Server. (Bug#23139)
CREATE TABLE ... SELECT statements were not rolled back correctly. As part of the fix, such a statement now causes an im-
plicit commit before and after it is executed. However, it does not cause a commit when used to create a temporary table.
(Bug#22864)
mysql_upgrade failed when called with a --basedir path name containing spaces. (Bug#22801)
Using INSTALL PLUGIN followed by a restart of the server caused an error due to memory not being properly initialized.
(Bug#22694)
MySQL Change History
2954
SET lc_time_names = value allowed only exact literal values, not expression values. (Bug#22647)
A partitioned table that used the DATA DIRECTORY option, where the data directory was the same as the directory in which the ta-
ble definition file resided, became corrupted following ALTER TABLE ENGINE=ARCHIVE. This was actually due to an issue
with the ARCHIVE storage engine, and not with partitioned tables in general. (Bug#22634)
The STDDEV() function returned a positive value for data sets consisting of a single value. (Bug#22555)
SHOW COLUMNS reported some NOT NULL columns as NULL. (Bug#22377)
A server crash occurred when using LOAD DATA to load a table containing a NOT NULL spatial column, when the statement did
not load the spatial column. Now a NULL supplied to NOT NULL column error occurs. (Bug#22372)
An ALTER TABLE statement that used a RENAME clause in combination with a MODIFY or CHANGE that did not actually change
the table (for example, when it changed a column's type from INT to INT). The behavior caused by this bug differed according to
whether or not the storage engine used by the table was transactional or nontransactional. For transactional tables (such as those us-
ing the InnoDB storage engine), the statement simply failed; for nontransactional tables (such as those using the MyISAM storage
engine), the ALTER TABLE statement succeeding renaming the table, but subsequent SELECT statements against the renamed ta-
ble would fail. (Bug#22369)
The Instance Manager STOP INSTANCE command could not be applied to instances in the Crashed, Failed, or Abandoned
state. (Bug#22306)
DATE_ADD() requires complete dates with no zero parts, but sometimes did not return NULL when given such a date.
(Bug#22229)
Some small double precision numbers (such as 1.00000001e-300) that should have been accepted were truncated to zero.
(Bug#22129)
Changing the value of MI_KEY_BLOCK_LENGTH in myisam.h and recompiling MySQL resulted in a myisamchk that saw ex-
isting MyISAM tables as corrupt. (Bug#22119)
For a nonexistent table, DROP TEMPORARY TABLE failed with an incorrect error message if read_only was enabled.
(Bug#22077)
A crash of the MySQL Server could occur when unpacking a BLOB column from a row in a corrupted MyISAM table. This could
happen when trying to repair a table using either REPAIR TABLE or myisamchk; it could also happen when trying to access such
a broken row using statements like SELECT if the table was not marked as crashed. (Bug#22053)
The code for generating USE statements for binary logging of CREATE PROCEDURE statements resulted in confusing output from
mysqlbinlog for DROP PROCEDURE statements. (Bug#22043)
STR_TO_DATE() returned NULL if the format string contained a space following a nonformat character. (Bug#22029)
It was possible to use DATETIME values whose year, month, and day parts were all zeroes but whose hour, minute, and second
parts contained nonzero values, an example of such an illegal DATETIME being '0000-00-00 11:23:45'.
Note
This fix was reverted in MySQL 5.1.18.
(Bug#21789)
See also Bug#25301.
SSL connections could hang at connection shutdown. (Bug#21781, Bug#24148)
yaSSL crashed on pre-Pentium Intel CPUs. (Bug#21765)
Using FLUSH TABLES in one connection while another connection is using HANDLER statements caused a server crash.
Note
This fix was reverted in MySQL 5.1.22
(Bug#21587)
MySQL Change History
2955
See also Bug#29474.
The FEDERATED storage engine did not support the euckr character set. (Bug#21556)
InnoDB crashed while performing XA recovery of prepared transactions. (Bug#21468)
It was possible to set the backslash character ( \ ) as the delimiter character using DELIMITER, but not actually possible to use it
as the delimiter. (Bug#21412)
Using ALTER TABLE to convert a CSV table containing NULL values to MyISAM resulted in warnings. (Bug#21328)
When updating a table that used a JOIN of the table itself (for example, when building trees) and the table was modified on one side
of the expression, the table would either be reported as crashed or the wrong rows in the table would be updated. (Bug#21310)
mysqld_error.h was not installed when only the client libraries were built. (Bug#21265)
InnoDB: During a restart of the MySQL Server that followed the creation of a temporary table using the InnoDB storage engine,
MySQL failed to clean up in such a way that InnoDB still attempted to find the files associated with such tables. (Bug#20867)
Selecting into variables sometimes returned incorrect wrong results. (Bug#20836)
Queries of the form SELECT ... WHERE string = ANY(...) failed when the server used a single-byte character set and
the client used a multi-byte character set. (Bug#20835)
See also Bug#34760.
mysql_fix_privilege_tables.sql altered the table_privs.table_priv column to contain too few privileges,
causing loss of the CREATE VIEW and SHOW VIEW privileges. (Bug#20589)
A stored routine containing semicolon in its body could not be reloaded from a dump of a binary log. (Bug#20396)
SELECT ... FOR UPDATE, SELECT ... LOCK IN SHARE MODE, DELETE, and UPDATE statements executed using a
full table scan were not releasing locks on rows that did not satisfy the WHERE condition. (Bug#20390)
The BUILD/check-cpu script did not recognize Celeron processors. (Bug#20061)
Unsigned BIGINT values treated as signed values by the MOD() function. (Bug#19955)
Compiling PHP 5.1 with the MySQL static libraries failed on some versions of Linux. (Bug#19817)
The DELIMITER statement did not work correctly when used in an SQL file run using the SOURCE statement. (Bug#19799)
mysqltest incorrectly tried to retrieve result sets for some queries where no result set was available. (Bug#19410)
VARBINARY column values inserted on a MySQL 4.1 server had trailing zeroes following upgrade to MySQL 5.0 or later.
(Bug#19371)
Some CASE statements inside stored routines could lead to excessive resource usage or a crash of the server. (Bug#19194,
Bug#24854)
Instance Manager could crash during shutdown. (Bug#19044)
myisampack wrote to unallocated memory, causing a crash. (Bug#17951)
FLUSH LOGS or mysqladmin flush-logs caused a server crash if the binary log was not open. (Bug#17733)
mysql_fix_privilege_tables did not accept a password containing embedded space or apostrophe characters.
(Bug#17700)
No warning was issued for use of the DATA DIRECTORY or INDEX DIRECTORY table options on a platform that does not sup-
port them. (Bug#17498)
The FEDERATED storage engine did not support the utf8 character set. (Bug#17044)
The optimizer removes expressions from GROUP BY and DISTINCT clauses if they happen to participate in expression =
constant predicates of the WHERE clause, the idea being that, if the expression is equal to a constant, then it cannot take on mul-
MySQL Change History
2956
tiple values. However, for predicates where the expression and the constant item are of different result types (for example, when a
string column is compared to 0), this is not valid, and can lead to invalid results in such cases. The optimizer now performs an addi-
tional check of the result types of the expression and the constant; if their types differ, then the expression is not removed from the
GROUP BY list. (Bug#15881)
When a prepared statement failed during the prepare operation, the error code was not cleared when it was reused, even if the sub-
sequent use was successful. (Bug#15518)
Dropping a user-defined function sometimes did not remove the UDF entry from the mysql.proc table. (Bug#15439)
Inserting a row into a table without specifying a value for a BINARY(N) NOT NULL column caused the column to be set to
spaces, not zeroes. (Bug#14171)
On Windows, the SLEEP() function could sleep too long, especially after a change to the system clock. (Bug#14094, Bug#24686,
Bug#17635)
mysqldump --order-by-primary failed if the primary key name was an identifier that required quoting. (Bug#13926)
Subqueries of the form NULL IN (SELECT ...) returned invalid results. (Bug#8804, Bug#23485)
C.1.24. Changes in MySQL 5.1.14 (05 December 2006)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Cluster Replication: Incompatible Change: Two major changes have taken place with regard to the MySQL Cluster system
tables. These are:
1. The cluster database is no longer used. The tables formerly found in the cluster database are now in the mysql data-
base, and have been renamed as ndb_binlog_index, ndb_apply_status, and ndb_schema.
2. The mysql.ndb_apply_status and mysql.ndb_schema tables (formerly cluster.apply_status and
cluster.schema are now created by ndb_restore, in the event that they do not already exist on the slave cluster.
Note
When upgrading from versions of MySQL previous to 5.1.14 to 5.1.14 or later, mysql_fix_privilege_tables
merely creates a new mysql.ndb_binlog_index table, but does not remove the existing cluster database (or, if
upgrading from MySQL 5.1.7 or earlier, the existing cluster_replication database), nor any of the tables in it.
For more information, see Section 17.9.4, MySQL Cluster Replication Schema and Tables. (Bug#14612)
Cluster Replication: Incompatible Change: The cluster database is no longer used. The tables formerly found in the
cluster database are now in the mysql database, and have been renamed as ndb_binlog_index, ndb_apply_status,
and ndb_schema.
Incompatible Change: The prepared_stmt_count system variable has been converted to the Prepared_stmt_count
global status variable (viewable with the SHOW GLOBAL STATUS statement). (Bug#23159)
MySQL Change History
2957
Incompatible Change: Previously, you could create a user-defined function (UDF) or stored function with the same name as a
built-in function, but could not invoke the UDF. Now an error occurs if you try to create such a UDF. The server also now generates
a warning if you create a stored function with the same name as a built-in function. It is not considered an error to create a stored
function with the same name as a built-in function because you can invoke the function using db_name.func_name() syntax.
However, the server now generates a warning in this case.
See Section 8.2.4, Function Name Parsing and Resolution, for the rules describing how the server interprets references to different
kinds of functions. (Bug#22619, Bug#18239)
MySQL Cluster: Backup messages are now printed to the Cluster log. (Bug#24544)
MySQL Cluster: Setting the configuration parameter LockPagesInMainMemory had no effect. (Bug#24461)
MySQL Cluster: The error message MANAGEMENT SERVER CLOSED CONNECTION, when recorded in the MySQL error log, now in-
cludes a timestamp indicating when the error took place. (Bug#21519)
MySQL Cluster: It is now possible to create a unique hashed index on a column that is not defined as NOT NULL.
Note
This change applies only to tables using the NDB storage engine.
Unique indexes on columns in NDB tables do not store null values because they are mapped to primary keys in an internal index ta-
ble (and primary keys cannot contain nulls).
Normally, an additional ordered index is created when one creates unique indexes on NDB table columns; this can be used to search
for NULL values. However, if USING HASH is specified when such an index is created, no ordered index is created.
The reason for permitting unique hash indexes with null values is that, in some cases, the user wants to save space if a large number
of records are pre-allocated but not fully initialized. This also assumes that the user will not try to search for null values. Since
MySQL does not support indexes that are not allowed to be searched in some cases, the NDB storage engine uses a full table scan
with pushed conditions for the referenced index columns to return the correct result.
A warning is returned if one creates a unique nullable hash index, since the query optimizer should be provided a hint not to use it
with NULL values if this can be avoided. (Bug#21507)
MySQL Cluster: (Disk Data): The output of mysqldump now includes by default all tablespace and logfile group definitions used
by any tables or databases that are dumped.
Note
The working of the --all-tablespaces or -Y option for mysqldump remains unaffected by this change.
(Bug#20839)
DROP TRIGGER now supports an IF EXISTS clause. (Bug#23703)
Direct and indirect usage of stored routines, user-defined functions, and table references is now prohibited in CREATE EVENT and
ALTER EVENT statements.
See Section 12.1.11, CREATE EVENT Syntax, and Section 12.1.2, ALTER EVENT Syntax, for more specific information.
(Bug#22830)
The XPath operators < and >, as implemented in the ExtractValue() function, operated in reverse.
With this fix, all standard XPath comparison operators should now be supported correctly for use with the ExtractValue() and
UpdateXML() functions. (Bug#22823)
For the mysql client, display of result set metadata now is enabled with the --column-type-info option rather than with -
-debug-info/-T.
mysqladmin, mysqlcheck, mysqldump, mysqlimport, and mysqlshow now accept the --debug-info option, which
displays debugging information and memory and CPU usage statistics at program exit.
Bugs fixed:
MySQL Change History
2958
MySQL Cluster: Replication: (Replication): If errors occurred during purging of the binary logs, extraneous rows could remain
left in the binlog_index table. (Bug#15021)
MySQL Cluster: The failure of a data node failure during a schema operation could lead to additional node failures. (Bug#24752)
MySQL Cluster: A committed read could be attempted before a data node had time to connect, causing a timeout error.
(Bug#24717)
MySQL Cluster: The simultaneous shutdown of mysqld and ndbd processes caused unnecessary locking. (Bug#24655)
MySQL Cluster: The failure of the master node in a node group during the allocation of node IDs could cause ndb_mgmd to hang.
(Bug#24543)
MySQL Cluster: In certain rare cases, a data node could crash due to a typographical error in the MySQL Cluster source code.
(Bug#24476)
MySQL Cluster: Creating a new tables containing a BLOB column when the server was short of memory could cause the server to
crash. (Bug#24470)
MySQL Cluster: Sudden disconnection of an SQL or data node could lead to shutdown of data nodes with the error FAILED ND-
BREQUIRE. (Bug#24447)
MySQL Cluster: Any statement following the execution of CREATE TABLE ... LIKE ndb_table (where ndb_table
was a table using the NDB storage engine), would cause the mysql client to hang. (Bug#24301)
MySQL Cluster: (Disk Data): Excessive fragmentation of Disk Data files (including log files and data files) could occur during the
course of normal use. (Bug#24143)
MySQL Cluster: When the management client command ALL RESTART -i was executed while one data node was not running,
all data nodes in the cluster were shut down. (Bug#24105)
MySQL Cluster: A query using an index scan followed by a delete operation, and then a rollback could cause one or more data
nodes to crash. (Bug#24039)
MySQL Cluster: (Disk Data): Under some circumstances, a DELETE from a Disk Data table could cause mysqld to crash.
(Bug#23542)
MySQL Cluster: It was possible for the sum of the MaxNoOfTables, MaxNoOfOrderedIndexes, and MaxNoOfUnique-
HashIndexes configuration parameters, plus the number of system tables to exceed the maximum value for a Uint32 number.
In such a case, the cluster's data nodes failed to start, and no reason for this could easily be determined from the error messages
provided. (Bug#22548)
MySQL Cluster: A value equal to or greater than the allowed maximum for LongMessageBuffer caused all data nodes to
crash. (Bug#22547)
MySQL Cluster: Multiple occurrences of error conditions were logged with duplicat error messages rather than being reported with
a single error message stating that the error was encountered N times. (Bug#22313)
MySQL Cluster: Given a table mytbl in a database mydb on a MySQL Server acting as an SQL node in a MySQL Cluster, then,
following multiple ALTER TABLE mytbl ENGINE=engine statements first, to change the storage engine used for a table
to NDB, and then again to change the table to use a non-NDB storage engine a DROP DATABASE mydb statement executed on
any SQL node in the cluster would cause mydb to be dropped on all SQL nodes in the cluster, even if mydb contained non-NDB
tables. (Bug#21495)
MySQL Cluster: An incorrect error message was displayed in the event that the value of the MaxNoOfOrderedIndexes para-
meter was set too low. (Bug#20065)
MySQL Cluster: An incorrect error message was displayed in the event that the value of the DataMemory parameter was insuffi-
cient for the amount of data to be stored by the cluster. (Bug#19808)
MySQL Cluster: Some values of MaxNoOfTriggers could cause the server to become inaccessible following startup of the data
nodes. (Bug#19454)
MySQL Cluster: If the value set for MaxNoOfAttributes is excessive, a suitable error message is now returned. (Bug#19352)
MySQL Cluster: Different error messages were returned for similar cases involving failure to allocate memory for Cluster opera-
MySQL Change History
2959
tions. (Bug#19203)
MySQL Cluster: A unique constraint violation was not ignored by an UPDATE IGNORE statement when the constraint violation
occurred on a nonprimary key. (Bug#18487, Bug#24303)
Replication: With row-based binary logging, replicated multiple-statement transaction deadlocks did not return the correct error
code, causing the slave SQL thread to stop rather than roll back and re-execute. (Bug#23831)
Replication: Changes to character set variables prior to an action on a replication-ignored table were forgotten by slave servers.
(Bug#22877)
Replication: On slave servers, transactions that exceeded the lock wait timeout failed to roll back properly. (Bug#20697)
Replication: SQL statements close to the size of max_allowed_packet could produce binary log events larger than
max_allowed_packet that could not be read by slave servers. (Bug#19402)
Disk Data: ndb_restore sometimes failed when attempting to restore Disk Data tables due to data node failure caused by ac-
cessing uninitialized memory. (Bug#24331)
Disk Data: It was possible to execute a statement for creating a Disk Data table that referred to a nonexistent tablespace, in which
case the table created was actually an in-memory NDB table. Such a statement now fails instead, with an appropriate error message.
(Bug#23576)
Cluster API: Using BIT values with any of the comparison methods of the NdbScanFilter class caused data nodes to fail.
(Bug#24503)
Cluster API: Some MGM API function calls could yield incorrect return values in certain cases where the cluster was operating un-
der a very high load, or experienced timeouts in inter-node communications. (Bug#24011)
In some cases, a function that should be parsed as a user-defined function was parsed as a stored function. (Bug#24736)
Some unnecessary Valgrind warnings were removed from the server. (Bug#24488, Bug#24533)
The server source code had multiple exportable definitions of the field_in_record_is_null() function. These are now all
declared static. (Bug#24190)
The loose index scan optimization for GROUP BY with MIN or MAX was not applied within other queries, such as CREATE TABLE
... SELECT ..., INSERT ... SELECT ..., or in the FROM clauses of subqueries. (Bug#24156)
Subqueries for which a pushed-down condition did not produce exactly one key field could cause a server crash. (Bug#24056)
The size of MEMORY tables and internal temporary tables was limited to 4GB on 64-bit Windows systems. (Bug#24052)
LAST_DAY('0000-00-00') could cause a server crash. (Bug#23653)
A trigger that invoked a stored function could cause a server crash when activated by different client connections. (Bug#23651)
The stack size for NetWare binaries was increased to 128KB to prevent problems caused by insufficient stack size. (Bug#23504)
If elements in a nontop-level IN subquery were accessed by an index and the subquery result set included a NULL value, the quanti-
fied predicate that contained the subquery was evaluated to NULL when it should return a non-NULL value. (Bug#23478)
When applying the group_concat_max_len limit, GROUP_CONCAT() could truncate multi-byte characters in the middle.
(Bug#23451)
mysql_affected_rows() could return values different from mysql_stmt_affected_rows() for the same sequence of
statements. (Bug#23383)
Calculation of COUNT(DISTINCT), AVG(DISTINCT), or SUM(DISTINCT) when they are referenced more than once in a
single query with GROUP BY could cause a server crash. (Bug#23184)
With row-based binary logging, for CREATE TABLE IF NOT EXISTS LIKE temporary_table statements, the IF NOT
EXISTS clause was not logged. (Bug#22762)
BENCHMARK(), ENCODE(), DECODE(), and FORMAT() could only accept a constant for some parameters, and could not be
used in prepared statements. (Bug#22684)
MySQL Change History
2960
Queries using a column alias in an expression as part of an ORDER BY clause failed, an example of such a query being SELECT
mycol + 1 AS mynum FROM mytable ORDER BY 30 - mynum. (Bug#22457)
Using EXPLAIN caused a server crash for queries that selected from INFORMATION_SCHEMA in a subquery in the FROM clause.
(Bug#22413)
Instance Manager option-parsing code caused memory-allocation errors. (Bug#22242)
Trailing spaces were not removed from Unicode CHAR column values when used in indexes. This resulted in excessive usage of
storage space, and could affect the results of some ORDER BY queries that made use of such indexes.
Note
When upgrading, it is necessary to re-create any existing indexes on Unicode CHAR columns in order to take advantage of
the fix. This can be done by using a REPAIR TABLE statement on each affected table.
(Bug#22052)
With row-based binary logging, CREATE TABLE IF NOT EXISTS SELECT statements were not logged properly.
(Bug#22027)
In some cases, the parser failed to distinguish a user-defined function from a stored function. (Bug#21809)
Inserting a default or invalid value into a spatial column could fail with Unknown error rather than a more appropriate error.
(Bug#21790)
Evaluation of subqueries that require the filesort algorithm were allocating and freeing the sort_buffer_size buffer many
times, resulting in slow performance. Now the buffer is allocated once and reused. (Bug#21727)
Through the C API, the member strings in MYSQL_FIELD for a query that contains expressions may return incorrect results.
(Bug#21635)
View columns were always handled as having implicit derivation, leading to illegal mix of collation errors for
some views in UNION operations. Now view column derivation comes from the original expression given in the view definition.
(Bug#21505)
INET_ATON() returned a signed BIGINT value, not an unsigned value. (Bug#21466)
For debug builds, mysqladmin shutdown displayed an extraneous skipped 9 bytes from file: socket (3)
message. (Bug#21428)
For renaming of views, encoding of table name to file names was not performed. (Bug#21370)
CREATE FUNCTION X() and CREATE FUNCTION Y() failed with a syntax error instead of warning the user that these func-
tion names are already used (for GIS functions). (Bug#21025)
CONCURRENT did not work correctly for LOAD DATA INFILE. (Bug#20637)
With lower_case_table_names set to 1, SHOW CREATE TABLE printed incorrect output for table names containing Turk-
ish I (LATIN CAPITAL LETTER I WITH DOT ABOVE). (Bug#20404)
A query with a subquery that references columns of a view from the outer SELECT could return an incorrect result if used from a
prepared statement. (Bug#20327)
For queries that select from a view, the server was returning MYSQL_FIELD metadata inconsistently for view names and table
names. For view columns, the server now returns the view name in the table field and, if the column selects from an underlying
table, the table name in the org_table field. (Bug#20191)
Invalidating the query cache caused a server crash for INSERT INTO ... SELECT statements that selected from a view.
(Bug#20045)
For a cast of a DATETIME value containing microseconds to DECIMAL, the microseconds part was truncated without generating a
warning. Now the microseconds part is preserved. (Bug#19491)
The server could send incorrect column count information to the client for queries that produce a larger number of columns than can
fit in a two-byte number. (Bug#19216)
MySQL Change History
2961
For some problems relating to character set conversion or incorrect string values for INSERT or UPDATE, the server was reporting
truncation or length errors instead. (Bug#18908)
Constant expressions and some numeric constants used as input parameters to user-defined functions were not treated as constants.
(Bug#18761)
Attempting to use a view containing DEFINER information for a nonexistent user resulted in an error message that revealed the
definer account. Now the definer is revealed only to superusers. Other users receive only an access denied message.
(Bug#17254)
IN() and CHAR() can return NULL, but did not signal that to the query processor, causing incorrect results for IS NULL opera-
tions. (Bug#17047)
Warnings were generated when explicitly casting a character to a number (for example, CAST('x' AS SIGNED)), but not for
implicit conversions in simple arithmetic operations (such as 'x' + 0). Now warnings are generated in all cases. (Bug#11927)
Metadata for columns calculated from scalar subqueries was limited to integer, double, or string, even if the actual type of the
column was different. (Bug#11032)
C.1.25. Changes in MySQL 5.1.13 (Not released)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: The number of function names affected by IGNORE_SPACE was reduced significantly in MySQL 5.1.13,
from about 200 to about 30. (For details about IGNORE_SPACE, see Section 8.2.4, Function Name Parsing and Resolution.) This
change improves the consistency of parser operation. However, it also introduces the possibility of incompatibility for old SQL code
that relies on the following conditions:
IGNORE_SPACE is disabled.
The presence or absence of whitespace following a function name is used to distinguish between a built-in function and stored
function that have the same name (for example, PI() versus PI ()).
For functions that are no longer affected by IGNORE_SPACE as of MySQL 5.1.13, that strategy no longer works. Either of the fol-
lowing approaches can be used if you have code that is subject to the preceding incompatibility:
If a stored function has a name that conflicts with a built-in function, refer to the stored function with a schema name qualifier,
regardless of whether whitespace is present. For example, write schema_name.PI() or schema_name.PI ().
Alternatively, rename the stored function to use a nonconflicting name and change invocations of the function to use the new
name.
(Bug#21114)
Incompatible Change: The innodb_buffer_pool_awe_mem_mb system variable has been removed and should no longer be
used.
MySQL Cluster: A change in the interfaces for the INFORMATION_SCHEMA.FILES table has made the table accessible to stor-
MySQL Change History
2962
age engines other than NDB. (Bug#23013)
Binary distributions of MySQL 5.1.12 were built without support for partitioning. This has been corrected except for NetWare.
(Bug#23949)
If the user specified the server options --max-connections=N or --table-open-cache=M , a warning would be given in
some cases that some values were recalculated, with the result that --table-open-cache could be assigned greater value.
In such cases, both the warning and the increase in the --table-open-cache value were completely harmless. Note also that it
is not possible for the MySQL Server to predict or to control limitations on the maximum number of open files, since this is determ-
ined by the operating system.
The value of --table-open-cache is no longer increased automatically, and a warning is now given only if some values had to
be decreased due to operating system limits. (Bug#21915)
For the CALL statement, stored procedures that take no arguments now can be invoked without parentheses. That is, CALL p()
and CALL p are equivalent. (Bug#21462)
mysql_upgrade now passes all the parameters specified on the command line to both mysqlcheck and mysql using the up-
grade_defaults file. (Bug#20100)
mysqldump --single-transaction now uses START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT
*/ rather than BEGIN to start a transaction, so that a consistent snapshot will be used on those servers that support it. (Bug#19660)
Bugs fixed:
MySQL Cluster: Backup of a cluster failed if there were any tables with 128 or more columns. (Bug#23502)
MySQL Cluster: Cluster backups failed when there were more than 2048 schema objects in the cluster. (Bug#23499)
MySQL Cluster: Restoring a cluster failed if there were any tables with 128 or more columns. (Bug#23494)
MySQL Cluster: The management client command ALL DUMP 1000 would cause the cluster to crash if data nodes were connec-
ted to the cluster but not yet fully started. (Bug#23203)
MySQL Cluster: INSERT ... ON DUPLICATE KEY UPDATE on an NDB table could lead to deadlocks and memory leaks.
(Bug#23200)
MySQL Cluster: An NDB source file included a memset() call with reversed arguments. (Bug#23169)
MySQL Cluster: If a node restart could not be performed from the REDO log, no node takeover took place. This could cause parti-
tions to be left empty during a system restart. (Bug#22893)
MySQL Cluster: Multiple node restarts in rapid succession could cause a system restart to fail , or induce a race condition.
(Bug#22892, Bug#23210)
MySQL Cluster: Attempting to create a unique constraint with USING HASH on an NDB table caused mysqld to crash.
(Bug#21873)
MySQL Cluster: When inserting a row into an NDB table with a duplicate value for a nonprimary unique key, the error issued
would reference the wrong key. (Bug#21072)
MySQL Cluster: Aborting a cluster backup too soon after starting it caused a forced shutdown of the data nodes. (Bug#19148)
Replication: Column names were not quoted properly for replicated views. (Bug#19736)
Replication: Transient errors in replication from master to slave may trigger multiple Got fatal error 1236: 'binlog
truncated in the middle of event' errors on the slave. (Bug#4053)
Disk Data: In the event of an aborted multiple update, the space in the Disk Data log buffer to be freed as a result was actually freed
twice, which could eventually lead to a crash. (Bug#23430)
Cluster API: When multiple processes or threads in parallel performed the same ordered scan with exclusive lock and updated the
retrieved records, the scan could skip some records, which as a result were not updated. (Bug#20446)
MySQL Change History
2963
There was a race condition in the InnoDB fil_flush_file_spaces() function. (Bug#24098)
yaSSL-related memory leaks were detected by Valgrind. (Bug#23981)
MySQL 5.0.26 introduced an ABI incompatibility, which this release reverts. Programs compiled against 5.0.26 are not compatible
with any other version and must be recompiled. (Bug#23427)
M % 0 returns NULL, but ( M % 0) IS NULL evaluated to false. (Bug#23411)
For not-yet-authenticated connections, the Time column in SHOW PROCESSLIST was a random value rather than NULL.
(Bug#23379)
InnoDB crashed when trying to display an error message about a foreign key constraint violation when the two tables are in differ-
ent schemas. (Bug#23368)
MySQL failed to build on Linux/Alpha. (Bug#23256)
This regression was introduced by Bug#21250.
If COMPRESS() returned NULL, subsequent invocations of COMPRESS() within a result set or within a trigger also returned
NULL. (Bug#23254)
Insufficient memory (myisam_sort_buffer_size) could cause a server crash for several operations on MyISAM tables: repair
table, create index by sort, repair by sort, parallel repair, bulk insert. (Bug#23175)
The column default value in the output from SHOW COLUMNS or SELECT FROM INFORMATION_SCHEMA.COLUMNS was
truncated to 64 characters. (Bug#23037)
mysql did not check for errors when fetching data during result set printing. (Bug#22913)
The return value from my_seek() was ignored. (Bug#22828)
Use of SQL_BIG_RESULT did not influence the sort plan for query execution. (Bug#22781)
The optimizer failed to use equality propagation for BETWEEN and IN predicates with string arguments. (Bug#22753)
The Handler_rollback status variable sometimes was incremented when no rollback had taken place. (Bug#22728)
The Host column in SHOW PROCESSLIST output was blank when the server was started with the --skip-grant-tables
option. (Bug#22723)
If a table contains an AUTO_INCREMENT column, inserting into an insertable view on the table that does not include the
AUTO_INCREMENT column should not change the value of LAST_INSERT_ID(), because the side effects of inserting default
values into columns not part of the view should not be visible. MySQL was incorrectly setting LAST_INSERT_ID() to zero.
(Bug#22584)
The optimizer used the ref join type rather than eq_ref for a simple join on strings. (Bug#22367)
Some queries that used MAX() and GROUP BY could incorrectly return an empty result. (Bug#22342)
If an init_connect SQL statement produced an error, the connection was silently terminated with no error message. Now the
server writes a warning to the error log. (Bug#22158)
An unhandled NULL pointer caused a server crash. (Bug#22138)
Incorrect warnings occurred for use of CREATE TABLE ... LIKE or REPAIR TABLE with the log tables. (Bug#21966)
The optimizer sometimes mishandled R-tree indexes for GEOMETRY data types, resulting in a server crash. (Bug#21888)
Use of a DES-encrypted SSL certificate file caused a server crash. (Bug#21868)
Use of PREPARE with a CREATE PROCEDURE statement that contained a syntax error caused a server crash. (Bug#21856)
Adding a day, month, or year interval to a DATE value produced a DATE, but adding a week interval produced a DATETIME value.
Now all produce a DATE value. (Bug#21811)
MySQL Change History
2964
Use of a subquery that invoked a function in the column list of the outer query resulted in a memory leak. (Bug#21798)
It was not possible to do an atomic rename of the log tables without the possibility of losing rows. Now you can do this:
USE mysql;
CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;
RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;
(Bug#21785, Bug#17544)
Within a prepared statement, SELECT (COUNT(*) = 1) (or similar use of other aggregate functions) did not return the correct
result for statement re-execution. (Bug#21354)
Within a stored routine, a view definition cannot refer to routine parameters or local variables. However, an error did not occur until
the routine was called. Now it occurs during parsing of the routine creation statement.
Note
A side effect of this fix is that if you have already created such routines, and error will occur if you execute SHOW CRE-
ATE PROCEDURE or SHOW CREATE FUNCTION. You should drop these routines because they are erroneous.
(Bug#20953)
In mysql, invoking connect or \r with very long db_name or host_name parameters caused buffer overflow. (Bug#20894)
WITH ROLLUP could group unequal values. (Bug#20825)
Range searches on columns with an index prefix could miss records. (Bug#20732)
The server did not allocate sufficient memory for some queries for which a DISTINCT to GROUP BY conversion is possible and an
ORDER BY clause is present, resulting in a server crash. (Bug#20503)
LIKE searches failed for indexed utf8 character columns. (Bug#20471)
With sql_mode = TRADITIONAL, MySQL incorrectly aborted on warnings within stored routines and triggers. (Bug#20028)
mysqldump --xml produced invalid XML for BLOB data. (Bug#19745)
The range analysis optimizer did not take into account predicates for which an index could be used after reading const tables. In
some cases this resulted in nonoptimal execution plans. (Bug#19579)
FLUSH INSTANCES in Instance Manager triggered an assertion failure. (Bug#19368)
For a debug server, a reference to an undefined user variable in a prepared statement executed with EXECUTE caused an assertion
failure. (Bug#19356)
Within a trigger for a base table, selecting from a view on that base table failed. (Bug#19111)
The value of the warning_count system variable was not being calculated correctly (also affecting SHOW COUNT(*) WARN-
INGS). (Bug#19024)
DELETE IGNORE could hang for foreign key parent deletes. (Bug#18819)
InnoDB used table locks (not row locks) within stored functions. (Bug#18077)
mysql would lose its connection to the server if its standard output was not writable. (Bug#17583)
At shutdown, Instance Manager told guarded server instances to stop, but did not wait until they actually stopped. (Bug#17486)
mysql-test-run did not work correctly for RPM-based installations. (Bug#17194)
A client library crash was caused by executing a statement such as SELECT * FROM t1 PROCEDURE ANALYSE() using a
server side cursor on a table t1 that does not have the same number of columns as the output from PROCEDURE ANALYSE().
(Bug#17039)
The WITH CHECK OPTION for a view failed to prevent storing invalid column values for UPDATE statements. (Bug#16813)
MySQL Change History
2965
InnoDB showed substandard performance with multiple queries running concurrently. (Bug#15815)
ALTER TABLE was not able to rename a view. (Bug#14959)
Statements such as DROP PROCEDURE and DROP VIEW were written to the binary log too late due to a race condition.
(Bug#14262)
A literal string in a GROUP BY clause could be interpreted as a column name. (Bug#14019)
Entries in the slow query log could have an incorrect Rows_examined value. (Bug#12240)
Lack of validation for input and output TIME values resulted in several problems: SEC_TO_TIME() in some cases did not clip
large values to the TIME range appropriately; SEC_TO_TIME() treated BIGINT UNSIGNED values as signed; only truncation
warnings were produced when both truncation and out-of-range TIME values occurred. (Bug#11655, Bug#20927)
Several string functions could return incorrect results when given very large length arguments. (Bug#10963)
FROM_UNIXTIME() did not accept arguments up to POWER(2,31)-1, which it had previously. (Bug#9191)
OPTIMIZE TABLE with myisam_repair_threads > 1 could result in MyISAM table corruption. (Bug#8283)
C.1.26. Changes in MySQL 5.1.12 (24 October 2006)
This is a new Beta development release, fixing recently discovered bugs.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: MySQL Cluster: MySQL Cluster node and system restarts formerly required that all fragments use the
same local checkpoint (LCP); beginning with this version, it is now possible for different fragments to use different LCPs during re-
starts. This means that data node file systems must be rebuilt as part of any upgrade to this version by restarting all data nodes with
the --initial option.
See Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x Upgrade and Downgrade Compatibility, and related
sections of the Manual before upgrading a MySQL Cluster to version 5.1.12 or later. (Bug#21478, Bug#21271)
Incompatible Change: In the INFORMATION_SCHEMA.EVENTS table, the EVENT_DEFINITION column now contains the
SQL executed by a scheduled event.
The EVENT_BODY column now contains the language used for the statement or statements shown in EVENT_DEFINITION. In
MySQL 5.1, the value shown in EVENT_BODY is always SQL.
These changes were made to bring this table into line with the INFORMATION_SCHEMA.ROUTINES table, and that table's
ROUTINE_BODY and ROUTINE_DEFINITION columns. (Bug#16992)
Incompatible Change: For GRANT and REVOKE, ON * previously granted and revoked privileges for the default database if there
was a default database and global privileges if there was none. Now ON * requires a default database and produces an error if there
is none.
Incompatible Change: Support for the BerkeleyDB (BDB) engine has been dropped from this release. Any existing tables that are
in BDB format will not be readable from within MySQL from 5.1.12 or newer. You should convert your tables to another storage
engine before upgrading to 5.1.12.
Because of this change, the SHOW [BDB] LOGS statement has been dropped.
Incompatible Change: A number of MySQL constructs are now prohibited in partitioning expressions, beginning with this release.
These include the following:
A number of MySQL functions. For a complete list of these, see Section 18.5.3, Partitioning Limitations Relating to
Functions.
MySQL Change History
2966
The bit operators |, &, ^, <<, >>, and ~.
Nested function calls.
Calls to stored routines, UDFs, or plugins.
Character-to-integer conversions involving non-8-bit character sets or any of the latin1_german2_ci, lat-
in2_czech_cs, or cp1250_czech_cs collations.
These restrictions were added in part as a result of Bug#18198 and related bug reports.
For more information about these and other restrictions on partitioned tables in MySQL, see Section 18.5, Restrictions and Limita-
tions on Partitioning.
Incompatible Change: The permitted values for and behaviour of the event_scheduler system variable have changed. Permit-
ted values are now ON, OFF, and DISABLED, with OFF being the default. It is not possible to change its value to or from DIS-
ABLED while the server is running.
For details, see Section 19.4.1, Event Scheduler Overview.
Incompatible Change: The plugin interface has changed: The st_mysql_plugin structure has a new license member to in-
dicate the license type. (The allowable values are defined in mysql/plugin.h.) This change is not backward compatible, so the
API version (MYSQL_PLUGIN_INTERFACE_VERSION) has changed. For additional information, see Section 22.2.3, Writing
Plugins.
Incompatible Change: The full-text parser plugin interface has changed in two ways:
The MYSQL_FTPARSER_PARAM structure has a new flags member. This is zero if there are no special flags, or
MYSQL_FTFLAGS_NEED_COPY, which means that mysql_add_word() must save a copy of the word (that is, it cannot
use a pointer to the word because the word is in a buffer that will be overwritten.)
This flag might be set or reset by MySQL before calling the parser plugin, by the parser plugin itself, or by the
mysql_parse() function.
The mysql_parse() and mysql_add_word() functions now take a MYSQL_FTPARSER_PARAM as their first argument,
not a MYSQL_FTPARSER_PARAM::mysql_ftparam as before.
These changes are not backward compatible, so the API version (MYSQL_FTPARSER_INTERFACE_VERSION) has changed. For
additional information, see Section 22.2.3, Writing Plugins.
Incompatible Change: Storage engines can be pluggable at runtime, so the distinction between disabled and invalid storage engines
no longer applies. This affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in Section 5.1.8, Server SQL Modes.
Incompatible Change: The namespace for scheduled events has changed, such that events are no longer unique to individual users.
This also means that a user with the EVENT privilege on a given database can now view, alter, or drop any events defined on that
database.
If you used scheduled events in an earlier MySQL 5.1 release, you should rename any of them having the same name and defined on
the same database but belonging to different users so that all events in a given database have unique names before upgrading
to 5.1.12 (or newer).
For additional information, see Section 19.4.6, The Event Scheduler and MySQL Privileges.
Important Change: Partitioning: MySQL Cluster: It is no longer possible to create Cluster tables using any partitioning type oth-
er than [LINEAR] KEY. Attempting to do so now raises an error.
Important Change: MySQL Cluster: LOAD DATA INFILE no longer causes an implicit commit for all storage engines. It now
causes an implicit commit only for tables using the NDB storage engine. (Bug#11151)
Important Change: MySQL Cluster: The status variables Ndb_connected_host and Ndb_connected_port were re-
named to Ndb_config_from_host and Ndb_config_from_port, respectively.
Important Change: Replication: The default value for the --binlog-format server option is now MIXED.
MySQL Cluster: The ndb_config utility now accepts -c as a short form of the --ndb-connectstring option.
MySQL Change History
2967
Bug#22295)
MySQL Cluster: Added the --bind-address option for ndbd. This allows a data node process to be bound to a specific net-
work interface. (Bug#22195)
MySQL Cluster: The Ndb_number_of_storage_nodes system variable was renamed to
Ndb_number_of_data_nodes. (Bug#20848)
MySQL Cluster: The HELP command in the Cluster management client now provides command-specific help. For example, HELP
RESTART in ndb_mgm provides detailed information about the RESTART command. (Bug#19620)
MySQL Cluster: A number of erroneous, misleading, or missing error messages have been corrected. (Bug#17297, Bug#19543)
MySQL Cluster: Backup messages are no longer printed to the cluster log.
MySQL Cluster: Added the --ndb-use-copying-alter-table option to mysqld to provide a fallback in case of prob-
lems with online ALTER TABLE operations on NDB tables.
Replication: The default binary log format (as used during replication) is now Mixed based, automatically using a combination of
row-based and statement based log events as appropriate.
Cluster API: Two new NDB API methods aggregate() and validate() were added to the NdbDiction-
ary::Object::Table class. See Table::aggregate(), and Table::validate(), for more information. This was
done to rectify the following issues:
Under some conditions, the data distribution could become unbalanced in a MySQL Cluster with 2 or more node groups follow-
ing the creation of a new table.
Data was stored unevenly between partitions due to all BLOB data being placed in partition 0.
(Bug#21690)
The number of InnoDB threads is no longer limited to 1,000 on Windows. (Bug#22268)
The STATE column of the INFORMATION_SCHEMA.PROCESSLIST table was increased from 30 to 64 characters to accommod-
ate longer state values. (Bug#21652)
mysqldump now has a --flush-privileges option. It causes mysqldump to emit a FLUSH PRIVILEGES statement after
dumping the mysql database. This option should be used any time the dump contains the mysql database and any other database
that depends on the data in the mysql database for proper restoration. (Bug#21424)
mysqlslap threads now try to connect up to 10 times if the initial connect attempt fails. (Bug#21297)
For mysqldump, the output generated by the server when using the --xml option has changed with regard to null values. It now
matches the output from mysqldump --xml. That is, a column containing a NULL value is now reported as
<field name="column_name" xsi:nil="true" />
whereas a column containing the string value 'NULL' is reported as
<field name="column_name">NULL</field>
and a column containing an empty string is reported as
<field name="column_name"></field>
(Bug#21263)
The mysqld and mysqlmanager man pages have been reclassified from volume 1 to volume 8. (Bug#21220)
InnoDB now honors IGNORE INDEX. Perviously using IGNORE INDEX in cases where an index sort would be slower than a
filesort had no effect when used with InnoDB tables. (Bug#21174)
TIMESTAMP columns that are NOT NULL now are reported that way by SHOW COLUMNS and INFORMATION_SCHEMA.
(Bug#20910)
MySQL Change History
2968
Memory consumption of the InnoDB data dictionary cache was roughly halved by cleaning up the data structures. (Bug#20877)
The BINARY keyword now is forbidden as a data type attribute in stored routines (for example, DECLARE v1 VARCHAR(25)
BINARY), because DECLARE does not support collations, and in this context BINARY specifies the binary collation of the variable's
character set. (Bug#20701)
The following statements now can be executed as prepared statements (using PREPARE plus EXECUTE):
CACHE INDEX
CHANGE MASTER
CHECKSUM {TABLE | TABLES}
{CREATE | RENAME | DROP} DATABASE
{CREATE | RENAME | DROP} USER
FLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES
| LOGS | STATUS | MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES}
GRANT
REVOKE
KILL
LOAD INDEX INTO CACHE
RESET {MASTER | SLAVE | QUERY CACHE}
SHOW BINLOG EVENTS
SHOW CREATE {PROCEDURE | FUNCTION | EVENT | TABLE | VIEW}
SHOW {AUTHORS | CONTRIBUTORS | WARNINGS | ERRORS}
SHOW {MASTER | BINARY} LOGS
SHOW {MASTER | SLAVE} STATUS
SLAVE {START | STOP}
INSTALL PLUGIN
UNINSTALL PLUGIN
(Bug#20665)
In the INFORMATION_SCHEMA.ROUTINES table the ROUTINE_DEFINITION column now is defined as NULL rather than
NOT NULL. Also, NULL rather than the empty string is returned as the column value if the user does not have sufficient privileges
to see the routine definition. (Bug#20230)
The mysqldumpslow script has been moved from client RPM packages to server RPM packages. This corrects a problem where
mysqldumpslow could not be used with a client-only RPM install, because it depends on my_print_defaults which is in
the server RPM. (Bug#20216)
The MySQL distribution now compiles on UnixWare 7.13. (Bug#20190)
configure now defines the symbol DBUG_ON in config.h to indicate whether the source tree is configured to be compiled
with debugging support. (Bug#19517)
TEXT and BLOB columns do not support DEFAULT values. However, when a default of '' was specified, the specification was si-
lently ignored. This now results in a warning, or an error in strict mode. (Bug#19498)
For mysqlshow, if a database name argument contains wildcard characters (such as _ ) but matches a single database name ex-
actly, treat the name as a literal name. This allows a command such as mysqlshow information_schema work without hav-
ing to escape the wildcard character. (Bug#19147)
The source distribution has been updated so that the UDF example can be compiled under Windows with CMake. See Sec-
tion 22.3.2.5, Compiling and Installing User-Defined Functions. (Bug#19121)
The default value of the tmp_table_size system variable was lowered from 32MB to 16MB because it is bounded by the value
of max_heap_table_size, which has a default of 16MB. (Bug#18875)
Log table changes: By default, the log tables use the CSV storage engine, as before. But now the log tables can be altered to use the
MyISAM storage engine. You cannot use ALTER TABLE to alter a log table that is in use. The log must be disabled first. No en-
gines other than CSV or MyISAM are legal for the log tables. The use of DROP TABLE for log tables is similarly restricted: It can-
not be used to drop a log table that is in use. The log must be disabled first. (These changes also correct a deadlock that occurred for
an attempt to drop an in-use log table.) (Bug#18559)
Added the --set-charset option to mysqlbinlog to allow the character set to be specified for processing binary log files.
(Bug#18351)
The ExtractValue() function now produces an error when passed an XML fragment that is not well-formed.
(Previously, the function allowed invalid XML fragments to be used.) (Bug#18201)
MySQL Change History
2969
On Windows, typing Control-C while a query was running caused the mysql client to crash. Now it causes mysql to attempt to
kill the current statement. If this cannot be done, or Control-C is typed again before the statement is killed, mysql exits. (In other
words, mysql's behavior with regard to Control-C is now the same as it is on Unix platforms.) (Bug#17926)
See also Bug#1989.
The bundled yaSSL library licensing has added a FLOSS exception similar to MySQL to resolve licensing incompatibilities with
MySQL. (See the extra/yassl/FLOSS-EXCEPTIONS file in a MySQL source distribution for details.) (Bug#16755)
SHOW CREATE TABLE now shows constraints for InnoDB tables. (Bug#16614)
EXPLAIN EXTENDED now shows a filtered column that is an estimated percentage of the examined rows that will be joined
with the previous tables. This was added while dealing with a problem of MySQL choosing the wrong index for some queries.
(Bug#14940)
The mysql client now allows \l in the prompt command argument to insert the current delimiter into the prompt. (Bug#14448)
The mysql client used the default character set if it automatically reconnected to the server, which is incorrect if the character set
had been changed. To enable the character set to remain synchronized on the client and server, the mysql command charset (or
\C) that changes the default character set and now also issues a SET NAMES statement. The changed character set is used for re-
connects. (Bug#11972)
The LEFT() and RIGHT() functions return NULL if any argument is NULL. (Bug#11728)
If a DROP VIEW statement named multiple views, it stopped with an error if a nonexistent view was named and did not drop the re-
maining views. Now it continues on and reports an error at the end, similar to DROP TABLE. (Bug#11551)
For a successful dump, mysqldump now writes a SQL comment to the end of the dump file in the following format:
-- Dump completed on YYYY-MM-DD hh:mm:ss
(Bug#10877)
There were several issues regarding how SHOW STATUS affected some status variables and logging which could impact monitor-
ing the MySQL Server. The behavior of this statement has been modified in two ways:
SHOW STATUS is no longer logged to the slow query log.
SHOW STATUS no longer updates any session status variables, except for com_show_status.
However, SHOW STATUS continues to update global status variables to allow monitoring of what the server is actually doing. This
is because SHOW STATUS creates temporary tables that may affect performance if it is called excessively often. (Bug#10210)
See also Bug#19764.
For spatial data types, the server formerly returned these as VARSTRING values with a binary collation. Now the server returns spa-
tial values as BLOB values. (Bug#10166)
The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER statements are deprecated. See Section 12.6.2.2, LOAD
DATA FROM MASTER Syntax, for recommended alternatives. (Bug#9125, Bug#20596, Bug#14399, Bug#12187, Bug#15025,
Bug#18822)
For the mysql client, typing Control-C causes mysql to attempt to kill the current statement. If this cannot be done, or Control-C
is typed again before the statement is killed, mysql exits. Previously, Control-C caused mysql to exit in all cases. (Bug#1989)
It is no longer possible to create partitioned tables using the CSV storage engine.
Binary MySQL distributions no longer include a mysqld-max server. Instead, distributions contain a binary that includes the fea-
tures previously included in the mysqld-max binary.
SHOW STATUS is no longer logged to the slow query log.
Program Database files (extension .pdb) are now included by default in Windows distributions. These can be used to help diagnose
problems with mysqld and other tools. See Section 22.5.1, Debugging a MySQL Server.
INFORMATION_SCHEMA contains new tables, GLOBAL_STATUS, SESSION_STATUS, GLOBAL_VARIABLES, and SES-
MySQL Change History
2970
SION_VARIABLES, that correspond to the output from the SHOW {GLOBAL|SESSION} STATUS and SHOW
{GLOBAL|SESSION} VARIABLES statements.
SHOW STATUS no longer updates any session status variables, except for com_show_status.
A new system variable, lc_time_names, specifies the locale that controls the language used to display day and month names and
abbreviations. This variable affects the output from the DATE_FORMAT(), DAYNAME() and MONTHNAME() functions. See Sec-
tion 9.8, MySQL Server Locale Support.
Using --with-debug to configure MySQL with debugging support enables you to use the --debug="d,parser_debug"
option when you start the server. This causes the Bison parser that is used to process SQL statements to dump a parser trace to the
server's standard error output. Typically, this output is written to the error log.
The bundled yaSSL library was upgraded to version 1.3.7.
The Instance Manager --passwd option has been renamed to --print-password-line. Other options were added to enable
management of the IM password file from the command line: --add-user, --drop-user, --edit-user, --list-users,
--check-password-file, --clean-password-file, --username, and --password. The -
-mysqld-safe-compatible option was added to cause the Instance Manner to act similarly to mysqld_safe.
Added the SHOW CONTRIBUTORS statement.
The general query log and slow query logs now can be enabled or disabled at runtime with the general_log and
slow_query_log system variables, and the name of the log files can be changed by setting the general_log_file and
slow_query_log_file system variables. See Section 5.2.3, The General Query Log, and Section 5.2.5, The Slow Query
Log.
Bugs fixed:
Security Fix: A stored routine created by one user and then made accessible to a different user using GRANT EXECUTE could be
executed by that user with the privileges of the routine's definer. (Bug#18630, CVE-2006-4227)
Security Fix: On Linux, and possibly other platforms using case-sensitive file systems, it was possible for a user granted rights on a
database to create or access a database whose name differed only from that of the first by the case of one or more letters.
(Bug#17647, CVE-2006-4226)
Security Fix: If a user has access to MyISAM table t, that user can create a MERGE table m that accesses t. However, if the user's
privileges on t are subsequently revoked, the user can continue to access t by doing so through m. If this behavior is undesirable,
you can start the server with the new --skip-merge option to disable the MERGE storage engine. (Bug#15195, CVE-2006-4031)
Incompatible Change: For utf8 columns, the full-text parser incorrectly considered several nonword punctuation and whitespace
characters as word characters, causing some searches to return incorrect results.
The fix involves a change to the full-text parser, so any tables that have FULLTEXT indexes on utf8 columns must be repaired
with REPAIR TABLE:
REPAIR TABLE tbl_name QUICK;
(Bug#19580)
MySQL Cluster: Packaging: The ndb_mgm program was included in both the MySQL-ndb-tools and MySQL-
ndb-management RPM packages, resulting in a conflict if both were installed. Now ndb_mgm is included only in MySQL-
ndb-tools. (Bug#21058)
MySQL Cluster: Replication: A DELETE FROM table with no WHERE clause (deleting all rows) running concurrently with
INSERT statements on a storage engine with row-level locking (such as NDB) could produce inconsistent results when using state-
ment-based replication. (Bug#19066)
MySQL Cluster: Replication: (Replication): A node failure could send duplicate events, causing a mysqld replicating tables con-
taining BLOBs to crash.
MySQL Cluster: (NDB API): Inacivity timeouts for scans were not correctly handled. (Bug#23107)
MySQL Change History
2971
MySQL Cluster: Inserting into an NDB table failed when the table had no primary key but had a unique key added after table was
created on one or more NOT NULL columns. This occurred when the unique key had been adding using either ALTER TABLE or
CREATE UNIQUE KEY. (Bug#22838)
MySQL Cluster: (NDB API): Attempting to read a nonexistent tuple using Commit mode for NdbTransac-
tion::execute() caused node failures. (Bug#22672)
MySQL Cluster: The --help output from NDB binaries did not include file-related options. (Bug#21994)
MySQL Cluster: Setting TransactionDeadlockDetectionTimeout to a value greater than 12000 would cause scans to
deadlock, time out, fail to release scan records, until the cluster ran out of scan records and stopped processing. (Bug#21800)
MySQL Cluster: A scan timeout returned Error 4028 (NODE FAILURE CAUSED ABORT OF TRANSACTION) instead of Error 4008
(NODE FAILURE CAUSED ABORT OF TRANSACTION...). (Bug#21799)
MySQL Cluster: The node recovery algorithm was missing a version check for tables in the ALTER_TABLE_COMMITTED state
(as opposed to the TABLE_ADD_COMMITTED state, which has the version check). This could cause inconsistent schemas across
nodes following node recovery. (Bug#21756)
MySQL Cluster: A memory leak occurred when running ndb_mgm -e "SHOW". (Bug#21670)
MySQL Cluster: The server provided a nondescriptive error message when encountering a fatally corrupted REDO log.
(Bug#21615)
MySQL Cluster: The output for the --help option used with NDB executable programs (such as ndbd, ndb_mgm,
ndb_restore, ndb_config, and others mentioned in Section 17.6, MySQL Cluster Programs) referred to the Ndb.cfg file,
instead of to my.cnf. (Bug#21585)
MySQL Cluster: A partial rollback could lead to node restart failures. (Bug#21536)
MySQL Cluster: Partition distribution keys were updated only for the primary and starting replicas during node recovery. This
could lead to node failure recovery for clusters having an odd number of replicas.
Note
For best results, use values for NumberOfReplicas that are even powers of 2.
(Bug#21535)
MySQL Cluster: The ndb_mgm management client did not set the exit status on errors, always returning 0 instead. (Bug#21530)
MySQL Cluster: The failure of a unique index read due to an invalid schema version could be handled incorrectly in some cases,
leading to unpredictable results. (Bug#21384)
MySQL Cluster: Attempting to create an NDB table on a MySQL server with an existing non-Cluster table with the same name in
the same database could result in data loss or corruption. Now, if such a table is encountered during autodiscovery, a warning is
written to the error log of the affected mysqld, and the local table is overwritten. (Bug#21378)
MySQL Cluster: Cluster logs were not rotated following the first rotation cycle. (Bug#21345)
MySQL Cluster: In a cluster with more than 2 replicas, a manual restart of one of the data nodes could fail and cause the other
nodes in the same node group to shut down. (Bug#21213)
MySQL Cluster: The ndb_size.pl script did not account for TEXT and BLOB column values correctly. (Bug#21204)
MySQL Cluster: Some queries involving joins on very large NDB tables could crash the MySQL server. (Bug#21059)
MySQL Cluster: Condition pushdown did not work correctly with DATETIME columns. (Bug#21056)
MySQL Cluster: Responses to the ALL DUMP 1000 management client command were printed multiple times in the cluster log
for each cluster node. (Bug#21044)
MySQL Cluster: The message ERROR 0 IN READAUTOINCREMENTVALUE(): NO ERROR was written to the error log whenever
SHOW TABLE STATUS was performed on a Cluster table that did not have an AUTO_INCREMENT column. (Bug#21033)
MySQL Cluster: Restarting a data node while DDL operations were in progress on the cluster could cause other data nodes to fail.
MySQL Change History
2972
This could also lead to mysqld hanging or crashing under some circumstances. (Bug#21017, Bug#21050)
MySQL Cluster: In some situations with a high disk-load, writing of the redo log could hang, causing a crash with the error mes-
sage GCP STOP DETECTED. (Bug#20904)
MySQL Cluster: A race condition could in some cirumstances following a DROP TABLE. (Bug#20897)
MySQL Cluster: Under some circumstances, local checkpointing would hang, keeping any unstarted nodes from being started.
(Bug#20895)
MySQL Cluster: When the redo buffer ran out of space, a POINTER TOO LARGE error was raised and the cluster could become un-
usable until restarted with --initial. (Bug#20892)
MySQL Cluster: A vague error message was returned when reading both schema files during a restart of the cluster. (Bug#20860)
MySQL Cluster: The repeated creating and dropping of a table would eventually lead to NDB Error 826, TOO MANY TABLES AND
ATTRIBUTES ... INSUFFICIENT SPACE. (Bug#20847)
MySQL Cluster: When attempting to restart the cluster following a data import, the cluster failed during Phase 4 of the restart with
ERROR 2334: JOB BUFFER CONGESTION. (Bug#20774)
MySQL Cluster: REPLACE statements did not work correctly on an NDB table having both a primary key and a unique key. In
such cases, proper values were not set for columns which were not explicitly referenced in the statement. (Bug#20728)
MySQL Cluster: The server did not honor the value set for ndb_cache_check_time in the my.cnf file. (Bug#20708)
MySQL Cluster: Truncating a table on one mysqld caused other mysqld processes connected to the cluster to return ERROR
1412 (HY000): TABLE DEFINITION HAS CHANGED, PLEASE RETRY TRANSACTION on subsequent queries. (Bug#20705)
MySQL Cluster: Using an invalid node ID with the management client STOP command could cause ndb_mgm to hang.
(Bug#20575)
MySQL Cluster: Renaming of table columns was not supported as fast a ALTER TABLE for NDB tables. (Bug#20456)
MySQL Cluster: ndb_size.pl and ndb_error_reporter were missing from RPM packages. (Bug#20426)
MySQL Cluster: Running ndbd --nowait-nodes=id where id was the node ID of a node that was already running would
fail with an invalid error message. (Bug#20419)
MySQL Cluster: Data nodes added while the cluster was running in single user mode were all assigned node ID 0, which could
later cause multiple node failures. Adding nodes while in single user mode is no longer possible. (Bug#20395)
MySQL Cluster: The ndb_mgm client command ALL CLUSTERLOG STATISTICS=15 had no effect. (Bug#20336)
MySQL Cluster: (Direct APIs): NdbScanOperation::readTuples() and NdbIndexScanOpera-
tion::readTuples() ignored the batch parameter. (Bug#20252)
MySQL Cluster: A node failure during a scan could sometime cause the node to crash when restarting too quickly following the
failure. (Bug#20197)
MySQL Cluster: The failure of a data node when preparing to commit a transaction (that is, while the node's status was
CS_PREPARE_TO_COMMIT) could cause the failure of other cluster data nodes. (Bug#20185)
MySQL Cluster: SHOW ENGINE NDB STATUS could sometimes return an incorrect value of 0 for the latest epoch, which could
cause problems with synchronizing the binlog. (Bug#20142)
MySQL Cluster: An internal formatting error caused some management client error messages to be unreadable. (Bug#20016)
MySQL Cluster: Creating tables with variable-size columns caused DataMemory to be used but not freed when the tables were
dropped. (Bug#20007)
MySQL Cluster: Renaming a table in such a way as to move it to a different database failed to move the table's indexes.
(Bug#19967)
MySQL Cluster: Running management client commands while mgmd was in the process of disconnecting could cause the manage-
ment server to fail. (Bug#19932)
MySQL Change History
2973
MySQL Cluster: Under certain conditions, a starting node could miss transactions, leading to inconsistencies between the primary
and backup replicas. (Bug#19929)
MySQL Cluster: An uncommitted row could sometimes be checkpointed and thus incorrectly included in a backup. (Bug#19928)
MySQL Cluster: In some cases where SELECT COUNT(*) from an NDB table should have yielded an error, MAX_INT was re-
turned instead. (Bug#19914)
MySQL Cluster: TEXT columns in Cluster tables having both an explicit primary key and a unique key were not correctly updated
by REPLACE statements. (Bug#19906)
MySQL Cluster: The cluster's data nodes failed while trying to load data when NoOfFrangmentLogFiles was set equal to 1.
(Bug#19894)
MySQL Cluster: Following the restart of a management node, the Cluster management client did not automatically reconnect.
(Bug#19873)
MySQL Cluster: Restoring a backup with ndb_restore failed when the backup had been taken from a cluster whose
DataMemory had been completely used up. (Bug#19852)
MySQL Cluster: Error messages given when trying to make online changes to parameters such as NoOfReplicas that can only
be changed via a complete shutdown and restart of the cluster did not indicate the true nature of the problem. (Bug#19787)
MySQL Cluster: Under some circumstances, repeated DDL operations on one mysqld could cause failure of a second mysqld
attached to the same cluster. (Bug#19770)
MySQL Cluster: ndb_restore did not always make clear that it had recovered successfully from temporary errors while restor-
ing a cluster backup. (Bug#19651)
MySQL Cluster: Resources for unique indexes on Cluster table columns were incorrectly allocated, so that only one-fourth as
many unique indexes as indicated by the value of UniqueHashIndexes could be created. (Bug#19623)
MySQL Cluster: LOAD DATA LOCAL failed to ignore duplicate keys in Cluster tables. (Bug#19496)
MySQL Cluster: For ndb_mgmd, Valgrind revealed problems with a memory leak and a dependency on an uninitialized variable.
(Bug#19318, Bug#20333)
MySQL Cluster: A DELETE of many rows immediately followed by an INSERT on the same table could cause the ndbd process
on the backup replica to crash. (Bug#19293)
MySQL Cluster: An excessive number of ALTER TABLE operations could cause the cluster to fail with NDB error code 773 (OUT
OF STRING MEMORY, PLEASE MODIFY STRINGMEMORY). (Bug#19275)
MySQL Cluster: A problem with error handling when ndb_use_exact_count was enabled could lead to incorrect values re-
turned from queries using COUNT(). A warning is now returned in such cases. (Bug#19202)
MySQL Cluster: In rare situations with resource shortages, a crash could result from insufficient IndexScanOperations.
(Bug#19198)
MySQL Cluster: Running out of DataMemory could sometimes crash ndbd and mysqld processes. (Bug#19185)
MySQL Cluster: It was possible to use port numbers greater than 65535 for ServerPort in the config.ini file. (Bug#19164)
MySQL Cluster: ndb_mgm -e show | head would hang after displaying the first 10 lines of output. (Bug#19047)
MySQL Cluster: The error returned by the cluster when too many nodes were defined did not make clear the nature of the problem.
(Bug#19045)
MySQL Cluster: The management client ALL STOP command shut down mgmd processes (as well as ndbd processes).
(Bug#18966)
MySQL Cluster: TRUNCATE TABLE failed to reset the AUTO_INCREMENT counter. (Bug#18864)
MySQL Cluster: Restarting a failed node could sometimes crash the cluster. (Bug#18782)
MySQL Cluster: Trying to create or drop a table while a node was restarting caused the node to crash. This is now handled by rais-
MySQL Change History
2974
ing an error. (Bug#18781)
MySQL Cluster: Repeated CREATE - INSERT - DROP operations on tables could in some circumstances cause the MySQL table
definition cache to become corrupt, so that some mysqld processes could access table information but others could not.
(Bug#18595)
MySQL Cluster: A CREATE TABLE statement involving foreign key constraints raised an error rather than being silently ignored
(see Section 12.1.17, CREATE TABLE Syntax).
This bug affected Cluster in MySQL 5.1 only. (Bug#18483)
MySQL Cluster: The server failed with a nondescriptive error message when out of data memory. (Bug#18475)
MySQL Cluster: For NDB and possibly InnoDB tables, a BEFORE UPDATE trigger could insert incorrect values. (Bug#18437)
MySQL Cluster: The DATA_LENGTH and AVG_ROW_LENGTH columns of the INFORMATION_SCHEMA.TABLES table did not
report the size of variable-width column values correctly.
See Section 20.2, The INFORMATION_SCHEMA TABLES Table, for more information. (Bug#18413)
MySQL Cluster: SELECT ... FOR UPDATE failed to lock the selected rows. (Bug#18184)
MySQL Cluster: (Disk Data): Deletes from Disk Data tables used a nonoptimal scan to find the rows to be deleted, resulting in
poor performance. The fix causes disk order rather than memory order to be used, and can improve performance of Disk Data de-
letes by up to ~300% in some cases. (Bug#17929)
MySQL Cluster: perror did not properly report NDB error codes. (Bug#16561)
MySQL Cluster: A problem with takeover during a system restart caused ordered indexes to be rebuilt incorrectly. This also ad-
versely affected MySQL Cluster Replication. (Bug#15303)
MySQL Cluster: A cluster data node could crash when an ordered index became full before the table containing the index was full.
(Bug#14935)
MySQL Cluster: The management client ALL STATUS command could sometimes report the status of some data nodes incor-
rectly. (Bug#13985)
MySQL Cluster: New mysqld processes were allowed to connect without a restart of the cluster, causing the cluster to crash.
(Bug#13266)
MySQL Cluster: Cluster system status variables were not updated properly. (Bug#11459)
MySQL Cluster: (NDBAPI): Update operations on blobs were not checked for illegal operations.
Note
Read locks with blob update operations are now upgraded from read committed to read shared.
MySQL Cluster: The loss of one or more data nodes could sometimes cause ndb_mgmd to use a high amount of CPU (15 percent
or more, as opposed to 1 to 2 percent normally).
Partitioning: Old partition and subpartition files were not always removed following ALTER TABLE ... REORGANIZE PAR-
TITION statements. (Bug#20770)
Cluster Replication: Replication: In some cases, a large number of MySQL servers sending requests to the cluster simultaneously
could cause the cluster to crash. This could also be triggered by many NDB API clients making simultaneous event subscriptions or
unsubscriptions. (Bug#20683)
Cluster Replication: Replication: Data definition and data manipulation statements on different tables were not serialised correctly
in the binary log. For example, there was no guarantee that a CREATE TABLE statement and an update on a different table would
occur in the same order in the binary log as they did on the cluster being replicated. (Bug#18947)
Replication: BIT columns were not replicated properly under row-based replication. (Bug#22550)
Replication: For row-based replication, log rotation could occur at an improper time. (Bug#21474)
MySQL Change History
2975
Replication: In mixed-format binary logging mode, stored functions, triggers, and views that use functions in their body that require
row-based logging did not replicate reliably because the logging did not switch from statement-based to row-based format. For ex-
ample, INSERT INTO t SELECT FROM v, where v is a view that selects UUID() could cause problems. This limitation has
been removed. (Bug#20930)
Replication: A race condition during slave server shutdown caused an assert failure. (Bug#20850)
Replication: With mixed-format binary logging, INSERT DELAYED statements were logged using statement-based logging, and
they did not replicate properly for statements that used values such as UUID(), RAND(), or user-defined variables that require row-
based logging. To correct this, the DELAYED handler thread how switches to row-based logging if the logging format is mixed.
(Bug#20633, Bug#20649)
Replication: With the auto_increment_increment system variable set larger than 1, if the next generated
AUTO_INCREMENT value would be larger than the column's maximum value, the value would be clipped down to that maximum
value and inserted, even if the resulting value would not be in the generated sequence. This could cause problems for master-master
replication. Now the server clips the value down to the previous value in the sequence, which correctly produces a duplicate-key er-
ror if that value already exists in the column. (Bug#20524)
Replication: In mixed binary logging mode, a temporary switch from statement-based logging to row-based logging occurs when
storing a row that uses a function such as UUID() into a temporary table. However, temporary table changes are not written to the
binary log under row-based logging, so the row does not exist on the slave. A subsequent select from the temporary table to a non-
temporary table using statement-based logging works correctly on the master, but not on the slave where the row does not exist.
Replication no longer switches back from row-based logging to statement-based logging until there are no temporary tables for the
session. (Bug#20499)
Replication: CREATE PROCEDURE, CREATE FUNTION, CREATE TRIGGER, and CREATE VIEW statements containing
multi-line comments (/* ... */) could not be replicated. (Bug#20438)
Replication: A stored procedure that used LAST_INSERT_ID() did not replicate properly using statement-based binary logging.
(Bug#20339)
Replication: When using row based replication, a CREATE TABLE ... SELECT statement was replicated, even if the table cre-
ation failed on the master (for example, due to a duplicate key failure). (Bug#20265)
Replication: If a table on a slave server had a higher AUTO_INCREMENT counter than the corresponding master table (even though
all rows of the two tables were identical), in some cases REPLACE or INSERT ... ON DUPLICATE KEY UPDATE would not
replicate properly using statement-based logging. (Different values would be inserted on the master and slave.) (Bug#20188)
Replication: Shutting down a slave in a replication scenario where temporary tables are in use would cause the slave to produce a
core dump. (Bug#19881)
Replication: The effect of a stored function or trigger that caused AUTO_INCREMENT values to be generated for multiple tables
was not logged properly if statement-based logging was used. Only the first table's value was logged, causing replication to fail. Un-
der mixed logging format, this is dealt with by switching to row-based logging for the function or trigger. For statement-based log-
ging, this remains a problem. (Bug#19630)
Replication: For row-based replication, the BINLOG statement did not lock tables properly, causing a crash for some table types.
(Bug#19459)
Replication: Column names supplied for a view created on a master server could be lost on a slave server. (Bug#19419)
Replication: The dropping of a temporary table whose name contained a backtick ('`') character was not correctly written to the
binary log, which also caused it not to be replicated correctly. (Bug#19188)
Replication: With row-based replication, replicating a statement to a slave where the table had additional columns relative to the
master table did not work. (Bug#19069)
Replication: Valgrind revealed several issues with mysqld that were corrected: A dangling stack pointer being overwritten; pos-
sible uninitialized data in a string comparison; memory corruption in replication slaves when switching databases; syscall()
write parameter pointing to an uninitialized byte. (Bug#19022, Bug#20579, Bug#20769, Bug#20783, Bug#20791)
Replication: A redundant table map event could be generated in the binary log when there were no actual changes to a table being
replicated. In addition, a slave failed to stop when attempting to replicate a table that did not exist on the slave. (Bug#18948)
Replication: Row-based replication failed when the query cache was enabled on the slave. (Bug#17620)
MySQL Change History
2976
Replication: Compilation on Windows would fail if row based replication was disabled using -
-without-row-based-replication. (Bug#16837)
Replication: An invalid GRANT statement for which Ok was returned on a replication master caused an error on the slave and rep-
lication to fail. (Bug#6774)
Disk Data: On some platforms, ndbd compiled with gcc 4 would crash when attempting to run CREATE LOGFILE GROUP.
(Bug#21981)
Disk Data: Trying to create a Disk Data table using a nonexistent tablespace or to drop a nonexistent data file from a tablespace
produced an uninformative error message. (Bug#21751)
Disk Data: Errors could occur when dropping a data file during a node local checkpoint. (Bug#21710)
Disk Data: Creating a tablespace and log file group, then attempting to restart the cluster without using the --initial option and
without having created any Disk Data tables could cause a forced shutdown of the cluster and raise a configuration error.
(Bug#21172)
Disk Data: mysqldump did not back up tablespace or log file group information for Disk Data tables correctly.
Specifically, UNDO_BUFFER_SIZE and INITIAL_SIZE values were misreported. This meant that trying to restore from such a
backup would produce error 1296: GOT ERROR 1504 'OUT OF LOGBUFFER MEMORY' FROM NDB. (Bug#20809)
Disk Data: Running a large number of scans on Disk Data could cause subsequent scans to perform poorly. (Bug#20334)
Disk Data: INFORMATION_SCHEMA.FILES records for UNDO files showed incorrect values in the EXTENT_SIZE,
FREE_EXTENTS, and TOTAL_EXTENTS columns. (Bug#20073)
Disk Data: A data file created for one tablespace could be dropped using ALTER TABLESPACE ... DROP DATAFILE using a
different tablespace. (Bug#20053)
Disk Data: Trying to create Disk Data tables when running the cluster in diskless mode caused cluster data nodes to crash.
Note
Disk Data tables are now disabled when running in diskless mode.
(Bug#20008)
Disk Data: An issue with disk allocation could sometimes cause a forced shutdown of the cluster when running a mix of memory
and Disk Data tables. (Bug#18780)
Disk Data: The failure of a CREATE TABLESPACE or CREATE LOGFILE GROUP statement did not revert all changes made
prior to the point of failure. (Bug#16341)
Cluster Replication: One or more of the mysqld processes could fail when subjecting a Cluster replication setup with multiple
mysqld processes on both the master and slave clusters to high loads. (Bug#19768)
Cluster API: The storage/ndb directory was missing from the server binary distribution, making it impossible to compile NDB
API and MGM API applications. This directory can be found as /usr/include/storage/ndb after installing that distribu-
tion. (Bug#21955)
Cluster API: Invoking the MGM API function ndb_mgm_listen_event() caused a memory leak. (Bug#21671)
Cluster API: The inclusion of my_config.h in NdbApi.h required anyone wishing to write NDB API applications against
MySQL 5.1 to have a complete copy of the 5.1 sources. (Bug#21253)
Cluster API: The MGM API function ndb_logevent_get_fd() was not implemented. (Bug#21129)
Cluster API: The NdbOperation::getBlobHandle() method, when called with the name of a nonexistent column, caused a
segmentation fault. (Bug#21036)
ALTER EVENT statements including only a COMMENT clause failed with a syntax error on two platforms: Linux for S/390, and OS
X 10.4 for 64-bit PPC. (Bug#23423)
When event_scheduler was set to DISABLED, its value was not displayed correctly by SHOW VARIABLES or SELECT
MySQL Change History
2977
@@global.event_scheduler. (Bug#22662)
ALTER EVENT in the body of a stored procedure led to a crash when the procedure was called. This affected only those ALTER
EVENT statements which changed the interval of the event. (Bug#22397)
The optimizer could make an incorrect index choice for indexes with a skewed key distribution. (Bug#22393)
Deleting entries from a large MyISAM index could cause index corruption when it needed to shrink. Deletes from an index can hap-
pen when a record is deleted, when a key changes and must be moved, and when a key must be un-inserted because of a duplicate
key. This can also happen in REPAIR TABLE when a duplicate key is found and in myisamchk when sorting the records by an
index. (Bug#22384)
Instance Manager had a race condition involving mysqld PID file removal. (Bug#22379)
yaSSL had a conflicting definition for socklen_t on hurd-i386 systems. (Bug#22326)
Conversion of values inserted into a BIT column could affect adjacent columns. (Bug#22271)
Some Linux-x86_64-icc packages (of previous releases) mistakenly contained 32-bit binaries. Only ICC builds are affected, not
gcc builds. Solaris and FreeBSD x86_64 builds are not affected. (Bug#22238)
mysql_com.h unnecessarily referred to the ulong type. (Bug#22227)
The source distribution would not build on Windows due to a spurious dependency on ib_config.h. (Bug#22224)
Execution of a prepared statement that uses an IN subquery with aggregate functions in the HAVING clause could cause a server
crash. (Bug#22085)
The CSV storage engine failed to detect some table corruption. (Bug#22080)
Using GROUP_CONCAT() on the result of a subquery in the FROM clause that itself used GROUP_CONCAT() could cause a server
crash. (Bug#22015)
Running SHOW MASTER LOGS at the same time as binary log files were being switched would cause mysqld to hang.
(Bug#21965)
libmysqlclient defined a symbol BN_bin2bn which belongs to OpenSSL. This could break applications that also linked
against OpenSSL's libcrypto library. The fix required correcting an error in a build script that was failing to add rename macros
for some functions. (Bug#21930)
character_set_results can be NULL to signify no conversion, but some code did not check for NULL, resulting in a serv-
er crash. (Bug#21913)
A misleading error message was displayed when attempting to define a unique key that was not valid for a partitioned table.
(Bug#21862)
A query that used GROUP BY and an ALL or ANY quantified subquery in a HAVING clause could trigger an assertion failure.
(Bug#21853)
An InnoDB mutex was not aquired and released under the same condition, leading to deadlock in some rare situations involving
XA transactions. (Bug#21833)
A NUL byte within a prepared statement string caused the rest of the string not to be written to the query log, allowing logging to be
bypassed. (Bug#21813)
COUNT(*) queries with ORDER BY and LIMIT could return the wrong result.
Note
This problem was introduced by the fix for Bug#9676, which limited the rows stored in a temporary table to the LIMIT
clause. This optimization is not applicable to nongroup queries with aggregate functions. The current fix disables the op-
timization in such cases.
(Bug#21787)
Using DROP TABLE with concurrent queries causes mysqld to crash. (Bug#21784)
MySQL Change History
2978
INSERT ... SELECT sometimes generated a spurious Column count doesn't match value count error.
(Bug#21774)
UPGRADE was treated as a reserved word, although it is not. (Bug#21772)
A function result in a comparison was replaced with a constant by the optimizer under some circumstances when this optimization
was invalid. (Bug#21698)
Selecting from INFORMATION_SCHEMA.FILES could crash the server. (Bug#21676)
Errors could be generated during the execution of certain prepared statements that ran queries on partitioned tables. (Bug#21658)
The presence of a subquery in the ON clause of a join in a view definition prevented the MERGE algorithm from being used for the
view in cases where it should be allowed. (Bug#21646)
When records are merged from the insert buffer and the page needs to be reorganized, InnoDB used incorrect column length in-
formation when interpreting the records of the page. This caused a server crash due to apparent corruption of secondary indexes in
ROW_FORMAT=COMPACT that contain prefix indexes of fixed-length columns. Data files should not be corrupted, but the crash was
likely to repeat every time the server was restarted. (Bug#21638)
For character sets having a mbmaxlen value of 2, any ALTER TABLE statement changed TEXT columns to MEDIUMTEXT.
(Bug#21620)
mysql displayed an empty string for NULL values. (Bug#21618)
Selecting from a MERGE table could result in a server crash if the underlying tables had fewer indexes than the MERGE table itself.
(Bug#21617, Bug#22937)
A loaded storage engine plugin did not load after a server restart. (Bug#21610)
For INSERT ... ON DUPLICATE KEY UPDATE, use of VALUES(col_name) within the UPDATE clause sometimes was
handled incorrectly. (Bug#21555)
Subqueries with aggregate functions but no FROM clause could return incorrect results. (Bug#21540)
mysqldump incorrectly tried to use LOCK TABLES for tables in the INFORMATION_SCHEMA database. (Bug#21527)
The server could crash for the second execution of a function containing a SELECT statement that uses an aggregating IN subquery.
(Bug#21493)
Memory overruns could occur for certain kinds of subqueries. (Bug#21477)
A DATE can be represented as an integer (such as 20060101) or as a string (such as '2006.01.01'). When a DATE (or TIME)
column is compared in one SELECT against both representations, constant propagation by the optimizer led to comparison of DATE
as a string against DATE as an integer. This could result in integer comparisons such as 2006 against 20060101, erroneously pro-
ducing a false result. (Bug#21475)
myisam_ftdump produced bad counts for common words. (Bug#21459)
Adding ORDER BY to a SELECT DISTINCT(expr) query could produce incorrect results. (Bug#21456)
The URL into the online manual that is printed in the stack trace message by the server was out of date. (Bug#21449)
Database and table names have a maximum length of 64 characters (even if they contain multi-byte characters), but were truncated
to 64 bytes.
Note
An additional fix was made in MySQL 5.1.18.
(Bug#21432)
With max_sp_recursion set to 0, a stored procedure that executed a SHOW CREATE PROCEDURE statement for itself
triggered a recursion limit exceeded error, though the statement involves no recursion. (Bug#21416)
After FLUSH TABLES WITH READ LOCK followed by UNLOCK TABLES, attempts to drop or alter a stored routine failed with
MySQL Change History
2979
an error that the routine did not exist, and attempts to execute the routine failed with a lock conflict error. (Bug#21414)
On 64-bit Windows, a missing table generated error 1017, not the correct value of 1146. (Bug#21396)
Table aliases in multiple-table DELETE statements sometimes were not resolved. (Bug#21392)
The optimizer sometimes produced an incorrect row-count estimate after elimination of const tables. This resulted in choosing ex-
tremely inefficient execution plans in same cases when distribution of data in joins were skewed. (Bug#21390)
For multiple-table UPDATE statements, storage engines were not notified of duplicate-key errors. (Bug#21381)
Using relative paths for DATA DIRECTORY or INDEX DIRECTORY with a partitioned table generated a warning rather than an
error, and caused junk files to be created in the server's data directory. (Bug#21350)
Using EXPLAIN PARTITIONS with a query on a table whose partitioning expression was based on the value of a DATE column
could sometimes cause the server to crash. (Bug#21339)
The feature of being able to recover a temporary table named #sql_id in InnoDB by creating a table named
rsql_id_recover_innodb_tmp_table was broken by the introduction of the new identifier encoding in MySQL 5.1.6
(Bug#21313)
It was possible for a stored routine with a non-latin1 name to cause a stack overrun. (Bug#21311)
A query result could be sorted improperly when using ORDER BY for the second table in a join. (Bug#21302)
Query results could be incorrect if the WHERE clause contained t.key_part NOT IN (val_list), where val_list is a
list of more than 1000 constants. (Bug#21282)
Queries that used the index_merge and sort_union methods to access an InnoDB table could produce inaccurate results.
This issue was introduced in MySQL 5.1.10 when a new handler and bitmap interface was implemented. (Bug#21277)
For user-defined functions created with CREATE FUNCTION, the DEFINER clause is not legal, but no error was generated.
(Bug#21269)
The SELECT privilege was required for an insert on a view, instead of the INSERT privilege. (Bug#21261)
This regression was introduced by Bug#20989.
mysql_config --libmysqld-libs did not produce any SSL options necessary for linking libmysqld with SSL support
enabled. (Bug#21239)
Subqueries on INFORMATION_SCHEMA tables could erroneously return an empty result. (Bug#21231)
mysql_upgrade created temporary files in a possibly insecure way. (Bug#21224)
When DROP DATABASE or SHOW OPEN TABLES was issued while concurrently in another connection issuing DROP TABLE,
RENAME TABLE, CREATE TABLE LIKE or any other statement that required a name lock, the server crashed. (Bug#21216,
Bug#19403)
The --master-data option for mysqldump requires certain privileges, but mysqldump generated a truncated dump file
without producing an appropriate error message or exit status if the invoking user did not have those privileges. (Bug#21215)
Using ALTER TABLE ... REORGANIZE PARTITIONS to reduce the number of subpartitions to 1 caused the server to crash.
(Bug#21210)
In the package of pre-built time zone tables that is available for download at http://dev.mysql.com/downloads/timezones.html, the
tables now explicitly use the utf8 character set so that they work the same way regardless of the system character set value.
(Bug#21208)
Under heavy load (executing more than 1024 simultaneous complex queries), a problem in the code that handles internal temporary
tables could lead to writing beyond allocated space and memory corruption.
Use of more than 1024 simultaneous cursors server wide also could lead to memory corruption. This applies to both stored proced-
ure cursors and C API cursors. (Bug#21206)
When run with the --use-threads option, mysqlimport returned a random exit code. (Bug#21188)
MySQL Change History
2980
A subquery that uses an index for both the WHERE and ORDER BY clauses produced an empty result. (Bug#21180)
Running SHOW TABLE STATUS on any InnoDB table having at least one record could crash the server. Note that this was not
due to any issue in the InnoDB storage engine, but rather with AUTO_INCREMENT handling in the partitioning code however,
the table did not have to have an AUTO_INCREMENT column for the bug to manifest. (Bug#21173)
Some prepared statements caused a server crash when executed a second time. (Bug#21166)
The optimizer assumed that if (a=x AND b=x) is true, (a=x AND b=x) AND a=b is also true. But that is not always so if a
and b have different data types. (Bug#21159)
Some ALTER TABLE statements affecting a table's subpartitioning could hang. (Bug#21143)
Certain malformed INSERT statements could crash the mysql client. (Bug#21142)
SHOW INNODB STATUS contained some duplicate output. (Bug#21113)
InnoDB was slow with more than 100,000 .idb files. (Bug#21112)
Creating a TEMPORARY table with the same name as an existing table that was locked by another client could result in a lock con-
flict for DROP TEMPORARY TABLE because the server unnecessarily tried to acquire a name lock. (Bug#21096)
Performing an INSERT on a view that was defined using a SELECT that specified a collation and a column alias caused the server
to crash . (Bug#21086)
Incorrect results could be obtained from re-execution of a parametrized prepared statement or a stored routine with a SELECT that
uses LEFT JOIN with a second table having only one row. (Bug#21081)
ALTER VIEW did not retain existing values of attributes that had been originally specified but were not changed in the ALTER
VIEW statement. (Bug#21080)
The myisam_stats_method variable was mishandled when set from an option file or on the command line. (Bug#21054)
With query_cache_type set to 0, RESET QUERY CACHE was very slow and other threads were blocked during the operation.
Now a cache reset is faster and nonblocking. (Bug#21051)
mysql crashed for very long arguments to the connect command. (Bug#21042)
When creating a table using CREATE...SELECT and a stored procedure, there would be a mismatch between the binary log and
transaction cache which would cause a server crash. (Bug#21039)
A query using WHERE column = constant OR column IS NULL did not return consistent results on successive invoca-
tions. The column in each part of the WHERE clause could be either the same column, or two different columns, for the effect to be
observed. (Bug#21019)
mysqldump sometimes did not select the correct database before trying to dump views from it, resulting in an empty result set that
caused mysqldump to die with a segmentation fault. (Bug#21014)
Performance during an import on a table with a trigger that called a stored procedure was severely degraded. (Bug#21013)
mysql_upgrade produced a malformed upgrade_defaults file by overwriting the [client] group header with a pass-
word option. This prevented mysqlcheck from running successfully when invoked by mysql_upgrade. (Bug#21011)
A query of the form shown here caused the server to crash:
SELECT * FROM t1 NATURAL JOIN (
t2 JOIN (
t3 NATURAL JOIN t4,
t5 NATURAL JOIN t6
)
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5)
);
(Bug#21007)
A SELECT that used a subquery in the FROM clause that did not select from a table failed when the subquery was used in a join.
(Bug#21002)
MySQL Change History
2981
REPLACE ... SELECT for a view required the INSERT privilege for tables other than the table being modified. (Bug#20989)
STR_TO_DATE() sometimes would return NULL if the %D format specifier was not the last specifier in the format string.
(Bug#20987)
A query using WHERE NOT (column < ANY (subquery)) yielded a different result from the same query using the same
column and subquery with WHERE (column > ANY (subquery)). (Bug#20975)
Under certain circumstances, AVG(key_val) returned a value but MAX(key_val) returned an empty set due to incorrect ap-
plication of MIN()/MAX() optimization. (Bug#20954)
Closing of temporary tables failed if binary logging was not enabled. (Bug#20919)
Use of zero-length variable names caused a server crash. (Bug#20908)
Building mysql on Windows with CMake 2.4 would fail to create libmysqld correctly. (Bug#20907)
Creating a partitioned table that used the InnoDB storage engine and then restarting mysqld with --skip-innodb caused
MySQL to crash. (Bug#20871)
For certain queries, the server incorrectly resolved a reference to an aggregate function and crashed. (Bug#20868)
If the binary logging format was changed between the times when a locked table was modified and when it was unlocked, the binary
log contents were incorrect. (Bug#20863)
It was possible to provide the ExtractValue() function with input containing tags that were not valid XML; for example, it
was possible to use tag names beginning with a digit, which are disallowed by the W3C's XML 1.0 specification. Such cases caused
the function to return junk output rather than an error message signalling the user as to the true nature of the problem.
(Bug#20854)
InnoDB (Partitioning): Updating an InnoDB table using HASH partitioning with a composite primary key would cause the server
to hang. (Bug#20852)
mysqldump did not add version-specific comments around WITH PARSER and TABLESPACE ... STORAGE DISK clauses
for CREATE TABLE statements, causing dump files from servers where these features were in use to fail when loaded into older
servers. (Bug#20841)
For multiple INSERT DELAYED statements executed in a batch by the delayed-insert handler thread, not all rows were written to
the binary log. (Bug#20821)
The ExtractValue() function did not accept XML tag names containing a period (.) character. (Bug#20795)
Using aggregate functions in subqueries yielded incorrect results under certain circumstances due to incorrect application of
MIN()/MAX() optimization. (Bug#20792)
On Windows, inserting into a MERGE table after renaming an underlying MyISAM table caused a server crash. (Bug#20789)
Within stored routines, some error messages were printed incorrectly. A nonnull-terminated string was passed to a message-printing
routine that expected a null-terminated string. (Bug#20778)
Merging multiple partitions having subpartitions into a single partition with subpartitions, or splitting a single partition having sub-
partitions into multiple partitions with subpartitions, could sometimes crash the server. These issues were associated with a failure
reported in the partition_range test. (Bug#20767, Bug#20893, Bug#20766, Bug#21357)
Searches against a ZEROFILL column of a partitioned table could fail when the ZEROFILL column was part of the table's parti-
tioning key. (Bug#20733)
If a column definition contained a character set declaration, but a DEFAULT value began with an introducer, the introducer character
set was used as the column character set. (Bug#20695)
An UPDATE that referred to a key column in the WHERE clause and activated a trigger that modified the column resulted in a loop.
(Bug#20670)
Issuing a SHOW CREATE FUNCTION or SHOW CREATE PROCEDURE statement without sufficient privileges could crash the
mysql client. (Bug#20664)
MySQL Change History
2982
INSERT DELAYED did not honor SET INSERT_ID or the auto_increment_* system variables. (Bug#20627, Bug#20830)
A buffer overwrite error in Instance Manager caused a crash. (Bug#20622)
Loading a plugin caused any an existing plugin with the same name to be lost. (Bug#20615)
A query selecting records from a single partition of a partitioned table and using ORDER BY ic DESC (where ic represents an
indexed column) could cause errors or crash the server. (Bug#20583)
If the auto_increment_offset setting causes MySQL to generate a value larger than the column's maximum possible value,
the INSERT statement is accepted in strict SQL mode, whereas but should fail with an error. (Bug#20573)
In a view defined with SQL SECURITY DEFINER, the CURRENT_USER() function returned the invoker, not the definer.
(Bug#20570)
The fill_help_tables.sql file did not contain a SET NAMES 'utf8' statement to indicate its encoding. This caused
problems for some settings of the MySQL character set such as big5. (Bug#20551)
Scheduled events that invoked stored procedures executing DDL operations on partitioned tables could crash the server.
(Bug#20548)
Users who had the SHOW VIEW privilege for a view and privileges on one of the view's base tables could not see records in IN-
FORMATION_SCHEMA tables relating to the base table. (Bug#20543)
The fill_help_tables.sql file did not load properly if the ANSI_QUOTES SQL mode was enabled. (Bug#20542)
The MD5(), SHA1(), and ENCRYPT() functions should return a binary string, but the result sometimes was converted to the char-
acter set of the argument. MAKE_SET() and EXPORT_SET() now use the correct character set for their default separators, result-
ing in consistent result strings which can be coerced according to normal character set rules. (Bug#20536)
If a partitioned InnoDB table contained an AUTO_INCREMENT column, a SHOW statement could cause an assertion failure with
more than one connection. (Bug#20493)
Using EXPLAIN PARTITIONS with a UNION query could crash the server. This could occur whether or not the query actually
used any partitioned tables. (Bug#20484)
Creation of a view as a join of views or tables could fail if the views or tables are in different databases. (Bug#20482)
SELECT statements using GROUP BY against a view could have missing columns in the output when there was a trigger defined on
one of the base tables for the view. (Bug#20466)
For connections that required a SUBJECT value, a check was performed to verify that the value was correct, but the connection was
not refused if not. (Bug#20411)
mysql_upgrade was missing from binary MySQL distributions. (Bug#20403, Bug#18516, Bug#20556)
Some user-level errors were being written to the server's error log, which is for server errors. (Bug#20402)
Using ALTER TABLE ... ENGINE = x, where x was not a storage engine supported by the server, would cause mysqld to
crash. (Bug#20397)
User names have a maximum length of 16 characters (even if they contain multi-byte characters), but were being truncated to 16
bytes. (Bug#20393)
Some queries using ORDER BY ... DESC on subpartitioned tables could crash the server. (Bug#20389)
mysqlslap did not enable the CLIENT_MULTI_RESULTS flag when connecting, which is necessary for executing stored pro-
cedures. (Bug#20365)
Queries using an indexed column as the argument for the MIN() and MAX() functions following an ALTER TABLE .. DIS-
ABLE KEYS statement returned GOT ERROR 124 FROM STORAGE ENGINE until ALTER TABLE ... ENABLE KEYS was run
on the table. (Bug#20357)
When a statement used a stored function that inserted into an AUTO_INCREMENT column, the generated AUTO_INCREMENT
value was not written into the binary log, so a different value could in some cases be inserted on the slave. (Bug#20341)
MySQL Change History
2983
Partitions were represented internally as the wrong data type, which led in some cases to failures of queries such as SELECT
COUNT(*) FROM INFORMATION_SCHEMA.PARTITIONS WHERE PARTITION_NAME = 'partition_name'.
(Bug#20340)
PROCEDURE ANALYSE() returned incorrect values of M FLOAT(M, D) and DOUBLE(M, D). (Bug#20305)
Defining a table partitioned by LIST with a single PARTITION ... VALUES IN (NULL) clause could lead to server crashes,
particularly with queries having WHERE conditions comparing the partitioning key with a constant. (Bug#20268, Bug#19801)
Partition pruning could cause incorrect results from queries, such missing rows, when the partitioning expression relied on a BI-
GINT UNSIGNED column. (Bug#20257)
For a MyISAM table locked with LOCK TABLES ...WRITE, queries optimized using the index_merge method did not show
rows inserted with the lock in place. (Bug#20256)
mysqldump produced a malformed dump file when dumping multiple databases that contained views. (Bug#20221)
Running InnoDB with many concurrent threads could cause memory corruption and a seg fault due to a bug introduced in MySQL
5.1.11. (Bug#20213)
SUBSTRING() results sometimes were stored improperly into a temporary table when multi-byte character sets were used.
(Bug#20204)
The thread for INSERT DELAYED rows was maintaining a separate AUTO_INCREMENT counter, resulting in incorrect values be-
ing assigned if DELAYED and non-DELAYED inserts were mixed. (Bug#20195)
The --default-storage-engine server option did not work. (Bug#20168)
For a table having LINEAR HASH subpartitions, the LINEAR keyword did not appear in the SUBPARTITION_METHOD column
of the INFORMATION_SCHEMA.PARTITIONS table. (Bug#20161)
For a DATE parameter sent via a MYSQL_TIME data structure, mysql_stmt_execute() zeroed the hour, minute, and second
members of the structure rather than treating them as read-only. (Bug#20152)
perror crashed on Solaris due to NULL return value of strerror() system call. (Bug#20145)
FLUSH TABLES followed by a LOCK TABLES statement to lock a log table and a nonlog table caused an infinite loop and high
CPU use. Now FLUSH TABLES ignores log tables. To flush the log tables, use FLUSH LOGS instead. (Bug#20139)
On Linux, libmysqlclient when compiled with yaSSL using the icc compiler had a spurious dependency on C++ libraries.
(Bug#20119)
For an ENUM column that used the ucs2 character set, using ALTER TABLE to modify the column definition caused the default
value to be lost. (Bug#20108)
For mysql, escaping with backslash sometimes did not work. (Bug#20103)
Queries on tables that were partitioned by KEY and had a VARCHAR column as the partitioning key produced an empty result set.
(Bug#20086)
A number of dependency issues in the RPM bench and test packages caused installation of these packages to fail. (Bug#20078)
Use of MIN() or MAX() with GROUP BY on a ucs2 column could cause a server crash. (Bug#20076)
mysqld --flush failed to flush MyISAM table changes to disk following an UPDATE statement for which no updated column
had an index. (Bug#20060)
In MySQL 5.1.11, the --with-openssl and --with-yassl options were replaced by --with-ssl. But no message was is-
sued if the old options were given. Now configure produces a message indicating that the new option should be used and exits.
(Bug#20002)
When a statement is executed that does not generate any rows, an extra table map event and associated binrows event would be gen-
erated and written to the binary log. (Bug#19995)
Join conditions using index prefixes on utf8 columns of InnoDB tables incorrectly ignored rows where the length of the actual
value was greater than the length of the index prefix. (Bug#19960)
MySQL Change History
2984
AUTHORS and CONTRIBUTORS were not treated as reserved words. (Bug#19939)
The query command for mysqltest did not work. (Bug#19890)
Identifiers with embedded escape characters were not handled correctly by some SHOW statements due to some old code that was
doing some extra unescaping. (Bug#19874)
When executing a SELECT with ORDER BY on a view that is constructed from a SELECT statement containing a stored function,
the stored function was evaluated too many times. (Bug#19862)
Using SELECT on a corrupt MyISAM table using the dynamic record format could cause a server crash. (Bug#19835)
Using cursors with READ COMMITTED isolation level could cause InnoDB to crash. (Bug#19834)
CREATE DATABASE, RENAME DATABASE, and DROP DATABASE could deadlock in cases where there was a global read lock.
(Bug#19815)
The yaSSL library bundled with libmysqlclient had some conflicts with OpenSSL. Now macros are used to rename the con-
flicting symbols to have a prefix of ya. (Bug#19810)
The WITH CHECK OPTION was not enforced when a REPLACE statement was executed against a view. (Bug#19789)
Multiple-table updates with FEDERATED tables could cause a server crash. (Bug#19773)
On 64-bit systems, use of the cp1250 character set with a primary key column in a LIKE clause caused a server crash for patterns
having letters in the range 128..255. (Bug#19741)
make install tried to build files that should already have been built by make all, causing a failure if installation was per-
formed using a different account than the one used for the initial build. (Bug#19738)
InnoDB unlocked its data directory before committing a transaction, potentially resulting in nonrecoverable tables if a server crash
occurred before the commit. (Bug#19727)
An issue with yaSSL prevented Connector/J clients from connecting to the server using a certificate. (Bug#19705)
For a MyISAM table with a FULLTEXT index, compression with myisampack or a check with myisamchk after compression
resulted in table corruption. (Bug#19702)
The EGNINE clause was displayed in the output of SHOW CREATE TABLE for partitioned tables when the SQL mode included
no_table_options. (Bug#19695)
A cast problem caused incorrect results for prepared statements that returned float values when MySQL was compiled with gcc 4.0.
(Bug#19694)
EXPLAIN PARTITIONS would produce illegible output in the partitions column if the length of text to be displayed in that
column was too long. This could occur when very many partitions were defined for the table, partitions were given very long names,
or due to a combination of the two. (Bug#19684)
The mysql_list_fields() C API function returned the incorrect table name for views. (Bug#19671)
If a query had a condition of the form tableX.key = tableY.key , which participated in equality propagation and also was
used for ref access, then early ref-access NULL filtering was not performed for the condition. This could make query execution
slower. (Bug#19649)
Re-execution of a prepared multiple-table DELETE statement that involves a trigger or stored function can result in a server crash.
(Bug#19634)
File size specifications for InnoDB data files were case sensitive. (Bug#19609)
CHECK TABLE on a MyISAM table briefly cleared its AUTO_INCREMENT value, while holding only a read lock. Concurrent in-
serts to that table could use the wrong AUTO_INCREMENT value. CHECK TABLE no longer modifies the AUTO_INCREMENT
value. (Bug#19604)
Some yaSSL public function names conflicted with those from OpenSSL, causing conflicts for applications that linked against both
OpenSSL and a version of libmysqlclient that was built with yaSSL support. The yaSSL public functions now are renamed to
avoid this conflict. (Bug#19575)
MySQL Change History
2985
In the INFORMATION_SCHEMA.FILES table, the INITIAL_SIZE, MAXIMUM_SIZE, and AUTOEXTEND_SIZE columns in-
correctly were being stored as VARCHAR rather than BIGINT. . (Bug#19544)
InnoDB failed to increment the handler_read_prev counter. (Bug#19542)
Portions of statements related to partitioning were not surrounded by version-specific comments by mysqldump, breaking back-
ward compatibility for dump files. (Bug#19488)
Repeated DROP TABLE statements in a stored procedure could sometimes cause the server to crash. (Bug#19399)
Renaming a database to itself caused a server crash. (Bug#19392)
Race conditions on certain platforms could cause the Instance Manager to fail to initialize. (Bug#19391)
When not running in strict mode, the server failed to convert the invalid years portion of a DATE or DATETIME value to '0000'
when inserting it into a table.
Note
This fix was reverted in MySQL 5.1.18.
(Bug#19370)
See also Bug#25301.
Use of the --no-pager option caused mysql to crash. (Bug#19363)
Multiple calls to a stored procedure that altered a partitioned MyISAM table would cause the server to crash. (Bug#19309)
ALTER TABLE ... COALESCE PARTITION did not delete the files associated with the partitions that were removed.
(Bug#19305)
Adding an index to a partitioned table that had been created using AUTO_INCREMENT = value caused the
AUTO_INCREMENT value to be reset. (Bug#19281)
Multiple-table DELETE statements containing a subquery that selected from one of the tables being modified caused a server crash.
(Bug#19225)
The final parenthesis of a CREATE INDEX statement occurring in a stored procedure was omitted from the binary log when the
stored procedure was called. (Bug#19207)
An ALTER TABLE operation that does not need to copy data, when executed on a table created prior to MySQL 4.0.25, could res-
ult in a server crash for subsequent accesses to the table. (Bug#19192)
SSL connections using yaSSL on OpenBSD could fail. (Bug#19191)
ALTER TABLE ... REBUILD PARTITION could cause the server to hang or crash. (Bug#19122)
Using ALTER TABLE on a subpartitioned table caused the server to crash. (Bug#19067)
Trying to execute a query having a WHERE clause using int_col = "string_value" OR int_col IS NULL on a parti-
tioned table whose partitioning or subpartitioning function used the integer column int_col would crash the server. (Bug#19055)
A SELECT with a subquery that was bound to the outer query over multiple columns returned different results when a constant was
used instead of one of the dependant columns. (Bug#18925)
It was possible using ALTER EVENT ... RENAME ... to move an event to a database on which the user did not have the
EVENT privilege. (Bug#18897)
When used in the DO clause of a CREATE EVENT statement, the statements CREATE EVENT, CREATE FUNCTION, and CRE-
ATE PROCEDURE caused the server to crash. (These statements are not permitted inside CREATE EVENT.) (Bug#18896,
Bug#16409)
BIT columns in a table could cause joins that use the table to fail. (Bug#18895)
The build process incorrectly tried to overwrite sql/lex_hash.h. This caused the build to fail when using a shadow link tree
MySQL Change History
2986
pointing to original sources that were owned by another account. (Bug#18888)
Setting myisam_repair_threads caused any repair operation on a MyISAM table to fail to update the cardinality of indexes,
instead making them always equal to 1. (Bug#18874)
The MySQL server startup script /etc/init.d/mysql (created from mysql.server) is now marked to ensure that the sys-
tem services ypbind, nscd, ldap, and NTP are started first (if these are configured on the machine). (Bug#18810)
InnoDB: Quoted Unicode identifiers were not handled correctly. This included names of tables, columns, and foreign keys.
(Bug#18800)
Intermediate tables created during the execution of an ALTER TABLE statement were visible in the output of SHOW TABLES.
(Bug#18775)
FEDERATED tables raised invalid duplicate key errors when attempting on one server to insert rows having the same primary key
values as rows that had been deleted from the linked table on the other server. (Bug#18764)
Memory used by scheduled events was not freed when the events were dropped. (Bug#18683)
The implementation for UNCOMPRESS() did not indicate that it could return NULL, causing the optimizer to do the wrong thing.
(Bug#18539)
Referring to a stored function qualified with the name of one database and tables in another database caused a table doesn't exist
error. (Bug#18444)
Identifiers could not contain bytes with a value of 255, though that should be allowed as of the identifier-encoding changes made in
MySQL 5.1.6. (Bug#18396)
Triggers on tables in the mysql database caused a server crash. Triggers for tables in this database now are disallowed.
(Bug#18361, Bug#18005)
Incorrect type aggregation for IN() and CASE expressions could lead to an incorrect result. (Bug#18360)
The length of the pattern string prefix for LIKE operations was calculated incorrectly for multi-byte character sets. As a result, the
scanned range was wider than necessary if the prefix contained any multi-byte characters, and rows could be missing from the result
set. (Bug#18359, Bug#16674)
On Windows, corrected a crash stemming from differences in Visual C runtime library routines from POSIX behavior regarding in-
valid file descriptors. (Bug#18275)
Linking the pthreads library to single-threaded MySQL libraries caused dlopen() to fail at runtime on HP-UX. (Bug#18267)
The source distribution failed to compile when configured with the --with-libwrap option. (Bug#18246)
On Windows, terminating mysqld with Control-C could result in a crash during shutdown. (Bug#18235)
Selecting data from a MEMORY table with a VARCHAR column and a HASH index over it returned only the first row matched.
(Bug#18233)
The use of MIN() and MAX() on columns with an index prefix produced incorrect results in some queries. (Bug#18206)
A UNION over more than 128 SELECT statements that use an aggregate function failed. (Bug#18175)
The optimizer did not take advantage of indexes on columns used for the second or third arguments of BETWEEN. (Bug#18165)
Performing INSERT ... SELECT ... JOIN ... USING without qualifying the column names caused ERROR 1052
"column 'x' in field list is ambiguous" even in cases where the column references were unambiguous.
(Bug#18080)
An update that used a join of a table to itself and modified the table on both sides of the join reported the table as crashed.
(Bug#18036)
Race conditions on certain platforms could cause the Instance Manager to try to restart the same instance multiple times.
(Bug#18023)
Changing the definition of a DECIMAL column with ALTER TABLE caused loss of column values. (Bug#18014)
MySQL Change History
2987
For table-format output, mysql did not always calculate columns widths correctly for columns containing multi-byte characters in
the column name or contents. (Bug#17939)
The character set was not being properly initialized for CAST() with a type like CHAR(2) BINARY, which resulted in incorrect
results or even a server crash. (Bug#17903)
Checking a MyISAM table (using CHECK TABLE) having a spatial index and only one row would wrongly indicate that the table
was corrupted. (Bug#17877)
For a reference to a nonexistent index in FORCE INDEX, the error message referred to a column, not an index. (Bug#17873)
A stored procedure that created and invoked a prepared statement was not executed when called in a mysqld init-file. (Bug#17843)
It is possible to create MERGE tables into which data cannot be inserted (by not specifying a UNION clause. However, when an in-
sert was attempted, the error message was confusing. Now an error occurs indicating that the table is read-only. (Bug#17766)
Attempting to insert a string of greater than 4096 bytes into a FEDERATED table resulted in the error ERROR 1296 (HY000) AT
LINE 2: GOT ERROR 10000 'ERROR ON REMOTE SYSTEM: 1054: UNKNOWN COLUMN 'STRING-VALUE' FROM FEDERATED.
This error was raised regardless of the type of column involved (VARCHAR, TEXT, and so on.) (Bug#17608)
If a file name was specified for the --log or --log-slow-queries options but the server was logging to tables and not files,
the server produced no error message. (Bug#17599)
If the general log table reached a large enough file size (27GB), SELECT COUNT(*) on the table caused a server crash.
(Bug#17589)
Using the extended syntax for TRIM() that is, TRIM(... FROM ...) in a SELECT statement defining a view caused an
invalid syntax error when selecting from the view. (Bug#17526)
Use of the --prompt option or prompt command caused mysql to be unable to connect to the Instance Manager. (Bug#17485)
OPTIMIZE TABLE and REPAIR TABLE yielded incorrect messages or warnings when used on partitioned tables. (Bug#17455)
mysqldump would not dump views that had become invalid because a table named in the view definition had been dropped. In-
stead, it quit with an error message. Now you can specify the --force option to cause mysqldump to keep going and write an
SQL comment containing the view definition to the dump output. (Bug#17371)
N'xxx' and _utf8'xxx' were not treated as equivalent because N'xxx' failed to unescape backslashes (\) and doubled apo-
strophe/single quote characters (''). (Bug#17313)
Following a failed attempt to add an index to an ARCHIVE table, it was no longer possible to drop the database in which the table
had been created. (Bug#17310)
Assignments of values to variables of type TEXT were handled incorrectly in stored routines. (Bug#17225)
Views created from prepared statements inside of stored procedures were created with a definition that included both SQL_CACHE
and SQL_NO_CACHE. (Bug#17203)
mysqldump wrote an extra pair of DROP DATABASE and CREATE DATABASE statements if run with the -
-add-drop-database option and the database contained views. (Bug#17201)
A TABLE ... DOESN'T EXIST error could occur for statements that called a function defined in another database. (Bug#17199)
A prepared statement that altered partitioned table within a stored procedure failed with the error UNKNOWN PREPARED STATEMENT
HANDLER. (Bug#17138)
myisam_ftdump would fail when trying to open a MyISAM index file that you did not have write permissions to access, even
though the command would only be reading from the file. (Bug#17122)
ALTER TABLE on a table created prior to 5.0.3 would cause table corruption if the ALTER TABLE did one of the following:
Change the default value of a column.
Change the table comment.
Change the table password.
MySQL Change History
2988
(Bug#17001)
For statements that have a DEFINER clause such as CREATE TRIGGER or CREATE VIEW, long user names or host names could
cause a buffer overflow. (Bug#16899)
The PASSWORD() function returned invalid results when used in some UNION queries. (Bug#16881)
ORDER BY RAND() LIMIT 1 always set a user variable to the last possible value from the table. (Bug#16861)
Queries containing a subquery that used aggregate functions could return incorrect results. (Bug#16792)
Concatenating the results of multiple constant subselects produced incorrect results. (Bug#16716)
When performing a GROUP_CONCAT(), the server transformed BLOB columns VARCHAR columns, which could cause erroneous
results when using Connector/J and possibly other MySQL APIs. (Bug#16712)
Stored procedures did not use the character set defined for the database in which they were created. (Bug#16676)
Some server errors were not reported to the client, causing both to try to read from the connection until a hang or crash resulted.
(Bug#16581)
If the files for an open table were removed at the OS level (external to the server), the server exited with an assertion failure.
(Bug#16532)
On Windows, a definition for mysql_set_server_option() was missing from the C client library. (Bug#16513)
mysqlcheck tried to check views instead of ignoring them. (Bug#16502)
Updating a column of a FEDERATED table to NULL sometimes failed. (Bug#16494)
For SELECT ... FOR UPDATE statements that used DISTINCT or GROUP BY over all key parts of a unique index (or primary
key), the optimizer unnecessarily created a temporary table, thus losing the linkage to the underlying unique index values. This
caused a Result set not updatable error. (The temporary table is unnecessary because under these circumstances the dis-
tinct or grouped columns must also be unique.) (Bug#16458)
A scheduled event that took longer to execute than the length of time scheduled between successive executions could skip execu-
tions. For example, an event defined with EVERY 1 SECOND but which required longer than 1 second to complete might be
executed only once every 2 seconds. (Bug#16417)
A subselect used in the ON SCHEDULE clause of a CREATE EVENT or ALTER EVENT statement caused the server to crash,
rather than producing an error as expected. (Bug#16394)
Grant table modifications sometimes did not refresh the in-memory tables if the host name was '' or not specified. (Bug#16297)
A subquery in the WHERE clause of the outer query and using IN and GROUP BY returned an incorrect result. (Bug#16255)
A query could produce different results with and without and index, if the WHERE clause contained a range condition that used an
invalid DATETIME constant. (Bug#16249)
TIMESTAMPDIFF() examined only the date and ignored the time when the requested difference unit was months or quarters.
(Bug#16226)
Using tables from MySQL 4.x in MySQL 5.x, in particular those with VARCHAR fields and using INSERT DELAYED to update
data in the table would result in either data corruption or a server crash. (Bug#16218, Bug#17294, Bug#16611)
The value returned by a stored function returning a string value was not of the declared character set. (Bug#16211)
The index_merge/Intersection optimizer could experience a memory overrun when the number of table columns covered
by an index was sufficiently large, possibly resulting in a server crash. (Bug#16201)
Row equalities (such as WHERE (a,b) = (c,d) were not taken into account by the optimizer, resulting in slow query execu-
tion. Now they are treated as conjunctions of equalities between row elements. (Bug#16081)
Some memory leaks in the libmysqld embedded server were corrected. (Bug#16017)
MySQL Change History
2989
Values greater than 2 gigabytes used in the VALUES LESS THAN clause of a table partitioned by RANGE were treated as negative
numbers. (Bug#16002)
A CREATE TABLE that produced a THE PARTITION FUNCTION RETURNS THE WRONG TYPE error also caused an INCORRECT
INFORMATION IN FILE to be printed to STDERR, and a junk file to be left in the database directory. (Bug#16000)
The max_length metadata value for columns created from CONCAT() could be incorrect when the collation of an argument
differed from the collation of the CONCAT() itself. In some contexts such as UNION, this could lead to truncation of the column
contents. (Bug#15962)
When NOW() was used in a BETWEEN clause of the definition for a view, it was replaced with a constant in the view. (Bug#15950)
The server's handling of the number of partitions or subpartitions specified in a PARTITIONS or SUBPARTITIONS clause was
changed. Beginning with this release, the number of partitions must:
be a positive, nonzero integer
not have any leading zeroes
not be an expression
Also beginning with this version, no attempt is made to convert, truncate, or evaluate a PARTITIONS or SUBPARTITIONS value;
instead, the CREATE TABLE or ALTER TABLE statement containing the PARTITIONS or SUBPARTITIONS clause now fails
with an appropriate error message. (Bug#15890)
Long multiple-row INSERT statements could take a very long time for some multi-byte character sets. (Bug#15811)
The C API failed to return a status message when invoking a stored procedure. (Bug#15752)
mysqlimport sends a set @@character_set_database=binary statement to the server, but this is not understood by
pre-4.1 servers. Now mysqlimport encloses the statement within a /*!40101 ... */ comment so that old servers will ig-
nore it. (Bug#15690)
DELETE with LEFT JOIN for InnoDB tables could crash the server if innodb_locks_unsafe_for_binlog was enabled.
(Bug#15650)
BIN(), OCT(), and CONV() did not work with BIT values. (Bug#15583)
Nested natural joins worked executed correctly when executed as a nonprepared statement could fail with an Unknown column
'col_name' in 'field list' error when executed as a prepared statement, due to a name resolution problem.
(Bug#15355)
The MD5() and SHA() functions treat their arguments as case-sensitive strings. But when they are compared, their arguments were
compared as case-insensitive strings, which leads to two function calls with different arguments (and thus different results) com-
pared as being identical. This can lead to a wrong decision made in the range optimizer and thus to an incorrect result set.
(Bug#15351)
Invalid escape sequences in option files caused MySQL programs that read them to abort. (Bug#15328)
SHOW GRANTS FOR CURRENT_USER did not return definer grants when executed in DEFINER context (such as within a stored
prodedure defined with SQL SECURITY DEFINER), it returned the invoker grants. (Bug#15298)
The --collation-server server option was being ignored. With the fix, if you choose a nondefault character set with -
-character-set-server, you should also use --collation-server to specify the collation. (Bug#15276)
Re-executing a stored procedure with a complex stored procedure cursor query could lead to a server crash. (Bug#15217)
The server crashed if it tried to access a CSV table for which the data file had been removed. (Bug#15205)
When using tables containing VARCHAR columns created under MySQL 4.1 with a 5.0 or later server, for some queries the metadata
sent to the client could have an empty column name. (Bug#14897)
An invalid comparison between keys with index prefixes over multi-byte character fields could lead to incorrect result sets if the se-
lected query execution plan used a range scan by an index prefix over a UTF8 character field. This also caused incorrect results un-
der similar circumstances with many other character sets. (Bug#14896)
MySQL Change History
2990
When setting a column to its implicit default value as the result of inserting a NULL into a NOT NULL column as part of a multi-
row insert or LOAD DATA operation, the server returned a misleading warning message. (Bug#14770)
For BOOLEAN mode full-text searches on nonindexed columns, NULL rows generated by a LEFT JOIN caused incorrect query res-
ults. (Bug#14708, Bug#25637)
The parser rejected queries that selected from a table twice using a UNION within a subquery. The parser now supports arbitrary
subquery, join, and parenthesis operations within EXISTS subqueries. A limitation still exists for scalar subqueries: If the subquery
contains UNION, the first SELECT of the UNION cannot be within parentheses. For example, SELECT (SELECT a FROM t1
UNION SELECT b FROM t2) will work, but SELECT ((SELECT a FROM t1) UNION (SELECT b FROM t2)) will
not. (Bug#14654)
Using SELECT and a table join while running a concurrent INSERT operation would join incorrect rows. (Bug#14400)
Prepared statements caused general log and server memory corruption. (Bug#14346)
The binary log lacked character set information for table names when dropping temporary tables. (Bug#14157)
libmysqld produced some warnings to stderr which could not be silenced. These warnings now are suppressed. (Bug#13717)
RPM packages had spurious dependencies on Perl modules and other programs. (Bug#13634)
InnoDB locking was improved by removing a gap lock for the case that you try to delete the same row twice within a transaction.
(Bug#13544)
REPLACE statements caused activation of UPDATE triggers, not DELETE and INSERT triggers. (Bug#13479)
The source distribution failed to compile when configured with the --without-geometry option. (Bug#12991)
With settings of read_buffer_size >= 2G and read_rnd_buffer_size >=2G, LOAD DATA INFILE failed with no er-
ror message or caused a server crash for files larger than 2GB. (Bug#12982)
A B-TREE index on a MEMORY table erroneously reported duplicate entry error for multiple NULL values. (Bug#12873)
Instance Manager didn't close the client socket file when starting a new mysqld instance. mysqld inherited the socket, causing
clients connected to Instance Manager to hang. (Bug#12751)
On Mac OS X, zero-byte read() or write() calls to an SMB-mounted file system could return a nonstandard return value, lead-
ing to data corruption. Now such calls are avoided. (Bug#12620)
DATE_ADD() and DATE_SUB() returned NULL when the result date was on the day '9999-12-31'. (Bug#12356)
For very complex SELECT statements could create temporary tables that were too large, and for which the temporary files were not
removed, causing subsequent queries to fail. (Bug#11824)
After an INSERT ... ON DUPLICATE KEY UPDATE statement that updated an existing row, LAST_INSERT_ID() could
return a value not in the table. (Bug#11460)
USE did not refresh database privileges when employed to re-select the current database. (Bug#10979)
The server returns a more informative error message when it attempts to open a MERGE table that has been defined to use non-My-
ISAM tables. (Bug#10974)
The type of the value returned by the VARIANCE() function varied according to the type of the input value. The function should
always return a DOUBLE value. (Bug#10966)
The same trigger error message was produced under two conditions: The trigger duplicated an existing trigger name, or the trigger
duplicated an existing combination of action and event. Now different messages are produced for the two conditions so as to be
more informative. (Bug#10946)
A locking safety check in InnoDB reported a spurious error STORED_SELECT_LOCK_TYPE IS 0 INSIDE ::START_STMT() for
INSERT ... SELECT statements in innodb_locks_unsafe_for_binlog mode. The safety check was removed.
(Bug#10746)
CREATE USER did not respect the 16-character user name limit. (Bug#10668)
MySQL Change History
2991
A server or network failure with an open client connection would cause the client to hang even though the server was no longer
available.
As a result of this change, the MYSQL_OPT_READ_TIMEOUT and MYSQL_OPT_WRITE_TIMEOUT options for
mysql_options() now apply to TCP/IP connections on all platforms. Previously, they applied only to Windows. (Bug#9678)
INSERT INTO ... SELECT ... LIMIT 1 could be slow because the LIMIT was ignored when selecting candidate rows.
(Bug#9676)
The optimizer could produce an incorrect result after AND with collations such as latin1_german2_ci, utf8_czech_ci,
and utf8_lithianian_ci. (Bug#9509)
The DATA DIRECTORY table option did not work for TEMPORARY tables. (Bug#8706)
A stored procedure with a CONTINUE handler that encountered an error continued to execute a statement that caused an error,
rather with the next statement following the one that caused the error. (Bug#8153)
For ODBC compatibility, MySQL supports use of WHERE col_name IS NULL for DATE or DATETIME columns that are NOT
NULL, to allow column values of '0000-00-00' or '0000-00-00 00:00:00' to be selected. However, this was not work-
ing for WHERE clauses in DELETE statements. (Bug#8143)
A user variable set to a value selected from an unsigned column was stored as a signed value. (Bug#7498)
The --with-collation option was not honored for client connections. (Bug#7192)
With TRADITIONAL SQL mode, assignment of out-of-bound values and rounding of assigned values was done correctly, but as-
signment of the same numbers represented as strings sometimes was handled differently. (Bug#6147)
On an INSERT into an updatable but noninsertable view, an error message was issued stating that the view was not updatable. Now
the message says the view is not insertable-into. (Bug#5505)
EXPLAIN sometimes returned an incorrect select_type for a SELECT from a view, compared to the select_type for the
equivalent SELECT from the base table. (Bug#5500)
Some queries that used ORDER BY and LIMIT performed quickly in MySQL 3.23, but slowly in MySQL 4.x/5.x due to an optim-
izer problem. (Bug#4981)
Incorporated portability fixes into the definition of __attribute__ in my_global.h. (Bug#2717)
User-created tables having a name beginning with #sql were not visible to SHOW TABLES and could collide with internal tempor-
ary table names. Now they are not hidden and do not collide. (Bug#1405)
C.1.27. Changes in MySQL 5.1.11 (26 May 2006)
This is a new Beta development release, fixing recently discovered bugs.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Incompatible Change: The Event Scheduler can now be in one of three states (on, off, or the new suspended state). In addition, due
to the fact that SET GLOBAL event_scheduler; now acts in a synchronous rather than asynchronous manner, the Event
Scheduler thread can be no longer be activated or deactivated at run time.
For more information regarding these changes, see Section 19.4.1, Event Scheduler Overview. (Bug#17619)
MySQL Cluster: The limit of 2048 ordered indexes per cluster has been lifted. There is now no upper limit on the number of
ordered indexes (including AUTO_INCREMENT columns) that may be used. (Bug#14509)
Added the log_queries_not_using_indexes system variable. (Bug#19616)
MySQL Change History
2992
Added the ssl_ca, ssl_capath, ssl_cert, ssl_cipher, and ssl_key system variables, which display the values given
via the corresponding command options. See Section 5.5.7.3, SSL Command Options. (Bug#19606)
The ENABLE KEYS and DISABLE KEYS clauses for the ALTER TABLE statement are now supported for partitioned tables.
(Bug#19502)
Added the --ssl-verify-server-cert option to MySQL client programs. This option causes the server's Common Name
value in its certificate to be verified against the host name used when connecting to the server, and the connection is rejected if there
is a mismatch. Added MYSQL_OPT_SSL_VERIFY_SERVER_CERT option for the mysql_options() C API function to en-
able this verification. This feature can be used to prevent man-in-the-middle attacks. Verification is disabled by default.
(Bug#17208)
The default for the innodb_thread_concurrency system variable was changed to 8. (Bug#15868)
It is now possible to use NEW.var_name values within triggers as INOUT parameters to stored procedures. (Bug#14635)
Added the --angel-pid-file option to mysqlmanager for specifying the file in which the angel process records its process
ID when mysqlmanager runs in daemon mode. (Bug#14106)
Previously, to build MySQL from source with SSL support enabled, you would invoke configure with either the -
-with-openssl or --with-yassl option. Those options both have been replaced by the --with-ssl option. By default, -
-with-ssl causes the bundled yaSSL library to be used. To select OpenSSL instead, give the option as --with-ssl=path ,
where path is the directory where the OpenSSL header files and libraries are located.
The mysql_get_ssl_cipher() C API function was added.
mysql_explain_log (a third-party program) is no longer included in MySQL distributions.
Bugs fixed:
Security Fix: An SQL-injection security hole has been found in multi-byte encoding processing. The bug was in the server, incor-
rectly parsing the string escaped with the mysql_real_escape_string() C API function.
This vulnerability was discovered and reported by Josh Berkus <[email protected]> and Tom Lane
<[email protected]> as part of the inter-project security collaboration of the OSDB consortium. For more information about
SQL injection, please see the following text.
Discussion. An SQL injection security hole has been found in multi-byte encoding processing. An SQL injection security hole can
include a situation whereby when a user supplied data to be inserted into a database, the user might inject SQL statements into the
data that the server will execute. With regards to this vulnerability, when character set-unaware escaping is used (for example, add-
slashes() in PHP), it is possible to bypass the escaping in some multi-byte character sets (for example, SJIS, BIG5 and GBK).
As a result, a function such as addslashes() is not able to prevent SQL-injection attacks. It is impossible to fix this on the serv-
er side. The best solution is for applications to use character set-aware escaping offered by a function such
mysql_real_escape_string().
However, a bug was detected in how the MySQL server parses the output of mysql_real_escape_string(). As a result,
even when the character set-aware function mysql_real_escape_string() was used, SQL injection was possible. This bug
has been fixed.
Workarounds. If you are unable to upgrade MySQL to a version that includes the fix for the bug in
mysql_real_escape_string() parsing, but run MySQL 5.0.1 or higher, you can use the NO_BACKSLASH_ESCAPES SQL
mode as a workaround. (This mode was introduced in MySQL 5.0.1.) NO_BACKSLASH_ESCAPES enables an SQL standard com-
patibility mode, where backslash is not considered a special character. The result will be that queries will fail.
To set this mode for the current connection, enter the following SQL statement:
SET sql_mode='NO_BACKSLASH_ESCAPES';
You can also set the mode globally for all clients:
SET GLOBAL sql_mode='NO_BACKSLASH_ESCAPES';
This SQL mode also can be enabled automatically when the server starts by using the command-line option -
MySQL Change History
2993
-sql-mode=NO_BACKSLASH_ESCAPES or by setting sql-mode=NO_BACKSLASH_ESCAPES in the server option file (for
example, my.cnf or my.ini, depending on your system). (Bug#8378, CVE-2006-2753)
See also Bug#8303.
Partitioning: MySQL Cluster: SELECT MIN(unique_column) from a Cluster table with user-defined partitioning crashed
the server. (Bug#18730)
MySQL Cluster: Replication: (Replication): Memory was not freed after some ALTER TABLE operations, which could cause
mysqld processes to crash. (Bug#19885)
MySQL Cluster: Running ALL START in the NDB management client or restarting multiple nodes simultaneously could under
some circumstances cause the cluster to crash. (Bug#19930)
MySQL Cluster: (NDBAPI): On big-endian platforms, NdbOperation::write_attr() did not update 32-bit fields cor-
rectly. (Bug#19537)
MySQL Cluster: TRUNCATE failed on tables having BLOB or TEXT columns with the error LOCK WAIT TIMEOUT EXCEEDED.
Note
This issue affected both in-memory and Disk Data tables.
(Bug#19201)
MySQL Cluster: ALTER TABLE ENGINE=... failed when used to change a MySQL Cluster table having no explicit primary
key to use a different storage engine.
Note
As a consequence of this fix, SHOW CREATE TABLE no longer displays auto-partitioning information for NDBCLUSTER
tables.
(Bug#19010)
MySQL Cluster: (NDBAPI): The Ndb::dropEventOperation() method failed to clean up all objects used, which could
cause memory leaks to occur. (Bug#17610)
MySQL Cluster: Using stale mysqld .FRM files could cause a newly-restored cluster to fail. This situation could arise when re-
starting a MySQL Cluster using the --initial option while leaving connected mysqld processes running. (Bug#16875)
MySQL Cluster: A Cluster whose storage nodes were installed from the MySQL-ndb-storage-* RPMs could not perform
CREATE or ALTER operations that made use of nondefault character sets or collations. (Bug#14918)
MySQL Cluster: Data node failures could cause excessive CPU usage by ndb_mgmd. (Bug#13987)
Replication: The embedded server crashed with row-based replication enabled. (Bug#18518)
Cluster Replication: mysqld processes did not always detect cluster shutdown, leading to issues with Cluster replication and
schema distribution. (Bug#19395)
The Data_free column in the output of SHOW TABLE STATUS always displayed 0 for partitioned tables. (Bug#19501)
Altering a VARCHAR column in a MyISAM table to make it longer could cause corruption of the following column. (Bug#19386)
In was not possible to invoke a stored routine containing dynamic SQL from a scheduled event. (Bug#19264)
Adding an index to a table created using partitioning by KEY and the MEMORY storage engine caused the server to crash.
(Bug#19140)
Use of uninitialized user variables in a subquery in the FROM clause resulted in invalid entries in the binary log. (Bug#19136)
A CREATE TABLE statement that created a table from a materialized view did not inherit default values from the underlying table.
(Bug#19089)
Premature optimization of nested subqueries in the FROM clause that refer to aggregate functions could lead to incorrect results.
MySQL Change History
2994
Bug#19077)
When creating a table using CREATE TABLE ... PARTITION BY ... SELECT ..., the partitioning clause was ignored.
(Bug#19062)
For dates with 4-digit year parts less than 200, an implicit conversion to add a century was applied for date arithmetic performed
with DATE_ADD(), DATE_SUB(), + INTERVAL, and - INTERVAL. (For example, DATE_ADD('0050-01-01
00:00:00', INTERVAL 0 SECOND) became '2050-01-01 00:00:00'.) Now these operations return NULL rather than
an incorrect non-NULL value. (Bug#18997)
BLOB or TEXT arguments to or values returned from stored functions were not copied properly if too long and could become
garbled. (Bug#18587)
The client libraries were not compiled for position-independent code on Solaris-SPARC and AMD x86_64 platforms. (Bug#18091,
Bug#13159, Bug#14202)
Returning the value of a system variable from a stored function caused a server crash. (Bug#18037)
Revised memory allocation for local objects within stored functions and triggers to avoid memory leak for repeated function or trig-
ger invocation. (Bug#17260)
Symlinking .mysql_history to /dev/null to suppress statement history saving by mysql did not work. (mysql deleted the
symlink and recreated .mysql_history as a regular file, and then wrote history to it.) (Bug#16803)
IS_USED_LOCK() could return an incorrect connection identifier. (Bug#16501)
Simultaneous scheduled events whose actions conflicted with one another could crash the server. (Bug#16428)
Concurrent reading and writing of privilege structures could crash the server. (Bug#16372)
The server no longer uses a signal handler for signal 0 because it could cause a crash on some platforms. (Bug#15869)
EXPLAIN ... SELECT INTO caused the client to hang. (Bug#15463)
CREATE TABLE ... SELECT ... statements that used a stored function explicitly or implicitly (through a view) resulted in a
Table not locked error. (Bug#15137, Bug#12472)
Display better error message for ALTER TABLE operations that will result in duplicate keys due to AUTO_INCREMENT resequen-
cing. (Bug#14573)
The result from CONV() is a string, but was not always treated the same way as a string when converted to a real value for an arith-
metic operation. (Bug#13975)
Within a trigger, SET used the SQL mode of the invoking statement, not the mode in effect at trigger creation time. (Bug#6951)
Corrected several problems with the treatment of the --log-error option by mysqld_safe. These problems were manifest as
differences from mysqld in error log handling.
If a file name was given for --log-error, mysqld_safe ignored it and did not pass it to mysqld, which then wrote error
information to stderr and resulted in incorrect log rotation when FLUSH LOGS was used.
mysql_safe now adds .err to the end of the file name if no extension is present (the same as mysqld).
mysqld_safe treated a relative path name as relative to its own current working directory. Now it treats a relative path name
as relative to the data directory (the same as mysqld).
In addition, some argument quoting problems were corrected. (Bug#6061)
The basedir and tmpdir system variables could not be accessed via @@var_name syntax. (Bug#1039)
mysqld_safe treated a relative path name as relative to its own current working directory. Now it treats a relative path name as
relative to the data directory (the same as mysqld).
mysql_safe now adds .err to the end of the file name if no extension is present (the same as mysqld).
If a file name was given for --log-error, mysqld_safe ignored it and did not pass it to mysqld, which then wrote error in-
MySQL Change History
2995
formation to stderr and resulted in incorrect log rotation when FLUSH LOGS was used.
The patch for Bug#8303 broke the fix for Bug#8378 and was reverted.
In string literals with an escape character (\) followed by a multi-byte character that had (\) as its second byte, the literal was not
interpreted correctly. Now only next byte now is escaped, and not the entire multi-byte character. This means it is a strict reverse of
the mysql_real_escape_string() function.
C.1.28. Changes in MySQL 5.1.10 (Not released)
Note
This was an internal release only, and no binaries were published.
MySQL 5.1.10 includes the patches for recently reported security vulnerabilites in the MySQL client-server protocol. We would like to
thank Stefano Di Paola <[email protected]> for finding and reporting these to us.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
Security Enhancement: Added the global max_prepared_stmt_count system variable to limit the total number of prepared
statements in the server. This limits the potential for denial-of-service attacks based on running the server out of memory by prepar-
ing huge numbers of statements. The current number of prepared statements is available through the prepared_stmt_count
system variable. (Bug#16365)
MySQL Cluster: It is now possible to restore a MySQL Cluster backup between big-endian and little-endian machines.
(Bug#19255)
MySQL Cluster: It is now possible to perform a partial start of a cluster. That is, it is now possible to bring up the cluster without
first running ndbd --initial on all configured data nodes. (Bug#18606)
MySQL Cluster: It is now possible to install MySQL with Cluster support to a nondefault location and change the search path for
font description files using either the --basedir or --character-sets-dir options. (Previously in MySQL 5.1, ndbd
searched only the default path for character sets.)
Packaging: The MySQL-shared-compat-5.1.X-.i386.rpm shared compatibility RPMs no longer contain libraries for
MySQL 5.0. This avoids a conflict because the 5.0 and 5.1 libraries share the same soname number. They now contain libraries for
MySQL 3.23, 4.0, 4.1, and 5.1. (Bug#19288)
SQL syntax for prepared statements now supports ANALYZE TABLE, OPTIMIZE TABLE, and REPAIR TABLE. (Bug#19308)
The ONLY_FULL_GROUP_BY SQL mode now also applies to the HAVING clause. That is, columns not named in the GROUP BY
clause cannot be used in the HAVING clause if not used in an aggregate function. (Bug#18739)
XPath expressions passed to the ExtractValue() and UpdateXML() functions can now include the colon character ( : ).
This enables use of these functions with XML which employs namespaces. (Bug#18170)
On Windows, some names such as nul, prn, and aux could not be used as file names because they are reserved as device names.
These are now allowable names in MySQL. They are encoded by appending @@@ to the name when the server creates the corres-
ponding file or directory. This occurs on all platforms for portability of the corresponding database object between platforms.
(Bug#17870)
The bundled yaSSL library was upgraded to version 1.3.5. This improves handling of certain problems with SSL-related command
options. (Bug#17737)
You must now have the DROP privilege to drop table partitions. (Bug#17139)
Server and clients ignored the --sysconfdir option that was passed to configure. The directory specified by this option, if
set, now is used as one of the standard locations in which to look for option files. (Bug#15069)
MySQL Change History
2996
In result set metadata, the MYSQL_FIELD.length value for BIT columns now is reported in number of bits. For example, the
value for a BIT(9) column is 9. (Formerly, the value was related to number of bytes.) (Bug#13601)
The following statements now cause an implicit commit: ANALYZE TABLE, CHECK TABLE, OPTIMIZE TABLE, and REPAIR
TABLE.
Added the KEY_BLOCK_SIZE table option and index option. This can be used in CREATE TABLE, ALTER TABLE, and CRE-
ATE INDEX statements to provide a hint to the storage engine about the size to use for index key blocks. The engine is allowed to
change the value if necessary.
Added the sql_big_selects system variable to the output of SHOW VARIABLES.
The mysql_upgrade command has been converted from a shell script to a C program, so it is available on non-Unix systems
such as Windows. This program should be run for each MySQL upgrade. See Section 4.4.8, mysql_upgrade Check Tables
for MySQL Upgrade.
Added the REFERENTIAL_CONSTRAINTS table to INFORMATION_SCHEMA. It provides information about foreign keys.
Added the have_dynamic_loading system variable that indicates whether the server supports dynamic loading of plugins.
Added --debug option to Instance Manager.
Binary distributions that include SSL support now are built using yaSSL when possible.
Bugs fixed:
Security Fix: A NUL byte within a comment in a statement string caused the rest of the string not to be written to the query log, al-
lowing logging to be bypassed. (Bug#17667, CVE-2006-0903)
Security Fix: A malicious client, using specially crafted invalid COM_TABLE_DUMP packets was able to trigger an exploitable buf-
fer overflow on the server. Thanks to Stefano Di Paola <[email protected]> for finding and reporting this bug.
(CVE-2006-1518)
Security Fix: A malicious client, using specially crafted invalid login or COM_TABLE_DUMP packets was able to read uninitialized
memory, which potentially, though unlikely in MySQL, could have led to an information disclosure. (, ) Thanks to Stefano Di Paola
<[email protected]> for finding and reporting this bug. (CVE-2006-1516, CVE-2006-1517)
MySQL Cluster: Replication: (Replication): Delete and update of rows in a table without a primary key failed on the slave.
(Bug#17400)
MySQL Cluster: A 5.1.6 or newer server did not read local checkpoints recorded by any other 5.1 version, thus preventing a sys-
tem restart following an upgrade. (Bug#19333)
MySQL Cluster: Concurrent INSERT and ROLLBACK statements from different connections could cause node failures.
(Bug#19245)
MySQL Cluster: (Disk Data): Running an INSERT and a DELETE on a Disk Data table in the same transaction could cause a
deadlock. (Bug#19244)
MySQL Cluster: Starting mysqld without --log-bin caused DDL statements on NDB tables to time out. (Bug#19214)
MySQL Cluster: (NDBAPI): Passing a nonexistent index name to NdbIndexScanOperation::setBound() caused a seg-
mentation fault. (Bug#19088)
MySQL Cluster: mysql-test-run.pl started NDB even for test cases that did not need it. (Bug#19083)
MySQL Cluster: Stopping multiple nodes could cause node failure handling not to be completed. (Bug#19039)
MySQL Cluster: The Cluster binlog mysqld accepted updates even though the binary log was not set up, which could lead to up-
dates missing from the binary log. (Bug#18932)
MySQL Cluster: mysqld could crash when attempting an update if the cluster had failed previously. (Bug#18798)
MySQL Cluster: An INSERT or UPDATE of more than 128 bytes of data in a 4-replica cluster could cause data nodes to crash.
MySQL Change History
2997
Bug#18622)
MySQL Cluster: (Disk Data): CREATE LOGFILE GROUP accepted values other than NDB or NDBCLUSTER in the ENGINE
clause. (Bug#18604)
MySQL Cluster: (Disk Data): Omitting the required ENGINE clause from a CREATE LOGFILE GROUP or CREATE TA-
BLESPACE statement caused the server to crash. An appropriate error message is now returned instead. (Bug#18603)
MySQL Cluster: Queries using ORDER BY pkN failed against a LIST-partitioned Cluster table having a multi-column primary
key, where pkN represents one of the columns making up the primary key. (Bug#18598)
MySQL Cluster: A simultaneous DROP TABLE and table update operation utilising a table scan could trigger a node failure.
(Bug#18597)
MySQL Cluster: Fragment IDs were not logged correctly, causing ndb_restore_log to fail. (Bug#18594)
MySQL Cluster: Repeated use of the SHOW and ALL STATUS commands in the ndb_mgm client could cause the mgmd process
to crash. (Bug#18591)
MySQL Cluster: ndbd sometimes failed to start with the error NODE FAILURE HANDLING NOT COMPLETED following a graceful re-
start. (Bug#18550)
MySQL Cluster: ndb_restore failed to restore a backup made from a 5.0 cluster to a 5.1 cluster. (Bug#18210)
MySQL Cluster: Adding an index to an unsigned integer column did not work correctly. (Bug#18133)
MySQL Cluster: A SELECT from an NDB table with ORDER BY indexed_column and a LIMIT clause would fail following
ALTER TABLE. (Bug#18094)
MySQL Cluster: mysqldump included in its output data from the internal cluster database. (Bug#17840)
MySQL Cluster: Backups could fail for large clusters with many tables, where the number of tables approached MaxNoOfT-
ables. (Bug#17607)
MySQL Cluster: Some queries having a WHERE clause of the form c1=val1 OR c2 LIKE 'val2' were not evaluated cor-
rectly. (Bug#17421)
MySQL Cluster: An issue with ndb_mgmd prevented more than 27 mysqld processes from connecting to a single cluster at one
time. (Bug#17150)
MySQL Cluster: In a 2-node cluster with a node failure, restarting the node with a low value for StartPartialTimeout could
cause the cluster to come up partitioned (split-brain issue).
A similar issue could occur when the cluster was first started with a sufficiently low value for this parameter. (Bug#16447,
Bug#18612)
MySQL Cluster: Performing multiple ALTER TABLE operations on the same NDB table from different mysqld processes in the
same cluster led to schema versioning errors when trying to access the table again following the restart of one of the mysqld pro-
cesses. (Bug#16445)
MySQL Cluster: On systems with multiple network interfaces, data nodes would get stuck in startup phase 2 if the interface con-
necting them to the management server was working on node startup while the interface interconnecting the data nodes experienced
a temporary outage. (Bug#15695)
MySQL Cluster: On slow networks or CPUs, the management client SHOW command could sometimes erroneously show all data
nodes as being master nodes belonging to nodegroup 0. (Bug#15530)
MySQL Cluster: Unused open handlers for tables in which the metadata had changed were not properly closed. This could result in
stale results from NDB tables following an ALTER TABLE statement. (Bug#13228)
MySQL Cluster: Uninitialized internal variables could lead to unexpected results. (Bug#11033, Bug#11034)
MySQL Cluster: When attempting to create an index on a BIT or BLOB column, ERROR 743: UNSUPPORTED CHARACTER SET IN
TABLE OR INDEX was returned instead of ERROR 906: UNSUPPORTED ATTRIBUTE TYPE IN INDEX.
Cluster Replication: Partitioning: Attempting to create an index using multiple columns on an explicitly partitioned table in a rep-
MySQL Change History
2998
licated Cluster database could cause the master mysqld process to crash. (Bug#18284)
Cluster Replication: Replication: An issue with replication caused a mysqld connected to a replicated cluster to crash when en-
tering single user mode. (Bug#18535)
Replication: CREATE VIEW statements would not be replicated to the slave if the --replicate-wild-ignore-table rule
was enabled. (Bug#18715)
Replication: Updating a field value when also requesting a lock with GET_LOCK() would cause slave servers in a replication en-
vironment to terminate. (Bug#17284)
Replication: The binary log would create an incorrect DROP query when creating temporary tables during replication. (Bug#17263)
Disk Data: Issuing a CREATE LOGFILE GROUP statement during the drop of an NDB table would cause database corruption.
(Bug#19141)
Disk Data: Concurrent table schema operations and operations on log file groups, tablespaces, data files, or undo files could lead to
data node failures. (Bug#18575)
Cluster Replication: Using the --binlog-do-db option caused problems with CREATE TABLE on the cluster acting as the
replication master. (Bug#19492)
Cluster Replication: When taking part in Cluster replication of tables containing BLOB columns, mysqld falsely reported a large
memory leak in the replication buffers when there was none. (Bug#19247)
Cluster Replication: Trying to restore the apply_status table from a 5.0 cluster backup failed on a 5.1 server. (Bug#18935)
A compatibility issue with NPTL (Native POSIX Thread Library) on Linux could result in a deadlock with FLUSH TABLES
WITH READ LOCK under some conditions. (Bug#20048)
Some outer joins were incorrectly converted to inner joins. (Bug#19816)
This regression was introduced by Bug#17146.
A view definition that referred to an alias in the HAVING clause could be saved in the .frm file with the alias replaced by the ex-
pression that it referred to, causing failure of subsequent SELECT * FROM view_name statements. (Bug#19573)
mysql displayed NULL for strings that are empty or contain only spaces. (Bug#19564)
Selecting from a view that used GROUP BY on a nonconstant temporal interval (such as DATE(col) + INTERVAL
TIME_TO_SEC(col) SECOND could cause a server crash. (Bug#19490)
An outer join of two views that was written using { OJ ... } syntax could cause a server crash. (Bug#19396)
An issue with file handling in the partitioning code could cause mysqld to crash when started and then stopped within a very short
period of time. (Bug#19313)
myisamchk and myisam_ftdump should allow either table names or .MYI file names as arguments, but allowed only table
names. (Bug#19220)
InnoDB could read a delete mark from its system tables incorrectly. (Bug#19217)
Executing a CREATE EVENT statement could cause 100% CPU usage. (Bug#19170)
Eliminated some memory corruption problems that resultsd in double free or corruption errors and a server crash.
(Bug#19154)
Attempting to set the default value of an ENUM or SET column to NULL caused a server crash. (Bug#19145)
Index corruption could occur in cases when key_cache_block_size was not a multiple of the myisam-block-size value
(for example, with --key_cache_block_size=1536 and --myisam-block-size=1024). (Bug#19079)
Instance Manager now finds the version numbers, so that it works properly when the executable name isn't the same as what the In-
stance Manager launched (such as when wrapping a libtool-wrapped executable from the source tree). (Bug#19059)
Some fast ALTER TABLE operations (requiring no temporary table) did not work for all tables. (Bug#19011)
MySQL Change History
2999
Successive ALTER TABLE ... DROP PARTITION statements on the same subpartitioned table could eventually cause the
server to crash. (Bug#18962)
Creating a table in an InnoDB database with a column name that matched the name of an internal InnoDB column (including
DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR and DB_MIX_ID) would cause a crash. MySQL now returns Error 1005 CANNOT
CREATE TABLE with errno set to -1. (Bug#18934)
The parser leaked memory when its stack needed to be extended. (Bug#18930)
MySQL would not compile on Linux distributions that use the tinfo library. (Bug#18912)
The server attempted to flush uninitialized log tables during SIGHUP processing, causing a crash. (Bug#18848)
For a reference to a nonexistent stored function in a stored routine that had a CONTINUE handler, the server continued as though a
useful result had been returned, possibly resulting in a server crash. (Bug#18787)
For single-SELECT union constructs of the form (SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY or-
der_list2, the ORDER BY lists were concatenated and the LIMIT clause was ignored. (Bug#18767)
Inserts failed with duplicate key errors on a table partitioned using an AUTO_INCREMENT column for the partitioning key.
(Bug#18753, Bug#18552)
It was possible to create a RANGE-partitioned table with a partition defined using the clause VALUES LESS THAN (NULL), even
though such a partition could never contain any values whatsoever. (Bug#18752)
Delimited identifiers for partitions were not being treated the same as delimited identifiers for other database objects (such as tables
and columns) with regard to allowed characters. (Bug#18750)
Conversion of a number to a CHAR UNICODE string returned an invalid result. (Bug#18691)
If the second or third argument to BETWEEN was a constant expression such as '2005-09-01 - INTERVAL 6 MONTH and the
other two arguments were columns, BETWEEN was evaluated incorrectly. (Bug#18618)
LOAD DATA FROM MASTER would fail when trying to load the INFORMATION_SCHEMA database from the master, because the
INFORMATION_SCHEMA system database would already exist on the slave. (Bug#18607)
Running an ALTER TABLE on a partitioned table simultaneously experiencing a high number of concurrent DML statements could
crash the server. (Bug#18572)
A LOCK TABLES statement that failed could cause MyISAM not to update table statistics properly, causing a subsequent CHECK
TABLE to report table corruption. (Bug#18544)
mysqltest incorrectly interpreted some ER_xxx error names given in the error command. (Bug#18495)
InnoDB: ALTER TABLE to add or drop a foreign key for an InnoDB table had no effect. (Bug#18477)
InnoDB did not use a consistent read for CREATE ... SELECT when innodb_locks_unsafe_for_binlog was set.
(Bug#18350)
DROP DATABASE did not drop stored routines associated with the database if the database name was longer than 21 characters.
(Bug#18344)
A query on a table partitioned or subpartitioned by HASH did not display all results when using a WHERE condition involving a
column used in the hashing expression. (Bug#18329, Bug#18423)
In mysqltest, --sleep=0 had no effect. Now it correctly causes sleep commands in test case files to sleep for 0 seconds.
(Bug#18312)
The ExtractValue() function did not return character data within <![CDATA[]]> as expected. (Bug#18285)
A recent change caused the mysql client not to display NULL values correctly and to display numeric columns left-justified rather
than right-justified. The problems have been corrected. (Bug#18265)
Updates to a MEMORY table caused the size of BTREE indexes for the table to increase. (Bug#18160)
A failed ALTER TABLE operation could fail to clean up a temporary .frm file. (Bug#18129)
MySQL Change History
3000
Event-creation statements enclosed in multi-line comments using /*!version_number ... */ syntax were not parsed cor-
rectly. (Bug#18078)
SELECT DISTINCT queries sometimes returned only the last row. (Bug#18068)
InnoDB: A DELETE followed by an INSERT and then by an UPDATE on a partitioned InnoDB table caused subsequent queries to
return incorrect results. (Bug#17992)
It was possible to use trailing spaces in the names of partitions and subpartitions. Attempting to do so now raises the error INCOR-
RECT PARTITION NAME. (Bug#17973)
LIKE searches failed on a CHAR column used as the partitioning column of a table partitioned by KEY. (Bug#17946)
Executing SELECT on a large table that had been compressed within myisampack could cause a crash. (Bug#17917)
The sql_big_selects system variable was not displayed by SHOW VARIABLES. (Bug#17849)
REPAIR TABLE did not restore the length for packed keys in tables created under MySQL 4.x, which caused them to appear cor-
rupt to CHECK TABLE but not to REPAIR TABLE. (Bug#17810)
A range access optimizer heuristic was invalid, causing some queries to be much slower in MySQL 5.0 than in 4.0. (Bug#17379,
Bug#18940)
Logging to the mysql.general_log and mysql.slow_log tables did not work for Windows builds because the CSV storage
engine was unavailable. The CSV engine now is enabled in Windows builds. (Bug#17368)
If the WHERE condition of a query contained an OR-ed FALSE term, the set of tables whose rows cannot serve for null-complements
in outer joins was determined incorrectly. This resulted in blocking possible conversions of outer joins into joins by the optimizer
for such queries. (Bug#17164)
Casting a string to DECIMAL worked, but casting a trimmed string (using LTRIM() or RTRIM()) resulted in loss of decimal di-
gits. (Bug#17043)
MyISAM table deadlock was possible if one thread issued a LOCK TABLES request for write locks and then an administrative state-
ment such as OPTIMIZE TABLE, if between the two statements another client meanwhile issued a multiple-table SELECT for
some of the locked tables. (Bug#16986)
ALTER TABLE ... REBUILD PARTITION returned an inaccurate error message. (Bug#16819)
Use of --default-storage-engine=innodb resulted in an error with the server reporting that InnoDB was an unknown
table type. (Bug#16691)
MySQL-shared-compat-5.1.9-0.i386.rpm incorrectly depended on glibc 2.3 and could not be installed on a glibc
2.2 system. (Bug#16539)
The presence of multiple equalities in a condition after reading a constant table could cause the optimizer not to use an index. This
resulted in certain queries being much slower than in MySQL 4.1. (Bug#16504)
Within a trigger, CONNECTION_ID() did not return the connection ID of the thread that caused the trigger to be activated.
(Bug#16461)
The XPath string-length() function was not implemented for use with ExtractValue(). (Bug#16319)
The ExtractValue() function failed with a syntax error when the XPath expression used special characters such as
(N-tilde). (Bug#16233)
The sql_notes and sql_warnings system variables were not always displayed correctly by SHOW VARIABLES (for ex-
ample, they were displayed as ON after being set to OFF). (Bug#16195)
If the first argument to BETWEEN was a DATE or TIME column of a view and the other arguments were constants, BETWEEN did
not perform conversion of the constants to the appropriate temporary type, resulting in incorrect evaluation. (Bug#16069)
After calling FLUSH STATUS, the max_used_connections variable did not increment for existing connections and connec-
tions which use the thread cache. (Bug#15933)
DELETE and UPDATE statements that used large NOT IN (value_list) clauses could use large amounts of memory.
MySQL Change History
3001
Bug#15872)
InnoDB failure to release an adaptive hash index latch could cause a server crash if the query cache was enabled. (Bug#15758)
LAST_INSERT_ID() in a stored function or trigger returned zero. . (Bug#15728)
The system_time_zone and version_* system variables could not be accessed via SELECT @@var_name syntax.
(Bug#15684, Bug#12792)
If the server were built without partition support, it was possible to run partitioning-related statements with no errors or warnings,
even though these statements would have no effect. Now such statements are disallowed unless the server has been compiled using
the --with-partition option. (Bug#15561)
Use of CONVERT_TZ() in a view definition could result in spurious syntax or access errors. (Bug#15153)
Prevent recursive views caused by using RENAME TABLE on a view after creating it. (Bug#14308)
Some queries were slower in 5.0 than in 4.1 because some 4.1 cost-evaluation code had not been merged into 5.0. (Bug#14292)
Avoid trying to include <asm/atomic.h> when it doesn't work in C++ code. (Bug#13621)
Running myisampack followed by myisamchk with the --unpack option would corrupt the auto_increment key.
(Bug#12633)
Use of CONVERT_TZ() in a stored function or trigger (or in a stored procedure called from a stored function or trigger) caused an
error. (Bug#11081)
When myisamchk needed to rebuild a table, AUTO_INCREMENT information was lost. (Bug#10405)
C.1.29. Changes in MySQL 5.1.9 (12 April 2006)
This is a new Beta development release, fixing recently discovered bugs.
Note
This Beta release, as any other pre-production release, should not be installed on production level systems or systems with
critical data. It is good practice to back up your data before installing any new version of software. Although MySQL has
worked very hard to ensure a high level of quality, protect your data by making a backup as you would for any software
beta release. Please refer to our bug database at http://bugs.mysql.com/ for more details about the individual bugs fixed in
this version.
This section documents all changes and bug fixes that have been applied since the last official MySQL release. If you would like to re-
ceive more fine-grained and personalized update alerts about fixes that are relevant to the version and features you use, please consider
subscribing to MySQL Enterprise (a commercial MySQL offering). For more details please see ht-
tp://www.mysql.com/products/enterprise.
Functionality added or changed:
MySQL Cluster: The NDB storage engine now supports CREATE TABLE statements of arbitrary length. (Previously, CREATE
TABLE statements for MySQL Cluster tables could contain a maximum of 4096 characters only.) (Bug#17813)
MySQL Cluster: Added the --nowait-nodes startup option for ndbd, making it possible to skip specified nodes without wait-
ing for them to start when starting the cluster. See Section 17.6.24.2, Program Options for ndbd and ndbmtd.
mysqld_safe no longer checks for a mysqld-max binary. Instead, mysqld_safe nows checks only for the standard mysqld
server unless another server binary is specified explicitly via --mysqld or --mysqld-version. If you previously relied on the
implicit invocation of mysqld-max, you should use an appropriate option now. (Bug#17861)
For partitioned tables, the output of SHOW TABLE STATUS now shows in the Engine column the name of the storage engine
used by all partitions for the table; in the Create_options column, the output now shows partitioned for a partitioned ta-
ble. This change also affects the values shown in the corresponding columns of the INFORMATION_SCHEMA.TABLES table.
(Bug#17631)
MySQL Change History
3002
SHOW PLUGIN was renamed to SHOW PLUGINS. SHOW PLUGIN now is deprecated and generates a warning. (Bug#17112)
Large file support was re-enabled for the MySQL server binary for the AIX 5.2 platform. (Bug#13571)
Binary MySQL distributions now include a mysqld-max server, in addition to the usual mysqld optimized server and the
mysqld-debug debugging server.
Bugs fixed:
Security Fix: Invalid arguments to DATE_FORMAT() caused a server crash. Thanks to Jean-David Maillefer for discovering and
reporting this problem to the Debian project and to Christian Hammers from the Debian Team for notifying us of it. (Bug#20729,
CVE-2006-3469)
Partitioning: MySQL Cluster: BLOB columns did not work correctly with user-partitioned NDB tables. (Bug#16796)
MySQL Cluster: An uninitialized internal variable could lead to unexpected results. (Bug#18831)
MySQL Cluster: TRUNCATE did not reset the AUTO_INCREMENT counter for MyISAM tables when issued inside a stored proced-
ure.
Note
This bug did not affect InnoDB tables.
In addition, TRUNCATE does not reset the AUTO_INCREMENT counter for NDB tables regardless of when it is called.
(Bug#14945)
See also Bug#18864.
For full-text searches in boolean mode, and when a full-text parser plugin was used, a
MYSQL_FTPARSER_PARAM::ftparser_state could have been corrupted by recursive calls to the plugin. (Bug#18836)
mysql_reconnect() sent a SET NAMES statement to the server, even for pre-4.1 servers that do not understand the statement.
(Bug#18830)
A query against a partitioned table using WHERE col IS NULL could produce incorrect results given the following conditions:
The table had partitions and subpartitions
The partitioning function depended on a single column col of one of the MySQL integer types
The partitioning function was not monotonically increasing
The same issue could cause the server to crash when run in debug mode. (Bug#18659)
Partition pruning did not work properly for some kinds of partitioning and subpartitioning, with certain WHERE clauses. (Partitions
and subpartitions that should have been marked as used were not so marked.) The error could manifest as incorrect content in EX-
PLAIN PARTITIONS output as well as missing rows in the results of affected queries. (Bug#18558)
Building the server using --with-example-storage-engine failed to enable the EXAMPLE storage engine in the server.
(Bug#18464)
If InnoDB encountered a HA_ERR_LOCK_TABLE_FULL error and rolled back a transaction, the transaction was still written to
the binary log. (Bug#18283)
Complex queries with nested joins could cause a server crash. (Bug#18279)
COUNT(*) on a MyISAM table could return different results for the base table and a view on the base table. (Bug#18237)
EXTRACT(QUARTER FROM date) returned unexpected results. (Bug#18100)
Queries using WHERE ... IS NULL returned incorrect results from partitioned tables. (Bug#18070)
MySQL Change History
3003
Partition pruning did not perform correctly with partitions on NULL, and could potentially crash the server. (Bug#18053)
MEDIUMINT columns were not handled in the same way as other column types by partition pruning.
Partition pruning would sometimes use inappropriate columns in preforming queries.
Both of these issues were rectified as part of the same bug fix. (Bug#18025)
For tables created in a MySQL 4.1 installation upgraded to MySQL 5.0 and up, multiple-table updates could update only the first
matching row. (Bug#16281)
For mysql.server, if the basedir option was specified after datadir in an option file, the setting for datadir was ignored
and assumed to be located under basedir. (Bug#16240)
Triggers created in one version of the server could not be dropped after upgrading to a newer version. (Bug#15921)
CAST(double AS SIGNED INT) for large double values outside the signed integer range truncated the result to be within
range, but the result sometimes had the wrong sign, and no warning was generated. (Bug#15098)
Quoted values could not be used for partition option values. (Bug#13520)
Delimited identifiers could not be used in defining partitions. (Bug#13433)
mysql_config returned incorrect libraries on x86_64 systems. (Bug#13158)
The server was always built as though --with-extra-charsets=complex had been specified. (Bug#12076)
C.1.30. Changes in MySQL 5.1.8 (Not released)
Note
This was an internal release only, and no binaries were published.
Functionality added or changed:
Cluster Replication: Incompatible Change: The cluster_replication database has been renamed to cluster. This will
effect replication between MySQL Clusters where one cluster is running MySQL 5.1.8 or later, and the other is running MySQL
5.1.7 or earlier. See Section 17.9, MySQL Cluster Replication, and especially Section 17.9.4, MySQL Cluster Replication
Schema and Tables.
Incompatible Change: The semantics of ALTER TABLE t ENGINE=X; for partitioned tables is changed, and now means that
the storage engine used for table t is changed to X.
The previous statement formerly (prior to MySQL 5.1.8) meant that all partitioning was removed from the table. In order to remove
the partitioning of a table, the syntax ALTER TABLE t REMOVE PARTITIONING; is introduced. The REMOVE PARTI-
TIONING option can be used in combination with existing ALTER TABLE options such as those employed for adding or dropping
columns or indexes. (Bug#17754)
Incompatible Change: For purposes of determining placement, RANGE partitioning now treats NULL as less than any other value.
(Formerly, NULL was treated as equal to zero.) See Section 18.2.6, How MySQL Partitioning Handles NULL. (Bug#15447)
MySQL Cluster: The stability of CREATE and DROP operations on NDB tables containing BLOB columns has been improved.
(Bug#17761)
MySQL Cluster: The NDBCLUSTER storage engine now supports INSERT IGNORE and REPLACE statements. Previously, these
statements failed with an error. (Bug#17431)
Replication: Triggers from older servers that included no DEFINER clause in the trigger definition now execute with the privileges
of the invoker (which on the slave is the slave SQL thread). Previously, replication slaves could not replicate such triggers.
(Bug#16266)
Replication: The binlog_format system variable now can be set to a third format, MIXED, as described in Section 16.1.2,
Replication Formats.
MySQL Change History
3004
Replication: The binlog_format system variable now is dynamic and can be changed at runtime, as described in Sec-
tion 16.1.2, Replication Formats.
Replication: A slave server may now switch the replication format automatically. This happens when the server is running in either
STATEMENT or MIXED format and encounters a row in the binary log that is written in ROW logging format. In that case, the slave
switches to row-based replication temporarily for that event, and switches back to the previous format afterwards.
Disk Data: You can now have only one log file group at any one time. See Section 12.1.14, CREATE LOGFILE GROUP Syntax.
(Bug#16386)
Builds for Windows, Linux, and Unix (except AIX) platforms now have SSL support enabled, in the server as well as in the client
libraries. Because part of the SSL code is written in C++, this does introduce dependencies on the system's C++ runtime libraries in
several cases, depending on compiler specifics. (Bug#18195)
Partition pruning was made more stable, particularly in cases involving queries using tests for NULL values in the WHERE clause
against subpartitioned tables which were partitioned by LIST( some_function(col1, ... ,colN) ). (Bug#17891)
The output of SHOW CREATE EVENT no longer qualifies the event name with the name of the schem to which the event belongs.
(Bug#17714)
The deprecated constructs in the following table now generate warnings. You should not employ them in new applications, as they
are likely to be removed in a future version of MySQL. Use the equivalents shown in the table's second column instead. For the
same reason, existing applications that depend on the deprecated constructs should be converted to make use of the current equival-
ents as soon as possible.
Deprecated
/ Obsolete:
Current /
Preferred:
@@table_
type
@@storag
e_engine
@@log_bi
n_trust_
routine_
creators
@@log_bi
n_trust_
func-
tion_cre
ators
TIMESTAM
P(N)
See Sec-
tion 11.6,
Date and
Time Func-
tions.
TYPE= ENGINE=
BACKUP
TABLE
mysql-
dump,
mysql-
hotcopy,
or MySQL
Administrat-
or
RESTORE
TABLE,
LOAD TA-
BLE FROM
MASTER
mysql-
dump,
mysql, or
MySQL Ad-
ministrator
SHOW TA-
BLE
TYPES
SHOW
[STORAGE
] EN-
GINES
SHOW IN-
NODB
STATUS
SHOW EN-
GINE IN-
NODB
STATUS
SHOW MU- SHOW EN-
MySQL Change History
3005
TEX
STATUS
GINE IN-
NODB MU-
TEX
SHOW BDB
LOGS,
SHOW
LOGS
SHOW EN-
GINE BDB
LOGS
SHOW BDB LOGS and SHOW LOGS are removed as of MySQL 5.1.12, and the other deprecated items shown in the table are re-
moved as of MySQL 5.2.5.
Important
TYPE vs ENGINE . In order not to break legacy applications, support for TYPE = engine_name deprecated since
MySQL 4.0 has been restored, but now generates a warning.
Beginning with MySQL 5.2.5, TYPE = engine_name will no longer be available and will produce a syntax error.
You should not use TYPE in any new applications, and you should immediately begin conversion of existing applications
to use the ENGINE = engine_name syntax instead.
(Bug#17501)
Temporary tables may no longer be partitioned. (Bug#17497)
More specific error messages are now given when attempting to create an excessive number of partitions or subpartitions.
(Previously, no distinction was made between an excessive number of partitions and an excessive number of subpartitions.)
(Bug#17393)
Added the --events option to mysqldump to enable events to be included in the dump output. (Bug#16853)
For an event having no STARTS time specified when it was created, the mysql.event table's start column now displays the
creation time rather than NULL.
In addition, both the SHOW EVENTS statement's Starts column and the STARTS column of the INFORMA-
TION_SCHEMA.EVENTS table are now empty rather than NULL when STARTS was not used in the CREATE EVENT statement.
(Bug#16537)
Event names are now case-insenstive. That is (for example), you cannot have events with the names Myevent and MyEvent be-
longing to the same database and definer. (Bug#16415)
Description of the EVENT privilege has been changed to To create, alter, drop, and execute events.
(Bug#16412)
MICROSECOND intervals are no longer allowed for events. (Bug#16411)
Events no longer support times past the end of the Unix epoch. (Formerly, such dates were interpreted as being at the beginning of
the Unix epoch.) (Bug#16396)
The XPath last() function is now implemented for use with ExtractValue(). (Bug#16318)
The ExtractValue() function with contains() now uses the SQL collation in making comparisons. Perviously, comparis-
ons were always binary (that is, case-sensitive). (Bug#16316)
Names of subpartitions must now be unique for an entire table, and not merely within the same partition. (Bug#15408)
Added the --sysdate-is-now option to mysqld to enable SYSDATE() to be treated as an alias for NOW(). See Section 11.6,
Date and Time Functions. (Bug#15101)
mysqldump now surrounds the DEFINER, SQL SECURITY DEFINER and WITH CHECK OPTION clauses of a CREATE
VIEW statement with "not in version" comments to prevent errors in earlier versions of MySQL. (Bug#14871)
The mysql_ping() function will now retry if the reconnect flag is set and error CR_SERVER_LOST is encountered during
MySQL Change History
3006
the first attempt to ping the server. (Bug#14057)
The mysqltest utility now converts all CR/LF combinations to LF to allow test cases intended for Windows to work properly on
UNIX-like systems. (Bug#13809)
The output from SHOW CREATE TABLE is more consistent about using uppercase for keywords. Data types still are in lowercase.
(Bug#10460)
The client API now attempts to reconnect using TCP/IP if the reconnect flag is set, as is the case with sockets. (Bug#2845)
The syntax for CREATE PROCEDURE and CREATE FUNCTION statements now includes a DEFINER clause. The DEFINER
value specifies the security context to be used when checking access privileges at routine invocation time if the routine has the SQL
SECURITY DEFINER characteristic. See Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION Syntax, for more
information.
When mysqldump is invoked with the --routines option, it now dumps the DEFINER value for stored routines.
Bugs fixed:
Partitioning: MySQL Cluster: Trying to insert a value into a nonexistent LIST partition of an NDB table would cause the server to
crash.
Note
Beginning with MySQL 5.1.12, user-defined partitioning types other than KEY or LINEAR KEY were disabled for NDB
tables.
(Bug#17763)
Partitioning: MySQL Cluster: A repeated SELECT on a partitioned table that used the NDB storage engine could cause the server
to crash. (Bug#17390)
MySQL Cluster: Replication: auto_increment values were not propagated correctly in statement-based replication.
(Bug#18208)
MySQL Cluster: Replication: Memory was mistakenly freed for NdbRecAttr objects during addition of an index while replicat-
ing the cluster, which could cause mysqld to crash. (Bug#18106)
MySQL Cluster: Replication: Row-based replication could fail with tables using VARCHAR columns for primary keys and having
BLOB columns. (Bug#18067)
MySQL Cluster: Replication: (Replication): The binary log on the secondary master was not being set up correctly following a ta-
ble rename. (Bug#17838)
MySQL Cluster: Attempting to restart a node with dropped events still pending would fail. (Bug#18491)
MySQL Cluster: Two mysqld processes starting at the same time could cause a race condition. (Bug#18472)
MySQL Cluster: A timeout in the handling of an ABORT condition with more that 32 operations could yield a node failure.
(Bug#18414)
MySQL Cluster: Two mysqld processes did not synchronise DROP TABLE binary log events correctly. (Bug#18395)
MySQL Cluster: A node restart immediately following a CREATE TABLE would fail.
Important
This fix supports 2-node Clusters only.
(Bug#18385)
MySQL Cluster: In event of a node failure during a rollback, a false lock could be established on the backup for that node, which
lock could not be removed without restarting the node. (Bug#18352)
MySQL Change History
3007
MySQL Cluster: When multiple node restarts were attempted without allowing each restart to complete, the error message returned
was ARRAY INDEX OUT OF BOUNDS rather than TOO MANY CRASHED REPLICAS. (Bug#18349)
MySQL Cluster: The cluster created a crashed replica of a table having an ordered index or when logging was not enabled, of a
table having a table or unique index leading to a crash of the cluster following 8 successive restarts. (Bug#18298)
MySQL Cluster: Issuing a DROP LOGFILE GROUP statement would cause ndbd processes to crash if MySQL had been com-
piled with gcc4. (Bug#18295)
MySQL Cluster: When replacing a failed master node, the replacement node could cause the cluster to crash from a buffer over-
flow if it had an excessively large amount of data to write to the cluster log. (Bug#18118)
MySQL Cluster: Insufficient StringBuffer memory when attempting to create a trigger caused the server to crash.
(Bug#18101)
MySQL Cluster: Variable-length columns used as primary keys were not handled correctly. (Bug#18075)
MySQL Cluster: CREATE UNIQUE INDEX on a column containing nonunique data could cause one or more ndbd nodes to
hang or crash. (Bug#18040)
MySQL Cluster: Node recovery of tables with VARCHAR columns using character sets was inconsistent, which could cause a num-
ber of issues, including the data nodes failing to restart and ALTER TABLE statements to hang. (Bug#18026)
MySQL Cluster: A SELECT ... ORDER BY query on an explicitly partitioned Cluster table with no explicit indexes would
crash the server. (Bug#17899)
MySQL Cluster: ALTER TABLE ... ADD INDEX failed with ERROR 756: INDEX ON DISK COLUMN IS NOT SUPPORTED
when run against a Disk Data table having a primary key. (Bug#17888)
MySQL Cluster: In some cases, a single ndbd node failed following a system restart. (Bug#17854)
MySQL Cluster: A simultaneous RENAME of several tables was logged multiple times. (Bug#17827)
MySQL Cluster: Trying to perform a DELETE from an NDB table following a LOCK TABLES caused the ndbd processes to hang.
(Bug#17812)
MySQL Cluster: Trying to update very large partitioned tables using the NDB storage engine sometimes caused the server to crash.
(Bug#17806, Bug#16385)
MySQL Cluster: Using ALTER TABLE ... ADD PARTITION on a table partitioned by LIST would cause the client to hang.
(Bug#17701)
MySQL Cluster: With a single replica, transactions waiting in the log synchronisation queue were not being restarted, causing them
to be aborted. (Bug#17536)
MySQL Cluster: ALTER TABLE on a partitioned NDB table could cause the server to crash. (Bug#17499)
MySQL Cluster: DELETE operations on NDB tables could cause memory leaks. (Bug#16874)
MySQL Cluster: Some query cache statistics were not always correctly reported for Cluster tables. (Bug#16795)
MySQL Cluster: Restarting nodes were allowed to start and join the cluster too early. (Bug#16772)
MySQL Cluster: UNDO_BUFFER_SIZE was limited to 17 MB. (Bug#16657, Bug#17890)
MySQL Cluster: Inserting and deleting BLOB column values while a backup was in process could cause data nodes to shut down.
(Bug#14028)
Replication: Replication of data stored in a partitioned table would cause slave servers to issue a assertion and terminate.
(Bug#18436)
Replication: Use of TRUNCATE TABLE for a TEMPORARY table on a master server was propagated to slaves properly, but slaves
did not decrement the Slave_open_temp_tables counter properly. (Bug#17137)
Replication: Slave servers would retry the execution of an SQL statement an infinite number of times, ignoring the value
SLAVE_TRANSACTION_RETRIES when using the NDB engine. (Bug#16228)
MySQL Change History
3008
Replication: The DEFINER value for stored routines was not replicated. (Bug#15963)
Disk Data: CREATE UNIQUE INDEX failed with ERROR 4243: INDEX NOT FOUND. (Bug#18039)
Disk Data: It was not possible to create more than 9 tablespaces. (Bug#16913)
A SELECT ... ORDER BY ... from a view defined using a function could crash the server. An example of such a view is
CREATE VIEW v1 AS SELECT SQRT(c1) FROM t1. (Bug#18386)
The server would crash when SHOW STATUS was called on a server linked with yaSSL. (Bug#18310)
The ExtractValue() function did not return an error when passed an invalid XPath string. (Bug#18172)
Using the position() function in the XPath argument to ExtractValue() crashed the server. (Bug#18171)
REPAIR TABLE, OPTIMIZE TABLE, and ALTER TABLE operations on transactional tables (or on tables of any type on Win-
dows) could corrupt triggers associated with those tables. (Bug#18153)
Connecting to a server with a UCS2 default character set with a client using a non-UCS2 character set crashed the server.
(Bug#18004)
Using ALTER TABLE ... REBUILD PARTITION without specifying the name of the partition caused the server to crash,
rather than reporting a syntax error. (Bug#17947)
ALTER TABLE ... REBUILD PARTITION with no partition name specified would crash the server. (Bug#17940)
A query with a WHERE date_column > date_value condition failed on a table partitioned by RANGE. (Bug#17894)
Renaming and adding a new column to a partitioned table in the same ALTER TABLE statement caused the server to crash.
(Bug#17772)
MyISAM: Performing a bulk insert on a table referenced by a trigger would crash the table. (Bug#17764)
Using triggers with partitioned InnoDB tables led to incorrect results. (Bug#17744)
Updating a view that filters certain rows to set a filtered out row to be included in the table caused infinite loop. For example, if the
view has a WHERE clause of salary > 100 then issuing an UPDATE statement of SET salary = 200 WHERE id =
10, caused an infinite loop. (Bug#17726)
A security enhancement in Visual Studio 8 could cause a MySQL debug server compiled with it to hang when running SELECT
queries against partitioned tables. (Bug#17722)
The EXAMPLE storage engine did not work on Windows. (Bug#17721)
ALTER TABLE ... REORGANIZE PARTITION failed with ERROR ON RENAME OF FILENAME ... on Windows.
(Bug#17720)
The MySQL server could crash with out of memory errors when performing aggregate functions on a DECIMAL column.
(Bug#17602)
NULL values were written to the mysql.slow_log table incorrectly. (Bug#17600)
mysql_fix_privilege_tables did not create the mysql.plugin table. (Bug#17568)
Improper checking of binary log statements could result in a server crash. (Bug#17457)
Rpeated invocations of a stored procedure containing a SHOW CREATE EVENT statement would result in the error PACKETS OUT
OF ORDER. (Bug#17403)
For FEDERATED tables, a SELECT statement with an ORDER BY clause did not return rows in the proper order. (Bug#17377)
SELECT ... WHERE column LIKE 'A%', when column had a key and used the latin2_czech_cs collation, caused
the wrong number of rows to be returned. (Bug#17374)
Calling CREATE TABLE or ALTER TABLE twice on a partitioned table in a stored procedure or a prepared statement resulted in
errors and sometimes server crashes. (Bug#17290)
MySQL Change History
3009
Checks for permissions on database operations could be performed in a case-insensitive manner (a user with permissions on data-
base MYDATABASE could by accident get permissions on database myDataBase), if the privilege data were still cached from a
previous check. (Bug#17279)
Stored procedures that call UDFs and pass local string variables caused server crashes. (Bug#17261)
A problem with NULLs and interval mapping sometimes caused incorrect results or crashes when trying to use less-than searches on
partitioned tables. (Bug#17173)
Attempting to add a new partition to a table partitioned by a unique key would cause an OUT OF MEMORY error. (Bug#17169)
Creating a table with the same name as the mapped name of another table caused a server crash. For example, if MySQL maps the
table name txu#P#p1 to txu@0023P@0023p1 on disk, creating another table named txu@0023P@0023p1 crashed the server.
(Bug#17142)
Trying to add a partition to a table having subpartitions could crash the server. (Bug#17140)
Attempting to use a conflicting VALUES clause in ALTER TABLE ... ADD PARTITION caused the server to crash. An ex-
ample of such a conflicting clause would be that uses VALUES LESS THAN (constant) (which indicates a range) with a table
that is partitioned by LIST. (Bug#17127)
A failed ALTER TABLE ... ADD PRIMARY KEY on a partitioned table would result in bad table metadata and could possibly
crash the server. (Bug#17097)
Stored routine names longer than 64 characters were silently truncated. Now the limit is properly enforced and an error occurs.
(Bug#17015)
Cursors in stored routines could cause a server crash. (Bug#16887)
Triggers created without BEGIN and END clauses resulted in You have an error in your SQL syntax errors when dumping and re-
playing a binary log. (Bug#16878)
Using ALTER TABLE to increase the length of a BINARY(M) column caused column values to be padded with spaces rather than
0x00 bytes. (Bug#16857)
ALTER TABLE ... COALESCE PARTITION failed with an OUT OF MEMORY error. (Bug#16810)
ALTER TABLE ... ADD COLUMN ... AFTER ... failed when used on partitioned tables. (Bug#16806)
If the server was started with the --skip-grant-tables option, it was impossible to create a trigger or a view without expli-
citly specifying a DEFINER clause. (Bug#16777)
In a highly concurrent environment, a server crash or deadlock could result from execution of a statement that used stored functions
or activated triggers coincident with alteration of the tables used by these functions or triggers. (Bug#16593)
Clients compiled from source with the --without-readline did not save command history from session to session.
(Bug#16557)
Using ORDER BY intvar within a stored procedure (where intvar is an integer variable or expression) would crash the serv-
er.
Note
The use of an integer i in an ORDER BY i clause for sorting the result by the i
th
column is deprecated (and nonstand-
ard). It should not be used in new applications. See Section 12.2.8, SELECT Syntax.
(Bug#16474)
Slow queries executed by scheduled events were not being written to the slow query log. (Bug#16426)
INSERT statements executed by scheduled events were not written to the general log. (Bug#16413)
Repeated invocations of a stored procedure containing a CREATE EVENT or ALTER EVENT statement would crash the server.
(Bug#16408)
Names of subpartitions were not displayed in the output of SHOW CREATE TABLE. (Bug#16370)
MySQL Change History
3010
The ExtractValue() function would not accept expressions which matched element names containing an underscore character.
(Bug#16320)
The self() XPath function was not handled correcty by ExtractValue(). (Bug#16315)
The ExtractValue() function allowed the use of the ! character in identifiers by ignoring the illegal character. This is now cor-
rectly reported as a syntax error. (Bug#16313)
A memory leak caused warnings on slaves for certain statements that executed without warning on the master. (Bug#16175)
No error was reported when subpartitions were defined for a nonsubpartitioned table. (Bug#15961)
Character set conversion of string constants for UNION of constant and table column was not done when it was safe to do so.
(Bug#15949)
The mysql_close() C API function leaked handles for shared-memory connections on Windows. (Bug#15846)
A SELECT using a function against a nested view would crash the server. (Bug#15683)
Setting up subpartitions on at least one but not all the partitions of a partitioned table caused the server to crash. (Bug#15407)
During conversion from one character set to ucs2, multi-byte characters with no ucs2 equivalent were converted to multiple char-
acters, rather than to 0x003F QUESTION MARK. (Bug#15375)
CREATE TABLE ... PARTITION ... AS SELECT ... would cause the server to crash. (Bug#15336)
When attempting to insert a 0 into a LIST-partitioned table that had no value-list containing 0, no error was reported. (Bug#15253)
SELECT COUNT(*) for a MyISAM table could return different results depending on whether an index was used. (Bug#14980)
Stored routines that contained only a single statement were not written properly to the dumpfile when using mysqldump.
(Bug#14857)
Execution of a stored function or trigger which inserted data into a table while running concurrent selects on the same table could
result in storing incorrect data in the query cache. (Bug#14767)
Naming a partition using the characters or (c-cedilla; Unicode 00C7 or 00E7) made unreadable the table containing the parti-
tion. (Bug#14527)
Searches on indexed columns of partitioned tables failed to find all matching rows following updates of the indexed columns.
(Bug#14526)
Creating a partition which depends on an expression containing a column using the UTF8 character set would cause the server to
crash. (Bug#14367)
On Linux, creation of table partitions failed within a stored procedure. (Bug#14363)
Invoking more than once a prepared statement that creates a partitioned table would crash the server. (Bug#14350)
The RENAME TABLE statement did not move triggers to the new table. (Bug#13525)
The server would execute stored routines that had a nonexistent definer. (Bug#13198)
The length of a VARCHAR() column that used the utf8 character set would increase each time the table was re-created in a stored
procedure or prepared statement, eventually causing the CREATE TABLE statement to fail. (Bug#13134)
Loading of UDFs in a statically linked MySQL caused a server crash. UDF loading is now blocked if the MySQL server is statically
linked. (Bug#11835)
Setting the myisam_repair_threads system variable to a value larger than 1 could cause corruption of large MyISAM tables.
(Bug#11527)
Issuing GRANT EXECUTE on a procedure would display any warnings related to the creation of the procedure. (Bug#7787)
C.1.31. Changes in MySQL 5.1.7 (27 February 2006)
MySQL Change History
3011
Functionality added or changed:
Incompatible Change: The mysql_stmt_attr_get() C API function now returns a boolean rather than an unsigned int for
STMT_ATTR_UPDATE_MAX_LENGTH. (Bug#16144)
Incompatible Change: Due to a change in the naming scheme for partitioning and subpartitioning files, it is not possible for the
server to read partitioned tables created in previous MySQL versions. Attempting to read pre-5.1.6 partitioned tables with a MySQL
5.1.7 or later server now generates a suitable warning message.
Two possible workarounds are:

1. Create a nonpartitioned table with the same table schema using a standard CREATE TABLE statement (that is, with no par-
titioning clauses)
2. Issue a SELECT INTO to copy the data into the nonpartitioned table before the upgrade
Following the upgrade, you can partition the new table using ALTER TABLE ... PARTITION BY ....
Alternatively, you can dump the table using mysqldump prior to upgrading and reload it afterwards with LOAD DATA.
In either case, you should drop the pre-5.1.6 partitioned tables before upgrading to 5.1.6 or later.
Important
If any partitioned tables that were created prior to MySQL 5.1.6 are present following an upgrade to MySQL 5.1.6 or later,
it is also not possible to read from the INFORMATION_SCHEMA.PARTITIONS table, nor will you be able to drop those
tables or the database or databases in which they are located. In this event, you must:
1. Shut down mysqld
2. Manually delete the table, partition, and (if any) subpartition files
3. Restart the MySQL Server
(Bug#13437, Bug#16695)
Incompatible Change: TYPE = engine_name is no longer accepted as a synonym for the ENGINE = engine_name table
option. (TYPE has been deprecated since MySQL 4.0.)
MySQL Cluster: Attempting to SELECT ... FROM INFORMATION_SCHEMA.FILES now raises a warning in the event that
the cluster has crashed. (Bug#17087)
Replication: In row-based replication, when executing a Rows_log_event, the associated table was locked, the rows applied and the
lock released. This did not work since there are storage engines that count locks and perform an autocommit when the number of
locks reach zero. Now we ensure that all table maps come before all ROWS events in a statement.
Disk Data: Status messages have been added to ndb_restore to enable users to know that data files for Disk Data are being cre-
ated. (Bug#16873)
Cluster Replication: It is now possible to replicate NDB tables having no explicit primary key. See Section 17.9, MySQL Cluster
Replication.
Creator privileges are now checked for all events before execution. (Bug#17289)
CREATE EVENT, DROP EVENT, and ALTER EVENT statements are not allowed in triggers. (Bug#16410)
The SQL mode in effect at the time an event is created or altered is recorded and used during event execution. (Bug#16407)
New charset command added to mysql command-line client. By typing charset name or \C name (such as \C UTF8),
the client character set can be changed without reconnecting. (Bug#16217)
Added the --wait-timeout option to mysqlmanager to allow configuration of the timeout for dropping an inactive connec-
tion, and increased the default timeout from 30 seconds to 28,800 seconds (8 hours). (Bug#15980, Bug#12674)
All subpartitions within a given partitioned table are now guaranteed to have unique names. (Bug#15408)
MySQL Change History
3012
mysqlimport now has a --use-threads=N option for loading data files in parallel using N threads.
Added the RENAME DATABASE statement.
Added the PROCESSLIST table to INFORMATION_SCHEMA.
Several changes were made to make upgrades easier:
Added the mysql_upgrade program that checks all tables for incompatibilities with the current version of MySQL Server
and repairs them if necessary. This program should be run for each MySQL upgrade (rather than
mysql_fix_privilege_tables). See Section 4.4.8, mysql_upgrade Check Tables for MySQL Upgrade.
Added the FOR UPGRADE option for the CHECK TABLE statement. This option checks whether tables are incompatible with
the current version of MySQL Server.
Added the --check-upgrade to mysqlcheck that invokes CHECK TABLE with the FOR UPGRADE option. Added the -
-fix-db-names and --fix-table-names options to mysqlcheck.
Removed the have_isam and have_raid system variables.
Added the IN NATURAL LANGUAGE MODE and IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION modifiers
for full-text searches. See Section 11.8, Full-Text Search Functions.
Bugs fixed:
MySQL Cluster: Creating NDB tables containing BLOB columns but no primary key caused unpredictable behavior. (Bug#17559)
MySQL Cluster: Inserting the output of REPEAT('some_string', some_int) into a BLOB column resulted in the error
INVALID BLOB ATTRIBUTES OR INVALID BLOB PARTS TABLE. (Bug#17505)
MySQL Cluster: ndbd restarts could sometimes fail due to incorrect memory access. (Bug#17417)
MySQL Cluster: Sharing of table names containing special characters between multiple SQL nodes was not handled correctly
when binary logging was enabled (a timeout error resulted). (Bug#17415)
MySQL Cluster: Table definitions were not shared between multiple SQL nodes in a cluster without binary logging being enabled.
(Bug#17414)
MySQL Cluster: Cluster log file paths were truncated to 128 characters. They may now be as long as MAX_PATH (the maximum
path length permitted by the operating system). (Bug#17411)
MySQL Cluster: SHOW CREATE TABLE would fail when run against a table created in a different session. (Bug#17340)
MySQL Cluster: Following multiple forced shutdowns and restarts of data nodes, DROP DATABASE could fail. (Bug#17325)
MySQL Cluster: The REDO log would become corrupted (and thus unreadable) in some circumstances, due to a failure in the query
handler. (Bug#17295)
MySQL Cluster: An UPDATE with an inner join failed to match any records if both tables in the join did not have a primary key.
(Bug#17257)
MySQL Cluster: A DELETE with a join in the WHERE clause failed to retrieve any records if both tables in the join did not have a
primary key. (Bug#17249)
MySQL Cluster: CREATE TEMPORARY TABLE of a Cluster table would fail with an UNSUPPORTED error or crash the server.
(Bug#17210, Bug#16552)
MySQL Cluster: The storage engine did not allow views to be updated. (Bug#17206)
MySQL Cluster: When attempting to import data into an NDB table using LOAD DATA INFILE, the server would hang in the
event of a duplicate key error. (Bug#17154)
MySQL Cluster: In some cases, LOAD DATA INFILE did not load all data into NDB tables. (Bug#17081)
MySQL Change History
3013
MySQL Cluster: CREATE TABLE new_tbl LIKE old_tbl; failed when old_tbl used the NDB storage engine.
(Bug#17005)
MySQL Cluster: An unhandled resources issue could cause node failure with a DELETE FROM TABLE affecting thousands of
rows. (Bug#16492)
MySQL Cluster: UNIQUE keys in Cluster tables were limited to 225 bytes in length. (Bug#15918)
MySQL Cluster: REPLACE failed when attempting to update a primary key value in a Cluster table. (Bug#14007)
MySQL Cluster: No error message was generated for setting NoOfFragmentLogFiles too low. (Bug#13966)
MySQL Cluster: No error message was generated for setting MaxNoOfAttributes too low. (Bug#13965)
MySQL Cluster: Performing large numbers of data manipulation statements on cluster tables using Disk Data could lead to a server
crash.
Cluster Replication: Replication: Row-based replication of a cluster failed to take --binlog-ignore-db settings into ac-
count. (Bug#17188)
Replication: An ALTER DATABASE statement on a replication master crashed the slaves. (Bug#17521)
Replication: For a transaction that used MyISAM and InnoDB tables, interruption of the transaction due to a dropped connection
on a master server caused slaves to lose synchrony. (Bug#16559)
Replication: Previously, a stored function invocation was written to the binary log as DO func_name() if the invocation changes
data and occurs within a nonlogged statement, or if the function invokes a stored procedure that produces an error. These invoca-
tions now are logged as SELECT func_name() instead for better control over error code checking (slave servers could stop due
to detecting a different error than occurred on the master). (Bug#14769)
Replication: BIT fields were not properly handled when using row-based replication. (Bug#13418)
Disk Data: In some cases, a cluster using Disk Data tables could not be restarted following a normal shutdown. (Bug#16872)
Cluster Replication: Row-based replication was not set up correctly if a backup was already in progress. For example, connecting a
mysqld instance to a cluster which was being backed up would result in the message NDB: SKIPPING SETUP TABLE TBL_NAME
being written to the error log. (Bug#17459)
Cluster Replication: Cluster tables not having an explicit primary key could not be replicated. (Bug#14541)
Column counts were encoded incorrectly in the binary log for row-based logging format. (Bug#17678)
Data truncations on non-UNIQUE indexes could crash InnoDB when using multi-byte character sets. (Bug#17530)
Execution times for scheduled events were not calculated correctly: the last execution time was used as a base rather than the actual
start time. (Bug#17494)
Creating an event and using a whitespace character other than space following the DO keyword caused a server crash. (Bug#17453)
Partitioning with certain SUBPARTITION BY HASH clauses caused an error when querying for a partitioned column using an IS
NULL comparison. (Bug#17430, Bug#17432)
Race conditions between event creation, dropping, and execution could result in a server crash or hang. (Bug#17373)
Trying to create a partitioned table with more than 32 attributes failed. (Bug#17179)
Attempting to add a new partition to a table partitioned by a unique key would cause an OUT OF MEMORY error. (Bug#17169)
myisam_ftdump did not work for FULLTEXT indexes associated with a parser plugin. (Bug#17116)
On Windows platforms, some attempts to create partitioned tables from the command line would cause the mysql client to hang.
(Bug#17082)
A SELECT from the last partition of a subpartitioned table having a UNIQUE KEY could crash the MySQL Server. (Bug#16907)
Statements that contained Unicode characters were not logged to the log tables correctly. (Bug#16905)
MySQL Change History
3014
A SELECT on a subpartitioned table having a multiple-column PRIMARY or UNIQUE KEY, and whose partitioning function used
only the first column of the key, could cause mysqld to crash. (Bug#16901)
A RETURN statement within a trigger caused a server crash. RETURN now is disallowed within triggers. To exit immediately, use
LEAVE. (Bug#16829)
Using REPLACE INTO on a partitioned table having a primary key would crash the server in the event of a duplicate key error.
(Bug#16782)
DROP TABLE would sometimes fail on a table having subpartitions that used the default storage engine. (Bug#16775)
If the query optimizer transformed a GROUP BY clause in a subquery, it did not also transform the HAVING clause if there was one,
producing incorrect results. (Bug#16603)
Querying the INFORMATION_SCHEMA.PARTITIONS table on a nonmax server caused a server crash. This also happened fol-
lowing the creation of a table with a very large number (hundreds) of partitions. (Bug#16591, Bug#17141)
SHOW CREATE EVENT displayed no output. (Bug#16423)
DROP DATABASE did not drop events for the database. (Bug#16406)
The mysql_fix_privilege_tables.sql script did not properly initialize the Event_priv column to 'Y' for those ac-
counts that should have the EVENT privilege. (Bug#16400)
SELECT with GROUP BY on a view could cause a server crash. (Bug#16382)
MySQL server dropped client connection for certain SELECT statements against views defined that used MERGE algorithm.
(Bug#16260)
Using an XPath expression containing = with ExtractValue() caused the server to crash. (Bug#16242)
When used with the ExtractValue() function, an XPath expression having no leading / character would crash the server.
(Bug#16234)
Using GROUP BY on column used in WHERE clause could cause empty set to be returned. (Bug#16203)
CAST(... AS TIME) operations returned different results when using versus not using prepared-statement protocol.
(Bug#15805)
The SELECT privilege was required for triggers that performed no selects. (Bug#15196)
The UPDATE privilege was required for triggers that performed no updates. (Bug#15166)
A statement containing GROUP BY and HAVING clauses could return incorrect results when the HAVING clause contained logic
that returned FALSE for every row. (Bug#14927)
Killing a long-running query containing a subquery could cause a server crash. (Bug#14851)
SUBSTRING_INDEX() could yield inconsistent results when applied with the same arguments to consecutive rows in a query.
(Bug#14676)
SET sql_mode = N, where N > 31, did not work properly. (Bug#13897)
SHOW CREATE TABLE produced extraneous spaces following the keywords PRIMARY KEY . (Bug#13883)
InnoDB could display an incorrect error message for a cascading update. (Bug#9680)
CHECKSUM TABLE returned different values for MyISAM tables depending on whether the QUICK or EXTENDED option was
used. (Bug#8841)
SET TRANSACTION ISOLATION LEVEL acted like SET SESSION TRANSACTION ISOLATION LEVEL. That is, it set
the isolation level for longer than the next transaction. (Bug#7955)
Repeated invocation of my_init() and my_end() caused corruption of character set data and connection failure. (Bug#6536)
MySQL Change History
3015
C.1.32. Changes in MySQL 5.1.6 (01 February 2006)
Functionality added or changed:
Incompatible Change: Words with apostrophes are now matched in a FULLTEXT search against nonapostrophe words (for ex-
ample, a search for Jerry will match against the term Jerry's). Users upgrading to this version must issue REPAIR TABLE
... QUICK statements for tables containing FULLTEXT indexes. (Bug#14194)
Incompatible Change: This release introduces the TRIGGER privilege. Previously, the SUPER privilege was needed to create or
drop triggers. Now those operations require the TRIGGER privilege. This is a security improvement because you no longer need to
grant users the SUPER privilege to enable them to create triggers. However, the requirement that the account named in a trigger's
DEFINER clause must have the SUPER privilege has changed to a requirement for the TRIGGER privilege. After upgrading, be
sure to update your grant tables by running mysql_upgrade. This will assign the TRIGGER privilege to all accounts that had the
SUPER privilege. (After updating, you might also consider whether any of those accounts no longer need the SUPER privilege.) If
you fail to update the grant tables, triggers may fail when activated. (Bug#9412)
Incompatible Change: Before MySQL 5.1.6, the server writes general query log and slow query log entries to log files. As of
MySQL 5.1.6, the server's logging capabilities for these logs are more flexible. Log entries can be written to log files (as before) or
to the general_log and slow_log tables in the mysql database. If logging is enabled, either or both destinations can be selec-
ted. The --log-output option controls the destination or destinations of log output. See Section 5.2.1, Selecting General Query
and Slow Query Log Output Destinations.
If logging is enabled, the default destination now is to log to tables, which differs from earlier versions. If you had the server con-
figured for logging to log files formerly, use --log-output=FILE to preserve this behavior after an upgrade to MySQL 5.1.6 or
higher.
Important Change: MySQL Cluster: Replication: Replication between MySQL Clusters is now supported. It is now also possible
to replicate between a MySQL Cluster and a noncluster database. See Section 17.9, MySQL Cluster Replication, for more inform-
ation.
MySQL Cluster: Added the ndb_extra_logging system variable.
MySQL Cluster: The NDB storage engine now supports the CREATE INDEX and DROP INDEX statements.
Packaging: MySQL 5.1.6 introduces some changes to distribution packaging:
Distributions include both a mysqld optimized server and mysqld-debug debugging server. There is no separate debug dis-
tribution.
There is no longer a mysqld-max server. (Note: This changed in MySQL 5.1.9: The mysqld-max server also is included in
binary distributions.)
Server binaries no longer are stripped, except for RPM distributions.
Binary distributions for Unix and Unix-like systems no longer include safe_mysqld as a link to mysqld_safe.
safe_mysqld has been deprecated since MySQL 4.0 and now is removed.
The mysqldump utility now supports an option for dumping tablespaces. Use -Y or --all-tablespaces to enable this func-
tionality. (Bug#16753)
Partition support is not an engine, but it was included in the output of SHOW ENGINES. Now it is not. The
have_partition_engine variable was renamed to have_partitioning. (Bug#14355, Bug#16718)
ANALYZE TABLE is now supported for partitioned tables. (Bug#13441)
Added the --use-threads option for mysqlslap.
Queries against partitioned tables can now take advantage of partition pruning. In some cases, this can result in query execution that
is an order of magnitude faster than the same query against a nonpartitioned version of the same table.
There is no longer a mysqld-max server. (Note: This changed in MySQL 5.1.9: The mysqld-max server also is included in bin-
ary distributions.)
Added the FILES table to INFORMATION_SCHEMA.
MySQL Change History
3016
Binary distributions for Unix and Unix-like systems no longer include safe_mysqld as a link to mysqld_safe.
safe_mysqld has been deprecated since MySQL 4.0 and now is removed.
Special characters in database and table identifiers now are encoded when creating the corresponding directory names and file
names. This relaxes the restrictions on the characters that can appear in identifiers. See Section 8.2.3, Mapping of Identifiers to File
Names.
Added the event_scheduler system variable.
MySQL 5.1.6 introduces the Event Scheduler which allows one to schedule statements for execution at predetermined times. Events
can be transient (one-time-only) or recurrent at regular intervals, and may execute queries and statements permitted in stored
routines, including compound statements.
Events can be altered after creation, and dropped when no longer needed.
Information about scheduled events can be obtained using the statements SHOW EVENTS and SHOW CREATE EVENT, or by
querying the INFORMATION_SCHEMA.EVENTS table. All of these are available beginning in MySQL 5.1.6.
Users must have the EVENT privilege (also added in 5.1.6) to create events.
For more information, see Section 19.4, Using the Event Scheduler.
Distributions include both a mysqld optimized server and mysqld-debug debugging server. There is no separate debug distribu-
tion.
Server binaries no longer are stripped, except for RPM distributions.
The ARCHIVE storage engine now supports the AUTO_INCREMENT column attribute and the AUTO_INCREMENT table option.
Section 13.12, The ARCHIVE Storage Engine.
Server plugins can register their own status variables to be displayed by the SHOW STATUS statement.
Added the PARTITIONS table to INFORMATION_SCHEMA.
Added the EVENTS table to INFORMATION_SCHEMA.
Bugs fixed:
MySQL Cluster: NDB leaked disk space when performing repeated INSERT or DELETE statements. (Bug#16771)
MySQL Cluster: ndb_delete_all ran out of memory when processing tables containing BLOB columns. (Bug#16693)
MySQL Cluster: Trying to import too many dumped tables requiring resources beyond those allocated in the cluster configuration
file caused the server to crash instead of reporting an insufficient resources error. (Bug#16455)
MySQL Cluster: A BIT column whose offset and length totaled 32 caused the cluster to crash. (Bug#16125)
MySQL Cluster: The ndb_autodiscover test failed sporadically due to a node not being permitted to connect to the cluster.
(Bug#15619)
MySQL Cluster: NDB returned an incorrect CAN'T FIND FILE ERROR for OS error 24; this has been changed to TOO MANY OPEN
FILES. (Bug#15020)
MySQL Cluster: CREATE TABLESPACE statements were incorrectly parsed on 64-bit platforms. (INITIAL SIZE size
worked, but INITIAL SIZE = size failed.) (Bug#13556)
MySQL Cluster: Using mysqldump to obtain a dump of a partitioned table employing the NDB storage engine produced a non-
functional table creation statement. (Bug#13155)
Disk Data: Tablespaces created using parameters with relatively low values (10 MB or less) produced filesizes much smaller than
expected. (Bug#16742)
Disk Data: NDB returned the wrong error when the tablespace on disk was full. (Bug#16738)
MySQL Change History
3017
Disk Data: The error message generated by a failed ADD UNDOFILE did not provide any reasons for the failure. (Bug#16267)
Disk Data: DROP LOGFILE GROUP corrupted the cluster file system and caused ndbd to fail when running more than one node
on the same system. (Bug#16193)
Cluster API: Upon the completion of a scan where a key request remained outstanding on the primary replica and a starting node
died, the scan did not terminate. This caused incomplete error handling for the failed node. (Bug#15908)
When the fulltext search parser plugin returned more words than half of the length (in bytes) of the query string, the server would
crash. (Bug#16722)
An indexing error sometimes caused values to be assigned to the wrong RANGE partition. (Bug#16684)
An INSERT statement in a stored procedure corrupted the binary log. (Bug#16621)
Trying to add more than one partition in a single ALTER TABLE ... ADD PARTITION statement caused the server to crash.
(Bug#16534)
Parallel builds occasionally failed on Solaris. (Bug#16282)
Inserting a negative value into an integer column used as the partitioning key for a table partitioned by HASH could cause the server
to crash. (Bug#15968)
Creating a partitioned table using a storage engine other than the session default storage engine caused the server to crash.
(Bug#15966)
The error message for specifying values for which no partition exists returned wrong values on certain platforms. (Bug#15910)
Specifying a value for --tmpdir without a trailing slash had unpredictable results. (Bug#15904)
STR_TO_DATE(1,NULL) caused a server crash. (Bug#15828, CVE-2006-3081)
ALTER TABLE ... ADD PARTITIONS on a table with one partition crashed the server. (Bug#15820)
The mysql_real_connect() C API function incorrectly reset the MYSQL_OPT_RECONNECT option to its default value.
(Bug#15719)
In some cases the query optimizer did not properly perform multiple joins where inner joins followed left joins, resulting in corrup-
ted result sets. (Bug#15633)
Certain permission management statements could create a NULL host name for a user, resulting in a server crash. (Bug#15598)
Improper memory handling for stored routine variables could cause memory overruns and binary log corruption. (Bug#15588)
The absence of a table in the left part of a left or right join was not checked prior to name resolution, which resulted in a server
crash. (Bug#15538)
An ALTER TABLE ... PARTITION BY ... statement did not have any effect. (Bug#15523)
Using RANGE partitioning with a CASE expression as the partitioning function would cause records to be placed in the wrong parti-
tion. (Bug#15393)
Certain subqueries where the inner query was the result of a aggregate function would return different results with MySQL 5.1 than
with MySQL 4.1.
Subselects could also return wrong results when the query cache and grouping were involved. (Bug#15347)
Attempting to insert data into a partitioned table that used the BLACKHOLE storage engine caused mysqld to crash. (Bug#14524)
A FULLTEXT query in a prepared statement could result in unexpected behavior. (Bug#14496)
With a table partitioned by LIST, inserting a value which was smaller than any value shown in the partitioning value-lists could
cause the server to crash. (Bug#14365)
The DATA DIRECTORY and INDEX DIRECTORY clauses of a CREATE TABLE statement involving partitions did not work.
(Bug#14354)
MySQL Change History
3018
SHOW CREATE TABLE did not display the PARTITIONS clause for tables partitioned by HASH or KEY. (Bug#14327)
ALTER TABLE ... DROP PARTITION would truncate all DATE column values in the table's remaining partitions to NULL.
(Bug#13644)
ALTER TABLE ... ADD PARTITION could crash the server or cause an OUT OF MEMORY error in some circumstances.
(Bug#13447)
The server would allow foreign keys to be declared in the definition of a partitioned table despite the fact that partitioned tables do
not support foreign keys (see Section 18.5, Restrictions and Limitations on Partitioning). (Bug#13446)
A SELECT from a key-partitioned table with a multi-column key could cause the server to crash. (Bug#13445)
Issuing a TRUNCATE statement twice in succession on the same partitioned table would cause the server to crash. (Bug#13442)
Using a REPLACE statement on a partitioned table caused the server to crash. (Bug#13440)
Using an identifier rather than a literal integer value in the LESS THAN clause of a range-partitioned table could cause the server to
crash and corruption of tables. (Bug#13439)
Using ENGINE=... within a PARTITION clause could cause the server to crash. (Bug#13438)
CREATE TABLE ... LIKE did not work if the table whose schema was to be copied was a partitoned table. (Bug#13435)
Multi-byte path names for LOAD DATA and SELECT ... INTO OUTFILE caused errors. Added the charac-
ter_set_filesystem system variable, which controls the interpretation of string literals that refer to file names. (Bug#12448)
Temporary table aliasing did not work inside stored functions. (Bug#12198)
Using the TRUNCATE() function with a negative number for the second argument on a BIGINT column returned incorrect results.
(Bug#8461)
Certain Japanese table names were not properly saved during a CREATE TABLE statement. (Bug#3906)
C.1.33. Changes in MySQL 5.1.5 (10 January 2006)
Functionality added or changed:
Replication: Added the binlog_format system variable that controls whether to use row-based or statement-based binary log-
ging. Added the --binlog-format and --binlog-row-event-max-size server options for binary logging control. See
Section 16.1.2, Replication Formats.
Added the --port-open-timeout option to mysqld to control how many seconds the server should wait for the TCP/IP port
to become free if it cannot be opened. (Bug#15591)
A new statement, BINLOG, is generated by mysqlbinlog to represent row-based events in binary log files. The statement argu-
ment, a base 64-encoded string, is decoded by the server to determine the data change indicated by the corresponding event.
Added the --create-schema, --lock-directory, --number-of-queries, --only-print, -
-preserve-schema, and --slave options for mysqlslap.
If innodb_locks_unsafe_for_binlog is enabled or if the transaction isolation mode is READ COMMITTED, InnoDB can
use semi-consistent reads. This affects treatment by UPDATE statements for rows that are already locked by another transaction. If
a row is locked, InnoDB returns the latest committed version to MySQL so that MySQL can determine whether the row matches
the WHERE condition of the UPDATE. If the row matches (must be updated), MySQL reads the row again and this time InnoDB
either locks it or waits for a lock on it.
See also Bug#3300.
Added the --base64-output option to mysqlbinlog to print all binary log entries using base64 encoding. This is for debug-
ging only. Logs produced using this option should not be applied on production systems.
Added the INFORMATION_SCHEMA PLUGINS table and the SHOW PLUGIN statement.
MySQL Change History
3019
Two new Hungarian collations are included: utf8_hungarian_ci and ucs2_hungarian_ci. These support the correct sort
order for Hungarian vowels. However, they do not support the correct order for sorting Hungarian consonant contractions; we ex-
pect to fix this issue in a future release.
Plugins now can have status variables that are displayed in the output from SHOW STATUS. See Section 22.2.3, Writing Plugins.
Added the INFORMATION_SCHEMA ENGINES table.
Added the XML functions ExtractValue() and UpdateXML(). ExtractValue() returns the content of a fragment of
XML matching a given XPath expression. UpdateXML() replaces the element selected from a fragment of XML by an XPath ex-
pression supplied by the user with a second XML fragment (also user-supplied), and returns the modified XML. See Section 11.10,
XML Functions.
Bugs fixed:
INSERT DELAYED caused mysqld to crash. (Bug#16095)
The --plugin_dir option was not working. Specifying the parser name for fulltext also did not work correctly. (Bug#16068)
Attempting to insert into a table partitioned by LIST a value less than any specified in one of the table's partition definitions resul-
ted in a server crash. In such cases, mysqld now returns ERROR 1500 (HY000): TABLE HAS NO PARTITION FOR VALUE V ,
where v is the out-of-range value. (Bug#15819)
Issuing a DROP USER command could cause some users to encounter a hostname is not allowed to connect to
this MySQL server error. (Bug#15775)
The output of mysqldump --triggers did not contain the DEFINER clause in dumped trigger definitions. (Bug#15110)
The output of SHOW TRIGGERS contained extraneous whitespace. (Bug#15103)
Creating a trigger caused a server crash if the table or trigger database was not known because no default database had been selec-
ted. (Bug#14863)
InnoDB: Comparison of indexed VARCHAR CHARACTER SET ucs2 COLLATE ucs2_bin columns using LIKE could fail.
(Bug#14583)
A COMMIT statement followed by a ALTER TABLE statement on a BDB table caused server crash. (Bug#14212)
An INSERT ... SELECT statement between tables in a MERGE set can return errors when statement involves insert into child ta-
ble from merge table or vice-versa. (Bug#5390)
InnoDB: A semi-consistent read for an UPDATE statement with no index column in the WHERE condition locked all the rows in the
table. (Bug#3300)
C.1.34. Changes in MySQL 5.1.4 (21 December 2005)
Functionality added or changed:
Added the --server-id option to mysqlbinlog to enable only those events created by the server having the given server ID
to be extracted. (Bug#15485)
It is now possible to build the server such that MyISAM tables can support up to 128 keys rather than the standard 64. This can be
done by configuring the build using the option --with-max-indexes=N , where N>128 is the maximum number of indexes to
permit per table. (Bug#10932)
Added the myisam_use_mmap system variable.
Added the --bdb-data-direct and --bdb-log-direct server options.
Added the mysqlslap program, which is designed to emulate client load for a MySQL server and report the timing of each stage.
It works as if multiple clients are accessing the server.
MySQL Change History
3020
The bundled BDB library was upgraded to version 4.4.16.
Added the cp1250_polish_ci collation for the cp1250 character set.
Bugs fixed:
MySQL Cluster: The --ndb option for perror did not function. (Bug#15486)
MySQL Cluster: Using ORDER BY primary_key_column when selecting from a table having the primary key on a
VARCHAR column caused a forced shutdown of the cluster. (Bug#15240, Bug#15682, Bug#14828, Bug#15517)
Server could not be built on default Debian systems with BDB enabled. (Bug#15734)
SHOW ENGINES output showed the FEDERATED engine as DISABLED even for builds with FEDERATED support. (Bug#15559)
BDB: A DELETE, INSERT, or UPDATE of a BDB table could cause the server to crash where the query contained a subquery using
an index read. (Bug#15536)
It was not possible to reorganize a partition reusing a discarded partition name.
Now, for example, you can create a table such as this one:
CREATE TABLE t1 (a INT)
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN MAXVALUE
);
and then repartition it as shown here:
ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (
PARTITION p2 VALUES LESS THAN (30)
);
Previously, attempting to do so would produce the error ALL PARTITIONS MUST HAVE UNIQUE NAMES IN THE TABLE .
(Bug#15521)
The BLACKHOLE storage engine did not handle transactions properly: Rolled-back transactions were written to the binary log. Now
they ae not. (Bug#15406)
A left join on a column that having a NULL value could cause the server to crash. (Bug#15268)
Selecting from a view processed with the temptable algorithm caused a server crash if the query cache was enabled. (Bug#15119)
Creating a view that referenced a stored function that selected from a view caused a crash upon selection from the view.
(Bug#15096)
Multiple-table update operations were counting updates and not updated rows. As a result, if a row had several updates it was coun-
ted several times for the rows matched value but updated only once. (Bug#15028)
ROW_COUNT() returned an incorrect result after EXECUTE of a prepared statement. (Bug#14956)
ANALYZE TABLE did not properly update table statistics for a MyISAM table with a FULLTEXT index containing stopwords, so a
subsequent ANALYZE TABLE would not recognize the table as having already been analyzed. (Bug#14902)
Creating a view within a stored procedure could result in an out of memory error or a server crash. (Bug#14885)
SELECT queries that began with an opening parenthesis were not being placed in the query cache. (Bug#14652)
Space truncation was being ignored when inserting into BINARY or VARBINARY columns. Now space truncation results in a warn-
ing, or an error in strict mode. (Bug#14299)
The maximum value of MAX_ROWS was handled incorrectly on 64-bit systems. (Bug#14155)
MySQL Change History
3021
For binary string data types, mysqldump --hex-blob produced an illegal output value of 0x rather than ''. (Bug#13318)
Some comparisons for the IN() operator were inconsistent with equivalent comparisons for the = operator. (Bug#12612)
Attempts to assign NULL to a NOT NULL column in strict mode now result in a message of Column 'col_name' cannot
be null, rather than Column set to default value; NULL supplied to NOT NULL column 'col_name'
at row n. (Bug#11491)
SHOW CREATE DATABASE was sometimes refused when the client had privileges for the database. (Bug#9785)
Invalid casts to DATE values now result in a message of Incorrect datetime value, rather than Truncated incor-
rect datetime value. (Bug#8294)
mysql ignored the MYSQL_TCP_PORT environment variable. (Bug#5792)
C.1.35. Changes in MySQL 5.1.3 (29 November 2005)
Functionality added or changed:
Plugin API: Incompatible Change: MySQL 5.1 adds support for a very flexible plugin API that enables loading and unloading of
various components at runtime, without restarting the server. Although the work on this is not finished yet, plugin full-text parsers
are a first step in this direction. This allows users to implement their own input filter on the indexed text, enabling full-text search
capability on arbitrary data such as PDF files or other document formats. A pre-parser full-text plugin performs the actual parsing
and extraction of the text and hands it over to the built-in MySQL full-text search. (Author: Sergey Vojtovich)
The plugin API requires the mysql.plugin table. When upgrading from an older version of MySQL, you should run the
mysql_fix_privilege_tables command to create this table. See Section 4.4.4, mysql_fix_privilege_tables
Upgrade MySQL System Tables.
Plugins are installed in the directory named by the plugin_dir system variable. This variable also controls the location from
which the server loads user-defined functions (UDFs), which is a change from earlier versions of MySQL. That is, all UDF library
files now must be installed in the plugin directory. When upgrading from an older version of MySQL, you must migrate your UDF
files to the plugin directory.
Incompatible Change: Renamed the table_cache system variable to table_open_cache. Any scripts that refer to ta-
ble_cache should be updated to use the new name.
MySQL Cluster: VARCHAR columns used in MySQL Cluster tables are now variable-sized; that is, they now only allocate as much
space as required to store the data. Previously, a VARCHAR(n) column allocated n+2 bytes (aligned to 4 bytes), regardless of
whether the actual inserted value required that much space. (In other words, a VARCHAR column always required the same, fixed,
amount of storage as a CHAR column of the same size.)
Partitioning: allows distributing portions of individual tables across a file system, according to rules which can be set when the ta-
ble is created. In effect, different portions of a table are stored as separate tables in different locations, but from the user point of
view, the partitioned table is still a single table. See Chapter 18, Partitioning, for further information on this functionality. (Author:
Mikael Ronstrm)
RAND() no longer allows nonconstant initializers. (Prior to MySQL 5.1.3, the effect of nonconstant initializers is undefined.)
(Bug#6172)
Added the table_definition_cache system variable. If you use a large number of tables, you can create a large table defini-
tion cache to speed up opening of tables. The table definition cache takes less space and does not use file descriptors, unlike the nor-
mal table cache.
SET instance_name. option_name=option_value sets an option to the specified value and writes it to the config file
See Section 4.6.10, mysqlmanager The MySQL Instance Manager, for more details on these new commands. (Author: Petr
Chardin)
SHOW instance_name LOG FILES provides a listing of all log files used by the instance. (Author: Petr Chardin)
Added the SHOW AUTHORS statement.
Fast ALTER TABLE: Operations that change only table metadata and not table data do not require a temporary table to be used,
MySQL Change History
3022
which improves performance. For example, renaming a column changes only the .frm file and no longer uses a temporary table.
The Instance Manager (IM) now has some additional functionality:
SHOW instance_name LOG FILES provides a listing of all log files used by the instance. (Author: Petr Chardin)
SHOW instance_name LOG {ERROR | SLOW | GENERAL} size retrieves a part of the specified log file. (Author:
Petr Chardin)
SET instance_name. option_name=option_value sets an option to the specified value and writes it to the config
file See Section 4.6.10, mysqlmanager The MySQL Instance Manager, for more details on these new commands.
(Author: Petr Chardin)
SHOW instance_name LOG {ERROR | SLOW | GENERAL} size retrieves a part of the specified log file. (Author: Petr
Chardin)
Added the SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements (available only for servers that have been built
with debugging support). See Section 12.5.5.29, SHOW PROCEDURE CODE Syntax.
The performance of boolean full-text searches (using the + Operator) has been improved. See Section 11.8, Full-Text Search
Functions, for more details about full-text searching. (Author: Sergey Vojtovich)
Bugs fixed:
RESET MASTER failed to delete log files on Windows. One consequence of this change is that server opens the general query and
slow log files in shared mode, so now they can be renamed while the server has them open (something not true in previous ver-
sions). (Bug#13377)
Set functions could not be aggregated in outer subqueries. (Bug#12762)
C.1.36. Changes in MySQL 5.1.2 (Not released)
Functionality added or changed:
Added the bdb_cache_parts and bdb_region_size system variables, and allowed bdb_cache_size to be larger than
4GB on systems that support it. (Bug#14895)
Added MAXLOCKS, MINLOCKS, MAXWRITE, and MINWRITE as allowable values of the --bdb-lock-detect option.
(Bug#14876)
Added --replace to mysqldump. This option uses REPLACE INTO, rather than INSERT INTO, when writing the dumpfile.
Added Transactions, XA, and Savepoints columns to SHOW ENGINES output.
Bugs fixed:
Foreign keys were not properly enforced in TEMPORARY tables. Foreign keys now are disallowed in TEMPORARY tables.
(Bug#12084)
C.1.37. Changes in MySQL 5.1.1 (Not released)
Bugs fixed:
Partitioning: MySQL Cluster: Specifying the wrong nodegroup in a CREATE TABLE statement using partitioning would lead to
the table name being locked after the statement failed (that is, the table name could not be re-used). (Bug#12114)
Using ORDER BY in a query with a partitioned table on a 64-bit operating system could crash the server. (Bug#12116)
MySQL Change History
3023
Performing a CREATE TABLE statement with a PARTITION BY clause in a prepared statement could crash a server running in
debug mode. (Bug#12097)
When two threads competed for the same table, a deadlock could occur if one thread also had a lock on another table through LOCK
TABLES and the thread was attempting to remove the table in some manner while the other thread tried to place locks on both
tables. (Bug#10600)
C.2. MySQL Enterprise Monitor Change History
This appendix lists the changes to the MySQL Enterprise Monitor, beginning with the most recent release. Each release section covers
added or changed functionality, bug fixes, and known issues, if applicable. All bug fixes are referenced by bug number and include a
link to the bug database. Bugs are listed in order of resolution. To find a bug quickly, search by bug number.
C.2.1. Changes in MySQL Enterprise Monitor 2.0.6 (Not yet released)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 2.0.5.
Bugs fixed:
An error was generated when an attempt was made to rename a Replication Group to one that had previously been deleted.
(Bug#43846)
A new topology was not discovered after the previous replication group was renamed. (Bug#43815)
On Unix systems, executing the command:
./mysqlmonitorctl.sh stop
did not make sure that mysqld was shutdown before finishing.
This resulted in a situation such as the following:
# /opt/mysql/enterprise/monitor-2.0.0.7092/mysqlmonitorctl.sh stop
Using CATALINA_BASE: /opt/mysql/enterprise/monitor/apache-tomcat
Using CATALINA_HOME: /opt/mysql/enterprise/monitor/apache-tomcat
Using CATALINA_TMPDIR: /opt/mysql/enterprise/monitor/apache-tomcat/temp
Using JRE_HOME: /opt/mysql/enterprise/monitor-2.0.0.7092/java
Stopping tomcat service ... [ OK ]
/opt/mysql/enterprise/monitor-2.0.0.7092/mysqlmonitorctl.sh : mysql stopped
However, running the following command a few minutes later showed that the MySQL server was still running:
# /opt/mysql/enterprise/monitor-2.0.0.7092/mysqlmonitorctl.sh status
MySQL Network MySQL is running
MySQL Network Tomcat is not running
(Bug#43803)
The MySQL Enterprise Monitor upgrade installer incorrectly replaced the AdvisorScript.jar in
<instDir>/apache-tomcat/webapps/ROOT/WEB-INF/lib/ with the default Advisor JAR. (Bug#43773)
The agent created the mysql.inventory table with an engine type of InnoDB, instead of MyISAM, when InnoDB was specified
as the default engine type in my.cnf. This happened because the agent did not explicitly specify the table engine type to be of My-
ISAM. (Bug#43551)
If a host was not a slave during the initial discovery phase, then it would not be displayed in the Replication tab if it subsequently
became a slave.
This was because after the initial discovery phase, if a host did not have slavestatus present, no subsequent checks were made
to check for the host being a slave. It was therefore missed for the purposes of replication discovery and never showed in the Replic-
ation tab. (Bug#42997)
MySQL Change History
3024
C.2.2. Changes in MySQL Enterprise Monitor 2.0.5 (18th March 2009)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 2.0.4.
Bugs fixed:
The FreeBSD 7 Agent was inadvertently a Linux binary.
shell> file mysqlmonitoragent-2.0.5.7153-freebsd7-x86-32bit-installer.bin
mysqlmonitoragent-2.0.5.7153-freebsd7-x86-32bit-installer.bin: ELF 32-bit LSB executable,
Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs),
stripped
(Bug#44263)
Calling the Agent with the option --agent-run-os-tests resulted in a crash. This happened on Linux x86-64 systems. The
resultant stack trace was:
(qa-merlin)
2009-03-04 16:39:42: (critical) chassis.c:1097: could not raise RLIMIT_NOFILE to 8192,
Invalid argument (22). Current limit still 1024.
sigar-test-all.c.124 (test_sigar_pid_get):
pid = 5188
sigar-test-all.c.106 (test_sigar_mem_get):
...cut...
sigar-test-all.c.427 (test_sigar_file_system_list_get): (items = 13)
[0]
fs.dirname = /
fs.devname = /dev/mapper/vg00-root
fs.typename = local
fs.sys-type-name = ext3
fs.type = 2
fsusage.total = 15481840
fsusage.free = 14116140
fsusage.used = 1365700
fsusage.avail = 13329708
fsusage.files = 1966080
fsusage.use_percent = 0.100000
[0]
diskusage.reads = 315302
diskusage.writes = 6318240
diskusage.write_bytes = 25879511040
diskusage.read_bytes = 6561092608
diskusage.queue = 47457530080206
Segmentation fault
On some systems no output was shown, other than the message Segmentation fault. (Bug#43381)
Following a change in the replication configuration, MySQL Enterprise Monitor did not display the new topology correctly.
(Bug#43240)
When a data collection became invalid, the agent sent NULLs for those collection values. However, the timestamps that it sent with
the values were the timestamps from the last valid value that was collected.
Due to key constraints on the Service Manager side, MySQL Enterprise Monitor disregarded anything sent with duplicate
timestamps, thus the NULLs received from the agent were never processed. Some mechanisms, such as replication discovery, de-
pend on the NULLs to identify a situation where data has become invalid. (Bug#43239)
MySQL Enterprise Monitor did not add a log entry each time data was purged. The log entry should have noted how many rows of
each type of data were purged (historical data, logs, quan data). (Bug#43159)
MySQL Enterprise Monitor generated a stack overflow. This was as a result of a bug in Hibernate, which caused Hibernate to enter
infinite recursion while trying to load a relationship. (Bug#43107)
The Table Cache Set Too Low For Startup and Table Cache Not Optimal rules were not supported on MySQL 5.1 because the
table_cache system variable was deprecated and replaced with table_open_cache. (Bug#42663)
Migrated server was not completely deleted.
In a Monitor that had been updated from 1.3.2 to 2.0.4, with 2 database servers queued for migration, if a server being migrated was
deleted, or a migrated server was deleted, this would not be reflected in the user interface or in the license count, until Tomcat was
restarted. (Bug#42604)
MySQL Change History
3025
The installer used to upgrade from version 1.3 corrupted passwords containing the ? character. (Bug#42452)
Sun multi-core processors caused all cores to be reported on the meta information page.
The larger T-series SPARC processors have 32+ cores. This caused the meta information page in the Dashboard to scroll as it repor-
ted each one. (Bug#42355)
If an attempt was made to disable a rule using the link next to the rule, the following error message was generated:
U0002 You must log in to access the requested resource. Go to login page.
However, clicking on the link did not prompt the user to login again. (Bug#42313)
Changing ssh-agent from OpenSSH or specifying a malevolent value of agent-host-id, could inject data into the mon-
itored MySQL Server.
For example, setting agent-host-id to the value I'm a test would result in the following message in the error log:
2009-01-23 15:45:11: ((error)) agent_mysqld.c:281: mysql_real_query('INSERT INTO
mysql.inventory (name, value) VALUES ( 'hostid', 'I'm a test' )') on 'mysql' failed: You
have an error in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'm a test' )' at line 1 (mysql-errno = 1064)
(Bug#42306)
When SHOW GLOBAL STATUS returned a value greater than 214748364, it was sent to the Service Manager as 214748364.
(Bug#42245)
The Agent failed to identify local sockets as local on Mac OS X 10.4.
If the Agent was configured to use a Unix domain socket on Mac OS X 10.4, it did not treat the connection as local and failed to
provide CPU and memory information to MySQL Enterprise Monitor. This is shown in the log file:
2009-01-20 18:15:02: (message) network-socket.c:752: is-local family 0 != 1
2009-01-20 18:15:02: (message) agent_mysqld.c:322: [mysql] mysqld is not local or not
directly connected
However, this problem did not happen on Mac OS X 10.5. (Bug#42220)
Some graphs on the GRAPH tab were not updated after the page was refreshed, or UPDATE was clicked.
The only way to get an updated graph was to change the graph size (in pixels) and then click UPDATE. (Bug#42162)
The my.cnf file for the Enterprise Monitor internal database had the following configuration item:
innodb_autoextend_increment = 50M
This generated the error:
16:36:23 [Warning] option 'innodb_autoextend_increment': unsigned value 52428800
adjusted to 1000
This variable is interpreted as being specified in MB, so 50M would be 50 TB. Such a high value results in the variable being adjus-
ted to 1000 MB.
The value in the configuration file should be:
innodb_autoextend_increment = 50
(Bug#42096)
A number of Advisor rules had advice text that had not been translated into Japanese. The Advisors that contained untranslated rules
included Performance, Schema and Security. (Bug#42067)
The Service Manager did not handle the case where the agent failed to supply a valid master_ip. The Service Manager would
MySQL Change History
3026
then not restart. The logs contained the following:
2009-01-09 14:39:50,472 ERROR [main:org.springframework.web.context.ContextLoader] Context
initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with
name 'serverConnectionMonitor' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor
argument with index 2 of type [com.mysql.etools.monitor.bo.Manager]: Error creating bean
with name 'manager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Invocation of init method failed; nested exception is
com.mysql.etools.monitor.pom.UnsupportedAttributeException:
101c6b5b-15eb-49aa-916c-843c51b28d38: mysql.slavestatus.Master_ip
(Bug#42005)
Having too many users with strong privileges generated Service Manager errors and events failed to be triggered.
If there were approximately 1000 users with full privileges and the value of group_concat_max_len was set to 100001, the
size of the data that the agent sent to the Service Manager was too large and caused Service Manager errors. Also, the Security event
Account has Strong MySQL privileges did not trigger. (Bug#41987)
Query Analyzer's Query Type filter for SELECT ignored statements starting with parenthesis.
If you sent a statement through Query Analyzer starting with parenthesis, such as:
(SELECT 1 FROM dual);
and then attempted to filter for SELECT queries only, queries starting with parenthesis were not displayed. (Bug#41968)
The agent angel process was spawning too soon, which caused a duplicate UUID error.
g_error() logged a fatal error, and called abort(). This terminated the program. Then the angel respawned with the same
UUID, but with a -1 session resync request, which the MEM server denied because the old session was still active. This resulted in a
permissions denied error (1142) on the mysql.inventory table.
2008-12-17 18:58:58: (message) agent_mysqld.c:313: [mysql] mysqld is local and directly connected
2008-12-17 18:58:58: ((error)) agent_mysqld.c:444: [mysql] mysql_real_query("SELECT value
FROM mysql.inventory WHERE name = 'uuid'") failed: SELECT command denied to user
'ent_agent'@'127.0.0.1' for table 'inventory' (errno=1142)
2008-12-17 18:58:58: (debug) chassis.c:282: 15134 returned: 15134
2008-12-17 18:58:58: (message) chassis.c:304: [angel] PID=15134 died on signal=6 (it used
0 kBytes max) ... waiting 3min before restart
2008-12-17 18:59:00: (debug) chassis.c:244: we are the child: 15149
2008-12-17 18:59:00: (message) chassis.c:259: [angel] we try to keep PID=15149 alive
2008-12-17 18:59:00: (debug) chassis.c:277: waiting for 15149
2008-12-17 18:59:00: (message) mysql-proxy 0.7.0 started
2008-12-17 18:59:00: (message) MySQL Monitor Agent 2.0.0.7111 started.
(Bug#41600)
master_uuid discovery did not work with MySQL Server versions prior to 5.1. master_uuid did not show in any Agent to
Monitor communications, and no log or error messages were generated.
However, now the bug has been fixed, an Agent monitoring a 5.0 MySQL Server would register the following in its logs:
...
<classname>slavestatus</classname>
<instance>12515cdc-8c00-4223-9d2a-2666a403512c</instance>
<attribute>Master_uuid</attribute>
</target>
<utc>2009-03-03T19:58:05.700Z</utc>
<value>b2fd9f86-6e42-49f2-b930-e8fb3e728179</value>
Note the presence of master_uuid. (Bug#41525)
The master_uuid was not used for replication topology discovery.
The agent collected master_uuid by reading the master.info file, and then running a SELECT directly against its master.
This was to try and read the mysql.inventory table on the master to obtain the instance master_uuid.
However, this was not being used correctly by the replication topology discovery within the server. (Bug#41519)
MySQL Change History
3027
Queries such as SELECT against the master mysql.inventory was not logged on slave-based agents. This made diagnosing to-
pology discovery issues difficult. (Bug#41518)
After an error was generated due to an incorrect password while trying to create a new user, the following error was obtained when
subsequently attempting to create a valid new user:
U0002 You must log in to access the requested resource
(Bug#41384)
Agent startup failed on Solaris 10. The error generated was:
# ./mysql-monitor-agent start
Bad string
ERROR! /opt/mysql/enterprise/agent/etc/mysql-monitor-agent.ini has to have a
[mysql-proxy].pid-file setting
This was caused by unexpected behavior of the tr command. (Bug#41260)
On the Query Analysis page, if a query was clicked the minimum displayed was greater than the average. (Bug#41259)
In some circumstances the agent/proxy ran out of file descriptors, causing secondary failures. It could not recover from that state.
The relevant part of the log file is shown here:
2008-11-27 11:11:00: (critical) last message repeated 2 times
2008-11-27 11:11:00: (critical) job_collect_os.c:411: sigar_cpu_info_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:445: sigar_cpu_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:411: sigar_cpu_info_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:445: sigar_cpu_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:411: sigar_cpu_info_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:445: sigar_cpu_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:411: sigar_cpu_info_list_get() failed
2008-11-27 11:11:00: (critical) job_collect_os.c:445: sigar_cpu_list_get() failed
2008-11-27 11:11:30: (critical) network-socket.c.292: socket(127.0.0.1:3306) failed: Too many open files (24)
2008-11-27 11:11:30: (critical) proxy-plugin.c.1532: Cannot connect, all backends are down.
2008-11-27 11:20:22: (critical) last message repeated 4 times
2008-11-27 11:20:22: (critical) network-io.c:215:
curl_easy_perform('https://user:password@merlin-dashboard:443/heartbeat') failed:
SSL connection timeout (curl-error = 'Timeout was reached' (28), os-error = 'Connection refused' (111))
(Bug#41068)
If an installation of Service Manager 2.0.0.7102 included a backup directory, due to a previous upgrade, and was upgraded using
at least Service Manager 2.0.0.7103, then the installer displayed an error message and exited.
The error message displayed was:
There has been an error.
Error renaming /Applications/mysql/enterprise/monitor/apache-tomcat to
/Applications/mysql/enterprise/monitor/backup/apache-tomcat
The application will exit now
(Bug#40996)
The Agent started without problems and connected to the master. But it was unable to perform a SELECT from the table
mysql.inventory in order to obtain server information. (Bug#40933)
Canonical Query Text for Select -1 was displayed as SELECT -? instead of SELECT ? on the Query Analyzer tab.
(Bug#40435)
The agent installer for Solaris 8 x86 32-bit was missing. (Bug#40248)
The startup scripts supplied with MySQL Network Monitoring and Advisory tool did not supply all of the LSB init.d script op-
tions required. A list of the required options can be found at the following website ht-
tp://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
The required options missing include status and force-reload. The option status is used by monitoring tools and cluster
software such as Red Hat Cluster, to ensure that the service is still running. The force-reload option is an alias for restart.
(Bug#29848)
MySQL Change History
3028
Multiple errors showed in the agent log after issuing a SHOW INNODB STATUS statement. The InnoDB Buffer Poolgraph
also went blank. (Bug#27372)
C.2.3. Changes in MySQL Enterprise Monitor 2.0.4 (5th February 2009)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 2.0.3.
Bugs fixed:
The Service Agent did not log connections to, and disconnects from, the monitored database.
This meant it was not possible to check if the Agent was connected to the database by simply looking at the log file. (Bug#42403)
The Service Agent failed to create the mysql.inventory table. The logs displayed the following error message:
(critical) (share/mysql-proxy/quan.lua:711) [proxy] please add SELECT permissions for
this user on mysql.inventory to enable the QUAN feature, got Table 'mysql.inventory'
doesn't exist
This happened even though the Service Agent used the root account. (Bug#42389)
After installing Service Agent 2.0.4.7138 and then starting it with --version, the incorrect version was displayed. Although
2.0.4.7138 was installed, the Service Agent displayed the version number as 2.0.2.7138. (Bug#42263)
An invalid path was shown in the error message if the upgrade installer failed to find the previous install location.
The error message is shown below, note that the error message displays a different path to that provided by the user:
Please specify the directory that contains the previous installation of the MySQL
Enterprise Monitor Agent
Installation directory [/home/mysql/mysql/enterprise/agent]: /var/lib/mysql/agent
Warning: The directory /home/mysql/mysql/enterprise/agent does not contain a a
previous installation. Please select the right installation directory.
Press [Enter] to continue :
----------------------------------------------------------------------------
Please specify the directory that contains the previous installation of the MySQL
Enterprise Monitor Agent
(Bug#42200)
The agent password error in the Service Manager did not log the originating host, making it impossible to determine the agent that
failed to log in:
ErrorJan 5, 2009 4:56:08 PM<?xml version='1.0'?><exceptions><error><![CDATA[E1702:
IncorrectPasswordException: [agent]]]></error></exceptions>
(Bug#42139)
The Service Manager's JDBC connections did not have sql_mode set to include NO_ENGINE_SUBSTITUTION. This resulted in
the failure of Data Definition Language (DDL) if the Service Manager was inadvertently pointed to an incorrect mysqld instance.
(Bug#42137)
A number of Advisor rules had advice text that had not been translated into Japanese. The Advisors that contained untranslated rules
included Performance, Schema and Security. (Bug#42067)
Service Agent configuration files had global read privileges on the filesystem. (Bug#41794)
When the log files rotated to the maximum allowed by the log4j configuration, the metadata contained in the FileAppender
became out of synchronization due to a logic bug. This caused an assertion error on any subsequent request for the logs tab or data.
(Bug#41593)
SNMP trap messages were sending 127.0.0.1 as the IP address, and there was no feature to allow the user to configure the IP ad-
dress contained in the SNMP message, which would have been useful for troubleshooting. (Bug#41361)
MySQL Change History
3029
On all available test systems, including SUSE Linux Enterprise Server (SLES) 9 and 10 x86-32, x86-64, IA64, and Ubuntu 6.10
x86-64, the agent memory grew incrementally within ~3 hours to ~25M.
The agents then switched to the 'red' condition on the dashboard and no more data was reported. The agent processes were still alive.
This was also present in MySQL Enterprise Monitor version 2.0.0.7111 on Suse 7.3, with the glibc2.2 x86 agent.
There was no load on the monitored servers, and the problem also occurred when the self-quan was not configured. (Bug#41244)
Although the MONITOR tab loaded initially, after a 64-bit MySQL server running a 32-bit MySQL Monitor Agent was clicked, a
Null Pointer Exception was generated. (Bug#41164)
The Service Agent startup configuration did not seem to work and did not generate a log file. (Bug#40583)
An error generated by a rule failed to clear.
When a rule was created with the os:disk:fs_used data item, if the instance was not a valid mount point then the Service
Agent reported the error:
2008-08-11 17:57:00: (critical) disk-get failed for all: 2
Note the above instance was for all, and similar results occurred for instance disk.
The issue was that upon editing the rule, or even deleting the rule, the agent still showed the above error type. Restarting the agent
and the monitoring service failed to remove the error. (Bug#38709)
If the On Save send test trap checkbox was checked when the SAVE button was clicked and the locale was set to Japanese, an error
occurred. The orange error banner was displayed at the top of the page with the error message in Japanese. (Bug#32069)
C.2.4. Changes in MySQL Enterprise Monitor 2.0.3 (23rd January 2009)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 2.0.2.
Bugs fixed:
The Service Agent failed to connect to the server, and no error message was displayed in the log file.
However, when the log verbosity level was set to message, the following message was recorded:
2009-01-12 13:34:43: (warning) agent_mysqld.c:600: agent connecting to mysql-server
failed: mysql_real_connect(host = '127.0.0.1', port = 3306, socket = ''): Lost connection
to MySQL server at 'reading initial communication packet', system error: 0 (mysql-errno =
2013)
(Bug#42044)
There was a mismatch between the contents of an SNMP Trap from MySQL Enterprise Monitor and the definition given in the file
MONITOR.MIB. (Bug#41912)
If a copy was made of a standard rule, the resulting Wiki markup was incorrect, resulting in the display of user-interface text con-
taining HTML markup. (Bug#41375)
Allowing the heat chart rules to be set to unscheduled caused the user interface to appear broken. (Bug#41312)
When a custom rule requiring disk information was created, for example:
[Expression]
%disk_reads% > THRESHOLD
[Thresholds]
Critical Alert: 9000
Warning Alert: 3000
Info Alert: 1000
[Variable Assignment]
variables: %disk_reads%
Data Item: os:disk:disk_reads
MySQL Change History
3030
Instance: /
The following error was written to the file mysql-service-agent.log:
2007-09-05 17:11:00: (critical) disk-get failed for c0d0p1: 2
It therefore appeared that the Service Agent was not able to obtain the required information. (Bug#30820)
C.2.5. Changes in MySQL Enterprise Monitor 2.0.2 (14th January 2009)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 2.0.1.
Bugs fixed:
The COMPLETE SETUP button was missing from the SETUP page you were taken to after the current subscription expired.
(Bug#41685)
If the host-id of the monitored instance and the host-id of the current agent did not match, the agent generated the following
error message:
Please TRUNCATE TABLE mysql.inventory on this mysql-instance and restart the agent.
However, it did not suggest using sql_log_bin = 0. This is used for all other actions against this table so that they are not rep-
licated to slaves, each of which has their own copy of this table. (Bug#41673)
The Agent did not start up when the monitored server had many databases and tables, and was under heavy load. This was because
the trigger_schema query was taking too long on agent start up. (Bug#41555)
The Service Agent failed to install on Solaris 10 x86. The following error was generated:
Installing
0% ______________ 50% ______________ 100%
########################################
Warning: Problem running post-install step.
Installation may not complete correctly
Error running /usr/local/mysqlagent/bin/mysql-monitor-agent
--defaults-file=/usr/local/mysqlagent/etc/mysql-monitor-agent.ini
--plugins=agent --agent-generate-uuid=true : 2008-12-12 13:06:02: (critical)
Conversion from character set '646' to 'UTF-8' is not supported
2008-12-12 13:06:02: (message) shutting down normally
(Bug#41445)
The console/stdout appender remained in the log4j configuration, which meant that all the MySQL Enterprise Monitor server logs
were duplicated to Catalina's stdout, and thus catalina.out, which was wasteful, especially as that file was not rotated or man-
aged. (Bug#41439)
When creating new multiple user accounts, the first attempt worked fine. However, following attempts to create new users did not
show the QUERY ANALYZER OPTIONS in the CREATE USER popup until the role field was changed. (Bug#41430)
When login privileges were required the Service Manager did not redirect the user to the login page. This resulted in error messages
being displayed rather than simply redirecting the user to the login page. This problem typically occurred if it was necessary to re-
start Tomcat. (Bug#41320)
The monitor 2.0.0.7105 and 2.0.0.7122 Solaris Intel update installer quits unexpectedly. The installer exits from the GUI in the
BACKUP OF PREVIOUS INSTALLATION screen, when OpenSolaris is running on top of Sun xVM.
The console output for both installer versions is given below:
shell> ./mysqlmonitor-2.0.0.7105-solaris-intel-update-installer.bin
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 73 (X_GetImage)
Serial number of failed request: 21161
Current serial number in output stream: 21161
MySQL Change History
3031
shell> ./mysqlmonitor-2.0.0.7122-solaris-intel-update-installer.bin
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 73 (X_GetImage)
Serial number of failed request: 21148
Current serial number in output stream: 21148
(Bug#41315)
The RENAME GROUP function failed if the new group name was different to the current one only in the case used; for example, if
Merlin was changed to MERLIN.
The error generated was:
U0105 This group name is already in use. Enter a different name.
(Bug#41266)
The Agent returned an inventory list of all databases and tables. This information was not used by MySQL Enterprise Monitor, other
than to populate the inv_databases and inv_tables tables. For large-scale deployments, where there were many databases
and tables, this resulted in redundant XML messages being sent from the Agent to the Service Manager. (Bug#33150)
C.2.6. Changes in MySQL Enterprise Monitor 2.0.1 (15th December 2008)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 2.0.0.
Bugs fixed:
Having an installation with over 420 master binlogs resulted in the mysql::status graph not being plotted. (Bug#41314)
The MySQL Enterprise Monitor installer generated a segfault on RedHat Fedora 10:
shell> ./mysqlmonitor-2.0.0.7105-linux-x86-installer.bin
Segmentation fault
(Bug#41196)
C.2.7. Changes in MySQL Enterprise Monitor 2.0.0 (11th December 2008)
This section documents all changes and bug fixes that have been applied since the release of MySQL Enterprise Monitor, version 1.3.3.
Functionality added or changed:
Important Change: The server-name configuration parameter is deprecated. For compatibility, during an upgrade, the informa-
tion will be migrated to a displayname configuration parameter within the individual instance configuration files. This configur-
ation parameter is provided only for compatibility, as display name information is now stored within the main repository. Support
for displayname is also deprecated and will be removed in a future release.
Important Note: The rules 32-Bit Binary Running on 64-Bit AMD Or Intel System and Key Buffer Size Greater Than 4 GB
occasionally do not evaluate correctly due to timing issues. This causes them to be displayed with the SEVERITY level of
Unknown. This is a known issue and will be resolved in future versions of MySQL Enterprise Monitor.
Important Note: When you start the Merlin 2.0 agent from the command line on Windows, you get the following error dialog:
"mysql-proxy.exe - Entry Point Not Found"
"The procedure entry point libiconv_set_relocation_prefix could not be located in the
dynamic link library iconv.dll"
If you click OK the agent works fine after that.
This only occurs when starting the agent from the command line, and only when there is another version of one of the DLLs that the
MySQL Change History
3032
agent uses somewhere on the current path. This error can be avoided by opening a command prompt, typing SET PATH= to clear
the path, and then starting the agent.
Important Note: If you are monitoring one instance of MySQL server (mysqld) and then upgrade that MySQL server, the correct
version of the MySQL server is not displayed in the Dashboard. This is a known issue that will be fixed in future versions of
MySQL Enterprise Monitor.
The following has been added to the Tomcat config.properties properties file:
# max connections in the pool for the repository
default.maxActive=70
(Bug#40652)
The dashboard could be used to change the agent password to one containing the @ character, or other special characters, which sub-
sequently caused errors. To fix this problem, special characters in passwords are now prevented by the dashboard. The list of disal-
lowed special characters can be found at the following location: ht-
tp://en.wikipedia.org/wiki/Percent-encoding#Types_of_URI_characters (Bug#37172)
The QUERY ANALYSIS page was missing the REFRESH dropdown control that the MONITOR, EVENTS, and GRAPHS pages had at
the top. (Bug#36831)
The User Interface only returned error strings, without any associated error codes. This meant that if the error string was in a lan-
guage that the user did not understand, it would be very difficult to determine which error actually occurred.
The User Interface now supports error codes, as well as error strings. This change allows easier testing of multiple locales.
(Bug#32131)
The wording was changed on the fading popup subscription alert. The text account was changed to subscription. (Bug#31492)
The alert thresholds for the Query Cache Advisor were changed:
Information Warning Critical
From 95 85 75
To 60 50 40
(Bug#30969)
The agent log file name has changed from mysql-service-agent.log to mysql-monitor-agent.log. The old log file
will be retained during a upgrade install.
Bugs fixed:
Starting a new agent against an instance that contained many databases broke up the initial discovery packet, causing collections
such as CPU usage and their graphs to fail. See also Bug#33150 and Bug#41314. (Bug#41933)
When altering an existing rule you had to add an empty string, "", to any threshold level that was empty. Otherwise, the rule failed
to run and the resulting exceptions caused the EVENTS page to be unusable due to duplicate key exceptions. (Bug#41310)
After installing the 2.0.0.7119 Dashboard the following error was generated in the logs:
com.opensymphony.xwork2.util.OgnlValueStack Warning Dec 5, 2008 10:41:26 AM Caught
an Ognl exception while getting property titleAddition
(Bug#41252)
The dc_ng_long_now table became very large partly due to an unused column begin_time. (Bug#41093)
Although there was a unique constraint on the user name, it was not enforced during first-time setup. This resulted in a stack trace
being produced, rather than a more user-friendly error message, if the same name was used for the admin and agent accounts.
(Bug#40870)
MySQL Change History
3033
MySQL Enterprise Monitor server had stopped sending up/down SNMP traps. (Bug#40861)
The Query Analyzer's EXPLAIN QUERY tab did not have pop up text or a link to the documentation regarding SELECT queries.
(Bug#40841)
When you tried to import a Trial-level advisor JAR using a Trial user account, one of the following error messages was generated:
U0009 The uploaded Advisor jar was invalid
U0161 Please import a Platinum level Advisor .jar to use with this Platinum level product key
(Bug#40834)
Meta Info on the Dashboard did not display information for the meta data os_description. (Bug#40830)
Attempting to create an alias of statements such as COMMIT, ROLLBACK, BEGIN, resulted in the error:
Can't find template commitTnx.st; group hierarchy is [HTMLFormatting]
org.antlr.stringtemplate.StringTemplateGroup.lookupTemplate(StringTemplateGroup.java:507)
(Bug#40736)
Trying to upgrade from 2.0.0.7088 to 2.0.0.7092 failed as there was a missing file. When the update program mysqlmonitor-
2.0.0.7092-solaris-intel-update-installer.bin was run, the file /
tmp/com/mysql/merlin/server/version.props could not be found. (Bug#40692)
On OS X with Java 1.5, Tomcat crashed on launch with the error:
Invalid memory access of location 00000007 eip=013df179
(Bug#40689)
When the agent was installed using the command line installer and --enableproxy 0 was specified, the installer should have
removed quan.lua from the agent-item-files option in the INI file. (Bug#40551)
The Agent could not connect to a database with the hostname set to localhost. Doing so resulted in the error:
(critical) the MySQL server could not be reached at socket '(null)', we will check in 10 seconds
(Bug#40530)
The update installer for the 2.0 Monitor did not have an IS SSL SUPPORT REQUIRED? checkbox. Therefore, the appropriate SSL
connector definition was commented out in the conf/server.xml file. (Bug#40414)
The Service Manager installer did not uninstall or wipe out the previous installation if you answered Yes to the question:
The directory you selected already contains a MySQL installation. If you continue installation all data will be lost. Do you wish to
continue? (Bug#40410)
If you unchecked the ENABLE PROXY checkbox on the QUERY ANALYSIS CONFIGURATION screen, the agent's INI file still con-
tained proxy configuration data and was not commented out. (Bug#40272)
As different queries were sent through the agent it used increasing amounts of memory. (Bug#40260)
The Service Manager installer set the Java Virtual Machine option HeapDumpPath to <install_root>\temp on Windows
and /tmp on other platforms. For consistency the HeapDumpPath directory should have been set to <install_root>\tmp
on Windows. (Bug#40215)
When using the command line agent setup program, a socket file was not accepted for the monitored instance. (Bug#40085)
The language option when installing the MySQL Enterprise Monitor in Japanese using the command-line instllaer has been changed
from jp to ja. (Bug#40082)
When monitoring MySQL 5.1.24 and above, the user used by the agent to connect to the MySQL server for monitoring must have
MySQL Change History
3034
the PROCESS privilege. (Bug#40050)
The check box option string Is SSL support required?, on the Tomcat Server Option dialog of the Monitor installation, was not
correctly translated into Japanese. (Bug#39814)
The base application directory for the MySQL Enterprise Dashboard has been updated from ht-
tp://localhost:18080/merlin to http://localhost:18080/. (Bug#39403)
If the Service Manager or the MySQL Server running the Repository crashed, they did not restart automatically. (Bug#39377)
If the agent crashed, there was no watchdog, angel or keep-alive mechanism to restart the agent and keep it running. (Bug#39374)
If the MySQL client libraries were located in a nonstandard location, the agent 2.0.0.7042 installer failed with a library not found
error. (Bug#39317)
For the rule Server-Enforced Data Integrity Checking Not Strict, the Recommended Action did not display correctly. It displayed
as SET sql_mode=modes, rather than SET [GLOBAL|SESSION] sql_mode=modes. (Bug#39261)
A query that was issued through the proxy, and that had an auto-explain performed on that query, did not give the correct response
to a subsequent query of SELECT FOUND_ROWS(). (Bug#39223)
It was not possible to establish a connection with the Dashboard using the SSL protocol (https://). (Bug#39198)
When a 1.3 MySQL Enterprise Monitor installation with many rules scheduled was upgraded to 2.0, the upgraded installation was
then found to have only the heat chart rules scheduled. (Bug#39043)
The agent installer did not allow a second agent to be installed on Windows. (Bug#38976)
The Dashboard incorrectly diplayed that insufficient licenses were available, even though sufficient licenses had been purchased.
(Bug#38514)
After running the MySQL Service Agent uninstall program, the file /etc/init.d/mysql-service-agent remained present
on the server. (Bug#38490)
The notice fader continued to display English text after you changed the locale to Japanese. (Bug#38460)
The SUBSCRIPTION EXPIRED pop-up window referred to the Global Preferences page, instead of the Global Settings page.
(Bug#38358)
An inappropriate time zone was used to parse user-entered date and time strings. (Bug#38323)
A sigar network stats error was generated on the Solaris platform:
# /opt/mysql/enterprise/agent/bin/mysql-service-agent --version
MySQL Service Agent - 1.2.0.7879, (glib lib=2.8.5, headers=2.8.5)
SunOS mysqlprd01 5.10 Generic_127127-11 sun4v sparc SUNW,T5240
2008-07-21 10:07:24: (critical) sigar_net_interface_config_primary_get() failed: 6
2008-07-21 10:08:00: (critical) sigar_net_interface_config_primary_get() failed: 6
# /opt/mysql/enterprise/agent/bin/sigar-test-all >/tmp/test.txt
sigar_net_interface_stat_get(e1000g0:2) failed#
(Bug#38302)
After deleting a server from the SETTINGS, MANAGE SERVERS tab, at the very bottom of the page the MONITORING X INSTANCES
ON X HOST values did not reflect the deletion. (Bug#38225)
The MySQL Enterprise Monitor alert INFO Alert - Users Can View All Databases On MySQL Server (v 1.5 *) from the Security
advisor was incorrect. This is because the default server behavior allows users to see databases for which they have privileges, not
all databases on server as suggested by the alert. (Bug#38052)
The Maximum Connection Limit Nearing Or Reached advisor did not generate a new Critical Alert event when there was an open
info success event. (Bug#37816)
The Linux IA64 installer appeared to crash. The installer appeared to crash on RH4_IA64 if called with option "--version":
-------------------------------------------------------------------------------
MySQL Change History
3035
<INSTALLER> --version
mysqlmonitorage(30704): unaligned access to 0x6000000000a8413c, ip=0x2000000003ddd5f0
mysqlmonitorage(30704): unaligned access to 0x6000000000a84144, ip=0x2000000003ddd5f1
mysqlmonitorage(30704): unaligned access to 0x6000000000a8414c, ip=0x2000000003ddd600
mysqlmonitorage(30704): unaligned access to 0x6000000000a84154, ip=0x2000000003ddd601
MySQL Enterprise Monitor Agent 0.7.0.1737 --- Built on 2008-06-25 19:31:53
-------------------------------------------------------------------------------
However, this warning is harmless and will not impact the operation of the agent. (Bug#37496)
If the log-level option in the agent configuration file was set to an unknown level by mistake, the init.d script appeared to enter
an infinite loop. (Bug#37108)
Malformatted server meta information appeared on the Dashboard; RAM and DISK SPACE appeared under the CPU category.
(Bug#36740)
A rename link incorrectly appeared next to the UPGRADE category on the MANAGE RULES page. (Bug#36584)
In the case where exceptions were passed through to the User Interface, the substituted arguments in the message contained de-
veloper-only information. (Bug#36580)
AGENT VERSION, LAST MYSQL CONTACT, OS INFO, CPU INFO, and IP ADDRESSES were all blank on the dashboard when the
agent for the selected server was not functioning. (Bug#36301)
mysql-monitor-agent became confused by the .DS_Store files that are created on Mac OS X. (Bug#36216)
The rule Key Buffer Size Greater Than 4 GB incorrectly triggered the following alert:
CRITICAL ALERT - KEY BUFFER SIZE GREATER THAN 4 GB
However, on non-Windows systems, a key buffer size greater than 4 GB is supported. (Bug#36143)
Since the repository database for MySQL Enterprise Monitor uses InnoDB there was no way to reduce the size of the data files after
an old log/event data purge operation. Further, the purge data operation executed once per day, and had no option to trigger the
purge operation manually. (Bug#35971)
On the Graphs page, if all graphs were expanded, then the Time Display interval updated, the page was refreshed with the EXPAND
ALL button displayed, even though all the graphs were already expanded. (Bug#35917, Bug#35133)
The Meta Info area of the Monitor page incorrectly reported the operating system version number for the MySQL version.
(Bug#35836)
The rule XA Distributed Transaction Support Enabled For InnoDB incorrectly sent a warning when the binary log was on.
(Bug#35786)
On the Monitor page, the time displayed for Last MySQL Contact lagged behind that for Last Agent Contact by a large
amount. (Bug#35774)
MySQL Enterprise Monitor did not update replication settings correctly. After a slave became the master, the Adviser still referred
to it as a slave. (Bug#35771)
The Adviser email suggested using the --log-queries-not-using-indexes option. However, this option is not available
in MySQL Server versions prior to 4.1. (Bug#35770)
Thumbnail graphs did not update properly after a time zone change. (Bug#35756)
If a system had a global wait_timeout lower than the general activity of the agent, the agent was disconnected. The monitored
server then logged an error and incremented Aborted_clients. (Bug#35648)
Alerts fired after a blackout period based on data collections that happened during the blackout. (Bug#35617)
The translation of the ADD ROW button on the Rule Definition window was incorrect. (Bug#35495)
An uninstallation message asked about removing Apache files, even though Apache is no longer used. (Bug#35154)
After updating from a previous version to the latest 1.3 version, the QUERY CACHE HAS SUB-OPTIMAL HIT RATE was still dis-
MySQL Change History
3036
played in English after setting the locale to Japanese. Note, the rule was translated correctly if the full installer was used.
(Bug#35134)
The MySQL Enterprise Monitor uninstall dialog box had missing text when using the Japanese locale. (Bug#34982)
Running the installer with the --help option caused an incorrect message to be displayed. (Bug#34200)
When using the unattended unInstall script on Linux together with the option --env deleteUserData=yes the correct
warning text was displayed. However, this text should not be displayed in unattended mode. Further, the option --env de-
leteUserData=yes was not displayed by the --help output. (Bug#34071)
Platinum Unlimited customers sometimes received a warning stating incorrectly that their subscription supported zero hosts.
(Bug#34010)
Clicking on the resolution notes link for a closed event on the events tab showed incorrect behaviour. The popup initially showed
the resolution notes, but when the resolution tab was clicked the notes disappeared and were replaced by an edit box. (Bug#33935)
The status on the product information page was not translated when the user locale was set to Japanese. (Bug#32785)
When the locale was set to Japanese, the date picker still had English month titles. (Bug#32741)
Flashing display of a pop-up used while saving outgoing email settings was caused by problematic initial placement calculations.
(Bug#32579)
AIX 5.2 Agent did not work on AIX 5.3. (Bug#32414)
When the First Time Setup program was run it did not prompt the user to allow importing an Advisor bundle. (Bug#32199)
Agent on MacOSX did not read IP addresses for network interfaces correctly, so the monitor displayed empty host IP addresses.
(Bug#32188)
HTML code in queries was not escaped when reporting replication errors, causing the code to be rendered into the page.
(Bug#32186)
The First Run pop-up defaulted to English rather than to the locale set in the browser. (Bug#32129)
The error dialog box flashed in the upper left corner before being positioned in the center of the screen. This error dialog box now
opens in the center of the screen. (Bug#32068)
The Events list did not take into account Daylight Time and Standard Time when listing events that happened during
1:00am-1:59am. An event that occurred at 1:10am Standard Time was listed before an event that occurred 50 minutes before it at
1:20am Daylight Time. (Bug#32016)
The pop-up for editing log levels failed to load due to bad instantiation data. (Bug#32013)
During the repeated hour of Daylight Savings Time (when 2am turns back into 1am), the graphs were not drawing data. Instead,
there was a straight line from the point at 1:00 to the second 1:00, which is what happens if there is no data. The repository did,
however, have data for this hour. (Bug#31997)
Only US English was supported for a locale setting. Other English variants are now available for the locale setting on the Gen-
eral Settings or the User Preferences pages. (Bug#31801)
If the user locale was changed the graph cache would continue to display the graph in the last locale until it timed out. (Bug#31680)
No init script was installed for the MySQL Network Monitoring Service Manager, and so it did not restart automatically on reboot.
(Bug#31676)
The graph's displayed time was not the local time of the Dashboard corresponding to the requested time on the monitored server.
(Bug#31656)
Saving a rule with a name that already existed resulted in a stack trace in the window, instead of a more user-friendly error message.
(Bug#30925)
The network.mysql.com error messages were remapped thereby causing confusion. For example, the following error message:
E9000: MYSQL ENTERPRISE CUSTOMER CENTER IS HAVING DIFFICULTIES FETCHING YOUR CONTRACT INFORMATION.
MySQL Change History
3037
LEASE CONTACT [email protected] FOR ASSISTANCE.
Was remapped to:
UNABLE TO CONNECT TO VERIFY CREDENTIALS (Bug#30873)
A newly added server showed as down in the user interface, and could potentially have sent a false alarm notification.
(Bug#30735)
The information on the ADVISORS, CHECK FOR UPDATES page did not accurately reflect how many rules and graphs were actually in
the database and available to the user. (Bug#29623)
The agent did not process SIGHUP. (Bug#29380)
Monitor did not have a facility to stop or downgrade an agent collection frequency. (Bug#28589)
After an agent installation was updated from 1.0.1.4391 to 1.1.0.4899, the version in the ADD/REMOVE PROGRAMS menu was incor-
rectly displayed as 1.0.1.4391, even though the update was successful and the file version of agent.exe was correctly displayed
as 1.1.0.4899. (Bug#27447)
When viewing the RESULTS of an EVENT in the EVENTS tab of the DASHBOARD, the NOTIFICATIONS section did not reflect the
NOTIFICATIONS settings at the time the EVENT was triggered, but rather the NOTIFICATIONS settings at the time the EVENT RES-
ULTS were viewed. (Bug#26349)
When the Service Agent was remotely monitoring a MySQL server it incorrectly reported that it could collect operating system in-
formation. (Bug#22497)
The Account Without Password advisor did not report all users who were without a password, it only reported one. (Bug#15165)
C.3. MySQL Connector/ODBC (MyODBC) Change History
C.3.1. Changes in MySQL Connector/ODBC 5.1.6 (Not yet released)
Bugs fixed:
Connector/ODBC failed to build with MySQL 5.1.30 due to incorrect use of the data type bool. (Bug#42120)
Calling SQLDescribeCol() with a NULL buffer and nonzero buffer length caused a crash. (Bug#41942)
MySQL Connector/ODBC updated some fields with random values, rather than with NULL. (Bug#41256)
Calling SQLDriverConnect() with a NULL pointer for the output buffer caused a crash if SQL_DRIVER_NOPROMPT was also
specified:
SQLDriverConnect(dbc, NULL, "DSN=myodbc5", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT)
(Bug#40316)
Setting the ADO Recordset decimal field value to 44.56 resulted in an incorrect value of 445600.0000 being stored when the re-
cord set was updated with the Update method. (Bug#39961)
The SQLTablesW API gave incorrect results. For example, table name and table type were returned as NULL rather than as the
correct values. (Bug#39957)
MyODBC would crash when a character set was being used on the server that was not supported in the client, for example cp1251:
[MySQL][ODBC 5.1 Driver][mysqld-5.0.27-community-nt]Restricted data type attribute violation
The fix causes MyODBC to return an error message instead of crashing. (Bug#39831)
When the SQLTables method was called with NULL passed as the tablename parameter, only one row in the resultset,
with table name of NULL was returned, instead of all tables for the given database. (Bug#39561)
MySQL Change History
3038
The SQLGetInfo() function returned 0 for SQL_CATALOG_USAGE information. (Bug#39560)
MyODBC Driver 5.1.5 was not able to connect if the connection string parameters contained spaces or tab symbols. For example, if
the SERVER parameter was specified as SERVER= localhost instead of SERVER=localhost the following error message will
be displayed:
[MySQL][ODBC 5.1 Driver] Unknown MySQL server host ' localhost' (11001).
(Bug#39085)
The pointer passed to the SQLDriverConnect method to retrieve the output connection string length was one greater than it
should have been due to the inclusion of the NULL terminator. (Bug#38949)
Data-at-execution parameters were not supported during positioned update. This meant updating a long text field with a cursor up-
date would erroneously set the value to null. This would lead to the error Column 'column_name' cannot be null while
updating the database, even when column_name had been assigned a valid nonnull string. (Bug#37649)
The SQLDriverConnect method truncated the OutputConnectionString parameter to 52 characters. (Bug#37278)
The connection string option Enable Auto-reconnect did not work. When the connection failed, it could not be restored, and
the errors generated were the same as if the option had not been selected. (Bug#37179)
Insertion of data into a LONGTEXT table field did not work. If such an attempt was made the corresponding field would be found to
be empty on examination, or contain random characters. (Bug#36071)
No result record was returned for SQLGetTypeInfo for the TIMESTAMP data type. An application would receive the result re-
turn code 100 (SQL_NO_DATA_FOUND). (Bug#30626)
It was not possible to use Connector/ODBC to connect to a server using SSL. The following error was generated:
Runtime error '-2147467259 (80004005)':
[MySQL][ODBC 3.51 Driver]SSL connection error.
(Bug#29955)
When the recordSet.Update function was called to update an adLongVarChar field, the field was updated but the recordset
was immediately lost. This happened with driver cursors, whether the cursor was opened in optimistic or pessimistic mode.
When the next update was called the test code would exit with the following error:
-2147467259 : Query-based update failed because the row to update could not be found.
(Bug#26950)
C.3.2. Changes in MySQL Connector/ODBC 5.1.5 (18 August 2008)
Bugs fixed:
ODBC TIMESTAMP string format is not handled properly by the MyODBC driver. When passing a TIMESTAMP or DATE to MyO-
DBC, in the ODBC format: {d <date>} or {ts <timestamp>}, the string that represents this is copied once into the SQL statement,
and then added again, as an escaped string. (Bug#37342)
The connector failed to prompt for additional information required to create a DSN-less connection from an application such as Mi-
crosoft Excel. (Bug#37254)
SQLDriverConnect does not return SQL_NO_DATA on cancel. The ODBC documentation specifies that this method should re-
turn SQL_NO_DATA when the user cancels the dialog to connect. The connector, however, returns SQL_ERROR. (Bug#36293)
Assigning a string longer than 67 characters to the TableType parameter resulted in a buffer overrun when the SQLTables()
function was called. (Bug#36275)
The ODBC connector randomly uses logon information stored in odbc-profile, or prompts the user for connection information
MySQL Change History
3039
and ignores any settings stored in odbc-profile. (Bug#36203)
After having successfully established a connection, a crash occurs when calling SQLProcedures() followed by SQLFreeSt-
mt(), using the ODBC C API. (Bug#36069)
C.3.3. Changes in MySQL Connector/ODBC 5.1.4 (15 April 2008)
Bugs fixed:
Wrong result obtained when using sum() on a decimal(8,2) field type. (Bug#35920)
The driver installer could not create a new DSN if many other drivers were already installed. (Bug#35776)
The SQLColAttribute() function returned SQL_TRUE when querying the SQL_DESC_FIXED_PREC_SCALE
(SQL_COLUMN_MONEY) attribute of a DECIMAL column. Previously, the correct value of SQL_FALSE was returned; this is now
again the case. (Bug#35581)
On Linux, SQLGetDiagRec() returned SQL_SUCCESS in cases when it should have returned SQL_NO_DATA. (Bug#33910)
The driver crashes ODBC Administrator on attempting to add a new DSN. (Bug#32057)
C.3.4. Changes in MySQL Connector/ODBC 5.1.3 (26 March 2008)
Platform specific notes:
Important Change: You must uninstall previous 5.1.x editions of Connector/ODBC before installing the new version.
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
The installer for 64-bit Windows installs both the 32-bit and 64-bit driver. Please note that Microsoft does not yet supply a 64-bit
bridge from ADO to ODBC.
Bugs fixed:
Important Change: In previous versions, the SSL certificate would automatically be verified when used as part of the Connector/
ODBC connection. The default mode is now to ignore the verificate of certificates. To enforce verification of the SSL certificate
during connection, use the SSLVERIFY DSN parameter, setting the value to 1. (Bug#29955, Bug#34648)
Inserting characters to a UTF8 table using surrogate pairs would fail and insert invalid data. (Bug#34672)
Installation of Connector/ODBC would fail because it was unable to uninstall a previous installed version. The file being requested
would match an older release version than any installed version of the connector. (Bug#34522)
Using SqlGetData in combination with SQL_C_WCHAR would return overlapping data. (Bug#34429)
Descriptor records were not cleared correctly when calling SQLFreeStmt(SQL_UNBIND). (Bug#34271)
The dropdown selection for databases on a server when creating a DSN was too small. The list size now automatically adjusts up to
a maximum size of 20 potential databases. (Bug#33918)
Microsoft Access would be unable to use DBEngine.RegisterDatabase to create a DSN using the Connector/ODBC driver.
(Bug#33825)
Connector/ODBC erroneously reported that it supported the CAST() and CONVERT() ODBC functions for parsing values in SQL
statements, which could lead to bad SQL generation during a query. (Bug#33808)
Using a linked table in Access 2003 where the table has a BIGINT column as the first column in the table, and is configured as the
MySQL Change History
3040
primary key, shows #DELETED for all rows of the table. (Bug#24535)
Updating a RecordSet when the query involves a BLOB field would fail. (Bug#19065)
C.3.5. Changes in MySQL Connector/ODBC 5.1.2 (13 February 2008)
MySQL Connector/ODBC 5.1.2-beta, a new version of the ODBC driver for the MySQL database management system, has been re-
leased. This release is the second beta (feature-complete) release of the new 5.1 series and is suitable for use with any MySQL server
version since MySQL 4.1, including MySQL 5.0, 5.1, and 6.0. (It will not work with 4.0 or earlier releases.)
Keep in mind that this is a beta release, and as with any other pre-production release, caution should be taken when installing on pro-
duction level systems or systems with critical data.
Platform specific notes:
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
The installer for 64-bit Windows installs both the 32-bit and 64-bit driver. Please note that Microsoft does not yet supply a 64-bit
bridge from ADO to ODBC.
Due to differences with the installation process used on Windows and potential registry corruption, it is recommended that uninstall
any existing versions of Connector/ODBC 5.1.x before upgrading.
See also Bug#34571.
Functionality added or changed:
Explicit descriptors are implemented. (Bug#32064)
A full implementation of SQLForeignKeys based on the information available from INFORMATION_SCHEMA in 5.0 and later
versions of the server has been implemented.
Changed SQL_ATTR_PARAMSET_SIZE to return an error until support for it is implemented.
Disabled MYSQL_OPT_SSL_VERIFY_SERVER_CERT when using an SSL connection.
SQLForeignKeys uses INFORMATION_SCHEMA when it is available on the server, which allows more complete information to
be returned.
Bugs fixed:
The SSLCIPHER option would be incorrectly recorded within the SSL configuration on Windows. (Bug#33897)
Within the GUI interface, when connecting to a MySQL server on a nonstandard port, the connection test within the GUI would fail.
The issue was related to incorrect parsing of numeric values within the DSN when the option was not configured as the last paramet-
er within the DSN. (Bug#33822)
Specifying a nonexistent database name within the GUI dialog would result in an empty list, not an error. (Bug#33615)
When deleting rows from a static cursor, the cursor position would be incorrectly reported. (Bug#33388)
SQLGetInfo() reported characters for SQL_SPECIAL_CHARACTERS that were not encoded correctly. (Bug#33130)
Retrieving data from a BLOB column would fail within SQLGetDatawhen the target data type was SQL_C_WCHAR due to incor-
rect handling of the character buffer. (Bug#32684)
Renaming an existing DSN entry would create a new entry with the new name without deleting the old entry. (Bug#31165)
MySQL Change History
3041
Reading a TEXT column that had been used to store UTF8 data would result in the wrong information being returned during a
query. (Bug#28617)
SQLForeignKeys would return an empty string for the schema columns instead of NULL. (Bug#19923)
When accessing column data, FLAG_COLUMN_SIZE_S32 did not limit the octet length or display size reported for fields, causing
problems with Microsoft Visual FoxPro.
The list of ODBC functions that could have caused failures in Microsoft software when retrieving the length of LONGBLOB or
LONGTEXT columns includes:
SQLColumns
SQLColAttribute
SQLColAttributes
SQLDescribeCol
SQLSpecialColumns (theoretically can have the same problem)
(Bug#12805, Bug#30890)
Dynamic cursors on statements with parameters were not supported. (Bug#11846)
Evaluating a simple numeric expression when using the OLEDB for ODBC provider and ADO would return an error, instead of the
result. (Bug#10128)
Adding or updating a row using SQLSetPos() on a result set with aliased columns would fail. (Bug#6157)
C.3.6. Changes in MySQL Connector/ODBC 5.1.1 (13 December 2007)
MySQL Connector/ODBC 5.1.1-beta, a new version of the ODBC driver for the MySQL database management system, has been re-
leased. This release is the first beta (feature-complete) release of the new 5.1 series and is suitable for use with any MySQL server ver-
sion since MySQL 4.1, including MySQL 5.0, 5.1, and 6.0. (It will not work with 4.0 or earlier releases.)
Keep in mind that this is a beta release, and as with any other pre-production release, caution should be taken when installing on pro-
duction level systems or systems with critical data.
Includes changes from Connector/ODBC 3.51.21 and 3.51.22.
Built using MySQL 5.0.52.
Platform specific notes:
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
The installer for 64-bit Windows installs both the 32-bit and 64-bit driver. Please note that Microsoft does not yet supply a 64-bit
bridge from ADO to ODBC.
Due to differences with the installation process used on Windows and potential registry corruption, it is recommended that uninstall
any existing versions of Connector/ODBC 5.1.x before upgrading.
See also Bug#34571.
Functionality added or changed:
Incompatible Change: Replaced myodbc3i (now myodbc-installer) with Connector/ODBC 5.0 version.
Incompatible Change: Removed monitor (myodbc3m) and dsn-editor (myodbc3c).
MySQL Change History
3042
Incompatible Change: Disallow SET NAMES in initial statement and in executed statements.
A wrapper for the SQLGetPrivateProfileStringW() function, which is required for Unicode support, has been created.
This function is missing from the unixODBC driver manager. (Bug#32685)
Added MSI installer for Windows 64-bit. (Bug#31510)
Implemented support for SQLCancel(). (Bug#15601)
Added support for SQL_NUMERIC_STRUCT. (Bug#3028, Bug#24920)
Removed nonthreadsafe configuration of the driver. The driver is now always built against the threadsafe version of libmysql.
Implemented native Windows setup library
Replaced the internal library which handles creation and loading of DSN information. The new library, which was originally a part
of Connector/ODBC 5.0, supports Unicode option values.
The Windows installer now places files in a subdirectory of the Program Files directory instead of the Windows system direct-
ory.
Bugs fixed:
The SET NAMES statement has been disabled because it causes problems in the ODBC driver when determining the current client
character set. (Bug#32596)
SQLDescribeColW returned UTF-8 column as SQL_VARCHAR instead of SQL_WVARCHAR. (Bug#32161)
ADO was unable to open record set using dynamic cursor. (Bug#32014)
ADO applications would not open a RecordSet that contained a DECIMAL field. (Bug#31720)
Memory usage would increase considerably. (Bug#31115)
SQL statements are limited to 64KB. (Bug#30983, Bug#30984)
SQLSetPos with SQL_DELETE advances dynamic cursor incorrectly. (Bug#29765)
Using an ODBC prepared statement with bound columns would produce an empty result set when called immediately after inserting
a row into a table. (Bug#29239)
ADO Not possible to update a client side cursor. (Bug#27961)
Recordset Update() fails when using adUseClient cursor. (Bug#26985)
Connector/ODBC would fail to connect to the server if the password contained certain characters, including the semicolon and other
punctuation marks. (Bug#16178)
Fixed SQL_ATTR_PARAM_BIND_OFFSET, and fixed row offsets to work with updatable cursors.
SQLSetConnectAttr() did not clear previous errors, possibly confusing SQLError().
SQLError() incorrectly cleared the error information, making it unavailable from subsequent calls to SQLGetDiagRec().
NULL pointers passed to SQLGetInfo() could result in a crash.
SQL_ODBC_SQL_CONFORMANCE was not handled by SQLGetInfo().
SQLCopyDesc() did not correctly copy all records.
Diagnostics were not correctly cleared on connection and environment handles.
C.3.7. Changes in MySQL Connector/ODBC 5.1.0 (10 September 2007)
MySQL Change History
3043
This release is the first of the new 5.1 series and is suitable for use with any MySQL server version since MySQL 4.1, including
MySQL 5.0, 5.1, and 6.0. (It will not work with 4.0 or earlier releases.)
Keep in mind that this is a alpha release, and as with any other pre-production release, caution should be taken when installing on pro-
duction level systems or systems with critical data. Not all of the features planned for the final Connector/ODBC 5.1 release are imple-
mented.
Functionality is based on Connector/ODBC 3.51.20.
Platform specific notes:
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
There are no installer packages for Microsoft Windows x64 Edition.
Due to differences with the installation process used on Windows and potential registry corruption, it is recommended that uninstall
any existing versions of Connector/ODBC 5.1.x before upgrading.
See also Bug#34571.
Functionality added or changed:
Added support for Unicode functions (SQLConnectW, etc).
Added descriptor support (SQLGetDescField, SQLGetDescRec, etc).
Added support for SQL_C_WCHAR.
C.3.8. Changes in MySQL Connector/ODBC 5.0.12 (Never released)
Note
Development on Connector/ODBC 5.0.x has ceased. New features and functionality will be incorporated into Connector/
ODBC 5.1. See Section 21.1.2.1, Connector/ODBC Roadmap.
Bugs fixed:
Inserting NULL values into a DATETIME column from Access reports an error. (Bug#27896)
Tables with TEXT columns would be incorrectly identified, returning an Unknown SQL type - 65535 error. (Bug#20127)
C.3.9. Changes in MySQL Connector/ODBC 5.0.11 (31 January 2007)
Functionality added or changed:
Added support for ODBC v2 statement options using attributes.
Driver now builds and is partially tested under Linux with the iODBC driver manager.
Bugs fixed:
Connection string parsing for DSN-less connections could fail to identify some parameters. (Bug#25316)
Updates of MEMO or TEXT columns from within Microsoft Access would fail. (Bug#25263)
MySQL Change History
3044
Transaction support has been added and tested. (Bug#25045)
Internal function, my_setpos_delete_ignore() could cause a crash. (Bug#22796)
Fixed occasional mis-handling of the SQL_NUMERIC_C type.
Fixed the binding of certain integer types.
C.3.10. Changes in MySQL Connector/ODBC 5.0.10 (14 December 2006)
Connector/ODBC 5.0.10 is the sixth BETA release.
Functionality added or changed:
Significant performance improvement when retrieving large text fields in pieces using SQLGetData() with a buffer smaller than
the whole data. Mainly used in Access when fetching very large text fields. (Bug#24876)
Added initial unicode support in data and metadata. (Bug#24837)
Added initial support for removing braces when calling stored procedures and retrieving result sets from procedure calls.
(Bug#24485)
Added loose handling of retrieving some diagnostic data. (Bug#15782)
Added wide-string type info for SQLGetTypeInfo().
Bugs fixed:
Editing DSN no longer crashes ODBC data source administrator. (Bug#24675)
String query parameters are new escaped correctly. (Bug#19078)
C.3.11. Changes in MySQL Connector/ODBC 5.0.9 (22 November 2006)
Connector/ODBC 5.0.9 is the fifth BETA release.
This is an implementation and testing release, and is not designed for use within a production environment.
Functionality added or changed:
Added support for column binding as SQL_NUMBERIC_STRUCT.
Added recognition of SQL_C_SHORT and SQL_C_TINYINT as C types.
Bugs fixed:
Fixed wildcard handling of and listing of catalogs and tables in SQLTables.
Added limit of display size when requested via SQLColAttribute/SQL_DESC_DISPLAY_SIZE.
Fixed buffer length return for SQLDriverConnect.
ODBC v2 behaviour in driver now supports ODBC v3 date/time types (since DriverManager maps them).
Catch use of SQL_ATTR_PARAMSET_SIZE and report error until we fully support.
Fixed statistics to fail if it couldn't be completed.
MySQL Change History
3045
Corrected retrieval multiple field types bit and blob/text.
Fixed SQLGetData to clear the NULL indicator correctly during multiple calls.
C.3.12. Changes in MySQL Connector/ODBC 5.0.8 (17 November 2006)
Connector/ODBC 5.0.8 is the fourth BETA release.
This is an implementation and testing release, and is not designed for use within a production environment.
Functionality added or changed:
Also made SQL_DESC_NAME only fill in the name if there was a data pointer given, otherwise just the length.
Fixed display size to be length if max length isnt available.
Made distinction between CHAR/BINARY (and VAR versions).
Wildcards now support escaped chars and underscore matching (needed to link tables with underscores in access).
Bugs fixed:
Fixed binding using SQL_C_LONG.
Fixed using wrong pointer for SQL_MAX_DRIVER_CONNECTIONS in SQLGetInfo.
Set default return to SQL_SUCCESS if nothing is done for SQLSpecialColumns.
Fixed MDiagnostic to use correct v2/v3 error codes.
Allow SQLDescribeCol to be called to retrieve the length of the column name, but not the name itself.
Length now used when handling bind parameter (needed in particular for SQL_WCHAR) - this enables updating char data in MS Ac-
cess.
Updated retrieval of descriptor fields to use the right pointer types.
Fixed hanlding of numeric pointers in SQLColAttribute.
Fixed type returned for MYSQL_TYPE_LONG to SQL_INTEGER instead of SQL_TINYINT.
Fix size return from SQLDescribeCol.
Fixed string length to chars, not bytes, returned by SQLGetDiagRec.
C.3.13. Changes in MySQL Connector/ODBC 5.0.7 (08 November 2006)
Connector/ODBC 5.0.7 is the third BETA release.
This is an implementation and testing release, and is not designed for use within a production environment.
Functionality added or changed:
Added support for SQLStatistics to MYODBCShell.
Improved trace/log.
Bugs fixed:
MySQL Change History
3046
SQLBindParameter now handles SQL_C_DEFAULT.
Corrected incorrect column index within SQLStatistics. Many more tables can now be linked into MS Access.
Fixed SQLDescribeCol returning column name length in bytes rather than chars.
C.3.14. Changes in MySQL Connector/ODBC 5.0.6 (03 November 2006)
Connector/ODBC 5.0.6 is the second BETA release.
This is an implementation and testing release, and is not designed for use within a production environment.
Features, limitations and notes on this release
Connector/ODBC supports both User and System DSNs.
Installation is provided in the form of a standard Microsoft System Installer (MSI).
You no longer have to have Connector/ODBC 3.51 installed before installing this version.
Bugs fixed:
You no longer have to have Connector/ODBC 3.51 installed before installing this version.
Connector/ODBC supports both User and System DSNs.
Installation is provided in the form of a standard Microsoft System Installer (MSI).
C.3.15. Changes in MySQL Connector/ODBC 5.0.5 (17 October 2006)
Connector/ODBC 5.0.5 is the first BETA release.
This is an implementation and testing release, and is not designed for use within a production environment.
You no longer have to have Connector/ODBC 3.51 installed before installing this version.
Bugs fixed:
You no longer have to have Connector/ODBC 3.51 installed before installing this version.
C.3.16. Changes in Connector/ODBC 5.0.3 (Connector/ODBC 5.0 Alpha 3) (20
June 2006)
This is an implementation and testing release, and is not designed for use within a production environment.
Features, limitations and notes on this release:
The following ODBC API functions have been added in this release:
SQLBindParameter
SQLBindCol
C.3.17. Changes in Connector/ODBC 5.0.2 (Never released)
MySQL Change History
3047
Connector/ODBC 5.0.2 was an internal implementation and testing release.
C.3.18. Changes in Connector/ODBC 5.0.1 (Connector/ODBC 5.0 Alpha 2) (05
June 2006)
Features, limitations and notes on this release:
Connector/ODBC 5.0 is Unicode aware.
Connector/ODBC is currently limited to basic applications. ADO applications and Microsoft Office are not supported.
Connector/ODBC must be used with a Driver Manager.
The following ODBC API functions are implemented:
SQLAllocHandle
SQLCloseCursor
SQLColAttribute
SQLColumns
SQLConnect
SQLCopyDesc
SQLDisconnect
SQLExecDirect
SQLExecute
SQLFetch
SQLFreeHandle
SQLFreeStmt
SQLGetConnectAttr
SQLGetData
SQLGetDescField
SQLGetDescRec
SQLGetDiagField
SQLGetDiagRec
SQLGetEnvAttr
SQLGetFunctions
SQLGetStmtAttr
SQLGetTypeInfo
SQLNumResultCols
SQLPrepare
SQLRowcount
MySQL Change History
3048
SQLTables
The following ODBC API function are implemented, but not yet support all the available attributes/options:
SQLSetConnectAttr
SQLSetDescField
SQLSetDescRec
SQLSetEnvAttr
SQLSetStmtAttr
C.3.19. Changes in MySQL Connector/ODBC 3.51.27 (20 November 2008)
Bugs fixed:
The client program hung when the network connection to the server was interrupted. (Bug#40407)
The connection string option Enable Auto-reconnect did not work. When the connection failed, it could not be restored, and
the errors generated were the same as if the option had not been selected. (Bug#37179)
It was not possible to use Connector/ODBC to connect to a server using SSL. The following error was generated:
Runtime error '-2147467259 (80004005)':
[MySQL][ODBC 3.51 Driver]SSL connection error.
(Bug#29955)
C.3.20. Changes in MySQL Connector/ODBC 3.51.26 (07 July 2008)
Functionality added or changed:
There is a new connection option, FLAG_NO_BINARY_RESULT. When set this option disables charset 63 for columns with an
empty org_table. (Bug#29402)
Bugs fixed:
When an ADOConnection is created and attempts to open a schema with ADOConnection.OpenSchema an access violation
occurs in myodbc3.dll. (Bug#30770)
When SHOW CREATE TABLE was invoked and then the field values read, the result was truncated and unusable if the table had
many rows and indexes. (Bug#24131)
C.3.21. Changes in MySQL Connector/ODBC 3.51.25 (11 April 2008)
Bugs fixed:
The SQLColAttribute() function returned SQL_TRUE when querying the SQL_DESC_FIXED_PREC_SCALE
(SQL_COLUMN_MONEY) attribute of a DECIMAL column. Previously, the correct value of SQL_FALSE was returned; this is now
again the case. (Bug#35581)
The driver crashes ODBC Administrator on attempting to add a new DSN. (Bug#32057)
MySQL Change History
3049
When accessing column data, FLAG_COLUMN_SIZE_S32 did not limit the octet length or display size reported for fields, causing
problems with Microsoft Visual FoxPro.
The list of ODBC functions that could have caused failures in Microsoft software when retrieving the length of LONGBLOB or
LONGTEXT columns includes:
SQLColumns
SQLColAttribute
SQLColAttributes
SQLDescribeCol
SQLSpecialColumns (theoretically can have the same problem)
(Bug#12805, Bug#30890)
C.3.22. Changes in MySQL Connector/ODBC 3.51.24 (14 March 2008)
Bugs fixed:
Security Enhancement: Accessing a parameer with the type of SQL_C_CHAR, but with a numeric type and a length of zero, the
parameter marker would get stropped from the query. In addition, an SQL injection was possible if the parameter value had a
nonzero length and was not numeric, the text would be inserted verbatim. (Bug#34575)
Important Change: In previous versions, the SSL certificate would automatically be verified when used as part of the Connector/
ODBC connection. The default mode is now to ignore the verificate of certificates. To enforce verification of the SSL certificate
during connection, use the SSLVERIFY DSN parameter, setting the value to 1. (Bug#29955, Bug#34648)
When using ADO, the count of parameters in a query would always return zero. (Bug#33298)
Using tables with a single quote or other nonstandard characters in the table or column names through ODBC would fail.
(Bug#32989)
When using Crystal Reports, table and column names would be truncated to 21 characters, and truncated columns in tables where
the truncated name was the duplicated would lead to only a single column being displayed. (Bug#32864)
SQLExtendedFetch() and SQLFetchScroll() ignored the rowset size if the Don't cache result DSN option was
set. (Bug#32420)
When using the ODBC SQL_TXN_READ_COMMITTED option, 'dirty' records would be read from tables as if the option had not
been applied. (Bug#31959)
When creating a System DSN using the ODBC Administrator on Mac OS X, a User DSN would be created instead. The root cause
is a problem with the iODBC driver manager used on Mac OS X. The fix works around this issue.
Note
ODBC Administrator may still be unable to register a System DSN unless the /Library/ODBC/odbc.ini file has the
correct permissions. You should ensure that the file is writable by the admin group.
(Bug#31495)
Calling SQLFetch or SQLFetchScroll would return negative data lengths when using SQL_C_WCHAR. (Bug#31220)
SQLSetParam() caused memory allocation errors due to driver manager's mapping of deprecated functions (buffer length -1).
(Bug#29871)
Static cursor was unable to be used through ADO when dynamic cursors were enabled. (Bug#27351)
Using connection.Execute to create a record set based on a table without declaring the cmd option as adCmdTable will fail
when communicating with versions of MySQL 5.0.37 and higher. The issue is related to the way that SQLSTATE is returned when
ADO tries to confirm the existence of the target object. (Bug#27158)
MySQL Change History
3050
Updating a RecordSet when the query involves a BLOB field would fail. (Bug#19065)
With some connections to MySQL databases using Connector/ODBC, the connection would mistakenly report 'user cancelled' for
accesses to the database information. (Bug#16653)
C.3.23. Changes in MySQL Connector/ODBC 3.51.23 (09 January 2008)
Platform specific notes:
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
There are no installer packages for Microsoft Windows x64 Edition.
Bugs fixed:
Connector/ODBC would incorrectly return SQL_SUCCESS when checking for distributed transaction support. (Bug#32727)
When using unixODBC or directly linked applications where the thread level is set to less than 3 (within odbcinst.ini), a
thread synchronization issue would lead to an application crash. This was because SQLAllocStmt() and SQLFreeStmt() did
not synchronize access to the list of statements associated with a connection. (Bug#32587)
Cleaning up environment handles in multithread environments could result in a five (or more) second delay. (Bug#32366)
Renaming an existing DSN entry would create a new entry with the new name without deleting the old entry. (Bug#31165)
Setting the default database using the DefaultDatabase property of an ADO Connection object would fail with the error
Provider does not support this property. The SQLGetInfo() returned the wrong value for
SQL_DATABASE_NAME when no database was selected. (Bug#3780)
C.3.24. Changes in MySQL Connector/ODBC 3.51.22 (13 November 2007)
Functionality added or changed:
The workaround for this bug was removed due to the fixes in MySQL Server 5.0.48 and 5.1.21.
This regression was introduced by Bug#10491.
Bugs fixed:
The English locale would be used when formatting floating point values. The C locale is now used for these values. (Bug#32294)
When accessing information about supported operations, the driver would return incorrect information about the support for UNION.
(Bug#32253)
Unsigned integer values greater than the maximum value of a signed integer would be handled incorrectly. (Bug#32171)
The wrong result was returned by SQLGetData() when the data was an empty string and a zero-sized buffer was specified.
(Bug#30958)
Added the FLAG_COLUMN_SIZE_S32 option to limit the reported column size to a signed 32-bit integer. This option is automat-
ically enabled for ADO applications to provide a work around for a bug in ADO. (Bug#13776)
C.3.25. Changes in MySQL Connector/ODBC 3.51.21 (08 October 2007)
MySQL Change History
3051
Bugs fixed:
When using a rowset/cursor and add a new row with a number of fields, subsequent rows with fewer fields will include the original
fields from the previous row in the final INSERT statement. (Bug#31246)
Uninitiated memory could be used when C/ODBC internally calls SQLGetFunctions(). (Bug#31055)
The wrong SQL_DESC_LITERAL_PREFIX would be returned for date/time types. (Bug#31009)
The wrong COLUMN_SIZE would be returned by SQLGetTypeInfo for the TIME columns (SQL_TYPE_TIME). (Bug#30939)
Clicking outside the character set selection box when configuring a new DSN could cause the wrong character set to be selected.
(Bug#30568)
Not specifying a user in the DSN dialog would raise a warning even though the parameter is optional. (Bug#30499)
SQLSetParam() caused memory allocation errors due to driver manager's mapping of deprecated functions (buffer length -1).
(Bug#29871)
When using ADO, a column marked as AUTO_INCREMENT could incorrectly report that the column allowed NULL values. This
was dur to an issue with NULLABLE and IS_NULLABLE return values from the call to SQLColumns(). (Bug#26108)
Connector/ODBC would return the wrong the error code when the server disconnects the active connection because the configured
wait_timeout has expired. Previously it would return HY000. Connector/ODBC now correctly returns an SQLSTATE of
08S01. (Bug#3456)
C.3.26. Changes in MySQL Connector/ODBC 3.51.20 (10 September 2007)
Bugs fixed:
Using FLAG_NO_PROMPT doesn't suppress the dialogs normally handled by SQLDriverConnect. (Bug#30840)
The specified length of the user name and authentication parameters to SQLConnect() were not being honored. (Bug#30774)
The wrong column size was returned for binary data. (Bug#30547)
SQLGetData() will now always return SQL_NO_DATA_FOUND on second call when no data left, even if requested size is 0.
(Bug#30520)
SQLGetConnectAttr() did not reflect the connection state correctly. (Bug#14639)
Removed checkbox in setup dialog for FLAG_FIELD_LENGTH (identified as Don't Optimize Column Width within the
GUI dialog), which was removed from the driver in 3.51.18.
C.3.27. Changes in MySQL Connector/ODBC 3.51.19 (10 August 2007)
Connector/ODBC 3.51.19 fixes a specific issue with the 3.51.18 release. For a list of changes in the 3.51.18 release, see Section C.3.28,
Changes in MySQL Connector/ODBC 3.51.18 (08 August 2007).
Functionality added or changed:
Because of Bug#10491 in the server, character string results were sometimes incorrectly identified as SQL_VARBINARY. Until this
server bug is corrected, the driver will identify all variable-length strings as SQL_VARCHAR.
C.3.28. Changes in MySQL Connector/ODBC 3.51.18 (08 August 2007)
Platform specific notes:
MySQL Change History
3052
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
Binary packages for Sun Solaris are now available as PKG packages.
Binary packages as disk images with installers are now available for Mac OS X.
A binary package without an installer is available for Microsoft Windows x64 Edition. There are no installer packages for Microsoft
Windows x64 Edition.
Functionality added or changed:
Incompatible Change: The FLAG_DEBUG option was removed.
When connecting to a specific database when using a DSN, the system tables from the mysql database are no longer also available.
Previously, tables from the mysql database (catalog) were listed as SYSTEM TABLES by SQLTables() even when a different
catalog was being queried. (Bug#28662)
Installed for Mac OS X has been re-instated. The installer registers the driver at a system (not user) level and makes it possible to
create both user and system DSNs using the Connector/ODBC driver. The installer also fixes the situation where the necessary
drivers would bge installed local to the user, not globally. (Bug#15326, Bug#10444)
Connector/ODBC now supports batched statements. In order to enable cached statement support you must switch enable the batched
statement option (FLAG_MULTI_STATEMENTS, 67108864, or ALLOW MULTIPLE STATEMENTS within a GUI configuration). Be
aware that batched statements create an increased chance of SQL injection attacks and you must ensure that your application pro-
tects against this scenario. (Bug#7445)
The SQL_ATTR_ROW_BIND_OFFSET_PTR is now supported for row bind offsets. (Bug#6741)
The TRACE and TRACEFILE DSN options have been removed. Use the ODBC driver manager trace options instead.
Bugs fixed:
When using a table with multiple TIMESTAMP columns, the final TIMESTAMP column within the table definition would not be up-
dateable. Note that there is still a limitation in MySQL server regarding multiple TIMESTAMP columns . (Bug#9927) (Bug#30081)
Fixed an issue where the myodbc3i would update the user ODBC configuration file (~/Library/ODBC/odbcinst.ini) in-
stead of the system /Library/ODBC/odbcinst.ini. This was caused because myodbc3i was not honoring the s and u
modifiers for the -d command-line option. (Bug#29964)
Getting table metadata (through the SQLColumns() would fail, returning a bad table definition to calling applications.
(Bug#29888)
DATETIME column types would return FALSE in place of SQL_SUCCESS when requesting the column type information.
(Bug#28657)
The SQL_COLUMN_TYPE, SQL_COLUMN_DISPLAY and SQL_COLUMN_PRECISION values would be returned incorrectly by
SQLColumns(), SQLDescribeCol() and SQLColAttribute() when accessing character columns, especially those gener-
ated through concat(). The lengths returned should now conform to the ODBC specification. The FLAG_FIELD_LENGTH op-
tion no longer has any affect on the results returned. (Bug#27862)
Obtaining the length of a column when using a character set for the connection of utf8 would result in the length being returned
incorrectly. (Bug#19345)
The SQLColumns() function could return incorrect information about TIMESTAMP columns, indicating that the field was not
nullable. (Bug#14414)
The SQLColumns() function could return incorrect information about AUTO_INCREMENT columns, indicating that the field was
not nullable. (Bug#14407)
MySQL Change History
3053
A binary package without an installer is available for Microsoft Windows x64 Edition. There are no installer packages for Microsoft
Windows x64 Edition.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
BIT(n) columns are now treated as SQL_BIT data where n = 1 and binary data where n > 1.
The wrong value from SQL_DESC_LITERAL_SUFFIX was returned for binary fields.
The SQL_DATETIME_SUB column in SQLColumns() was not correctly set for date and time types.
The value for SQL_DESC_FIXED_PREC_SCALE was not returned correctly for values in MySQL 5.0 and later.
The wrong value for SQL_DESC_TYPE was returned for date and time types.
SQLConnect() and SQLDriverConnect() were rewritten to eliminate duplicate code and ensure all options were supported
using both connection methods. SQLDriverConnect() now only requires the setup library to be present when the call requires
it.
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
Binary packages as disk images with installers are now available for Mac OS X.
Binary packages for Sun Solaris are now available as PKG packages.
The wrong value for DECIMAL_DIGITS in SQLColumns() was reported for FLOAT and DOUBLE fields, as well as the wrong
value for the scale parameter to SQLDescribeCol(), and the SQL_DESC_SCALE attribute from SQLColAttribute().
The SQL_DATA_TYPE column in SQLColumns() results did not report the correct value for date and time types.
C.3.29. Changes in MySQL Connector/ODBC 3.51.17 (14 July 2007)
Platform specific notes:
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
Binary packages for Sun Solaris are now available as PKG packages.
Binary packages as disk images with installers are now available for Mac OS X.
A binary package without an installer is available for Microsoft Windows x64 Edition. There are no installer packages for Microsoft
Windows x64 Edition.
Functionality added or changed:
It is now possible to specify a different character set as part of the DSN or connection string. This must be used instead of the SET
NAMES statement. You can also configure the character set value from the GUI configuration. (Bug#9498, Bug#6667)
Fixed calling convention ptr and wrong free in myodbc3i, and fixed the null terminating (was only one, not two) when writing
DSN to string.
Dis-allow NULL ptr for null indicator when calling SQLGetData() if value is null. Now returns SQL_ERROR w/state 22002.
The setup library has been split into its own RPM package, to allow installing the driver itself with no GUI dependencies.
Bugs fixed:
MySQL Change History
3054
myodbc3i did not correctly format driver info, which could cause the installation to fail. (Bug#29709)
Connector/ODBC crashed with Crystal Reports due to a rproblem with SQLProcedures(). (Bug#28316)
Fixed a problem where the GUI would crash when configuring or removing a System or User DSN. (Bug#27315)
Fixed error handling of out-of-memory and bad connections in catalog functions. This might raise errors in code paths that had ig-
nored them in the past. (Bug#26934)
For a stored procedure that returns multiple result sets, Connector/ODBC returned only the first result set. (Bug#16817)
Calling SQLGetDiagField with RecNumber 0, DiagIdentifier NOT 0 returned SQL_ERROR, preventing access to
diagnostic header fields. (Bug#16224)
Added a new DSN option (FLAG_ZERO_DATE_TO_MIN) to retrieve XXXX-00-00 dates as the minimum allowed ODBC date
(XXXX-01-01). Added another option (FLAG_MIN_DATE_TO_ZERO) to mirror this but for bound parameters.
FLAG_MIN_DATE_TO_ZERO only changes 0000-01-01 to 0000-00-00. (Bug#13766)
If there was more than one unique key on a table, the correct fields were not used in handling SQLSetPos(). (Bug#10563)
When inserting a large BLOB field, Connector/ODBC would crash due to a memory allocation error. (Bug#10562)
The driver was using mysql_odbc_escape_string(), which does not handle the NO_BACKSLASH_ESCAPES SQL mode.
Now it uses mysql_real_escape_string(), which does. (Bug#9498)
SQLColumns() did not handle many of its parameters correctly, which could lead to incorrect results. The table name argument
was not handled as a pattern value, and most arguments were not escaped correctly when they contained nonalphanumeric charac-
ters. (Bug#8860)
There are no binary packages for Microsoft Windows x64 Edition.
There is no binary package for Mac OS X on 64-bit PowerPC because Apple does not currently provide a 64-bit PowerPC version
of iODBC.
Correctly return error if SQLBindCol is called with an invalid column.
Fixed possible crash if SQLBindCol() was not called before SQLSetPos().
The Mac OS X binary packages are only provided as tarballs, there is no installer.
The binary packages for Sun Solaris are only provided as tarballs, not the PKG format.
The HP-UX 11.23 IA64 binary package does not include the GUI bits because of problems building Qt on that platform.
C.3.30. Changes in MySQL Connector/ODBC 3.51.16 (14 June 2007)
Functionality added or changed:
Connector/ODBC now supports using SSL for communication. This is not yet exposed in the setup GUI, but must be enabled
through configuration files or the DSN. (Bug#12918)
Bugs fixed:
Calls to SQLNativeSql() could cause stack corruption due to an incorrect pointer cast. (Bug#28758)
Using curors on results sets with multi-column keys could select the wrong value. (Bug#28255)
SQLForeignKeys does not escape _ and % in the table name arguments. (Bug#27723)
When using stored procedures, making a SELECT or second stored procedure call after an initial stored procedure call, the second
statement will fail. (Bug#27544)
MySQL Change History
3055
SQLTables() did not distinguish tables from views. (Bug#23031)
Data in TEXT columns would fail to be read correctly. (Bug#16917)
Specifying strings as parameters using the adBSTR or adVarWChar types, (SQL_WVARCHAR and SQL_WLONGVARCHAR) would
be incorrectly quoted. (Bug#16235)
SQL_WVARCHAR and SQL_WLONGVARCHAR parameters were not properly quoted and escaped. (Bug#16235)
Using BETWEEN with date values, the wrong results could be returned. (Bug#15773)
When using the Don't Cache Results (option value 1048576) with Microsoft Access, the connection will fail using DAO/
VisualBasic. (Bug#4657)
Return values from SQLTables() may be truncated. (Bugs #22797)
C.3.31. Changes in MySQL Connector/ODBC 3.51.15 (07 May 2007)
Bugs fixed:
Connector/ODBC would incorrectly claim to support SQLProcedureColumns (by returning true when queried about SQLPRO-
CEDURECOLUMNS with SQLGetFunctions), but this functionality is not supported. (Bug#27591)
An incorrect transaction isolation level may not be returned when accessing the connection attributes. (Bug#27589)
Adding a new DSN with the myodbc3i utility under AIX would fail. (Bug#27220)
When inserting data using bulk statements (through SQLBulkOperations), the indicators for all rows within the insert would
not updated correctly. (Bug#24306)
Using SQLProcedures does not return the database name within the returned resultset. (Bug#23033)
The SQLTransact() function did not support an empty connection handle. (Bug#21588)
Using SQLDriverConnect instead of SQLConnect could cause later operations to fail. (Bug#7912)
When using blobs and parameter replacement in a statement with WHERE CURSOR OF, the SQL is truncated. (Bug#5853)
Connector/ODBC would return too many foreign key results when accessing tables with similar names. (Bug#4518)
C.3.32. Changes in MySQL Connector/ODBC 3.51.14 (08 March 2007)
Functionality added or changed:
Use of SQL_ATTR_CONNECTION_TIMEOUT on the server has now been disabled. If you attempt to set this attribute on your con-
nection the SQL_SUCCESS_WITH_INFO will be returned, with an error number/string of HYC00: Optional feature not
supported. (Bug#19823)
Added auto is null option to Connector/ODBC option parameters. (Bug#10910)
Added auto-reconnect option to Connector/ODBC option parameters.
Added support for the HENV handlers in SQLEndTran().
Bugs fixed:
On 64-bit systems, some types would be incorrectly returned. (Bug#26024)
When retrieving TIME columns, C/ODBC would incorrectly interpret the type of the string and could interpret it as a DATE type in-
stead. (Bug#25846)
MySQL Change History
3056
Connector/ODBC may insert the wrong parameter values when using prepared statements under 64-bit Linux. (Bug#22446)
Using Connector/ODBC, with SQLBindCol and binding the length to the return value from SQL_LEN_DATA_AT_EXEC fails
with a memory allocation error. (Bug#20547)
Using DataAdapter, Connector/ODBC may continually consume memory when reading the same records within a loop
(Windows Server 2003 SP1/SP2 only). (Bug#20459)
When retrieving data from columns that have been compressed using COMPRESS(), the retrieved data would be truncated to 8KB.
(Bug#20208)
The ODBC driver name and version number were incorrectly reported by the driver. (Bug#19740)
A string format exception would be raised when using iODBC, Connector/ODBC and the embedded MySQL server. (Bug#16535)
The SQLDriverConnect() ODBC method did not work with recent Connector/ODBC releases. (Bug#12393)
C.3.33. Changes in MySQL Connector/ODBC 3.51.13 (Never released)
Connector/ODBC 3.51.13 was an internal implementation and testing release.
C.3.34. Changes in MySQL Connector/ODBC 3.51.12 (11 February 2005)
Functionality added or changed:
N/A
Bugs fixed:
Using stored procedures with ADO, where the CommandType has been set correctly to adCmdStoredProc, calls to stored pro-
cedures would fail. (Bug#15635)
File DSNs could not be saved. (Bug#12019)
SQLColumns() returned no information for tables that had a column named using a reserved word. (Bug#9539)
C.3.35. Changes in MySQL Connector/ODBC 3.51.11 (28 January 2005)
Bugs fixed:
mysql_list_dbcolumns() and insert_fields() were retrieving all rows from a table. Fixed the queries generated by
these functions to return no rows. (Bug#8198)
SQLGetTypoInfo() returned tinyblob for SQL_VARBINARY and nothing for SQL_BINARY. Fixed to return varbinary
for SQL_VARBINARY, binary for SQL_BINARY, and longblob for SQL_LONGVARBINARY. (Bug#8138)
C.4. MySQL Connector/NET Change History
C.4.1. Changes in MySQL Connector/NET 6.0.5 (Not yet released)
This is a new release, fixing recently discovered bugs.
Bugs fixed:
Adding the Allow Batch=False option to the connection string caused MySQL Connector/NET to generate the error:
MySQL Change History
3057
You have an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'SET character_set_results=NULL' at line 1
(Bug#45502)
A MySQL Connector/NET test program that connected to MySQL Server using the connection string option compress=true
crashed, but only when running on Mono. The program worked as expected when running on Microsoft Windows.
This was due to a bug in Mono. MySQL Connector/NET was modified to avoid using WeakReferences in the Compressed
stream class, which was causing the crash. (Bug#45463)
After a Reference to "C:\Program Files\MySQL\MySQL Connector Net 5.2.4\Compact Framework\MySql.Data.CF.dll" was added
to a Windows Mobile 5.0 project, the project then failed to build, generating a Microsoft Visual C# compiler error.
The error generated was:
Error 2 The type 'System.Runtime.CompilerServices.CompilerGeneratedAttribute'
has no constructors defined MysqlTest
Error 3 Internal Compiler Error (0xc0000005 at address 5A7E3714):
likely culprit is 'COMPILE'.
(Bug#42261)
C.4.2. Changes in MySQL Connector/NET 6.0.4 (16 June 2009)
This is the first post-GA release, fixing recently discovered bugs.
Bugs fixed:
If a certain socket exception occurred when trying to establish a MySQL database connection, MySQL Connector/NET displayed an
exception message that appeared to be unrelated to the underlying problem. This masked the problem and made diagnosing prob-
lems more difficult.
For example, if, when establishing a database connection via TCP/IP, Windows on the local machine allocated an ephemeral port
that conflicted with a socket address still in use, then Windows/.NET would throw a socket exception with the following error text:
Only one usage of each socket address (protocol/network address/port) is normally
permitted IP ADDRESS/PORT.
However, MySQL Connector/NET masked this socket exception and displayed an exception with the following text:
Unable to connect to any of the specified MySQL hosts.
(Bug#45021)
A SQL query string containing an escaped backslash caused an exception to be generated:
Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean
fAlwaysCopy)
at MySql.Data.MySqlClient.MySqlTokenizer.NextParameter()
at MySql.Data.MySqlClient.Statement.InternalBindParameters(String sql,
MySqlParameterCollection parameters, MySqlPacket packet)
at MySql.Data.MySqlClient.Statement.BindParameters()
at MySql.Data.MySqlClient.PreparableStatement.Execute()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior belhavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
(Bug#44960)
The Microsoft Visual Studio solution file MySQL-VS2005.sln was invalid. Several projects could not be loaded and thus it was
not possible to build MySQL Connector/NET from source. (Bug#44822)
MySQL Change History
3058
The Data Set editor generated an error when attempts were made to modify insert, update or delete commands:
Error in WHERE clause near '@'.
Unable to parse query text.
(Bug#44512)
The DataReader in MySQL Connector/NET 6.0.3 considered a BINARY(16) field as a GUID with a length of 16. (Bug#44507)
When creating a new DataSet the following error was generated:
Failed to open a connection to database.
Cannot load type with name 'MySQL.Data.VisualStudio.StoredProcedureColumnEnumerator'
(Bug#44460)
The MySQL Connector/NET MySQLRoleProvider reported that there were no roles, even when roles existed. (Bug#44414)
MySQL Connector/NET was missing the capability to validate the server's certificate when using encryption. This made it possible
to conduct a man-in-the-middle attack against the connection, which defeated the security provided by SSL. (Bug#38700)
C.4.3. Changes in MySQL Connector/NET 6.0.3 (28 April 2009)
First GA release.
Functionality added or changed:
The MySqlTokenizer failed to split fieldnames from values if they were not separated by a space. This also happened if the
string contained certain characters. As a result MySqlCommand.ExecuteNonQuery raised an index out of range exception.
The resulting errors are illustrated by the following examples. Note, the example statements do not have delimiting spaces around
the = operator.
INSERT INTO anytable SET Text='test--test';
The tokenizer incorrectly interpreted the value as containing a comment.
UPDATE anytable SET Project='123-456',Text='Can you explain this ?',Duration=15 WHERE
ID=4711;'
A MySqlException was generated, as the ? in the value was interpreted by the tokenizer as a parameter sign. The error message
generated was:
Fatal error encountered during command execution.
EXCEPTION: MySqlException - Parameter '?'' must be defined.
(Bug#44318)
Bugs fixed:
MySQL.Data was not displayed as a Reference inside Microsoft Visual Studio 2008 Professional.
When a new C# project was created in Microsoft Visual Studio 2008 Professional, MySQL.Data was not displayed when REFER-
ENCES, ADD REFERENCE was selected. (Bug#44141)
Column types for SchemaProvider and ISSchemaProvider did not match.
When the source code in SchemaProvider.cs and ISSchemaProvider.cs were compared it was apparent that they were
not using the same column types. The base provider used SQL such as SHOW CREATE TABLE, while ISSchemaProvider
used the schema information tables. Column types used by the base class were INT64 and the column types used by ISS-
chemaProvider were UNSIGNED. (Bug#44123)
MySQL Change History
3059
C.4.4. Changes in MySQL Connector/NET 6.0.2 (07 April 2009 beta)
This is a new development release, fixing recently discovered bugs.
Bugs fixed:
MySQL Connector/NET 6.0.1 did not load in Microsoft Visual Studio 2008 and Visual Studio 2005 Pro.
The following error message was generated:
.NET Framework Data Provider for MySQL: The data provider object factory service was not
found.
(Bug#44064)
C.4.5. Changes in MySQL Connector/NET 6.0.1 (02 April 2009 beta)
This is a new Beta development release, fixing recently discovered bugs.
Bugs fixed:
An insert and update error was generated by the decimal data type in the Entity Framework, when a German collation was used.
(Bug#43574)
Generating an Entity Data Model (EDM) schema with a table containing columns with data types MEDIUMTEXT and LONGTEXT
generated a runtime error message Max value too long or too short for Int32. (Bug#43480)
C.4.6. Changes in MySQL Connector/NET 6.0.0 (02 March 2009 alpha)
This is a new Alpha development release.
Bugs fixed:
A null reference exception was generated when MySqlConnection.ClearPool(connection) was called. (Bug#42801)
C.4.7. Changes in MySQL Connector/NET 5.3.0 (Not yet released)
Bugs fixed:
The Web Provider did not work at all on a remote host, and did not create a database when using autogenerates-
chema="true". (Bug#39072)
The MySQL Connector/NET installer program ended prematurely without reporting the specific error. (Bug#39019)
When called with an incorrect password the MembershipProvider.GetPassword() method threw a MySQLException
instead of a MembershipPasswordException . (Bug#38939)
Possible overflow in MySqlPacket.ReadLong(). (Bug#36997)
The TokenizeSql method was adding query overhead and causing high CPU utilization for larger queries. (Bug#36836)
C.4.8. Changes in MySQL Connector/NET 5.2.7 (Not yet released)
Bugs fixed:
A MySQL Connector/NET test program that connected to MySQL Server using the connection string option compress=true
MySQL Change History
3060
crashed, but only when running on Mono. The program worked as expected when running on Microsoft Windows.
This was due to a bug in Mono. MySQL Connector/NET was modified to avoid using WeakReferences in the Compressed
stream class, which was causing the crash. (Bug#45463)
If a certain socket exception occurred when trying to establish a MySQL database connection, MySQL Connector/NET displayed an
exception message that appeared to be unrelated to the underlying problem. This masked the problem and made diagnosing prob-
lems more difficult.
For example, if, when establishing a database connection via TCP/IP, Windows on the local machine allocated an ephemeral port
that conflicted with a socket address still in use, then Windows/.NET would throw a socket exception with the following error text:
Only one usage of each socket address (protocol/network address/port) is normally
permitted IP ADDRESS/PORT.
However, MySQL Connector/NET masked this socket exception and displayed an exception with the following text:
Unable to connect to any of the specified MySQL hosts.
(Bug#45021)
The Microsoft Visual Studio solution file MySQL-VS2005.sln was invalid. Several projects could not be loaded and thus it was
not possible to build MySQL Connector/NET from source. (Bug#44822)
The MySQL Connector/NET MySQLRoleProvider reported that there were no roles, even when roles existed. (Bug#44414)
After a Reference to "C:\Program Files\MySQL\MySQL Connector Net 5.2.4\Compact Framework\MySql.Data.CF.dll" was added
to a Windows Mobile 5.0 project, the project then failed to build, generating a Microsoft Visual C# compiler error.
The error generated was:
Error 2 The type 'System.Runtime.CompilerServices.CompilerGeneratedAttribute'
has no constructors defined MysqlTest
Error 3 Internal Compiler Error (0xc0000005 at address 5A7E3714):
likely culprit is 'COMPILE'.
(Bug#42261)
When a TableAdapter was created on a DataSet, it was not possible to use a stored procedure with variables. The following error
was generated:
The method or operation is not implemented
(Bug#39409)
C.4.9. Changes in MySQL Connector/NET 5.2.6 (28 April 2009)
Functionality added or changed:
A new connection string option has been added: use affected rows. When true the connection will report changed rows in-
stead of found rows. (Bug#44194)
Bugs fixed:
Calling GetSchema() on Indexes or IndexColumns failed where index or column names were restricted.
In SchemaProvider.cs, methods GetIndexes() and GetIndexColumns() passed their restrictions directly to Get-
Tables(). This only worked if the restrictions were no more specific than schemaName and tableName. If IndexName was
given, this was passed to GetTables() where it was treated as TableType. As a result no tables were returned, unless the index
name happened to be BASE TABLE or VIEW. This meant that both methods failed to return any rows. (Bug#43991)
MySQL Change History
3061
GetSchema("MetaDataCollections") should have returned a table with a column named NumberOfRestrictions not
NumberOfRestriction.
This can be confirmed by referencing the Microsoft Documentation. (Bug#43990)
Requests sent to the MySQL Connector/NET role provider to remove a user from a role failed. The query log showed the query was
correctly executed within a transaction which was immediately rolled back. The rollback was caused by a missing call to the Com-
plete method of the transaction. (Bug#43553)
When using MySqlBulkLoader.Load(), the text file is opened by NativeDriver.SendFileToServer. If it en-
countered a problem opening the file as a stream, an exception was generated and caught. An attempt to clean up resources was then
made in the finally{} clause by calling fs.Close(), but since the stream was never successfully opened, this was an attempt
to execute a method of a null reference. (Bug#43332)
A null reference exception was generated when MySqlConnection.ClearPool(connection) was called. (Bug#42801)
MySQLMembershipProvider.ValidateUser only used the userId to validate. However, it should also use the applic-
ationId to perform the validation correctly.
The generated query was, for example:
SELECT Password, PasswordKey, PasswordFormat, IsApproved, Islockedout
FROM my_aspnet_Membership WHERE userId=13
Note that applicationId is not used. (Bug#42574)
There was an error in the ProfileProvider class in the private ProfileInfoCollection GetProfiles() func-
tion. The column of the final table was named lastUpdatdDate ('e' is missing) instead of the correct lastUpdatedDate.
(Bug#41654)
The GetGuid() method of MySqlDataReader did not treat BINARY(16) column data as a GUID. When operating on such a
column a FormatException exception was generated. (Bug#41452)
When ASP.NET membership was configured to not require password question and answer using requiresQuestion-
AndAnswer="false", a SqlNullValueException was generated when using MembershipUser.ResetPassword()
to reset the user password. (Bug#41408)
If a Stored Procedure contained spaces in its parameter list, and was then called from MySQL Connector/NET, an exception
was generated. However, the same Stored Procedure called from the MySQL Query Analyzer or the MySQL Client worked
correctly.
The exception generated was:
Parameter '0' not found in the collection.
(Bug#41034)
The DATETIME format contained an erroneous space. (Bug#41021)
When MySql.Web.Profile.MySQLProfileProvider was configured, it was not possible to assign a name other than the
default name MySQLProfileProvider.
If the name SCC_MySQLProfileProvider was assigned, an exception was generated when attempting to use
Page.Context.Profile['custom prop'].
The exception generated was:
The profile default provider was not found.
Note that the exception stated: 'the profile default provider...', even though a different name was explicitly requested. (Bug#40871)
When ExecuteNonQuery was called with a command type of Stored Procedure it worked for one user but resulted in a
hang for another user with the same database permissions.
However, if CALL was used in the command text and ExecuteNonQuery was used with a command type of Text, the call
MySQL Change History
3062
worked for both users. (Bug#40139)
C.4.10. Changes in MySQL Connector/NET 5.2.5 (19 November 2008)
Bugs fixed:
Visual Studio 2008 displayed the following error three times on start-up:
"Package Load Failure
Package 'MySql.Data.VisualStudio.MySqlDataProviderPackage, MySql.VisualStudio,
Version=5.2.4, Culture=neutral, PublicKeyTopen=null' has failed to load properly (GUID =
{79A115C9-B133-4891-9E7B-242509DAD272}). Please contact the package vendor for
assistance. Application restart is recommended, due to possible environment corruption.
Would you like to disable loading the package in the future? You may use
'devenve/resetskippkgs' to re-enable package loading."
(Bug#40726)
C.4.11. Changes in MySQL Connector/NET 5.2.4 (13 November 2008)
Bugs fixed:
MySqlDataReader did not feature a GetSByte method. (Bug#40571)
When working with stored procedures MySQL Connector/NET generated an exception Unknown "table parameters" in
information_schema. (Bug#40382)
GetDefaultCollation and GetMaxLength were not thread safe. These functions called the database to get a set of paramet-
ers and cached them in two static dictionaries in the function InitCollections. However, if many threads called them they
would try to insert the same keys in the collections resulting in duplicate key exceptions. (Bug#40231)
If connection pooling was not set explicitly in the connection string, MySQL Connector/NET added ;Pooling=False to the end of
the connection string when MySqlCommand.ExecuteReader() was called.
If connection pooling was explicitly set in the connection string, when MySqlConnection.Open() was called it converted
Pooling=True to pooling=True.
If MySqlCommand.ExecuteReader() was subsequently called, it concatenated ;Pooling=False to the end of the connection
string. The resulting connection string was thus terminated with pooling=True;Pooling=False. This disabled connection pooling
completely. (Bug#40091)
The connection string option Functions Return String did not set the correct encoding for the result string. Even though
the connection string option Functions Return String=true; is set, the result of SELECT DES_DECRYPT() contained
?? instead of the correct national character symbols. (Bug#40076)
If, when using the MySqlTransaction transaction object, an exception was thrown, the transaction object was not disposed of
and the transaction was not rolled back. (Bug#39817)
After the ConnectionString property was initialized via the public setter of DbConnectionStringBuilder, the Get-
ConnectionString method of MySqlConnectionStringBuilder incorrectly returned null when true was assigned
to the includePass parameter. (Bug#39728)
When using ProfileProvider, attempting to update a previously saved property failed. (Bug#39330)
Reading a negative time value greater than -01:00:00 returned the absolute value of the original time value. (Bug#39294)
Inserting a negative time value (negative TimeSpan) into a Time column through the use of MySqlParameter caused
MySqlException to be thrown. (Bug#39275)
When a data connection was created in the server explorer of Visual Studio 2008 Team, an error was generated when trying to ex-
pand stored procedures that had parameters.
MySQL Change History
3063
Also, if TABLEADAPTER was right-clicked and then ADD, QUERY, USE EXISTING STORED PROCEDURES selected, if you then at-
tempted to select a stored procedure, the window would close and no error message would be displayed. (Bug#39252)
The Web Provider did not work at all on a remote host, and did not create a database when using autogenerates-
chema="true". (Bug#39072)
MySQL Connector/NET called hashed password methods not supported in Mono 2.0 Preview 2. (Bug#38895)
C.4.12. Changes in MySQL Connector/NET 5.2.3 (19 August 2008)
Functionality added or changed:
Error string was returned after a 28000 second wait_timeout. This has been changed to generate a Connection-
State.Closed event. (Bug#38119)
Changed how the procedure schema collection is retrieved. If the connection string contains use procedure bodies=true
then a SELECT is performed on the mysql.proc table directly, as this is up to 50 times faster than the current Information
Schema implementation. If the connection string contains use procedure bodies=false, then the Information Schema
collection is queried. (Bug#36694)
Changed how the procedure schema collection is retrieved. If use procedure bodies=true then the mysql.proc table is
selected directly as this is up to 50 times faster than the current information_schema implementation. If use procedure
bodies=false, then the information_schema collection is queried. (Bug#36694)
String escaping functionality has been moved from the MySqlString class to the MySqlHelper class, where it can be accessed
by the EscapeString method. (Bug#36205)
Bugs fixed:
The GetOrdinal() method failed to return the ordinal if the column name string contained an accent. (Bug#38721)
MySQL Connector/NET uninstaller did not clean up all installed files. (Bug#38534)
There was a short circuit evaluation error in the MySqlCommand.CheckState() method. When the statement connection
== null was true a NullReferenceException was thrown and not the expected InvalidOperationException.
(Bug#38276)
The provider did not silently create the user if the user did not exist. (Bug#38243)
Executing a command that resulted in a fatal exception did not close the connection. (Bug#37991)
When a prepared insert query is run that contains an UNSIGNED TINYINT in the parameter list, the complete query and data that
should be inserted is corrupted and no error is thrown. (Bug#37968)
In a .NET application MySQL Connector/NET modifies the connection string so that it contains several occurrences of the same op-
tion with different values. This is illustrated by the example that follows.
The original connection string:
host=localhost;database=test;uid=*****;pwd=*****;
connect timeout=25; auto enlist=false;pooling=false;
The connection string after after closing MySqlDataReader:
host=localhost;database=test;uid=*****;pwd=*****;
connect timeout=25;auto enlist=false;pooling=false;
Allow User Variables=True;Allow User Variables=False;
Allow User Variables=True;Allow User Variables=False;
(Bug#37955)
MySQL Change History
3064
Unnecessary network traffic was generated for the normal case where the web provider schema was up to date. (Bug#37469)
MySqlReader.GetOrdinal() performance enhancements break existing functionality. (Bug#37239)
The autogenerateschema option produced tables with incorrect collations. (Bug#36444)
GetSchema did not work correctly when querying for a collection, if using a non-English locale. (Bug#35459)
When reading back a stored double or single value using the .NET provider, the value had less precision than the one stored.
(Bug#33322)
Using the MySQL Visual Studio plugin and a MySQL 4.1 server, certain field types (ENUM) would not be identified correctly. Also,
when looking for tables, the plugin would list all tables matching a wildcard pattern of the database name supplied in the connection
string, instead of only tables within the specified database. (Bug#30603)
C.4.13. Changes in MySQL Connector/NET 5.2.2 (12 May 2008)
Bugs fixed:
Product documentation incorrectly stated '?' is the preferred parameter marker. (Bug#37349)
An incorrect value for a bit field would returned in a multi-row query if a preceding value for the field returned NULL. (Bug#36313)
Tables with GEOMETRY field types would return an unknown datatype exception. (Bug#36081)
When using the MySQLProfileProvider, setting profile details and then reading back saved data would result in the default
values being returned instead of the updated values. (Bug#36000)
When creating a connection, setting the ConnectionString property of MySqlConnection to NULL would throw an excep-
tion. (Bug#35619)
The DbCommandBuilder.QuoteIdentifer method was not implemented. (Bug#35492)
When using encrypted passwords, the GetPassword() function would return the wrong string. (Bug#35336)
An error would be raised when calling GetPassword() with a NULL value. (Bug#35332)
When retreiving data where a field has been identified as containing a GUID value, the incorrect value would be returned when a
previous row contained a NULL value for that field. (Bug#35041)
Using the TableAdapter Wizard would fail when generating commands that used stored procedures due to the change in sup-
ported parameter characters. (Bug#34941)
When creating a new stored procedured, the new parameter code which allows the use of the @ symbol would interfere with the spe-
cification of a DEFINER. (Bug#34940)
When using SqlDataSource to open a connection, the connection would not automatically be closed when access had com-
pleted. (Bug#34460)
There was a high level of contention in the connection pooling code that could lead to delays when opening connections and submit-
ting queries. The connection pooling code has been modified to try and limit the effects of the contention issue. (Bug#34001)
Using the TableAdaptor wizard in combination with a suitable SELECT statement, only the associated INSERT statement
would also be created, rather than the required DELETE and UPDATE statements. (Bug#31338)
Fixed problem in datagrid code related to creating a new table. This problem may have been introduced with .NET 2.0 SP1.
Fixed profile provider that would throw an exception if you were updating a profile that already existed.
C.4.14. Changes in MySQL Connector/NET 5.2.1 (27 February 2008)
Bugs fixed:
MySQL Change History
3065
When using the provider to generate or update users and passwords, the password checking algorithm would not validate the pass-
word strength or requirements correctly. (Bug#34792)
When executing statements that used stored procedures and functions, the new parameter code could fail to identify the correct para-
meter format. (Bug#34699)
The installer would fail to the DDEX provider binary if the Visual Studio 2005 component was not selected. The result would lead
to MySQL Connector/NET not loading properly when using the interface to a MySQL server within Visual Studio. (Bug#34674)
A number issues were identified in the case, connection and scema areas of the code for MembershipProvider, RolePro-
vider, ProfileProvider. (Bug#34495)
When using web providers, the MySQL Connector/NET would check the schema and cache the application id, even when the con-
nection string had been set. The effect would be to break the memvership provider list. (Bug#34451)
Attempting to use an isolation level other than the default with a transaction scope would use the default isolation level.
(Bug#34448)
When altering a stored procedure within Visual Studio, the parameters to the procedure could be lost. (Bug#34359)
A race condition could occur within the procedure cache resulting the cache contents overflowing beyond the configured cache size.
(Bug#34338)
Fixed problem with Visual Studio 2008 integration that caused pop-up menus on server explorer nodes to not function
The provider code has been updated to fix a number of outstanding issues.
C.4.15. Changes in MySQL Connector/NET 5.2.0 (11 February 2008)
Functionality added or changed:
Performing GetValue() on a field TINYINT(1) returned a BOOLEAN. While not a bug, this caused problems in software that
expected an INT to be returned. A new connection string option Treat Tiny As Boolean has been added with a default value
of true. If set to false the provider will treat TINYINT(1) as INT. (Bug#34052)
Added support for DbDataAdapter UpdateBatchSize. Batching is fully supported including collapsing inserts down into the
multi-value form if possible.
DDEX provider now works under Visual Studio 2008 beta 2.
Added ClearPool and ClearAllPools features.
Bugs fixed:
Some speed improvements have been implemented in the TokenizeSql process used to identify elements of SQL statements.
(Bug#34220)
When accessing tables from different databases within the same TransactionScope, the same user/password combination
would be used for each database connection. MySQL Connector/NET does not handle multiple connections within the same transac-
tion scope. An error is now returned if you attempt this process, instead of using the incorrect authorization information.
(Bug#34204)
The status of connections reported through the state change handler was not being updated correctly. (Bug#34082)
Incorporated some connection string cache optimizations sent to us by Maxim Mass. (Bug#34000)
In an open connection where the server had disconnected unexpectedly, the status information of the connection would not be up-
dated properly. (Bug#33909)
Data cached from the connection string could return invalid information because the internal routines were not using case-sensitive
semantics. This lead to updated connection string options not being recognized if they were of a different case than the existing
cached values. (Bug#31433)
MySQL Change History
3066
Column name metadata was not using the character set as deifned within the connection string being used. (Bug#31185)
Memory usage could increase and decrease significantly when updating or inserting a large number of rows. (Bug#31090)
Commands executed from within the state change handeler would fail with a NULL exception. (Bug#30964)
When running a stored procedure multiple times on the same connection, the memory usage could increase indefinitely.
(Bug#30116)
Using compression in the MySQL connection with MySQL Connector/NET would be slower than using native (uncompressed)
communication. (Bug#27865)
The MySqlDbType.Datetime has been replaced with MySqlDbType.DateTime. The old format has been obsoleted.
(Bug#26344)
C.4.16. Changes in MySQL Connector/NET 5.1.8 (Not yet released)
Bugs fixed:
Calling GetSchema() on Indexes or IndexColumns failed where index or column names were restricted.
In SchemaProvider.cs, methods GetIndexes() and GetIndexColumns() passed their restrictions directly to Get-
Tables(). This only worked if the restrictions were no more specific than schemaName and tableName. If IndexName was
given, this was passed to GetTables() where it was treated as TableType. As a result no tables were returned, unless the index
name happened to be BASE TABLE or VIEW. This meant that both methods failed to return any rows. (Bug#43991)
The DATETIME format contained an erroneous space. (Bug#41021)
If connection pooling was not set explicitly in the connection string, MySQL Connector/NET added ;Pooling=False to the end of
the connection string when MySqlCommand.ExecuteReader() was called.
If connection pooling was explicitly set in the connection string, when MySqlConnection.Open() was called it converted
Pooling=True to pooling=True.
If MySqlCommand.ExecuteReader() was subsequently called, it concatenated ;Pooling=False to the end of the connection
string. The resulting connection string was thus terminated with pooling=True;Pooling=False. This disabled connection pooling
completely. (Bug#40091)
If, when using the MySqlTransaction transaction object, an exception was thrown, the transaction object was not disposed of
and the transaction was not rolled back. (Bug#39817)
When a prepared insert query is run that contains an UNSIGNED TINYINT in the parameter list, the complete query and data that
should be inserted is corrupted and no error is thrown. (Bug#37968)
C.4.17. Changes in MySQL Connector/NET 5.1.7 (21 August 2008)
Bugs fixed:
There was a short circuit evaluation error in the MySqlCommand.CheckState() method. When the statement connection
== null was true a NullReferenceException was thrown and not the expected InvalidOperationException.
(Bug#38276)
Executing a command that resulted in a fatal exception did not close the connection. (Bug#37991)
In a .NET application MySQL Connector/NET modifies the connection string so that it contains several occurrences of the same op-
tion with different values. This is illustrated by the example that follows.
The original connection string:
host=localhost;database=test;uid=*****;pwd=*****;
connect timeout=25; auto enlist=false;pooling=false;
MySQL Change History
3067
The connection string after after closing MySqlDataReader:
host=localhost;database=test;uid=*****;pwd=*****;
connect timeout=25;auto enlist=false;pooling=false;
Allow User Variables=True;Allow User Variables=False;
Allow User Variables=True;Allow User Variables=False;
(Bug#37955)
As MySqlDbType.DateTime is not available in VB.Net the warning THE DATETIME ENUM VALUE IS OBSOLETE was always
shown during compilation. (Bug#37406)
An unknown MySqlErrorCode was encountered when opening a connection with an incorrect password. (Bug#37398)
Documentation incorrectly stated that the DataColumn class in .NET 1.0 and 1.1 does not allow columns with type of UInt16,
UInt32, or UInt64 to be autoincrement columns. (Bug#37350)
SemaphoreFullException is generated when application is closed. (Bug#36688)
GetSchema did not work correctly when querying for a collection, if using a non-English locale. (Bug#35459)
When reading back a stored double or single value using the .NET provider, the value had less precision than the one stored.
(Bug#33322)
Using the MySQL Visual Studio plugin and a MySQL 4.1 server, certain field types (ENUM) would not be identified correctly. Also,
when looking for tables, the plugin would list all tables matching a wildcard pattern of the database name supplied in the connection
string, instead of only tables within the specified database. (Bug#30603)
C.4.18. Changes in MySQL Connector/NET 5.1.6 (12 May 2008)
Bugs fixed:
When creating a connection pool, specifying an invalid IP address will cause the entire application to crash, instead of providing an
exception. (Bug#36432)
An incorrect value for a bit field would returned in a multi-row query if a preceding value for the field returned NULL. (Bug#36313)
The MembershipProvider will raise an exception when the connection string is configured with enablePasswordRet-
rival = true and RequireQuestionAndAnswer = false. (Bug#36159)
When calling GetNumberOfUsersOnline an exception is raised on the submitted query due to a missing parameter.
(Bug#36157)
Tables with GEOMETRY field types would return an unknown datatype exception. (Bug#36081)
When creating a connection, setting the ConnectionString property of MySqlConnection to NULL would throw an excep-
tion. (Bug#35619)
The DbCommandBuilder.QuoteIdentifer method was not implemented. (Bug#35492)
When using SqlDataSource to open a connection, the connection would not automatically be closed when access had com-
pleted. (Bug#34460)
Attempting to use an isolation level other than the default with a transaction scope would use the default isolation level.
(Bug#34448)
When altering a stored procedure within Visual Studio, the parameters to the procedure could be lost. (Bug#34359)
A race condition could occur within the procedure cache resulting the cache contents overflowing beyond the configured cache size.
(Bug#34338)
Using the TableAdaptor wizard in combination with a suitable SELECT statement, only the associated INSERT statement
would also be created, rather than the required DELETE and UPDATE statements. (Bug#31338)
MySQL Change History
3068
C.4.19. Changes in MySQL Connector/NET 5.1.5 (Not yet released)
Functionality added or changed:
Performing GetValue() on a field TINYINT(1) returned a BOOLEAN. While not a bug, this caused problems in software that
expected an INT to be returned. A new connection string option Treat Tiny As Boolean has been added with a default value
of true. If set to false the provider will treat TINYINT(1) as INT. (Bug#34052)
Bugs fixed:
Some speed improvements have been implemented in the TokenizeSql process used to identify elements of SQL statements.
(Bug#34220)
When accessing tables from different databases within the same TransactionScope, the same user/password combination
would be used for each database connection. MySQL Connector/NET does not handle multiple connections within the same transac-
tion scope. An error is now returned if you attempt this process, instead of using the incorrect authorization information.
(Bug#34204)
The status of connections reported through the state change handler was not being updated correctly. (Bug#34082)
Incorporated some connection string cache optimizations sent to us by Maxim Mass. (Bug#34000)
In an open connection where the server had disconnected unexpectedly, the status information of the connection would not be up-
dated properly. (Bug#33909)
MySQL Connector/NET would fail to compile properly with nant. (Bug#33508)
Problem with membership provider would mean that FindUserByEmail would fail with a MySqlException because it was
trying to add a second parameter with the same name as the first. (Bug#33347)
Using compression in the MySQL connection with MySQL Connector/NET would be slower than using native (uncompressed)
communication. (Bug#27865)
C.4.20. Changes in MySQL Connector/NET 5.1.4 (20 November 2007)
Bugs fixed:
Setting the size of a string parameter after the value could cause an exception. (Bug#32094)
Creation of parameter objects with noninput direction using a constructor would fail. This was cause by some old legacy code pre-
venting their use. (Bug#32093)
A date string could be returned incorrectly by MySqlDataTime.ToString() when the date returned by MySQL was
0000-00-00 00:00:00. (Bug#32010)
A syntax error in a set of batch statements could leave the data adapter in a state that appears hung. (Bug#31930)
Installing over a failed uninstall of a previous version could result in multiple clients being registered in the machine.config.
This would prevent certain aspects of the MySQL connection within Visual Studio to work properly. (Bug#31731)
MySQL Connector/NET would incorrectly report success when enlisting in a distributed transaction, although distributed transac-
tions are not supported. (Bug#31703)
Data cached from the connection string could return invalid information because the internal routines were not using case-sensitive
semantics. This lead to updated connection string options not being recognized if they were of a different case than the existing
cached values. (Bug#31433)
Trying to use a connection that was not open could return an ambiguous and misleading error message. (Bug#31262)
Column name metadata was not using the character set as deifned within the connection string being used. (Bug#31185)
MySQL Change History
3069
Memory usage could increase and decrease significantly when updating or inserting a large number of rows. (Bug#31090)
Commands executed from within the state change handeler would fail with a NULL exception. (Bug#30964)
Extracting data through XML functions within a query returns the data as System.Byte[]. This was due to MySQL Connector/
NET incorrectly identifying BLOB fields as binary, rather than text. (Bug#30233)
When running a stored procedure multiple times on the same connection, the memory usage could increase indefinitely.
(Bug#30116)
Column types with only 1-bit (such as BOOLEAN and TINYINT(1) were not returned as boolean fields. (Bug#27959)
When accessing certain statements, the command would timeout before the command completed. Because this cannot always be
controlled through the individual command timeout options, a default command timeout has been added to the connection
string options. (Bug#27958)
The server error code was not updated in the Data[] hash, which prevented DbProviderFactory users from accessing the
server error code. (Bug#27436)
The MySqlDbType.Datetime has been replaced with MySqlDbType.DateTime. The old format has been obsoleted.
(Bug#26344)
Changing the connection string of a connection to one that changes the parameter marker after the connection had been assigned to a
command but before the connection is opened could cause parameters to not be found. (Bug#13991)
C.4.21. Changes in MySQL Connector/NET 5.1.3 (21 September 2007 beta)
This is a new Beta development release, fixing recently discovered bugs.
Bugs fixed:
An incorrect ConstraintException could be raised on an INSERT when adding rows to a table with a multiple-column
unique key index. (Bug#30204)
A DATE field would be updated with a date/time value, causing a MySqlDataAdapter.Update() exception. (Bug#30077)
The Saudi Hijri calendar was not supported. (Bug#29931)
Calling SHOW CREATE PROCEDURE for routines with a hyphen in the catalog name produced a syntax error. (Bug#29526)
Connecting to a MySQL server earlier than version 4.1 would raise a NullException. (Bug#29476)
The availability of a MySQL server would not be reset when using pooled connections (pooling=true). This would lead to the
server being reported as unavailable, even if the server become available while the application was still running. (Bug#29409)
A FormatException error would be raised if a parameter had not been found, instead of Re-
sources.ParameterMustBeDefined. (Bug#29312)
An exception would be thrown when using the Manage Role functionality within the web administrator to assign a role to a user.
(Bug#29236)
Using the membership/role providers when validationKey or decryptionKey parameters are set to AutoGenerate, an
exception would be raised when accessing the corresponding values. (Bug#29235)
Certain operations would not check the UsageAdvisor setting, causing log messages from the Usage Advisor even when it was
disabled. (Bug#29124)
Using the same connection string multiple times would result in Database=dbname appearing multiple times in the resulting
string. (Bug#29123)
Visual Studio Plugin: Adding a new query based on a stored procedure that uses the SELECT statement would terminate the query/
TableAdapter wizard. (Bug#29098)
Using TransactionScope would cause an InvalidOperationException. (Bug#28709)
MySQL Change History
3070
C.4.22. Changes in MySQL Connector/NET 5.1.2 (18 June 2007)
This is a new Beta development release, fixing recently discovered bugs.
Bugs fixed:
Log messages would be truncated to 300 bytes. (Bug#28706)
Creating a user would fail due to the application name being set incorrectly. (Bug#28648)
Visual Studio Plugin: Adding a new query based on a stored procedure that used a UPDATE, INSERT or DELETE statement would
terminate the query/TableAdapter wizard. (Bug#28536)
Visual Studio Plugin: Query Builder would fail to show TINYTEXT columns, and any columns listed after a TINYTEXT column
correctly. (Bug#28437)
Accessing the results from a large query when using data compression in the connection would fail to return all the data.
(Bug#28204)
Visual Studio Plugin: Update commands would not be generated correctly when using the TableAdapter wizard. (Bug#26347)
C.4.23. Changes in MySQL Connector/NET 5.1.1 (23 May 2007)
Bugs fixed:
Running the statement SHOW PROCESSLIST would return columns as byte arrays instead of native columns. (Bug#28448)
Installation of the MySQL Connector/NET on Windows would fail if VisualStudio had not already been installed. (Bug#28260)
MySQL Connector/NET would look for the wrong table when executing User.IsRole(). (Bug#28251)
Building a connection string within a tight loop would show slow performance. (Bug#28167)
The UNSIGNED flag for parameters in a stored procedure would be ignored when using MySqlCommandBuilder to obtain the
parameter information. (Bug#27679)
Using MySQLDataAdapter.FillSchema() on a stored procedure would raise an exception: Invalid attempt to ac-
cess a field before calling Read(). (Bug#27668)
DATETIME fields from versions of MySQL bgefore 4.1 would be incorrectly parsed, resulting in a exception. (Bug#23342)
Fixed password property on MySqlConnectionStringBuilder to use PasswordPropertyText attribute. This causes
dots to show instead of actual password text.
C.4.24. Changes in MySQL Connector/NET 5.1.0 (01 May 2007)
Functionality added or changed:
Now compiles for .NET CF 2.0.
Rewrote stored procedure parsing code using a new SQL tokenizer. Really nasty procedures including nested comments are now
supported.
GetSchema will now report objects relative to the currently selected database. What this means is that passing in null as a database
restriction will report objects on the currently selected database only.
Added Membership and Role provider contributed by Sean Wright (thanks!).
C.4.25. Changes in MySQL Connector/NET 5.0.10 (Not yet released)
MySQL Change History
3071
Bugs fixed:
If, when using the MySqlTransaction transaction object, an exception was thrown, the transaction object was not disposed of
and the transaction was not rolled back. (Bug#39817)
Executing a command that resulted in a fatal exception did not close the connection. (Bug#37991)
When a prepared insert query is run that contains an UNSIGNED TINYINT in the parameter list, the complete query and data that
should be inserted is corrupted and no error is thrown. (Bug#37968)
In a .NET application MySQL Connector/NET modifies the connection string so that it contains several occurrences of the same op-
tion with different values. This is illustrated by the example that follows.
The original connection string:
host=localhost;database=test;uid=*****;pwd=*****;
connect timeout=25; auto enlist=false;pooling=false;
The connection string after after closing MySqlDataReader:
host=localhost;database=test;uid=*****;pwd=*****;
connect timeout=25;auto enlist=false;pooling=false;
Allow User Variables=True;Allow User Variables=False;
Allow User Variables=True;Allow User Variables=False;
(Bug#37955)
When creating a connection pool, specifying an invalid IP address will cause the entire application to crash, instead of providing an
exception. (Bug#36432)
GetSchema did not work correctly when querying for a collection, if using a non-English locale. (Bug#35459)
When reading back a stored double or single value using the .NET provider, the value had less precision than the one stored.
(Bug#33322)
C.4.26. Changes in MySQL Connector/NET 5.0.9 (Not yet released)
Bugs fixed:
The DbCommandBuilder.QuoteIdentifer method was not implemented. (Bug#35492)
Setting the size of a string parameter after the value could cause an exception. (Bug#32094)
Creation of parameter objects with noninput direction using a constructor would fail. This was cause by some old legacy code pre-
venting their use. (Bug#32093)
A date string could be returned incorrectly by MySqlDataTime.ToString() when the date returned by MySQL was
0000-00-00 00:00:00. (Bug#32010)
A syntax error in a set of batch statements could leave the data adapter in a state that appears hung. (Bug#31930)
Installing over a failed uninstall of a previous version could result in multiple clients being registered in the machine.config.
This would prevent certain aspects of the MySQL connection within Visual Studio to work properly. (Bug#31731)
Data cached from the connection string could return invalid information because the internal routines were not using case-sensitive
semantics. This lead to updated connection string options not being recognized if they were of a different case than the existing
cached values. (Bug#31433)
Column name metadata was not using the character set as deifned within the connection string being used. (Bug#31185)
Memory usage could increase and decrease significantly when updating or inserting a large number of rows. (Bug#31090)
Commands executed from within the state change handeler would fail with a NULL exception. (Bug#30964)
MySQL Change History
3072
When running a stored procedure multiple times on the same connection, the memory usage could increase indefinitely.
(Bug#30116)
The server error code was not updated in the Data[] hash, which prevented DbProviderFactory users from accessing the
server error code. (Bug#27436)
Changing the connection string of a connection to one that changes the parameter marker after the connection had been assigned to a
command but before the connection is opened could cause parameters to not be found. (Bug#13991)
C.4.27. Changes in MySQL Connector/NET 5.0.8 (21 August 2007)
Note
This version introduces a new installer technology.
Bugs fixed:
Extracting data through XML functions within a query returns the data as System.Byte[]. This was due to MySQL Connector/
NET incorrectly identifying BLOB fields as binary, rather than text. (Bug#30233)
An incorrect ConstraintException could be raised on an INSERT when adding rows to a table with a multiple-column
unique key index. (Bug#30204)
A DATE field would be updated with a date/time value, causing a MySqlDataAdapter.Update() exception. (Bug#30077)
Fixed bug where MySQL Connector/NET was hand building some date time patterns rather than using the patterns provided under
CultureInfo. This caused problems with some calendars that do not support the same ranges as Gregorian.. (Bug#29931)
Calling SHOW CREATE PROCEDURE for routines with a hyphen in the catalog name produced a syntax error. (Bug#29526)
The availability of a MySQL server would not be reset when using pooled connections (pooling=true). This would lead to the
server being reported as unavailable, even if the server become available while the application was still running. (Bug#29409)
A FormatException error would be raised if a parameter had not been found, instead of Re-
sources.ParameterMustBeDefined. (Bug#29312)
Certain operations would not check the UsageAdvisor setting, causing log messages from the Usage Advisor even when it was
disabled. (Bug#29124)
Using the same connection string multiple times would result in Database=dbname appearing multiple times in the resulting
string. (Bug#29123)
Log messages would be truncated to 300 bytes. (Bug#28706)
Accessing the results from a large query when using data compression in the connection will fail to return all the data. (Bug#28204)
Fixed problem where MySqlConnection.BeginTransaction checked the drivers status var before checking if the connec-
tion was open. The result was that the driver could report an invalid condition on a previously opened connection.
Fixed problem where we were not closing prepared statement handles when commands are disposed. This could lead to using up all
prepared statement handles on the server.
Fixed the database schema collection so that it works on servers that are not properly respecting the
lower_case_table_names setting.
Fixed problem where any attempt to not read all the records returned from a select where each row of the select is greater than 1024
bytes would hang the driver.
Fixed problem where a command timing out just after it actually finished would cause an exception to be thrown on the command
timeout thread which would then be seen as an unhandled exception.
Fixed some serious issues with command timeout and cancel that could present as exceptions about thread ownership. The issue was
that not all queries cancel the same. Some produce resultsets while others don't. ExecuteReader had to be changed to check for this.
MySQL Change History
3073
C.4.28. Changes in MySQL Connector/NET 5.0.7 (18 May 2007)
Bugs fixed:
Running the statement SHOW PROCESSLIST would return columns as byte arrays instead of native columns. (Bug#28448)
Building a connection string within a tight loop would show slow performance. (Bug#28167)
Using logging (with the logging=true parameter to the connection string) would not generate a log file. (Bug#27765)
The UNSIGNED flag for parameters in a stored procedure would be ignored when using MySqlCommandBuilder to obtain the
parameter information. (Bug#27679)
Using MySQLDataAdapter.FillSchema() on a stored procedure would raise an exception: Invalid attempt to ac-
cess a field before calling Read(). (Bug#27668)
If you close an open connection with an active transaction, the transaction is not automatically rolled back. (Bug#27289)
When cloning an open MySqlClient.MySqlConnection with the Persist Security Info=False option set, the
cloned connection is not usable because the security information has not been cloned. (Bug#27269)
Enlisting a null transaction would affect the current connection object, such that further enlistment operations to the transaction are
not possible. (Bug#26754)
Attempting to change the Connection Protocol property within a PropertyGrid control would raise an exception.
(Bug#26472)
The characterset property would not be identified during a connection (also affected Visual Studion Plugin). (Bug#26147,
Bug#27240)
The CreateFormat column of the DataTypes collection did not contain a format specification for creating a new column type.
(Bug#25947)
DATETIME fields from versions of MySQL bgefore 4.1 would be incorrectly parsed, resulting in a exception. (Bug#23342)
C.4.29. Changes in MySQL Connector/NET 5.0.6 (22 March 2007)
Bugs fixed:
Publisher listed in "Add/Remove Programs" is not consistent with other MySQL products. (Bug#27253)
DESCRIBE .... SQL statement returns byte arrays rather than data on MySQL versions older than 4.1.15. (Bug#27221)
cmd.Parameters.RemoveAt("Id") will cause an error if the last item is requested. (Bug#27187)
MySqlParameterCollection and parameters added with Insert method can not be retrieved later using
ParameterName. (Bug#27135)
Exception thrown when using large values in UInt64 parameters. (Bug#27093)
MySQL Visual Studio Plugin 1.1.2 does not work with MySQL Connector/NET 5.0.5. (Bug#26960)
C.4.30. Changes in MySQL Connector/NET 5.0.5 (07 March 2007)
Functionality added or changed:
Reverted behavior that required parameter names to start with the parameter marker. We apologize for this back and forth but we
mistakenly changed the behavior to not match what SqlClient supports. We now support using either syntax for adding paramet-
ers however we also respond exactly like SqlClient in that if you ask for the index of a parameter using a syntax different from
when you added the parameter, the result will be -1.
MySQL Change History
3074
Assembly now properly appears in the Visual Studio 2005 Add/Remove Reference dialog.
Fixed problem that prevented use of SchemaOnly or SingleRow command behaviors with stored procedures or prepared state-
ments.
Added MySqlParameterCollection.AddWithValue and marked the Add(name, value) method as obsolete.
Return parameters created with DeriveParameters now have the name RETURN_VALUE.
Fixed problem with parameter name hashing where the hashes were not getting updated when parameters were removed from the
collection.
Fixed problem with calling stored functions when a return parameter was not given.
Added Use Procedure Bodies connection string option to allow calling procedures without using procedure metadata.
Bugs fixed:
MySqlConnection.GetSchema fails with NullReferenceException for Foreign Keys. (Bug#26660)
MySQL Connector/NET would fail to install under Windows Vista. (Bug#26430)
Opening a connection would be slow due to host name lookup. (Bug#26152)
Incorrect values/formats would be applied when the OldSyntax connection string option was used. (Bug#25950)
Registry would be incorrectly populated with installation locations. (Bug#25928)
Times with negative values would be returned incorrectly. (Bug#25912)
Returned data types of a DataTypes collection do not contain the right correctl CLR Datatype. (Bug#25907)
GetSchema and DataTypes would throw an exception due to an incorrect table name. (Bug#25906)
MySqlConnection throws an exception when connecting to MySQL v4.1.7. (Bug#25726)
SELECT did not work correctly when using a WHERE clause containing a UTF-8 string. (Bug#25651)
When closing and then re-opening a connection to a database, the character set specification is lost. (Bug#25614)
Filling a table schema through a stored procedure triggers a runtime error. (Bug#25609)
BINARY and VARBINARY columns would be returned as a string, not binary, datatype. (Bug#25605)
A critical ConnectionPool error would result in repeated System.NullReferenceException. (Bug#25603)
The UpdateRowSource.FirstReturnedRecord method does not work. (Bug#25569)
When connecting to a MySQL Server earlier than version 4.1, the connection would hang when reading data. (Bug#25458)
Using ExecuteScalar() with more than one query, where one query fails, will hang the connection. (Bug#25443)
When a MySqlConversionException is raised on a remote object, the client application would receive a Serializa-
tionException instead. (Bug#24957)
When connecting to a server, the return code from the connection could be zero, even though the host name was incorrect.
(Bug#24802)
High CPU utilization would be experienced when there is no idle connection waiting when using pooled connections through
MySqlPool.GetConnection. (Bug#24373)
MySQL Connector/NET would not compile properly when used with Mono 1.2. (Bug#24263)
Applications would crash when calling with CommandType set to StoredProcedure.
MySQL Change History
3075
C.4.31. Changes in MySQL Connector/NET 5.0.4 (Not released)
This is a new Beta development release, fixing recently discovered bugs.
C.4.32. Changes in MySQL Connector/NET 5.0.3 (05 January 2007)
Functionality added or changed:
Usage Advisor has been implemented. The Usage Advisor checks your queries and will report if you are using the connection ineffi-
ciently.
PerfMon hooks have been added to monitor the stored procedure cache hits and misses.
The MySqlCommand object now supports asynchronous query methods. This is implemented useg the BeginExecuteNon-
Query and EndExecuteNonQuery methods.
Metadata from storaed procedures and stored function execution are cached.
The CommandBuilder.DeriveParameters function has been updated to the procedure cache.
The ViewColumns GetSchema collection has been updated.
Improved speed and performance by re-architecting certain sections of the code.
Support for the embedded server and client library have been removed from this release. Support will be added back to a later re-
lease.
The ShapZipLib library has been replaced with the deflate support provided within .NET 2.0.
SSL support has been updated.
Bugs fixed:
Additional text added to error message (Bug#25178)
An exception would be raised, or the process would hang, if SELECT privileges on a database were not granted and a stored proced-
ure was used. (Bug#25033)
When adding parameter objects to a command object, if the parameter direction is set to ReturnValue before the parameter is ad-
ded to the command object then when the command is executed it throws an error. (Bug#25013)
Using Driver.IsTooOld() would return the wrong value. (Bug#24661)
When using a DbNull.Value as the value for a parameter value, and then later setting a specific value type, the command would
fail with an exception because the wrong type was implied from the DbNull.Value. (Bug#24565)
Stored procedure executions are not thread safe. (Bug#23905)
Deleting a connection to a disconnected server when using the Visual Studio Plugin would cause an assertion failure. (Bug#23687)
Nested transactions (which are unsupported)do not raise an error or warning. (Bug#22400)
C.4.33. Changes in MySQL Connector/NET 5.0.2 (06 November 2006)
Functionality added or changed:
An Ignore Prepare option has been added to the connection string options. If enabled, prepared statements will be disabled ap-
plication-wide. The default for this option is true.
Implemented a stored procedure cache. By default, the connector caches the metadata for the last 25 procedures that are seen. You
can change the numbver of procedures that are cacheds by using the procedure cache connection string.
MySQL Change History
3076
Important change: Due to a number of issues with the use of server-side prepared statements, MySQL Connector/NET 5.0.2 has
disabled their use by default. The disabling of server-side prepared statements does not affect the operation of the connector in any
way.
To enable server-side prepared statements you must add the following configuration property to your connector string properties:
ignore prepare=false
The default value of this property is true.
Bugs fixed:
One system where IPv6 was enabled, MySQL Connector/NET would incorrectly resolve host names. (Bug#23758)
Column names with accented characters were not parsed properly causing malformed column names in result sets. (Bug#23657)
An exception would be thrown when calling GetSchemaTable and fields was null. (Bug#23538)
A System.FormatException exception would be raised when invoking a stored procedure with an ENUM input parameter.
(Bug#23268)
During installation, an antivirus error message would be raised (indicating a malicious script problem). (Bug#23245)
Creating a connection through the Server Explorer when using the Visual Studio Plugin would fail. The installer for the Visual Stu-
dio Plugin has been updated to ensure that MySQL Connector/NET 5.0.2 must be installed. (Bug#23071)
Using Windows Vista (RC2) as a nonprivileged user would raise a Registry key 'Global' access denied.
(Bug#22882)
Within Mono, using the PreparedStatement interface could result in an error due to a BitArray copying error. (Bug#18186)
MySQL Connector/NET did not work as a data source for the SqlDataSource object used by ASP.NET 2.0. (Bug#16126)
C.4.34. Changes in MySQL Connector/NET 5.0.1 (01 October 2006)
Bugs fixed:
MySQL Connector/NET on a Tukish operating system, may fail to execute certain SQL statements correctly. (Bug#22452)
Starting a transaction on a connection created by MySql.Data.MySqlClient.MySqlClientFactory, using Begin-
Transaction without specifying an isolation level, causes the SQL statement to fail with a syntax error. (Bug#22042)
The MySqlexception class is now derived from the DbException class. (Bug#21874)
The # would not be accepted within column/table names, even though it was valid. (Bug#21521)
You can now install the MySQL Connector/NET MSI package from the command line using the /passive, /quiet, /q options.
(Bug#19994)
Submitting an empty string to a command object through prepare raises an System.IndexOutOfRangeException, rather
than a MySQL Connector/NET exception. (Bug#18391)
Using ExecuteScalar with a datetime field, where the value of the field is "0000-00-00 00:00:00", a MySqlConversionEx-
ception exception would be raised. (Bug#11991)
An MySql.Data.Types.MySqlConversionException would be raised when trying to update a row that contained a date
field, where the date field contained a zero value (0000-00-00 00:00:00). (Bug#9619)
Executing multiple queries as part of a transaction returns There is already an openDataReader associated
with this Connection which must be closed first. (Bug#7248)
Incorrect field/data lengths could be returned for VARCHAR UTF8 columns. Bug (#14592)
MySQL Change History
3077
C.4.35. Changes in MySQL Connector/NET 5.0.0 (08 August 2006)
Functionality added or changed:
Replaced use of ICSharpCode with .NET 2.0 internal deflate support.
Refactored test suite to test all protocols in a single pass.
Added usage advisor warnings for requesting column values by the wrong type.
Reimplemented PacketReader/PacketWriter support into MySqlStream class.
Reworked connection string classes to be simpler and faster.
Added procedure metadata caching.
Added internal implemention of SHA1 so we don't have to distribute the OpenNetCF on mobile devices.
Implemented MySqlClientFactory class.
Added perfmon hooks for stored procedure cache hits and misses.
Implemented classes and interfaces for ADO.Net 2.0 support.
Added Async query methods.
Implemented Usage Advisor.
Completely refactored how column values are handled to avoid boxing in some cases.
Implemented MySqlConnectionBuilder class.
Bugs fixed:
CommandText: Question mark in comment line is being parsed as a parameter. (Bug#6214)
C.4.36. Changes in MySQL Connector/NET 1.0.11 (Not yet released)
Bugs fixed:
Attempting to utilize MySQL Connector .Net version 1.0.10 throws a fatal exception under Mono when pooling is enabled.
(Bug#33682)
Setting the size of a string parameter after the value could cause an exception. (Bug#32094)
Creation of parameter objects with noninput direction using a constructor would fail. This was cause by some old legacy code pre-
venting their use. (Bug#32093)
Memory usage could increase and decrease significantly when updating or inserting a large number of rows. (Bug#31090)
Commands executed from within the state change handeler would fail with a NULL exception. (Bug#30964)
Extracting data through XML functions within a query returns the data as System.Byte[]. This was due to MySQL Connector/
NET incorrectly identifying BLOB fields as binary, rather than text. (Bug#30233)
Using compression in the MySQL connection with MySQL Connector/NET would be slower than using native (uncompressed)
communication. (Bug#27865)
Changing the connection string of a connection to one that changes the parameter marker after the connection had been assigned to a
command but before the connection is opened could cause parameters to not be found. (Bug#13991)
MySQL Change History
3078
C.4.37. Changes in MySQL Connector/NET 1.0.10 (24 August 2007)
Bugs fixed:
An incorrect ConstraintException could be raised on an INSERT when adding rows to a table with a multiple-column
unique key index. (Bug#30204)
The availability of a MySQL server would not be reset when using pooled connections (pooling=true). This would lead to the
server being reported as unavailable, even if the server become available while the application was still running. (Bug#29409)
Publisher listed in "Add/Remove Programs" is not consistent with other MySQL products. (Bug#27253)
MySqlParameterCollection and parameters added with Insert method can not be retrieved later using
ParameterName. (Bug#27135)
BINARY and VARBINARY columns would be returned as a string, not binary, datatype. (Bug#25605)
A critical ConnectionPool error would result in repeated System.NullReferenceException. (Bug#25603)
When a MySqlConversionException is raised on a remote object, the client application would receive a Serializa-
tionException instead. (Bug#24957)
High CPU utilization would be experienced when there is no idle connection waiting when using pooled connections through
MySqlPool.GetConnection. (Bug#24373)
C.4.38. Changes in MySQL Connector/NET 1.0.9 (02 February 2007)
Functionality added or changed:
The ICSharpCode ZipLib is no longer used by the Connector, and is no longer distributed with it.
Important change: Binaries for .NET 1.0 are no longer supplied with this release. If you need support for .NET 1.0, you must build
from source.
Improved CommandBuilder.DeriveParameters to first try and use the procedure cache before querying for the stored pro-
cedure metadata. Return parameters created with DeriveParameters now have the name RETURN_VALUE.
An Ignore Prepare option has been added to the connection string options. If enabled, prepared statements will be disabled ap-
plication-wide. The default for this option is true.
Implemented a stored procedure cache. By default, the connector caches the metadata for the last 25 procedures that are seen. You
can change the numbver of procedures that are cacheds by using the procedure cache connection string.
Important change: Due to a number of issues with the use of server-side prepared statements, MySQL Connector/NET 5.0.2 has
disabled their use by default. The disabling of server-side prepared statements does not affect the operation of the connector in any
way.
To enable server-side prepared statements you must add the following configuration property to your connector string properties:
ignore prepare=false
The default value of this property is true.
Bugs fixed:
Times with negative values would be returned incorrectly. (Bug#25912)
MySqlConnection throws a NullReferenceException and ArgumentNullException when connecting to MySQL
v4.1.7. (Bug#25726)
SELECT did not work correctly when using a WHERE clause containing a UTF-8 string. (Bug#25651)
MySQL Change History
3079
When closing and then re-opening a connection to a database, the character set specification is lost. (Bug#25614)
Trying to fill a table schema through a stored procedure triggers a runtime error. (Bug#25609)
Using ExecuteScalar() with more than one query, where one query fails, will hang the connection. (Bug#25443)
Additional text added to error message. (Bug#25178)
When adding parameter objects to a command object, if the parameter direction is set to ReturnValue before the parameter is ad-
ded to the command object then when the command is executed it throws an error. (Bug#25013)
When connecting to a server, the return code from the connection could be zero, even though the host name was incorrect.
(Bug#24802)
Using Driver.IsTooOld() would return the wrong value. (Bug#24661)
When using a DbNull.Value as the value for a parameter value, and then later setting a specific value type, the command would
fail with an exception because the wrong type was implied from the DbNull.Value. (Bug#24565)
Stored procedure executions are not thread safe. (Bug#23905)
The CommandBuilder would mistakenly add insert parameters for a table column with auto incrementation enabled.
(Bug#23862)
One system where IPv6 was enabled, MySQL Connector/NET would incorrectly resolve host names. (Bug#23758)
Nested transactions do not raise an error or warning. (Bug#22400)
An System.OverflowException would be raised when accessing a varchar field over 255 bytes. Bug (#23749)
Within Mono, using the PreparedStatement interface could result in an error due to a BitArray copying error. (Bug 18186)
C.4.39. Changes in MySQL Connector/NET 1.0.8 (20 October 2006)
Functionality added or changed:
Stored procedures are now cached.
The method for retrieving stored procedured metadata has been changed so that users without SELECT privileges on the
mysql.proc table can use a stored procedure.
Bugs fixed:
MySQL Connector/NET on a Tukish operating system, may fail to execute certain SQL statements correctly. (Bug#22452)
The # would not be accepted within column/table names, even though it was valid. (Bug#21521)
Calling Close on a connection after calling a stored procedure would trigger a NullReferenceException. (Bug#20581)
You can now install the MySQL Connector/NET MSI package from the command line using the /passive, /quiet, /q options.
(Bug#19994)
The DiscoverParameters function would fail when a stored procedure used a NUMERIC parameter type. (Bug#19515)
When running a query that included a date comparison, a DateReader error would be raised. (Bug#19481)
IDataRecord.GetString would raise NullPointerException for null values in returned rows. Method now throws
SqlNullValueException. (Bug#19294)
Parameter substitution in queries where the order of parameters and table fields did not match would substitute incorrect values.
(Bug#19261)
MySQL Change History
3080
Submitting an empty string to a command object through prepare raises an System.IndexOutOfRangeException, rather
than a MySQL Connector/NET exception. (Bug#18391)
An exception would be raised when using an output parameter to a System.String value. (Bug#17814)
CHAR type added to MySqlDbType. (Bug#17749)
A SELECT query on a table with a date with a value of '0000-00-00' would hang the application. (Bug#17736)
The CommandBuilder ignored Unsigned flag at Parameter creation. (Bug#17375)
When working with multiple threads, character set initialization would generate errors. (Bug#17106)
When using an unsigned 64-bit integer in a stored procedure, the unsigned bit would be lost stored. (Bug#16934)
DataReader would show the value of the previous row (or last row with nonnull data) if the current row contained a datetime
field with a null value. (Bug#16884)
Unsigned data types were not properly supported. (Bug#16788)
The connection string parser did not allow single or double quotes in the password. (Bug#16659)
The MySqlDateTime class did not contain constructors. (Bug#15112)
Called MySqlCommandBuilder.DeriveParameters for a stored procedure that has no paramers would cause an application
crash. (Bug#15077)
Using ExecuteScalar with a datetime field, where the value of the field is "0000-00-00 00:00:00", a MySqlConversionEx-
ception exception would be raised. (Bug#11991)
An MySql.Data.Types.MySqlConversionException would be raised when trying to update a row that contained a date
field, where the date field contained a zero value (0000-00-00 00:00:00). (Bug#9619)
When using MySqlDataAdapter, connections to a MySQL server may remain open and active, even though the use of the con-
nection has been completed and the data received. (Bug#8131)
Executing multiple queries as part of a transaction returns There is already an openDataReader associated
with this Connection which must be closed first. (Bug#7248)
Incorrect field/data lengths could be returned for VARCHAR UTF8 columns. Bug (#14592)
C.4.40. Changes in MySQL Connector/NET 1.0.7 (21 November 2005)
Bugs fixed:
Unsigned tinyint (NET byte) would lead to and incorrectly determined parameter type from the parameter value. (Bug#18570)
A #42000Query was empty exception occurred when executing a query built with MySqlCommandBuilder, if the query
string ended with a semicolon. (Bug#14631)
The parameter collection object's Add() method added parameters to the list without first checking to see whether they already ex-
isted. Now it updates the value of the existing parameter object if it exists. (Bug#13927)
Added support for the cp932 character set. (Bug#13806)
Calling a stored procedure where a parameter contained special characters (such as '@') would produce an exception. Note that
ANSI_QUOTES had to be enabled to make this possible. (Bug#13753)
The Ping() method did not update the State property of the Connection object. (Bug#13658)
Implemented the MySqlCommandBuilder.DeriveParameters method that is used to discover the parameters for a stored
procedure. (Bug#13632)
A statement that contained multiple references to the same parameter could not be prepared. (Bug#13541)
MySQL Change History
3081
C.4.41. Changes in MySQL Connector/NET 1.0.6 (03 October 2005)
Bugs fixed:
MySQL Connector/NET 1.0.5 could not connect on Mono. (Bug#13345)
Serializing a parameter failed if the first value passed in was NULL. (Bug#13276)
Field names that contained the following characters caused errors: ()%<>/ (Bug#13036)
The nant build sequence had problems. (Bug#12978)
The MySQL Connector/NET 1.0.5 installer would not install alongside MySQL Connector/NET 1.0.4. (Bug#12835)
C.4.42. Changes in MySQL Connector/NET 1.0.5 (29 August 2005)
Bugs fixed:
MySQL Connector/NET could not connect to MySQL 4.1.14. (Bug#12771)
With multiple hosts in the connection string, MySQL Connector/NET would not connect to the last host in the list. (Bug#12628)
The ConnectionString property could not be set when a MySqlConnection object was added with the designer.
(Bug#12551, Bug#8724)
The cp1250 character set was not supported. (Bug#11621)
A call to a stored procedure caused an exception if the stored procedure had no parameters. (Bug#11542)
Certain malformed queries would trigger a Connection must be valid and open error message. (Bug#11490)
Trying to use a stored procedure when Connection.Database was not populated generated an exception. (Bug#11450)
MySQL Connector/NET interpreted the new decimal data type as a byte array. (Bug#11294)
Added support to call a stored function from MySQL Connector/NET. (Bug#10644)
Connection could fail when .NET thread pool had no available worker threads. (Bug#10637)
Calling MySqlConnection.clone when a connection string had not yet been set on the original connection would generate an
error. (Bug#10281)
Decimal parameters caused syntax errors. (Bug#10152, Bug#11550, Bug#10486)
Parameters were not recognized when they were separated by linefeeds. (Bug#9722)
The MySqlCommandBuilder class could not handle queries that referenced tables in a database other than the default database.
(Bug#8382)
Trying to read a TIMESTAMP column generated an exception. (Bug#7951)
MySQL Connector/NET could not work properly with certain regional settings. (WL#8228)
C.4.43. Changes in MySQL Connector/NET 1.0.4 (20 January 2005)
Bugs fixed:
MySqlReader.GetInt32 throws exception if column is unsigned. (Bug#7755)
Quote character \222 not quoted in EscapeString. (Bug#7724)
MySQL Change History
3082
GetBytes is working no more. (Bug#7704)
MySqlDataReader.GetString(index) returns non-Null value when field is Null. (Bug#7612)
Clone method bug in MySqlCommand. (Bug#7478)
Problem with Multiple resultsets. (Bug#7436)
MySqlAdapter.Fill method throws error message Non-negative number required. (Bug#7345)
MySqlCommand.Connection returns an IDbConnection. (Bug#7258)
Calling prepare causing exception. (Bug#7243)
Fixed problem with shared memory connections.
Added or filled out several more topics in the API reference documentation.
Fixed another small problem with prepared statements.
Fixed problem that causes named pipes to not work with some blob functionality.
C.4.44. Changes in MySQL Connector/NET 1.0.3 (12 October 2004 gamma)
Bugs fixed:
Invalid query string when using inout parameters (Bug#7133)
Inserting DateTime causes System.InvalidCastException to be thrown. (Bug#7132)
MySqlDateTime in Datatables sorting by Text, not Date. (Bug#7032)
Exception stack trace lost when re-throwing exceptions. (Bug#6983)
Errors in parsing stored procedure parameters. (Bug#6902)
InvalidCast when using DATE_ADD-function. (Bug#6879)
Int64 Support in MySqlCommand Parameters. (Bug#6863)
Test suite fails with MySQL 4.0 because of case sensitivity of table names. (Bug#6831)
MySqlDataReader.GetChar(int i) throws IndexOutOfRange exception. (Bug#6770)
Integer "out" parameter from stored procedure returned as string. (Bug#6668)
An Open Connection has been Closed by the Host System. (Bug#6634)
Fixed Invalid character set index: 200. (Bug#6547)
Connections now do not have to give a database on the connection string.
Installer now includes options to install into GAC and create START MENU items.
Fixed major problem with detecting null values when using prepared statements.
Fixed problem where multiple resultsets having different numbers of columns would cause a problem.
Added ServerThread property to MySqlConnection to expose server thread id.
Added Ping method to MySqlConnection.
Changed the name of the test suite to MySql.Data.Tests.dll.
MySQL Change History
3083
Now SHOW COLLATION is used upon connection to retrieve the full list of charset ids.
Made MySQL the default named pipe name.
C.4.45. Changes in MySQL Connector/NET 1.0.2 (15 November 2004 gamma)
Bugs fixed:
Fixed Objects not being disposed (Bug#6649)
Fixed Charset-map for UCS-2 (Bug#6541)
Fixed Zero date "0000-00-00" is returned wrong when filling Dataset (Bug#6429)
Fixed double type handling in MySqlParameter(string parameterName, object value) (Bug#6428)
Fixed Installation directory ignored using custom installation (Bug#6329)
Fixed #HY000 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ (Bug#6322)
Added the TableEditor CS and VB sample
Added charset connection string option
Fixed problem with MySqlBinary where string values could not be used to update extended text columns
Provider is now using character set specified by server as default
Updated the installer to include the new samples
Fixed problem where setting command text leaves the command in a prepared state
Fixed Long inserts take very long time (Bu #5453)
Fixed problem where calling stored procedures might cause an "Illegal mix of collations" problem.
C.4.46. Changes in MySQL Connector/NET 1.0.1 (27 October 2004 beta)
Bugs fixed:
Fixed IndexOutOfBounds when reading BLOB with DataReader with GetString(index) (Bug#6230)
Fixed GetBoolean returns wrong values (Bug#6227)
Fixed Method TokenizeSql() uses only a limited set of valid characters for parameters (Bug#6217)
Fixed NET Connector source missing resx files (Bug#6216)
Fixed System.OverflowException when using YEAR datatype (Bug#6036)
Fixed MySqlDateTime sets IsZero property on all subseq.records after first zero found (Bug#6006)
Fixed serializing of floating point parameters (double, numeric, single, decimal) (Bug#5900)
Fixed missing Reference in DbType setter (Bug#5897)
Fixed Parsing the ';' char (Bug#5876)
Fixed DBNull Values causing problems with retrieving/updating queries. (Bug#5798)
IsNullable error (Bug#5796)
MySQL Change History
3084
Fixed problem where MySqlParameterCollection.Add() would throw unclear exception when given a null value (Bug#5621)
Fixed construtor initialize problems in MySqlCommand() (Bug#5613)
Fixed Yet Another "object reference not set to an instance of an object" (Bug#5496)
Fixed Can't display Chinese correctly (Bug#5288)
Fixed MySqlDataReader and 'show tables from ...' behavior (Bug#5256)
Fixed problem in PacketReader where it could try to allocate the wrong buffer size in EnsureCapacity
Fixed problem where using old syntax while using the interfaces caused problems
Fixed Bug#5458 Calling GetChars on a longtext column throws an exception
Added test case for resetting the command text on a prepared command
Fixed Bug#5388 DataReader reports all rows as NULL if one row is NULL
Fixed problem where connection lifetime on the connect string was not being respected
Fixed Bug#5602 Possible bug in MySqlParameter(string, object) constructor
Field buffers being reused to decrease memory allocations and increase speed
Fixed Bug#5392 MySqlCommand sees "?" as parameters in string literals
Added Aggregate function test (wasn't really a bug)
Using PacketWriter instead of Packet for writing to streams
Implemented SequentialAccess
Fixed problem with ConnectionInternal where a key might be added more than once
Fixed Russian character support as well
Fixed Bug#5474 cannot run a stored procedure populating mysqlcommand.parameters
Fixed problem where connector was not issuing a CMD_QUIT before closing the socket
Fixed problem where Min Pool Size was not being respected
Refactored compression code into CompressedStream to clean up NativeDriver
CP1252 is now used for Latin1 only when the server is 4.1.2 and later
Fixed Bug#5469 Setting DbType throws NullReferenceException
Virtualized driver subsystem so future releases could easily support client or embedded server support
C.4.47. Changes in MySQL Connector/NET 1.0.0 (01 September 2004)
Bugs fixed:
Thai encoding not correctly supported. (Bug#3889)
Bumped version number to 1.0.0 for beta 1 release.
Removed all of the XML comment warnings.
Added COPYING.rtf file for use in installer.
MySQL Change History
3085
Updated many of the test cases.
Fixed problem with using compression.
Removed some last references to ByteFX.
C.4.48. Changes in MySQL Connector/NET Version 0.9.0 (30 August 2004)
Added test fixture for prepared statements.
All type classes now implement a SerializeBinary method for sending their data to a PacketWriter.
Added PacketWriter class that will enable future low-memory large object handling.
Fixed many small bugs in running prepared statements and stored procedures.
Changed command so that an exception will not be thrown in executing a stored procedure with parameters in old syntax mode.
SingleRow behavior now working right even with limit.
GetBytes now only works on binary columns.
Logger now truncates long sql commands so blob columns do not blow out our log.
Host and database now have a default value of "" unless otherwise set.
Connection Timeout seems to be ignored. (Bug#5214)
Added test case for bug# 5051: GetSchema not working correctly.
Fixed problem where GetSchema would return false for IsUnique when the column is key.
MySqlDataReader GetXXX methods now using the field level MySqlValue object and not performing conversions.
DataReader returning NULL for time column. (Bug#5097)
Added test case for LOAD DATA LOCAL INFILE.
Added replacetext custom nant task.
Added CommandBuilderTest fixture.
Added Last One Wins feature to CommandBuilder.
Fixed persist security info case problem.
Fixed GetBool so that 1, true, "true", and "yes" all count as true.
Make parameter mark configurable.
Added the "old syntax" connection string parameter to allow use of @ parameter marker.
MySqlCommandBuilder. (Bug#4658)
ByteFX.MySqlClient caches passwords if Persist Security Info is false. (Bug#4864)
Updated license banner in all source files to include FLOSS exception.
Added new .Types namespace and implementations for most current MySql types.
Added MySqlField41 as a subclass of MySqlField.
Changed many classes to now use the new .Types types.
MySQL Change History
3086
Changed type enum int to Int32, short to Int16, and bigint to Int64.
Added dummy types UInt16, UInt32, and UInt64 to allow an unsigned parameter to be made.
Connections are now reset when they are pulled from the connection pool.
Refactored auth code in driver so it can be used for both auth and reset.
Added UserReset test in PoolingTests.cs.
Connections are now reset using COM_CHANGE_USER when pulled from the pool.
Implemented SingleResultSet behavior.
Implemented support of unicode.
Added char set mappings for utf-8 and ucs-2.
Time fields overflow using bytefx .net mysql driver (Bug#4520)
Modified time test in data type test fixture to check for time spans where hours > 24.
Wrong string with backslash escaping in ByteFx.Data.MySqlClient.MySqlParameter. (Bug#4505)
Added code to Parameter test case TestQuoting to test for backslashes.
MySqlCommandBuilder fails with multi-word column names. (Bug#4486)
Fixed bug in TokenizeSql where underscore would terminate character capture in parameter name.
Added test case for spaces in column names.
MySqlDataReader.GetBytes do not work correctly. (Bug#4324)
Added GetBytes() test case to DataReader test fixture.
Now reading all server variables in InternalConnection.Configure into Hashtable.
Now using string[] for index map in CharSetMap.
Added CRInSQL test case for carriage returns in SQL.
Setting maxPacketSize to default value in Driver.ctor.
Setting MySqlDbType on a parameter doesn't set generic type. (Bug#4442)
Removed obsolete data types Long and LongLong.
Overflow exception thrown when using "use pipe" on connection string. (Bug#4071)
Changed "use pipe" keyword to "pipe name" or just "pipe".
Allow reading multiple resultsets from a single query.
Added flags attribute to ServerStatusFlags enum.
Changed name of ServerStatus enum to ServerStatusFlags.
Inserted data row doesn't update properly.
Error processing show create table. (Bug#4074)
Change Packet.ReadLenInteger to ReadPackedLong and added packet.ReadPackedInteger that always reads in-
tegers packed with 2,3,4.
Added syntax.cs test fixture to test various SQL syntax bugs.
MySQL Change History
3087
Improper handling of time values. Now time value of 00:00:00 is not treated as null. (Bug#4149)
Moved all test suite files into TestSuite folder.
Fixed bug where null column would move the result packet pointer backward.
Added new nant build script.
Clear tablename so it will be regen'ed properly during the next GenerateSchema. (Bug#3917)
GetValues was always returning zero and was also always trying to copy all fields rather than respecting the size of the array
passed in. (Bug#3915)
Implemented shared memory access protocol.
Implemented prepared statements for MySQL 4.1.
Implemented stored procedures for MySQL 5.0.
Renamed MySqlInternalConnection to InternalConnection.
SQL is now parsed as chars, fixes problems with other languages.
Added logging and allow batch connection string options.
RowUpdating event not set when setting the DataAdapter property. (Bug#3888)
Fixed bug in char set mapping.
Implemented 4.1 authentication.
Improved open/auth code in driver.
Improved how connection bits are set during connection.
Database name is now passed to server during initial handshake.
Changed namespace for client to MySql.Data.MySqlClient.
Changed assembly name of client to MySql.Data.dll.
Changed license text in all source files to GPL.
Added the MySqlClient.build Nant file.
Removed the mono batch files.
Moved some of the unused files into notused folder so nant build file can use wildcards.
Implemented shared memory access.
Major revamp in code structure.
Prepared statements now working for MySql 4.1.1 and later.
Finished implementing auth for 4.0, 4.1.0, and 4.1.1.
Changed namespace from MySQL.Data.MySQLClient back to MySql.Data.MySqlClient.
Fixed bug in CharSetMapping where it was trying to use text names as ints.
Changed namespace to MySQL.Data.MySQLClient.
Integrated auth changes from UC2004.
Fixed bug where calling any of the GetXXX methods on a datareader before or after reading data would not throw the appropriate
exception (thanks Luca Morelli).
MySQL Change History
3088
Added TimeSpan code in parameter.cs to properly serialize a timespan object to mysql time format (thanks Gianluca Colombo).
Added TimeStamp to parameter serialization code. Prevented DataAdatper updates from working right (thanks Michael King).
Fixed a misspelling in MySqlHelper.cs (thanks Patrick Kristiansen).
C.4.49. Changes in MySQL Connector/NET Version 0.76
Driver now using charset number given in handshake to create encoding.
Changed command editor to point to MySqlClient.Design.
Fixed bug in Version.isAtLeast.
Changed DBConnectionString to support changes done to MySqlConnectionString.
Removed SqlCommandEditor and DataAdapterPreviewDialog.
Using new long return values in many places.
Integrated new CompressedStream class.
Changed ConnectionString and added attributes to allow it to be used in MySqlClient.Design.
Changed packet.cs to support newer lengths in ReadLenInteger.
Changed other classes to use new properties and fields of MySqlConnectionString.
ConnectionInternal is now using PING to see whether the server is alive.
Moved toolbox bitmaps into resource folder.
Changed field.cs to allow values to come directly from row buffer.
Changed to use the new driver.Send syntax.
Using a new packet queueing system.
Started work handling the "broken" compression packet handling.
Fixed bug in StreamCreator where failure to connect to a host would continue to loop infinitly (thanks Kevin Casella).
Improved connectstring handling.
Moved designers into Pro product.
Removed some old commented out code from command.cs.
Fixed a problem with compression.
Fixed connection object where an exception throw prior to the connection opening would not leave the connection in the connecting
state (thanks Chris Cline).
Added GUID support.
Fixed sequence out of order bug (thanks Mark Reay).
C.4.50. Changes in MySQL Connector/NET Version 0.75
Enum values now supported as parameter values (thanks Philipp Sumi).
Year datatype now supported.
MySQL Change History
3089
Fixed compression.
Fixed bug where a parameter with a TimeSpan as the value would not serialize properly.
Fixed bug where default constructor would not set default connection string values.
Added some XML comments to some members.
Work to fix/improve compression handling.
Improved ConnectionString handling so that it better matches the standard set by SqlClient.
A MySqlException is now thrown if a user name is not included in the connection string.
Localhost is now used as the default if not specified on the connection string.
An exception is now thrown if an attempt is made to set the connection string while the connection is open.
Small changes to ConnectionString docs.
Removed MultiHostStream and MySqlStream. Replaced it with Common/StreamCreator.
Added support for Use Pipe connection string value.
Added Platform class for easier access to platform utility functions.
Fixed small pooling bug where new connection was not getting created after IsAlive fails.
Added Platform.cs and StreamCreator.cs.
Fixed Field.cs to properly handle 4.1 style timestamps.
Changed Common.Version to Common.DBVersion to avoid name conflict.
Fixed field.cs so that text columns return the right field type.
Added MySqlError class to provide some reference for error codes (thanks Geert Veenstra).
C.4.51. Changes in MySQL Connector/NET Version 0.74
Added Unix socket support (thanks Mohammad DAMT).
Only calling Thread.Sleep when no data is available.
Improved escaping of quote characters in parameter data.
Removed misleading comments from parameter.cs.
Fixed pooling bug.
Fixed ConnectionString editor dialog (thanks marco p (pomarc)).
UserId now supported in connection strings (thanks Jeff Neeley).
Attempting to create a parameter that is not input throws an exception (thanks Ryan Gregg).
Added much documentation.
Checked in new MultiHostStream capability. Big thanks to Dan Guisinger for this. he originally submitted the code and idea of
supporting multiple machines on the connect string.
Added a lot of documentation.
Fixed speed issue with 0.73.
MySQL Change History
3090
Changed to Thread.Sleep(0) in MySqlDataStream to help optimize the case where it doesn't need to wait (thanks Todd German).
Prepopulating the idlepools to MinPoolSize.
Fixed MySqlPool deadlock condition as well as stupid bug where CreateNewPooledConnection was not ever adding new connec-
tions to the pool. Also fixed MySqlStream.ReadBytes and ReadByte to not use TicksPerSecond which does not appear
to always be right. (thanks Matthew J. Peddlesden)
Fix for precision and scale (thanks Matthew J. Peddlesden).
Added Thread.Sleep(1) to stream reading methods to be more cpu friendly (thanks Sean McGinnis).
Fixed problem where ExecuteReader would sometime return null (thanks Lloyd Dupont).
Fixed major bug with null field handling (thanks Naucki).
Enclosed queries for max_allowed_packet and characterset inside try catch (and set defaults).
Fixed problem where socket was not getting closed properly (thanks Steve!).
Fixed problem where ExecuteNonQuery was not always returning the right value.
Fixed InternalConnection to not use @@session.max_allowed_packet but use @@max_allowed_packet.
(Thanks Miguel)
Added many new XML doc lines.
Fixed sql parsing to not send empty queries (thanks Rory).
Fixed problem where the reader was not unpeeking the packet on close.
Fixed problem where user variables were not being handled (thanks Sami Vaaraniemi).
Fixed loop checking in the MySqlPool (thanks Steve M. Brown)
Fixed ParameterCollection.Add method to match SqlClient (thanks Joshua Mouch).
Fixed ConnectionString parsing to handle no and yes for boolean and not lowercase values (thanks Naucki).
Added InternalConnection class, changes to pooling.
Implemented Persist Security Info.
Added security.cs and version.cs to project
Fixed DateTime handling in Parameter.cs (thanks Burkhard Perkens-Golomb).
Fixed parameter serialization where some types would throw a cast exception.
Fixed DataReader to convert all returned values to prevent casting errors (thanks Keith Murray).
Added code to Command.ExecuteReader to return null if the initial SQL statement throws an exception (thanks Burkhard
Perkens-Golomb).
Fixed ExecuteScalar bug introduced with restructure.
Restructure to allow for LOCAL DATA INFILE and better sequencing of packets.
Fixed several bugs related to restructure.
Early work done to support more secure passwords in Mysql 4.1. Old passwords in 4.1 not supported yet.
Parameters appearing after system parameters are now handled correctly (Adam M. (adammil)).
Strings can now be assigned directly to blob fields (Adam M.).
Fixed float parameters (thanks Pent).
MySQL Change History
3091
Improved Parameter constructor and ParameterCollection.Add methods to better match SqlClient (thanks Joshua Mouch).
Corrected Connection.CreateCommand to return a MySqlCommand type.
Fixed connection string designer dialog box problem (thanks Abraham Guyt).
Fixed problem with sending commands not always reading the response packet (thanks Joshua Mouch).
Fixed parameter serialization where some blobs types were not being handled (thanks Sean McGinnis).
Removed spurious MessageBox.show from DataReader code (thanks Joshua Mouch).
Fixed a nasty bug in the split sql code (thanks everyone!).
C.4.52. Changes in MySQL Connector/NET Version 0.71
Fixed bug in MySqlStream where too much data could attempt to be read (thanks Peter Belbin)
Implemented HasRows (thanks Nash Pherson).
Fixed bug where tables with more than 252 columns cause an exception (thanks Joshua Kessler).
Fixed bug where SQL statements ending in ; would cause a problem (thanks Shane Krueger).
Fixed bug in driver where error messages were getting truncated by 1 character (thanks Shane Krueger).
Made MySqlException serializable (thanks Mathias Hasselmann).
C.4.53. Changes in MySQL Connector/NET Version 0.70
Updated some of the character code pages to be more accurate.
Fixed problem where readers could be opened on connections that had readers open.
Moved test to separate assembly MySqlClientTests.
Fixed stupid problem in driver with sequence out of order (Thanks Peter Belbin).
Added some pipe tests.
Increased default max pool size to 50.
Compiles with Mono 0-24.
Fixed connection and data reader dispose problems.
Added String datatype handling to parameter serialization.
Fixed sequence problem in driver that occurred after thrown exception (thanks Burkhard Perkens-Golomb).
Added support for CommandBehavior.SingleRow to DataReader.
Fixed command sql processing so quotes are better handled (thanks Theo Spears).
Fixed parsing of double, single, and decimal values to account for non-English separators. You still have to use the right syntax if
you using hard coded sql, but if you use parameters the code will convert floating point types to use '.' appropriately internal both in-
to the server and out.
Added MySqlStream class to simplify timeouts and driver coding.
Fixed DataReader so that it is closed properly when the associated connection is closed. [thanks smishra]
MySQL Change History
3092
Made client more SqlClient compliant so that DataReaders have to be closed before the connection can be used to run another com-
mand.
Improved DBNull.Value handling in the fields.
Added several unit tests.
Fixed MySqlException base class.
Improved driver coding
Fixed bug where NextResult was returning false on the last resultset.
Added more tests for MySQL.
Improved casting problems by equating unsigned 32bit values to Int64 and unsigned 16bit values to Int32, and so forth.
Added new constructor for MySqlParameter for (name, type, size, srccol)
Fixed bug in MySqlDataReader where it didn't check for null fieldlist before returning field count.
Started adding MySqlClient unit tests (added MySqlClient/Tests folder and some test cases).
Fixed some things in Connection String handling.
Moved INIT_DB to MySqlPool. I may move it again, this is in preparation of the conference.
Fixed bug inside CommandBuilder that prevented inserts from happening properly.
Reworked some of the internals so that all three execute methods of Command worked properly.
Fixed many small bugs found during benchmarking.
The first cut of CoonectionPooling is working. "min pool size" and "max pool size" are respected.
Work to enable multiple resultsets to be returned.
Character sets are handled much more intelligently now. The driver queries MySQL at startup for the default character set. That
character set is then used for conversions if that code page can be loaded. If not, then the default code page for the current OS is
used.
Added code to save the inferred type in the name,value constructor of Parameter.
Also, inferred type if value of null parameter is changed using Value property.
Converted all files to use proper Camel case. MySQL is now MySql in all files. PgSQL is now PgSql.
Added attribute to PgSql code to prevent designer from trying to show.
Added MySQLDbType property to Parameter object and added proper conversion code to convert from DbType to MySQLDb-
Type).
Removed unused ObjectToString method from MySQLParameter.cs.
Fixed Add(..) method in ParameterCollection so that it doesn't use Add(name, value) instead.
Fixed IndexOf and Contains in ParameterCollection to be aware that parameter names are now stored without @.
Fixed Command.ConvertSQLToBytes so it only allows characters that can be in MySQL variable names.
Fixed DataReader and Field so that blob fields read their data from Field.cs and GetBytes works right.
Added simple query builder editor to CommandText property of MySQLCommand.
Fixed CommandBuilder and Parameter serialization to account for Parameters not storing @ in their names.
Removed MySQLFieldType enum from Field.cs. Now using MySQLDbType enum.
MySQL Change History
3093
Added Designer attribute to several classes to prevent designer view when using VS.Net.
Fixed Initial catalog typo in ConnectionString designer.
Removed 3 parameter constructor for MySQLParameter that conflicted with (name, type, value).
Changed MySQLParameter so paramName is now stored without leading @ (this fixed null inserts when using designer).
Changed TypeConverter for MySQLParameter to use the constructor with all properties.
C.4.54. Changes in MySQL Connector/NET Version 0.68
Fixed sequence issue in driver.
Added DbParametersEditor to make parameter editing more like SqlClient.
Fixed Command class so that parameters can be edited using the designer
Update connection string designer to support Use Compression flag.
Fixed string encoding so that European characters will work correctly.
Creating base classes to aid in building new data providers.
Added support for UID key in connection string.
Field, parameter, command now using DBNull.Value instead of null.
CommandBuilder using DBNull.Value.
CommandBuilder now builds insert command correctly when an auto_insert field is not present.
Field now uses typeof keyword to return System.Types (performance).
C.4.55. Changes in MySQL Connector/NET Version 0.65
MySQLCommandBuilder now implemented.
Transaction support now implemented (not all table types support this).
GetSchemaTable fixed to not use xsd (for Mono).
Driver is now Mono-compatible.
TIME data type now supported.
More work to improve Timestamp data type handling.
Changed signatures of all classes to match corresponding SqlClient classes.
C.4.56. Changes in MySQL Connector/NET Version 0.60
Protocol compression using SharpZipLib (www.icsharpcode.net).
Named pipes on Windows now working properly.
Work done to improve Timestamp data type handling.
Implemented IEnumerable on DataReader so DataGrid would work.
MySQL Change History
3094
C.4.57. Changes in MySQL Connector/NET Version 0.50
Speed increased dramatically by removing bugging network sync code.
Driver no longer buffers rows of data (more ADO.Net compliant).
Conversion bugs related to TIMESTAMP and DATETIME fields fixed.
C.5. MySQL Visual Studio Plugin Change History
Note
As of Connector/NET 5.1.2 (14 June 2007), the Visual Studion Plugin is part of the main Connector/NET package. For the
change history for the Visual Studio Plugin, see Section C.4, MySQL Connector/NET Change History.
C.5.1. Changes in MySQL Visual Studio Plugin 1.0.3 (Not yet released)
Bugs fixed:
Running queries based on a stored procedure would cause the data set designer to terminate. (Bugs #26364)
DataSet wizard would show all tables instead of only the tables available within the selected database. (Bugs #26348)
C.5.2. Changes in MySQL Visual Studio Plugin 1.0.2 (Not yet released)
Bugs fixed:
The Add Connection dialog of the Server Explorer would freeze when accessing databases with capitalized characters in their name.
(Bug#24875)
Creating a connection through the Server Explorer when using the Visual Studio Plugin would fail. The installer for the Visual Stu-
dio Plugin has been updated to ensure that Connector/NET 5.0.2 must be installed. (Bug#23071)
C.5.3. Changes in MySQL Visual Studio Plugin 1.0.1 (4 October 2006)
This is a bug fix release to resolve an incompatibility issue with Connector/NET 5.0.1.
It is critical that this release only be used with Connector/NET 5.0.1. After installing Connector/NET 5.0.1, you will need to make a
small change in your machine.config file. This file should be located at
%win%\Microsoft.Net\Framework\v2.0.50727\CONFIG\machine.config (%win% should be the location of your
Windows folder). Near the bottom of the file you will see a line like this:
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
It needs to be changed to be like this:
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=5.0.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
C.5.4. Changes in MySQL Visual Studio Plugin 1.0.0 (4 October 2006)
Bugs fixed:
MySQL Change History
3095
Ability to work with MySQL objects (tables, views, stored procedures, etc) from within Server Explorer.
DDEX (Data Designer Extensibility) compatibility.
C.6. MySQL Connector/J Change History
C.6.1. Changes in MySQL Connector/J 5.1.x
C.6.1.1. Changes in MySQL Connector/J 5.1.8 (Not yet released)
Bugs fixed:
The reported milliseconds since the last server packets were received/sent was incorrect by a factor of 1000. For example, the fol-
lowing method call:
SQLError.createLinkFailureMessageBasedOnHeuristics(
(ConnectionImpl) this.conn,
System.currentTimeMillis() - 1000,
System.currentTimeMillis() - 2000,
e,
false);
returned the following string:
The last packet successfully received from the server
was 2 milliseconds ago. The last packet sent successfully to the
server was 1 milliseconds ago.
(Bug#45419)
Calling Connection.serverPrepareStatement() variants that do not take result set type or concurrency arguments re-
turned statements that produced result sets with incorrect defaults, namely TYPE_SCROLL_SENSITIVE. (Bug#45171)
The result set returned by getIndexInfo() did not have the format defined in the JDBC API specifications. The fourth column,
DATA_TYPE, of the result set should be of type BOOLEAN. Connector/J however returns CHAR. (Bug#44869)
The result set returned by getTypeInfo() did not have the format defined in the JDBC API specifications. The second column,
DATA_TYPE, of the result set should be of type INTEGER. Connector/J however returns SMALLINT. (Bug#44868)
The DEFERRABILITY column in database metadata result sets was expected to be of type SHORT. However, Connector/J returned
it as INTEGER.
This affected the following methods: getImportedKeys(), getExportedKeys(), getCrossReference().
(Bug#44867)
The result set returned by getColumns() did not have the format defined in the JDBC API specifications. The fifth column,
DATA_TYPE, of the result set should be of type INTEGER. Connector/J however returns SMALLINT. (Bug#44865)
The result set returned by getVersionColumns() did not have the format defined in the JDBC API specifications. The third
column, DATA_TYPE, of the result set should be of type INTEGER. Connector/J however returns SMALLINT. (Bug#44863)
The result set returned by getBestRowIdentifier() did not have the format defined in the JDBC API specifications. The
third column, DATA_TYPE, of the result set should be of type INTEGER. Connector/J however returns SMALLINT. (Bug#44862)
Connector/J contains logic to generate a message text specifically for streaming result sets when there are CommunicationsEx-
ception exceptions generated. However, this code was never reached.
In the CommunicationsException code:
private boolean streamingResultSetInPlay = false;
public CommunicationsException(ConnectionImpl conn, long lastPacketSentTimeMs,
long lastPacketReceivedTimeMs, Exception underlyingException) {
this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
MySQL Change History
3096
lastPacketSentTimeMs, lastPacketReceivedTimeMs, underlyingException,
this.streamingResultSetInPlay);
streamingResultSetInPlay was always false, which in the following code in SQLEr-
ror.createLinkFailureMessageBasedOnHeuristics() never being executed:
if (streamingResultSetInPlay) {
exceptionMessageBuf.append(
Messages.getString("CommunicationsException.ClientWasStreaming")); //$NON-NLS-1$
} else {
...
(Bug#44588)
The SQLError.createLinkFailureMessageBasedOnHeuristics() method created a message text for communica-
tion link failures. When certain conditions were met, this message included both last packet sent and last packet received in-
formation, but when those conditions were not met, only last packet sent information was provided.
Information about when the last packet was successfully received should be provided in all cases. (Bug#44587)
Statement.getGeneratedKeys() retained result set instances until the statement was closed. This caused memory leaks for
long-lived statements, or statements used in tight loops. (Bug#44056)
Using useInformationSchema with DatabaseMetaData.getExportedKeys() generated the following exception:
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column
'REFERENCED_TABLE_NAME' in where clause is ambiguous
...
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1772)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1923)
at
com.mysql.jdbc.DatabaseMetaDataUsingInfoSchema.executeMetadataQuery(
DatabaseMetaDataUsingInfoSchema.java:50)
at
com.mysql.jdbc.DatabaseMetaDataUsingInfoSchema.getExportedKeys(
DatabaseMetaDataUsingInfoSchema.java:603)
(Bug#43714)
LoadBalancingConnectionProxy.doPing() did not have blacklist awareness.
LoadBalancingConnectionProxy implemented doPing() to ping all underlying connections, but it threw any exceptions
it encountered during this process.
With the global blacklist enabled, it catches these exceptions, adds the host to the global blacklist, and only throws an exception if
all hosts are down. (Bug#43421)
When the MySQL Server was upgraded from 4.0 to 5.0, the Connector/J application then failed to connect to the server. This was
because authentication failed when the application ran from EBCDIC platforms such as z/OS. (Bug#43071)
When connecting with traceProtocol=true, no trace data was generated for the server greeting or login request. (Bug#43070)
Connector/J generated an unhandled StringIndexOutOfBoundsException:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1938)
at com.mysql.jdbc.EscapeProcessor.processTimeToken(EscapeProcessor.java:353)
at com.mysql.jdbc.EscapeProcessor.escapeSQL(EscapeProcessor.java:257)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1546)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1524)
(Bug#42253)
A ConcurrentModificationException was generated in LoadBalancingConnectionProxy:
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
at
com.mysql.jdbc.LoadBalancingConnectionProxy.getGlobalBlacklist(LoadBalancingConnectionProxy.java:520)
MySQL Change History
3097
at com.mysql.jdbc.RandomBalanceStrategy.pickConnection(RandomBalanceStrategy.java:55)
at
com.mysql.jdbc.LoadBalancingConnectionProxy.pickNewConnection(LoadBalancingConnectionProxy.java:414)
at
com.mysql.jdbc.LoadBalancingConnectionProxy.invoke(LoadBalancingConnectionProxy.java:390)
(Bug#42055)
SQL injection was possible when using a string containing U+00A5 in a client-side prepared statement, and the character set being
used was SJIS/Windows-31J. (Bug#41730)
If there was an apostrophe in a comment in a statement that was being sent through Connector/J, the apostrophe was still recognized
as a quote and put the state machine in EscapeTokenizer into the inQuotes state. This led to further parse errors.
For example, consider the following statement:
String sql = "-- Customer's zip code will be fixed\n" +
"update address set zip_code = 99999\n" +
"where not regexp '^[0-9]{5}([[.-.]])?([0-9]{4})?$'";
When passed through Connector/J, the EscapeTokenizer did not recognize that the first apostrophe was in a comment and thus
set inQuotes to true. When that happened, the quote count was incorrect and thus the regular expression did not appear to be in
quotes. With the parser not detecting that the regular expression was in quotes, the curly braces were recognized as escape se-
quences and were removed from the regular expression, breaking it. The server thus received SQL such as:
-- Customer's zip code will be fixed
update address set zip_code = '99999'
where not regexp '^[0-9]([[.-.]])?([0-9])?$'
(Bug#41566)
MySQL Connector/J 5.1.7 was slower than previous versions when the rewriteBatchedStatements option was set to true.
Note
The performance regression in indexOfIgnoreCaseRespectMarker()has been fixed. It has also been made pos-
sible for the driver to rewrite INSERT statements with ON DUPLICATE KEY UPDATE clauses in them, as long as the
UPDATE clause contains no reference to LAST_INSERT_ID(), as that would cause the driver to return bogus values for
getGeneratedKeys() invocations. This has resulted in improved performance over version 5.1.7.
(Bug#41532)
When accessing a result set column by name using ResultSetImpl.findColumn() an exception was generated:
java.lang.NullPointerException
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1103)
at com.mysql.jdbc.ResultSetImpl.getShort(ResultSetImpl.java:5415)
at org.apache.commons.dbcp.DelegatingResultSet.getShort(DelegatingResultSet.java:219)
at com.zimbra.cs.db.DbVolume.constructVolume(DbVolume.java:297)
at com.zimbra.cs.db.DbVolume.get(DbVolume.java:197)
at com.zimbra.cs.db.DbVolume.create(DbVolume.java:95)
at com.zimbra.cs.store.Volume.create(Volume.java:227)
at com.zimbra.cs.store.Volume.create(Volume.java:189)
at com.zimbra.cs.service.admin.CreateVolume.handle(CreateVolume.java:48)
at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:428)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:285)
(Bug#41484)
When DatabaseMetaData.getProcedureColumns() was called, the value for LENGTH was always returned as 65535, re-
gardless of the column type (fixed or variable) or the actual length of the column.
However, if you obtained the PRECISION value, this was correct for both fixed and variable length columns. (Bug#41269)
PreparedStatement.addBatch() did not check for all parameters being set, which led to inconsistent behavior in ex-
ecuteBatch(), especially when rewriting batched statements into multi-value INSERTs. (Bug#41161)
Error message strings contained variable values that were not expanded. For example:
MySQL Change History
3098
Mon Nov 17 11:43:18 JST 2008 WARN: Invalid value {1} for server variable named {0},
falling back to sane default of {2}
(Bug#40772)
When using rewriteBatchedStatements=true with:
INSERT INTO table_name_values (...) VALUES (...)
Query rewriting failed because values at the end of the table name was mistaken for the reserved keyword. The error generated
was as follows:
testBug40439(testsuite.simple.TestBug40439)java.sql.BatchUpdateException: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'values (2,'toto',2),(id,data, ordr) values
(3,'toto',3),(id,data, ordr) values (' at line 1
at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1495)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1097)
at testsuite.simple.TestBug40439.testBug40439(TestBug40439.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at testsuite.simple.TestBug40439.main(TestBug40439.java:57)
(Bug#40439)
Using Connector/J 5.1.6 the method ResultSet.getObject returned a BYTE[] for following:
SELECT TRIM(rowid) FROM tbl
Where rowid had a type of INT(11) PRIMARY KEY AUTO_INCREMENT.
The expected return type was one of CHAR, VARCHAR, CLOB, however, a BYTE[] was returned.
Further, adding functionsNeverReturnBlobs=true to the connection string did not have any effect on the return type.
(Bug#38387)
C.6.1.2. Changes in MySQL Connector/J 5.1.7 (21 October 2008)
Functionality added or changed:
When statements include ON DUPLICATE UPDATE, and rewriteBatchedStatements is set to true, batched statements are
not rewritten into the form INSERT INTO table VALUES (), (), (), instead the statements are executed sequentially.
Bugs fixed:
Statement.getGeneratedKeys() returned two keys when using ON DUPLICATE KEY UPDATE and the row was up-
dated, not inserted. (Bug#42309)
When using the replication driver with autoReconnect=true, Connector/J checks in PreparedStatement.execute
(also called by CallableStatement.execute) to determine if the first character of the statement is an S, in an attempt to
block all statements that are not read-only-safe, for example non-SELECT statements. However, this also blocked CALLs to stored
procedures, even if the stored procedures were defined as SQL READ DATA or NO SQL. (Bug#40031)
With large result sets ResultSet.findColumn became a performance bottleneck. (Bug#39962)
Connector/J ignored the value of the MySQL Server variable auto_increment_increment. (Bug#39956)
Connector/J failed to parse TIMESTAMP strings for nanos correctly. (Bug#39911)
When the LoadBalancingConnectionProxy handles a SQLException with SQL state starting with 08, it calls inval-
idateCurrentConnection, which in turn removes that Connection from liveConnections and the connection-
MySQL Change History
3099
sToHostsMap, but it did not add the host to the new global blacklist, if the global blacklist was enabled.
There was also the possibility of a NullPointerException when trying to update stats, where connectionsToHost-
sMap.get(this.currentConn) was called:
int hostIndex = ((Integer) this.hostsToListIndexMap.get(this.connectionsToHostsMap.get(this.currentConn))).intValue();
This could happen if a client tried to issue a rollback after catching a SQLException caused by a connection failure. (Bug#39784)
When configuring the Java Replication Driver the last slave specified was never used. (Bug#39611)
When an INSERT ON DUPLICATE KEY UPDATE was performed, and the key already existed, the affected-rows value
was returned as 1 instead of 0. (Bug#39352)
When using the random load balancing strategy and starting with two servers that were both unavailable, an IndexOutOfBound-
sException was generated when removing a server from the whiteList. (Bug#38782)
Connector/J threw the following exception when using a read-only connection:
java.sql.SQLException: Connection is read-only. Queries leading to data
modification are not allowed.
(Bug#38747)
Connector/J was unable to connect when using a non-latin1 password. (Bug#37570)
Incorrect result is returned from isAfterLast() in streaming ResultSet when using setFetchS-
ize(Integer.MIN_VALUE). (Bug#35170)
When getGeneratedKeys() was called on a statement that had not been created with RETURN_GENERATED_KEYS, no ex-
ception was thrown, and batched executions then returned erroneous values. (Bug#34185)
The loadBalance bestResponseTime blacklists did not have a global state. (Bug#33861)
C.6.1.3. Changes in MySQL Connector/J 5.1.6 (07 March 2008)
Functionality added or changed:
Multiple result sets were not supported when using streaming mode to return data. Both normal statements and the resul sets from
stored procedures now return multiple results sets, with the exception of result sets using registered OUTPUT paramaters.
(Bug#33678)
XAConnections and datasources have been updated to the JDBC-4.0 standard.
The profiler event handling has been made extensible via the profilerEventHandler connection property.
Add the verifyServerCertificate propery. If set to "false" the driver will not verify the server's certificate when useSSL
is set to "true"
When using this feature, the keystore parameters should be specified by the clientCertificateKeyStore* properties, rather
than system properties, as the JSSE doesn't it straightforward to have a nonverifying trust store and the "default" key store.
Bugs fixed:
DatabaseMetaData.getColumns() returns incorrect COLUMN_SIZE value for SET column. (Bug#36830)
When trying to read Time values like 00:00:00 with ResultSet.getTime(int) an exception is thrown. (Bug#36051)
JDBC connection URL parameters is ignored when using MysqlConnectionPoolDataSource. (Bug#35810)
When useServerPrepStmts=true and slow query logging is enabled, the connector throws a NullPointerException
MySQL Change History
3100
when it encounters a slow query. (Bug#35666)
When using the keyword loadbalance in the connection string and trying to perform load balancing between two databases, the
driver appears to hang. (Bug#35660)
JDBC data type getter method was changed to accept only column name, whereas previously it accepted column label. (Bug#35610)
Prepared statements from pooled connections caused a NullPointerException when closed() under JDBC-4.0.
(Bug#35489)
In calling a stored function returning a bigint, an exception is encountered beginning:
java.sql.SQLException: java.lang.NumberFormatException: For input string:
followed by the text of the stored function starting after the argument list. (Bug#35199)
The JDBC driver uses a different method for evaluating column names in resultsetmetadata.getColumnName() and
when looking for a column in resultset.getObject(columnName). This causes Hibernate to fail in queries where the two
methods yield different results, for example in queries that use alias names:
SELECT column AS aliasName from table
(Bug#35150)
MysqlConnectionPoolDataSource does not support ReplicationConnection. Notice that we implemented
com.mysql.jdbc.Connection for ReplicationConnection, however, only accessors from ConnectionProperties are
implemented (not the mutators), and they return values from the currently active connection. All other methods from
com.mysql.jdbc.Connection are implemented, and operate on the currently active connection, with the exception of re-
setServerState() and changeUser(). (Bug#34937)
ResultSet.getTimestamp() returns incorrect values for month/day of TIMESTAMPs when using server-side prepared state-
ments (not enabled by default). (Bug#34913)
RowDataStatic does't always set the metadata in ResultSetRow, which can lead to failures when unpacking DATE, TIME,
DATETIME and TIMESTAMP types when using absolute, relative, and previous result set navigation methods. (Bug#34762)
When calling isValid() on an active connection, if the timeout is nonzero then the Connection is invalidated even if the
Connection is valid. (Bug#34703)
It was not possible to truncate a BLOB using Blog.truncate() when using 0 as an argument. (Bug#34677)
When using a cursor fetch for a statement, the internal prepared statement could cause a memory leak until the connection was
closed. The internal prepared statement is now deleted when the corresponding result set is closed. (Bug#34518)
When retrieving the column type name of a geometry field, the driver would return UNKNOWN instead of GEOMETRY. (Bug#34194)
Statements with batched values do not return correct values for getGeneratedKeys() when rewriteBatchedState-
ments is set to true, and the statement has an ON DUPLICATE KEY UPDATE clause. (Bug#34093)
The internal class ResultSetInternalMethods referenced the nonpublic class
com.mysql.jdbc.CachedResultSetMetaData. (Bug#33823)
A NullPointerException could be raised when using client-side prepared statements and enabled the prepared statement
cache using the cachePrepStmts. (Bug#33734)
Using server side cursors and cursor fetch, the table metadata information would return the data type name instead of the column
name. (Bug#33594)
ResultSet.getTimestamp() would throw a NullPointerException instead of a SQLException when called on an
empty ResultSet. (Bug#33162)
Load balancing connection using best response time would incorrectly "stick" to hosts that were down when the connection was first
created.
We solve this problem with a black list that is used during the picking of new hosts. If the black list ends up including all configured
hosts, the driver will retry for a configurable number of times (the retriesAllDown configuration property, with a default of 120
MySQL Change History
3101
times), sleeping 250ms between attempts to pick a new connection.
We've also went ahead and made the balancing strategy extensible. To create a new strategy, implement the interface
com.mysql.jdbc.BalanceStrategy (which also includes our standard "extension" interface), and tell the driver to use it by
passing in the class name via the loadBalanceStrategy configuration property. (Bug#32877)
During a Daylight Savings Time (DST) switchover, there was no way to store two timestamp/datetime values , as the hours end up
being the same when sent as the literal that MySQL requires.
Note that to get this scenario to work with MySQL (since it doesn't support per-value timezones), you need to configure your server
(or session) to be in UTC, and tell the driver not to use the legacy date/time code by setting useLegacyDatetimeCode to
"false". This will cause the driver to always convert to/from the server and client timezone consistently.
This bug fix also fixes Bug#15604, by adding entirely new date/time handling code that can be switched on by useLegacyDate-
timeCode being set to "false" as a JDBC configuration property. For Connector/J 5.1.x, the default is "true", in trunk and beyond
it will be "false" (that is, the old date/time handling code will be deprecated) (Bug#32577, Bug#15604)
When unpacking rows directly, we don't hand off error message packets to the internal method which decodes them correctly, so no
exception is raised, and the driver than hangs trying to read rows that aren't there. This tends to happen when calling stored proced-
ures, as normal SELECTs won't have an error in this spot in the protocol unless an I/O error occurs. (Bug#32246)
When using a connection from ConnectionPoolDataSource, some Connection.prepareStatement() methods
would return null instead of the prepared statement. (Bug#32101)
Using CallableStatement.setNull() on a stored function would throw an ArrayIndexOutOfBounds exception when
setting the last parameter to null. (Bug#31823)
MysqlValidConnectionChecker doesn't properly handle connections created using ReplicationConnection.
(Bug#31790)
Retrieving the server version information for an active connection could return invalid information if the default character encoding
on the host was not ASCII compatible. (Bug#31192)
Further fixes have been made to this bug in the event that a node is nonresponsive. Connector/J will now try a different random node
instead of waiting for the node to recover before continuing. (Bug#31053)
ResultSet returned by Statement.getGeneratedKeys() is not closed automatically when statement that created it is
closed. (Bug#30508)
DatabaseMetadata.getColumns() doesn't return the correct column names if the connection character isn't UTF-8. A bug
in MySQL server compounded the issue, but was fixed within the MySQL 5.0 release cycle. The fix includes changes to all the sec-
tions of the code that access the server metadata. (Bug#20491)
Fixed ResultSetMetadata.getColumnName() for result sets returned from Statement.getGeneratedKeys() - it
was returning null instead of "GENERATED_KEY" as in 5.0.x.
C.6.1.4. Changes in MySQL Connector/J 5.1.5 (09 October 2007)
The following features are new, compared to the 5.0 series of Connector/J
Support for JDBC-4.0 NCHAR, NVARCHAR and NCLOB types.
JDBC-4.0 support for setting per-connection client information (which can be viewed in the comments section of a query via SHOW
PROCESSLIST on a MySQL server, or can be extended to support custom persistence of the information via a public interface).
Support for JDBC-4.0 XML processing via JAXP interfaces to DOM, SAX and StAX.
JDBC-4.0 standardized unwrapping to interfaces that include vendor extensions.
Functionality added or changed:
Added autoSlowLog configuration property, overrides slowQueryThreshold* properties, driver determines slow queries by
MySQL Change History
3102
those that are slower than 5 * stddev of the mean query time (outside the 96% percentile).
Bugs fixed:
When a connection is in read-only mode, queries that are wrapped in parentheses were incorrectly identified DML statements.
(Bug#28256)
C.6.1.5. Changes in MySQL Connector/J 5.1.4 (Not Released)
Only released internally.
C.6.1.6. Changes in MySQL Connector/J 5.1.3 (10 September 2007)
The following features are new, compared to the 5.0 series of Connector/J
Support for JDBC-4.0 NCHAR, NVARCHAR and NCLOB types.
JDBC-4.0 support for setting per-connection client information (which can be viewed in the comments section of a query via SHOW
PROCESSLIST on a MySQL server, or can be extended to support custom persistence of the information via a public interface).
Support for JDBC-4.0 XML processing via JAXP interfaces to DOM, SAX and StAX.
JDBC-4.0 standardized unwrapping to interfaces that include vendor extensions.
Functionality added or changed:
Connector/J now connects using an initial character set of utf-8 solely for the purpose of authentication to allow user names or
database names in any character set to be used in the JDBC connection URL. (Bug#29853)
Added two configuration parameters:
blobsAreStrings Should the driver always treat BLOBs as Strings. Added specifically to work around dubious metadata
returned by the server for GROUP BY clauses. Defaults to false.
functionsNeverReturnBlobs Should the driver always treat data from functions returning BLOBs as Strings. Added
specifically to work around dubious metadata returned by the server for GROUP BY clauses. Defaults to false.
Setting rewriteBatchedStatements to true now causes CallableStatements with batched arguments to be re-written in the
form "CALL (...); CALL (...); ..." to send the batch in as few client-server round trips as possible.
The driver now picks appropriate internal row representation (whole row in one buffer, or individual byte[]s for each column value)
depending on heuristics, including whether or not the row has BLOB or TEXT types and the overall row-size. The threshold for row
size that will cause the driver to use a buffer rather than individual byte[]s is configured by the configuration property lar-
geRowSizeThreshold, which has a default value of 2KB.
The data (and how it is stored) for ResultSet rows are now behind an interface which allows us (in some cases) to allocate less
memory per row, in that for "streaming" result sets, we re-use the packet used to read rows, since only one row at a time is ever act-
ive.
Added experimental support for statement "interceptors" via the com.mysql.jdbc.StatementInterceptor interface, ex-
amples are in com/mysql/jdbc/interceptors. Implement this interface to be placed "in between" query execution, so that
it can be influenced (currently experimental).
The driver will automatically adjust the server session variable net_write_timeout when it determines its been asked for a
"streaming" result, and resets it to the previous value when the result set has been consumed. (The configuration property is named
netTimeoutForStreamingResults, with a unit of seconds, the value '0' means the driver will not try and adjust this value).
JDBC-4.0 ease-of-development features including auto-registration with the DriverManager via the service provider mechan-
ism, standardized Connection validity checks and categorized SQLExceptions based on recoverability/retry-ability and class of
the underlying error.
MySQL Change History
3103
Statement.setQueryTimeout()s now affect the entire batch for batched statements, rather than the individual statements
that make up the batch.
Errors encountered during Statement/PreparedStatement/CallableStatement.executeBatch() when re-
writeBatchStatements has been set to true now return BatchUpdateExceptions according to the setting of con-
tinueBatchOnError.
If continueBatchOnError is set to true, the update counts for the "chunk" that were sent as one unit will all be set to EX-
ECUTE_FAILED, but the driver will attempt to process the remainder of the batch. You can determine which "chunk" failed by
looking at the update counts returned in the BatchUpdateException.
If continueBatchOnError is set to "false", the update counts returned will contain all updates up-to and including the failed
"chunk", with all counts for the failed "chunk" set to EXECUTE_FAILED.
Since MySQL doesn't return multiple error codes for multiple-statements, or for multi-value INSERT/REPLACE, it is the applica-
tion's responsibility to handle determining which item(s) in the "chunk" actually failed.
New methods on com.mysql.jdbc.Statement: setLocalInfileInputStream() and getLocalInfileInputStream():
setLocalInfileInputStream() sets an InputStream instance that will be used to send data to the MySQL server for
a LOAD DATA LOCAL INFILE statement rather than a FileInputStream or URLInputStream that represents the
path given as an argument to the statement.
This stream will be read to completion upon execution of a LOAD DATA LOCAL INFILE statement, and will automatically
be closed by the driver, so it needs to be reset before each call to execute*() that would cause the MySQL server to request
data to fulfill the request for LOAD DATA LOCAL INFILE.
If this value is set to NULL, the driver will revert to using a FileInputStream or URLInputStream as required.
getLocalInfileInputStream() returns the InputStream instance that will be used to send data in response to a
LOAD DATA LOCAL INFILE statement.
This method returns NULL if no such stream has been set via setLocalInfileInputStream().
Setting useBlobToStoreUTF8OutsideBMP to true tells the driver to treat [MEDIUM/LONG]BLOB columns as
[LONG]VARCHAR columns holding text encoded in UTF-8 that has characters outside the BMP (4-byte encodings), which MySQL
server can't handle natively.
Set utf8OutsideBmpExcludedColumnNamePattern to a regex so that column names matching the given regex will still
be treated as BLOBs The regex must follow the patterns used for the java.util.regexpackage. The default is to exclude no
columns, and include all columns.
Set utf8OutsideBmpIncludedColumnNamePattern to specify exclusion rules to
utf8OutsideBmpExcludedColumnNamePattern". The regex must follow the patterns used for the java.util.regex package.
Bugs fixed:
setObject(int, Object, int, int) delegate in PreparedStatmentWrapper delegates to wrong method. (Bug#30892)
NPE with null column values when padCharsWithSpace is set to true. (Bug#30851)
Collation on VARBINARY column types would be misidentified. A fix has been added, but this fix only works for MySQL server
versions 5.0.25 and newer, since earlier versions didn't consistently return correct metadata for functions, and thus results from sub-
queries and functions were indistinguishable from each other, leading to type-related bugs. (Bug#30664)
An ArithmeticException or NullPointerException would be raised when the batch had zero members and re-
writeBatchedStatements=true when addBatch() was never called, or executeBatch() was called immediately
after clearBatch(). (Bug#30550)
Closing a load-balanced connection would cause a ClassCastException. (Bug#29852)
Connection checker for JBoss didn't use same method parameters via reflection, causing connections to always seem "bad".
(Bug#29106)
MySQL Change History
3104
DatabaseMetaData.getTypeInfo() for the types DECIMAL and NUMERIC will return a precision of 254 for server ver-
sions older than 5.0.3, 64 for versions 5.0.3-5.0.5 and 65 for versions newer than 5.0.5. (Bug#28972)
CallableStatement.executeBatch() doesn't work when connection property noAccessToProcedureBodies has
been set to true.
The fix involves changing the behavior of noAccessToProcedureBodies,in that the driver will now report all paramters as
"IN" paramters but allow callers to call registerOutParameter() on them without throwing an exception. (Bug#28689)
DatabaseMetaData.getColumns() doesn't contain SCOPE_* or IS_AUTOINCREMENT columns. (Bug#27915)
Schema objects with identifiers other than the connection character aren't retrieved correctly in ResultSetMetadata.
(Bug#27867)
Connection.getServerCharacterEncoding() doesn't work for servers with version >= 4.1. (Bug#27182)
The automated SVN revisions in DBMD.getDriverVersion(). The SVN revision of the directory is now inserted into the ver-
sion information during the build. (Bug#21116)
Specifying a "validation query" in your connection pool that starts with "/* ping */" _exactly_ will cause the driver to instead send a
ping to the server and return a fake result set (much lighter weight), and when using a ReplicationConnection or a LoadBalanced-
Connection, will send the ping across all active connections.
C.6.1.7. Changes in MySQL Connector/J 5.1.2 (29 June 2007)
This is a new Beta development release, fixing recently discovered bugs.
Functionality added or changed:
Setting the configuration property rewriteBatchedStatements to true will now cause the driver to rewrite batched pre-
pared statements with more than 3 parameter sets in a batch into multi-statements (separated by ";") if they are not plain (that is,
without SELECT or ON DUPLICATE KEY UPDATE clauses) INSERT or REPLACE statements.
C.6.1.8. Changes in MySQL Connector/J 5.1.1 (22 June 2007)
This is a new Alpha development release, adding new features and fixing recently discovered bugs.
Functionality added or changed:
Incompatible Change: Pulled vendor-extension methods of Connection implementation out into an interface to support
java.sql.Wrapper functionality from ConnectionPoolDataSource. The vendor extensions are javadoc'd in the
com.mysql.jdbc.Connection interface.
For those looking further into the driver implementation, it is not an API that is used for plugability of implementations inside our
driver (which is why there are still references to ConnectionImpl throughout the code).
We've also added server and client prepareStatement() methods that cover all of the variants in the JDBC API.
Connection.serverPrepare(String) has been re-named to Connection.serverPrepareStatement() for con-
sistency with Connection.clientPrepareStatement().
Row navigation now causes any streams/readers open on the result set to be closed, as in some cases we're reading directly from a
shared network packet and it will be overwritten by the "next" row.
Made it possible to retrieve prepared statement parameter bindings (to be used in StatementInterceptors, primarily).
Externalized the descriptions of connection properties.
The data (and how it is stored) for ResultSet rows are now behind an interface which allows us (in some cases) to allocate less
memory per row, in that for "streaming" result sets, we re-use the packet used to read rows, since only one row at a time is ever act-
ive.
MySQL Change History
3105
Similar to Connection, we pulled out vendor extensions to Statement into an interface named com.mysql.Statement,
and moved the Statement class into com.mysql.StatementImpl. The two methods (javadoc'd in
com.mysql.Statement are enableStreamingResults(), which already existed, and disableStreamingRes-
ults() which sets the statement instance back to the fetch size and result set type it had before enableStreamingRes-
ults() was called.
Driver now picks appropriate internal row representation (whole row in one buffer, or individual byte[]s for each column value) de-
pending on heuristics, including whether or not the row has BLOB or TEXT types and the overall row-size. The threshold for row
size that will cause the driver to use a buffer rather than individual byte[]s is configured by the configuration property lar-
geRowSizeThreshold, which has a default value of 2KB.
Added experimental support for statement "interceptors" via the com.mysql.jdbc.StatementInterceptor interface, ex-
amples are in com/mysql/jdbc/interceptors.
Implement this interface to be placed "in between" query execution, so that you can influence it. (currently experimental).
StatementInterceptors are "chainable" when configured by the user, the results returned by the "current" interceptor will be
passed on to the next on in the chain, from left-to-right order, as specified by the user in the JDBC configuration property state-
mentInterceptors.
See the sources (fully javadoc'd) for com.mysql.jdbc.StatementInterceptor for more details until we iron out the API
and get it documented in the manual.
Setting rewriteBatchedStatements to true now causes CallableStatements with batched arguments to be re-
written in the form CALL (...); CALL (...); ... to send the batch in as few client-server round trips as possible.
C.6.1.9. Changes in MySQL Connector/J 5.1.0 (11 April 2007)
This is the first public alpha release of the current Connector/J 5.1 development branch, providing an insight to upcoming features. Al-
though some of these are still under development, this release includes the following new features and changes (in comparison to the
current Connector/J 5.0 production release):
Important change: Due to a number of issues with the use of server-side prepared statements, Connector/J 5.0.5 has disabled their use
by default. The disabling of server-side prepared statements does not affect the operation of the connector in any way.
To enable server-side prepared statements you must add the following configuration property to your connector string:
useServerPrepStmts=true
The default value of this property is false (that is, Connector/J does not use server-side prepared statements).
Note
The disabling of server-side prepared statements does not affect the operation of the connector. However, if you use the
useTimezone=true connection option and use client-side prepared statements (instead of server-side prepared state-
ments) you should also set useSSPSCompatibleTimezoneShift=true.
Functionality added or changed:
Refactored CommunicationsException into a JDBC-3.0 version, and a JDBC-4.0 version (which extends SQLRecover-
ableException, now that it exists).
Note
This change means that if you were catching com.mysql.jdbc.CommunicationsException in your applications
instead of looking at the SQLState class of 08, and are moving to Java 6 (or newer), you need to change your imports to
that exception to be com.mysql.jdbc.exceptions.jdbc4.CommunicationsException, as the old class
will not be instantiated for communications link-related errors under Java 6.
Added support for JDBC-4.0 categorized SQLExceptions.
Added support for JDBC-4.0's NCLOB, and NCHAR/NVARCHAR types.
MySQL Change History
3106
com.mysql.jdbc.java6.javac full path to your Java-6 javac executable
Added support for JDBC-4.0's SQLXML interfaces.
Re-worked Ant buildfile to build JDBC-4.0 classes separately, as well as support building under Eclipse (since Eclipse can't mix/
match JDKs).
To build, you must set JAVA_HOME to J2SDK-1.4.2 or Java-5, and set the following properties on your Ant command line:
com.mysql.jdbc.java6.javac full path to your Java-6 javac executable
com.mysql.jdbc.java6.rtjar full path to your Java-6 rt.jar file
New feature driver will automatically adjust session variable net_write_timeout when it determines it has been asked for a
"streaming" result, and resets it to the previous value when the result set has been consumed. (configuration property is named
netTimeoutForStreamingResults value and has a unit of seconds, the value 0 means the driver will not try and adjust this
value).
Added support for JDBC-4.0's client information. The backend storage of information provided via Connec-
tion.setClientInfo() and retrieved by Connection.getClientInfo() is pluggable by any class that implements the
com.mysql.jdbc.JDBC4ClientInfoProvider interface and has a no-args constructor.
The implementation used by the driver is configured using the clientInfoProvider configuration property (with a default of
value of com.mysql.jdbc.JDBC4CommentClientInfoProvider, an implementation which lists the client information as
a comment prepended to every query sent to the server).
This functionality is only available when using Java-6 or newer.
com.mysql.jdbc.java6.rtjar full path to your Java-6 rt.jar file
Added support for JDBC-4.0's Wrapper interface.
C.6.2. Changes in MySQL Connector/J 5.0.x
C.6.2.1. Changes in MySQL Connector/J 5.0.8 (09 October 2007)
Functionality added or changed:
blobsAreStrings Should the driver always treat BLOBs as Strings. Added specifically to work around dubious metadata re-
turned by the server for GROUP BY clauses. Defaults to false.
Added two configuration parameters:
blobsAreStrings Should the driver always treat BLOBs as Strings. Added specifically to work around dubious metadata
returned by the server for GROUP BY clauses. Defaults to false.
functionsNeverReturnBlobs Should the driver always treat data from functions returning BLOBs as Strings. Added
specifically to work around dubious metadata returned by the server for GROUP BY clauses. Defaults to false.
functionsNeverReturnBlobs Should the driver always treat data from functions returning BLOBs as Strings. Added spe-
cifically to work around dubious metadata returned by the server for GROUP BY clauses. Defaults to false.
XAConnections now start in auto-commit mode (as per JDBC-4.0 specification clarification).
Driver will now fall back to sane defaults for max_allowed_packet and net_buffer_length if the server reports them in-
correctly (and will log this situation at WARN level, since it is actually an error condition).
Bugs fixed:
Connections established using URLs of the form jdbc:mysql:loadbalance:// weren't doing failover if they tried to connect
to a MySQL server that was down. The driver now attempts connections to the next "best" (depending on the load balance strategy
MySQL Change History
3107
in use) server, and continues to attempt connecting to the next "best" server every 250 milliseconds until one is found that is up and
running or 5 minutes has passed.
If the driver gives up, it will throw the last-received SQLException. (Bug#31053)
setObject(int, Object, int, int) delegate in PreparedStatmentWrapper delegates to wrong method. (Bug#30892)
NPE with null column values when padCharsWithSpace is set to true. (Bug#30851)
Collation on VARBINARY column types would be misidentified. A fix has been added, but this fix only works for MySQL server
versions 5.0.25 and newer, since earlier versions didn't consistently return correct metadata for functions, and thus results from sub-
queries and functions were indistinguishable from each other, leading to type-related bugs. (Bug#30664)
An ArithmeticException or NullPointerException would be raised when the batch had zero members and re-
writeBatchedStatements=true when addBatch() was never called, or executeBatch() was called immediately
after clearBatch(). (Bug#30550)
Closing a load-balanced connection would cause a ClassCastException. (Bug#29852)
Connection checker for JBoss didn't use same method parameters via reflection, causing connections to always seem "bad".
(Bug#29106)
DatabaseMetaData.getTypeInfo() for the types DECIMAL and NUMERIC will return a precision of 254 for server ver-
sions older than 5.0.3, 64 for versions 5.0.3-5.0.5 and 65 for versions newer than 5.0.5. (Bug#28972)
CallableStatement.executeBatch() doesn't work when connection property noAccessToProcedureBodies has
been set to true.
The fix involves changing the behavior of noAccessToProcedureBodies,in that the driver will now report all paramters as
"IN" paramters but allow callers to call registerOutParameter() on them without throwing an exception. (Bug#28689)
When a connection is in read-only mode, queries that are wrapped in parentheses were incorrectly identified DML statements.
(Bug#28256)
UNSIGNED types not reported via DBMD.getTypeInfo(), and capitalization of type names is not consistent between DB-
MD.getColumns(), RSMD.getColumnTypeName() and DBMD.getTypeInfo().
This fix also ensures that the precision of UNSIGNED MEDIUMINT and UNSIGNED BIGINT is reported correctly via DB-
MD.getColumns(). (Bug#27916)
DatabaseMetaData.getColumns() doesn't contain SCOPE_* or IS_AUTOINCREMENT columns. (Bug#27915)
Schema objects with identifiers other than the connection character aren't retrieved correctly in ResultSetMetadata.
(Bug#27867)
Cached metadata with PreparedStatement.execute() throws NullPointerException. (Bug#27412)
Connection.getServerCharacterEncoding() doesn't work for servers with version >= 4.1. (Bug#27182)
The automated SVN revisions in DBMD.getDriverVersion(). The SVN revision of the directory is now inserted into the ver-
sion information during the build. (Bug#21116)
Specifying a "validation query" in your connection pool that starts with "/* ping */" _exactly_ will cause the driver to instead send a
ping to the server and return a fake result set (much lighter weight), and when using a ReplicationConnection or a LoadBalanced-
Connection, will send the ping across all active connections.
C.6.2.2. Changes in MySQL Connector/J 5.0.7 (20 July 2007)
Functionality added or changed:
The driver will now automatically set useServerPrepStmts to true when useCursorFetch has been set to true, since
the feature requires server-side prepared statements in order to function.
tcpKeepAlive - Should the driver set SO_KEEPALIVE (default true)?
MySQL Change History
3108
Give more information in EOFExceptions thrown out of MysqlIO (how many bytes the driver expected to read, how many it actu-
ally read, say that communications with the server were unexpectedly lost).
Driver detects when it is running in a ColdFusion MX server (tested with version 7), and uses the configuration bundle coldFu-
sion, which sets useDynamicCharsetInfo to false (see previous entry), and sets useLocalSessionState and
autoReconnect to true.
tcpNoDelay - Should the driver set SO_TCP_NODELAY (disabling the Nagle Algorithm, default true)?
Added configuration property slowQueryThresholdNanos - if useNanosForElapsedTime is set to true, and this prop-
erty is set to a nonzero value the driver will use this threshold (in nanosecond units) to determine if a query was slow, instead of us-
ing millisecond units.
tcpRcvBuf - Should the driver set SO_RCV_BUF to the given value? The default value of '0', means use the platform default
value for this property.
Setting useDynamicCharsetInfo to false now causes driver to use static lookups for collations as well (makes ResultSet-
Metadata.isCaseSensitive() much more efficient, which leads to performance increase for ColdFusion, which calls this method for
every column on every table it sees, it appears).
Added configuration properties to allow tuning of TCP/IP socket parameters:
tcpNoDelay - Should the driver set SO_TCP_NODELAY (disabling the Nagle Algorithm, default true)?
tcpKeepAlive - Should the driver set SO_KEEPALIVE (default true)?
tcpRcvBuf - Should the driver set SO_RCV_BUF to the given value? The default value of '0', means use the platform default
value for this property.
tcpSndBuf - Should the driver set SO_SND_BUF to the given value? The default value of '0', means use the platform default
value for this property.
tcpTrafficClass - Should the driver set traffic class or type-of-service fields? See the documentation for
java.net.Socket.setTrafficClass() for more information.
Setting the configuration parameter useCursorFetch to true for MySQL-5.0+ enables the use of cursors that allow Connector/
J to save memory by fetching result set rows in chunks (where the chunk size is set by calling setFetchSize() on a Statement or Res-
ultSet) by using fully-materialized cursors on the server.
tcpSndBuf - Should the driver set SO_SND_BUF to the given value? The default value of '0', means use the platform default
value for this property.
tcpTrafficClass - Should the driver set traffic class or type-of-service fields? See the documentation for
java.net.Socket.setTrafficClass() for more information.
Added new debugging functionality - Setting configuration property includeInnodbStatusInDeadlockExceptions to
true will cause the driver to append the output of SHOW ENGINE INNODB STATUS to deadlock-related exceptions, which will
enumerate the current locks held inside InnoDB.
Added configuration property useNanosForElapsedTime - for profiling/debugging functionality that measures elapsed time,
should the driver try to use nanoseconds resolution if available (requires JDK >= 1.5)?
Note
If useNanosForElapsedTime is set to true, and this property is set to "0" (or left default), then elapsed times will
still be measured in nanoseconds (if possible), but the slow query threshold will be converted from milliseconds to nano-
seconds, and thus have an upper bound of approximately 2000 milliseconds (as that threshold is represented as an integer,
not a long).
Bugs fixed:
Don't send any file data in response to LOAD DATA LOCAL INFILE if the feature is disabled at the client side. This is to prevent a
malicious server or man-in-the-middle from asking the client for data that the client is not expecting. Thanks to Jan Kneschke for
discovering the exploit and Andrey "Poohie" Hristov, Konstantin Osipov and Sergei Golubchik for discussions about implications
MySQL Change History
3109
and possible fixes. (Bug#29605)
Parser in client-side prepared statements runs to end of statement, rather than end-of-line for '#' comments. Also added support for '-
-' single-line comments. (Bug#28956)
Parser in client-side prepared statements eats character following '/' if it is not a multi-line comment. (Bug#28851)
PreparedStatement.getMetaData() for statements containing leading one-line comments is not returned correctly.
As part of this fix, we also overhauled detection of DML for executeQuery() and SELECTs for executeUpdate() in plain
and prepared statements to be aware of the same types of comments. (Bug#28469)
C.6.2.3. Changes in MySQL Connector/J 5.0.6 (15 May 2007)
Functionality added or changed:
Added an experimental load-balanced connection designed for use with SQL nodes in a MySQL Cluster/NDB environment (This is
not for master-slave replication. For that, we suggest you look at ReplicationConnection or lbpool).
If the JDBC URL starts with jdbc:mysql:loadbalance://host-1,host-2,...host-n, the driver will create an im-
plementation of java.sql.Connection that load balances requests across a series of MySQL JDBC connections to the given
hosts, where the balancing takes place after transaction commit.
Therefore, for this to work (at all), you must use transactions, even if only reading data.
Physical connections to the given hosts will not be created until needed.
The driver will invalidate connections that it detects have had communication errors when processing a request. A new connection
to the problematic host will be attempted the next time it is selected by the load balancing algorithm.
There are two choices for load balancing algorithms, which may be specified by the loadBalanceStrategy JDBC URL con-
figuration property:
random the driver will pick a random host for each request. This tends to work better than round-robin, as the randomness
will somewhat account for spreading loads where requests vary in response time, while round-robin can sometimes lead to over-
loaded nodes if there are variations in response times across the workload.
bestResponseTime the driver will route the request to the host that had the best response time for the previous transac-
tion.
bestResponseTime the driver will route the request to the host that had the best response time for the previous transaction.
Added configuration property padCharsWithSpace (defaults to false). If set to true, and a result set column has the CHAR
type and the value does not fill the amount of characters specified in the DDL for the column, the driver will pad the remaining
characters with space (for ANSI compliance).
When useLocalSessionState is set to true and connected to a MySQL-5.0 or later server, the JDBC driver will now de-
termine whether an actual commit or rollback statement needs to be sent to the database when Connection.commit() or
Connection.rollback() is called.
This is especially helpful for high-load situations with connection pools that always call Connection.rollback() on connec-
tion check-in/check-out because it avoids a round-trip to the server.
Added configuration property useDynamicCharsetInfo. If set to false (the default), the driver will use a per-connection
cache of character set information queried from the server when necessary, or when set to true, use a built-in static mapping that is
more efficient, but isn't aware of custom character sets or character sets implemented after the release of the JDBC driver.
Note
This only affects the padCharsWithSpace configuration property and the ResultSet-
MetaData.getColumnDisplayWidth() method.
New configuration property, enableQueryTimeouts (default true).
MySQL Change History
3110
When enabled, query timeouts set via Statement.setQueryTimeout() use a shared java.util.Timer instance for
scheduling. Even if the timeout doesn't expire before the query is processed, there will be memory used by the TimerTask for the
given timeout which won't be reclaimed until the time the timeout would have expired if it hadn't been cancelled by the driver.
High-load environments might want to consider disabling this functionality. (this configuration property is part of the maxPer-
formance configuration bundle).
Give better error message when "streaming" result sets, and the connection gets clobbered because of exceeding
net_write_timeout on the server.
random the driver will pick a random host for each request. This tends to work better than round-robin, as the randomness will
somewhat account for spreading loads where requests vary in response time, while round-robin can sometimes lead to overloaded
nodes if there are variations in response times across the workload.
com.mysql.jdbc.[NonRegistering]Driver now understands URLs of the format jdbc:mysql:replication://
and jdbc:mysql:loadbalance:// which will create a ReplicationConnection (exactly like when using
[NonRegistering]ReplicationDriver) and an experimental load-balanced connection designed for use with SQL nodes
in a MySQL Cluster/NDB environment, respectively.
In an effort to simplify things, we're working on deprecating multiple drivers, and instead specifying different core behavior based
upon JDBC URL prefixes, so watch for [NonRegistering]ReplicationDriver to eventually disappear, to be replaced
with com.mysql.jdbc[NonRegistering]Driver with the new URL prefix.
Fixed issue where a failed-over connection would let an application call setReadOnly(false), when that call should be ig-
nored until the connection is reconnected to a writable master unless failoverReadOnly had been set to false.
Driver will now use INSERT INTO ... VALUES (DEFAULT)form of statement for updatable result sets for Result-
Set.insertRow(), rather than pre-populating the insert row with values from DatabaseMetaData.getColumns()(which
results in a SHOW FULL COLUMNS on the server for every result set). If an application requires access to the default values before
insertRow() has been called, the JDBC URL should be configured with populateInsertRowWithDefaultValues set
to true.
This fix specifically targets performance issues with ColdFusion and the fact that it seems to ask for updatable result sets no matter
what the application does with them.
More intelligent initial packet sizes for the "shared" packets are used (512 bytes, rather than 16K), and initial packets used during
handshake are now sized appropriately as to not require reallocation.
Bugs fixed:
More useful error messages are generated when the driver thinks a result set is not updatable. (Thanks to Ashley Martens for the
patch). (Bug#28085)
Connection.getTransactionIsolation() uses "SHOW VARIABLES LIKE" which is very inefficient on MySQL-5.0+
servers. (Bug#27655)
Fixed issue where calling getGeneratedKeys() on a prepared statement after calling execute() didn't always return the
generated keys (executeUpdate() worked fine however). (Bug#27655)
CALL /* ... */ some_proc() doesn't work. As a side effect of this fix, you can now use /* */ and # comments when
preparing statements using client-side prepared statement emulation.
If the comments happen to contain parameter markers (?), they will be treated as belonging to the comment (that is, not recognized)
rather than being a parameter of the statement.
Note
The statement when sent to the server will contain the comments as-is, they're not stripped during the process of preparing
the PreparedStatement or CallableStatement.
(Bug#27400)
ResultSet.get*() with a column index < 1 returns misleading error message. (Bug#27317)
MySQL Change History
3111
Using ResultSet.get*() with a column index less than 1 returns a misleading error message. (Bug#27317)
Comments in DDL of stored procedures/functions confuse procedure parser, and thus metadata about them can not be created, lead-
ing to inability to retrieve said metadata, or execute procedures that have certain comments in them. (Bug#26959)
Fast date/time parsing doesn't take into account 00:00:00 as a legal value. (Bug#26789)
PreparedStatement is not closed in BlobFromLocator.getBytes(). (Bug#26592)
When the configuration property useCursorFetch was set to true, sometimes server would return new, more exact metadata
during the execution of the server-side prepared statement that enables this functionality, which the driver ignored (using the origin-
al metadata returned during prepare()), causing corrupt reading of data due to type mismatch when the actual rows were re-
turned. (Bug#26173)
CallableStatements with OUT/INOUT parameters that are "binary" (BLOB, BIT, (VAR)BINARY, JAVA_OBJECT) have
extra 7 bytes. (Bug#25715)
Whitespace surrounding storage/size specifiers in stored procedure parameters declaration causes NumberFormatException to
be thrown when calling stored procedure on JDK-1.5 or newer, as the Number classes in JDK-1.5+ are whitespace intolerant.
(Bug#25624)
Client options not sent correctly when using SSL, leading to stored procedures not being able to return results. Thanks to Don Co-
hen for the bug report, testcase and patch. (Bug#25545)
Statement.setMaxRows() is not effective on result sets materialized from cursors. (Bug#25517)
BIT(> 1) is returned as java.lang.String from ResultSet.getObject() rather than byte[]. (Bug#25328)
C.6.2.4. Changes in MySQL Connector/J 5.0.5 (02 March 2007)
Functionality added or changed:
Usage Advisor will now issue warnings for result sets with large numbers of rows. You can configure the trigger value by using the
resultSetSizeThreshold parameter, which has a default value of 100.
The rewriteBatchedStatements feature can now be used with server-side prepared statements.
Important change: Due to a number of issues with the use of server-side prepared statements, Connector/J 5.0.5 has disabled their
use by default. The disabling of server-side prepared statements does not affect the operation of the connector in any way.
To enable server-side prepared statements you must add the following configuration property to your connector string:
useServerPrepStmts=true
The default value of this property is false (that is, Connector/J does not use server-side prepared statements).
Improved speed of datetime parsing for ResultSets that come from plain or nonserver-side prepared statements. You can enable
old implementation with useFastDateParsing=false as a configuration parameter.
Usage Advisor now detects empty results sets and does not report on columns not referenced in those empty sets.
Fixed logging of XA commands sent to server, it is now configurable via logXaCommands property (defaults to false).
Added configuration property localSocketAddress, which is the host name or IP address given to explicitly configure the in-
terface that the driver will bind the client side of the TCP/IP connection to when connecting.
We've added a new configuration option treatUtilDateAsTimestamp, which is false by default, as (1) We already had
specific behavior to treat java.util.Date as a java.sql.Timestamp because it is useful to many folks, and (2) that behavior will very
likely be required for drivers JDBC-post-4.0.
Bugs fixed:
MySQL Change History
3112
Connection property socketFactory wasn't exposed via correctly named mutator/accessor, causing data source implementations
that use JavaBean naming conventions to set properties to fail to set the property (and in the case of SJAS, fail silently when trying
to set this parameter). (Bug#26326)
A query execution which timed out did not always throw a MySQLTimeoutException. (Bug#25836)
Storing a java.util.Date object in a BLOB column would not be serialized correctly during setObject. (Bug#25787)
Timer instance used for Statement.setQueryTimeout() created per-connection, rather than per-VM, causing memory leak.
(Bug#25514)
EscapeProcessor gets confused by multiple backslashes. We now push the responsibility of syntax errors back on to the server
for most escape sequences. (Bug#25399)
INOUT parameters in CallableStatements get doubly-escaped. (Bug#25379)
When using the rewriteBatchedStatements connection option with PreparedState.executeBatch() an internal
memory leak would occur. (Bug#25073)
Fixed issue where field-level for metadata from DatabaseMetaData when using INFORMATION_SCHEMA didn't have refer-
ences to current connections, sometimes leading to Null Pointer Exceptions (NPEs) when introspecting them via ResultSet-
MetaData. (Bug#25073)
StringUtils.indexOfIgnoreCaseRespectQuotes() isn't case-insensitive on the first character of the target. This bug
also affected rewriteBatchedStatements functionality when prepared statements did not use uppercase for the VALUES
clause. (Bug#25047)
Client-side prepared statement parser gets confused by in-line comments /*...*/ and therefore cannot rewrite batch statements or
reliably detect the type of statements when they are used. (Bug#25025)
Results sets from UPDATE statements that are part of multi-statement queries would cause an SQLException error, "Result is
from UPDATE". (Bug#25009)
Specifying US-ASCII as the character set in a connection to a MySQL 4.1 or newer server does not map correctly. (Bug#24840)
Using DatabaseMetaData.getSQLKeywords() does not return a all of the of the reserved keywords for the current MySQL
version. Current implementation returns the list of reserved words for MySQL 5.1, and does not distinguish between versions.
(Bug#24794)
Calling Statement.cancel() could result in a Null Pointer Exception (NPE). (Bug#24721)
Using setFetchSize() breaks prepared SHOW and other commands. (Bug#24360)
Calendars and timezones are now lazily instantiated when required. (Bug#24351)
Using DATETIME columns would result in time shifts when useServerPrepStmts was true. The reason was due to different
behavior when using client-side compared to server-side prepared statements and the useJDBCCompliantTimezoneShift
option. This is now fixed if moving from server-side prepared statements to client-side prepared statements by setting
useSSPSCompatibleTimezoneShift to true, as the driver can't tell if this is a new deployment that never used server-side
prepared statements, or if it is an existing deployment that is switching to client-side prepared statements from server-side prepared
statements. (Bug#24344)
Connector/J now returns a better error message when server doesn't return enough information to determine stored procedure/func-
tion parameter types. (Bug#24065)
A connection error would occur when connecting to a MySQL server with certain character sets. Some collations/character sets re-
ported as "unknown" (specifically cias variants of existing character sets), and inability to override the detected server character
set. (Bug#23645)
Inconsistency between getSchemas and INFORMATION_SCHEMA. (Bug#23304)
DatabaseMetaData.getSchemas() doesn't return a TABLE_CATALOG column. (Bug#23303)
When using a JDBC connection URL that is malformed, the NonRegisteringDriver.getPropertyInfo method will
throw a Null Pointer Exception (NPE). (Bug#22628)
MySQL Change History
3113
Some exceptions thrown out of StandardSocketFactory were needlessly wrapped, obscuring their true cause, especially
when using socket timeouts. (Bug#21480)
When using a server-side prepared statement the driver would send timestamps to the server using nanoseconds instead of milli-
seconds. (Bug#21438)
When using server-side prepared statements and timestamp columns, value would be incorrectly populated (with nanoseconds, not
microseconds). (Bug#21438)
ParameterMetaData throws NullPointerException when prepared SQL has a syntax error. Added generateSim-
pleParameterMetadata configuration property, which when set to true will generate metadata reflecting VARCHAR for
every parameter (the default is false, which will cause an exception to be thrown if no parameter metadata for the statement is ac-
tually available). (Bug#21267)
Fixed an issue where XADataSources couldn't be bound into JNDI, as the DataSourceFactory didn't know how to create
instances of them.
Other changes:
Avoid static synchronized code in JVM class libraries for dealing with default timezones.
Performance enhancement of initial character set configuration, driver will only send commands required to configure connection
character set session variables if the current values on the server do not match what is required.
Re-worked stored procedure parameter parser to be more robust. Driver no longer requires BEGIN in stored procedure definition,
but does have requirement that if a stored function begins with a label directly after the "returns" clause, that the label is not a
quoted identifier.
Throw exceptions encountered during timeout to thread calling Statement.execute*(), rather than RuntimeException.
Changed cached result set metadata (when using cacheResultSetMetadata=true) to be cached per-connection rather than
per-statement as previously implemented.
Reverted back to internal character conversion routines for single-byte character sets, as the ones internal to the JVM are using
much more CPU time than our internal implementation.
When extracting foreign key information from SHOW CREATE TABLE in DatabaseMetaData, ignore exceptions relating to
tables being missing (which could happen for cross-reference or imported-key requests, as the list of tables is generated first, then it-
erated).
Fixed some Null Pointer Exceptions (NPEs) when cached metadata was used with UpdatableResultSets.
Take localSocketAddress property into account when creating instances of CommunicationsException when the un-
deryling exception is a java.net.BindException, so that a friendlier error message is given with a little internal diagnostics.
Fixed cases where ServerPreparedStatements weren't using cached metadata when cacheResultSet-
Metadata=true was used.
Use a java.util.TreeMap to map column names to ordinal indexes for ResultSet.findColumn() instead of a
HashMap. This allows us to have case-insensitive lookups (required by the JDBC specification) without resorting to the many tran-
sient object instances needed to support this requirement with a normal HashMap with either case-adjusted keys, or case-insensitive
keys. (In the worst case scenario for lookups of a 1000 column result set, TreeMaps are about half as fast wall-clock time as a
HashMap, however in normal applications their use gives many orders of magnitude reduction in transient object instance creation
which pays off later for CPU usage in garbage collection).
When using cached metadata, skip field-level metadata packets coming from the server, rather than reading them and discarding
them without creating com.mysql.jdbc.Field instances.
C.6.2.5. Changes in MySQL Connector/J 5.0.4 (20 October 2006)
Bugs fixed:
MySQL Change History
3114
DBMD.getColumns() does not return expected COLUMN_SIZE for the SET type, now returns length of largest possible set disreg-
arding whitespace or the "," delimitters to be consistent with the ODBC driver. (Bug#22613)
Added new _ci collations to CharsetMapping - utf8_unicode_ci not working. (Bug#22456)
Driver was using milliseconds for Statement.setQueryTimeout() when specification says argument is to be in seconds. (Bug#22359)
Workaround for server crash when calling stored procedures via a server-side prepared statement (driver now detects prepare(stored
procedure) and substitutes client-side prepared statement). (Bug#22297)
Driver issues truncation on write exception when it shouldn't (due to sending big decimal incorrectly to server with server-side pre-
pared statement). (Bug#22290)
Newlines causing whitespace to span confuse procedure parser when getting parameter metadata for stored procedures.
(Bug#22024)
When using information_schema for metadata, COLUMN_SIZE for getColumns() is not clamped to range of java.lang.Integer as is
the case when not using information_schema, thus leading to a truncation exception that isn't present when not using informa-
tion_schema. (Bug#21544)
Column names don't match metadata in cases where server doesn't return original column names (column functions) thus breaking
compatibility with applications that expect 1-1 mappings between findColumn() and rsmd.getColumnName(), usually manifests it-
self as "Can't find column ('')" exceptions. (Bug#21379)
Driver now sends numeric 1 or 0 for client-prepared statement setBoolean() calls instead of '1' or '0'.
Fixed configuration property jdbcCompliantTruncation was not being used for reads of result set values.
DatabaseMetaData correctly reports true for supportsCatalog*() methods.
Driver now supports {call sp} (without "()" if procedure has no arguments).
C.6.2.6. Changes in MySQL Connector/J 5.0.3 (26 July 2006 beta)
Functionality added or changed:
Added configuration option noAccessToProcedureBodies which will cause the driver to create basic parameter metadata for
CallableStatements when the user does not have access to procedure bodies via SHOW CREATE PROCEDURE or selecting
from mysql.proc instead of throwing an exception. The default value for this option is false
Bugs fixed:
Fixed Statement.cancel() causes NullPointerException if underlying connection has been closed due to server fail-
ure. (Bug#20650)
If the connection to the server has been closed due to a server failure, then the cleanup process will call Statement.cancel(),
triggering a NullPointerException, even though there is no active connection. (Bug#20650)
C.6.2.7. Changes in MySQL Connector/J 5.0.2 (11 July 2006)
Bugs fixed:
MysqlXaConnection.recover(int flags) now allows combinations of XAResource.TMSTARTRSCAN and
TMENDRSCAN. To simulate the scanning nature of the interface, we return all prepared XIDs for TMSTARTRSCAN, and no new
XIDs for calls with TMNOFLAGS, or TMENDRSCAN when not in combination with TMSTARTRSCAN. This change was made for
API compliance, as well as integration with IBM WebSphere's transaction manager. (Bug#20242)
Fixed MysqlValidConnectionChecker for JBoss doesn't work with MySQLXADataSources. (Bug#20242)
Added connection/datasource property pinGlobalTxToPhysicalConnection (defaults to false). When set to true,
MySQL Change History
3115
when using XAConnections, the driver ensures that operations on a given XID are always routed to the same physical connec-
tion. This allows the XAConnection to support XA START ... JOIN after XA END has been called, and is also a workaround
for transaction managers that don't maintain thread affinity for a global transaction (most either always maintain thread affinity, or
have it as a configuration option). (Bug#20242)
Better caching of character set converters (per-connection) to remove a bottleneck for multibyte character sets. (Bug#20242)
Fixed ConnectionProperties (and thus some subclasses) are not serializable, even though some J2EE containers expect them
to be. (Bug#19169)
Fixed driver fails on non-ASCII platforms. The driver was assuming that the platform character set would be a superset of MySQL's
latin1 when doing the handshake for authentication, and when reading error messages. We now use Cp1252 for all strings sent to
the server during the handshake phase, and a hard-coded mapping of the language systtem variable to the character set that is
used for error messages. (Bug#18086)
Fixed can't use XAConnection for local transactions when no global transaction is in progress. (Bug#17401)
C.6.2.8. Changes in MySQL Connector/J 5.0.1 (Not Released)
Not released due to a packaging error
C.6.2.9. Changes in MySQL Connector/J 5.0.0 (22 December 2005)
Bugs fixed:
Added support for Connector/MXJ integration via url subprotocol jdbc:mysql:mxj://.... (Bug#14729)
Idle timeouts cause XAConnections to whine about rolling themselves back. (Bug#14729)
When fix for Bug#14562 was merged from 3.1.12, added functionality for CallableStatement's parameter metadata to return
correct information for .getParameterClassName(). (Bug#14729)
Added service-provider entry to META-INF/services/java.sql.Driver for JDBC-4.0 support. (Bug#14729)
Fuller synchronization of Connection to avoid deadlocks when using multithreaded frameworks that multithread a single connec-
tion (usually not recommended, but the JDBC spec allows it anyways), part of fix to Bug#14972). (Bug#14729)
Moved all SQLException constructor usage to a factory in SQLError (ground-work for JDBC-4.0 SQLState-based exception
classes). (Bug#14729)
Removed Java5-specific calls to BigDecimal constructor (when result set value is '', (int)0 was being used as an argument
indirectly via method return value. This signature doesn't exist prior to Java5.) (Bug#14729)
Implementation of Statement.cancel() and Statement.setQueryTimeout(). Both require MySQL-5.0.0 or newer
server, require a separate connection to issue the KILL QUERY statement, and in the case of setQueryTimeout() creates an
additional thread to handle the timeout functionality.
Note: Failures to cancel the statement for setQueryTimeout() may manifest themselves as RuntimeExceptions rather
than failing silently, as there is currently no way to unblock the thread that is executing the query being cancelled due to timeout ex-
piration and have it throw the exception instead. (Bug#14729)
Return "[VAR]BINARY" for RSMD.getColumnTypeName() when that is actually the type, and it can be distinguished
(MySQL-4.1 and newer). (Bug#14729)
Attempt detection of the MySQL type BINARY (it is an alias, so this isn't always reliable), and use the
java.sql.Types.BINARY type mapping for it.
Added unit tests for XADatasource, as well as friendlier exceptions for XA failures compared to the "stock" XAException
(which has no messages).
If the connection useTimezone is set to true, then also respect time zone conversions in escape-processed string literals (for ex-
ample, "{ts ...}" and "{t ...}").
MySQL Change History
3116
Don't allow .setAutoCommit(true), or .commit() or .rollback() on an XA-managed connection as per the JDBC
specification.
XADataSource implemented (ported from 3.2 branch which won't be released as a product). Use
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource as your datasource class name in your application server to
utilize XA transactions in MySQL-5.0.10 and newer.
Moved -bin-g.jar file into separate debug subdirectory to avoid confusion.
Return original column name for RSMD.getColumnName() if the column was aliased, alias name for .getColumnLabel()
(if aliased), and original table name for .getTableName(). Note this only works for MySQL-4.1 and newer, as older servers
don't make this information available to clients.
Setting useJDBCCompliantTimezoneShift=true (it is not the default) causes the driver to use GMT for all
TIMESTAMP/DATETIME time zones, and the current VM time zone for any other type that refers to time zones. This feature can
not be used when useTimezone=true to convert between server and client time zones.
PreparedStatement.setString() didn't work correctly when sql_mode on server contained
NO_BACKSLASH_ESCAPES and no characters that needed escaping were present in the string.
Add one level of indirection of internal representation of CallableStatement parameter metadata to avoid class not found is-
sues on JDK-1.3 for ParameterMetadata interface (which doesn't exist prior to JDBC-3.0).
C.6.3. Changes in MySQL Connector/J 3.1.x
C.6.3.1. Changes in MySQL Connector/J 3.1.15 (Not yet released)
Important change: Due to a number of issues with the use of server-side prepared statements, Connector/J 5.0.5 has disabled their use
by default. The disabling of server-side prepared statements does not affect the operation of the connector in any way.
To enable server-side prepared statements you must add the following configuration property to your connector string:
useServerPrepStmts=true
The default value of this property is false (that is, Connector/J does not use server-side prepared statements).
Bugs fixed:
Specifying US-ASCII as the character set in a connection to a MySQL 4.1 or newer server does not map correctly. (Bug#24840)
C.6.3.2. Changes in MySQL Connector/J 3.1.14 (10-19-2006)
Bugs fixed:
Check and store value for continueBatchOnError property in constructor of Statements, rather than when executing batches, so that
Connections closed out from underneath statements don't cause NullPointerExceptions when it is required to check this property.
(Bug#22290)
Fixed Bug#18258 - DatabaseMetaData.getTables(), columns() with bad catalog parameter threw exception rather than return empty
result set (as required by spec). (Bug#22290)
Driver now sends numeric 1 or 0 for client-prepared statement setBoolean() calls instead of '1' or '0'. (Bug#22290)
Fixed bug where driver would not advance to next host if roundRobinLoadBalance=true and the last host in the list is down.
(Bug#22290)
Driver issues truncation on write exception when it shouldn't (due to sending big decimal incorrectly to server with server-side pre-
pared statement). (Bug#22290)
Fixed bug when calling stored functions, where parameters weren't numbered correctly (first parameter is now the return value, sub-
sequent parameters if specified start at index "2"). (Bug#22290)
MySQL Change History
3117
Removed logger autodetection altogether, must now specify logger explicitly if you want to use a logger other than one that logs to
STDERR. (Bug#21207)
DDriver throws NPE when tracing prepared statements that have been closed (in asSQL()). (Bug#21207)
ResultSet.getSomeInteger() doesn't work for BIT(>1). (Bug#21062)
Escape of quotes in client-side prepared statements parsing not respected. Patch covers more than bug report, including
NO_BACKSLASH_ESCAPES being set, and stacked quote characters forms of escaping (that is, '' or ""). (Bug#20888)
Fixed can't pool server-side prepared statements, exception raised when re-using them. (Bug#20687)
Fixed Updatable result set that contains a BIT column fails when server-side prepared statements are used. (Bug#20485)
Fixed updatable result set throws ClassCastException when there is row data and moveToInsertRow() is called. (Bug#20479)
Fixed ResultSet.getShort() for UNSIGNED TINYINT returns incorrect values when using server-side prepared statements.
(Bug#20306)
ReplicationDriver does not always round-robin load balance depending on URL used for slaves list. (Bug#19993)
Fixed calling toString() on ResultSetMetaData for driver-generated (that is, from DatabaseMetaData method calls, or from getGen-
eratedKeys()) result sets would raise a NullPointerException. (Bug#19993)
Connection fails to localhost when using timeout and IPv6 is configured. (Bug#19726)
ResultSet.getFloatFromString() can't retrieve values near Float.MIN/MAX_VALUE. (Bug#18880)
Fixed memory leak with profileSQL=true. (Bug#16987)
Fixed NullPointerException in MysqlDataSourceFactory due to Reference containing RefAddrs with null content. (Bug#16791)
C.6.3.3. Changes in MySQL Connector/J 3.1.13 (26 May 2006)
Bugs fixed:
Fixed PreparedStatement.setObject(int, Object, int) doesn't respect scale of BigDecimals. (Bug#19615)
Fixed ResultSet.wasNull() returns incorrect value when extracting native string from server-side prepared statement gener-
ated result set. (Bug#19282)
Fixed invalid classname returned for ResultSetMetaData.getColumnClassName() for BIGINT type. (Bug#19282)
Fixed case where driver wasn't reading server status correctly when fetching server-side prepared statement rows, which in some
cases could cause warning counts to be off, or multiple result sets to not be read off the wire. (Bug#19282)
Fixed data truncation and getWarnings() only returns last warning in set. (Bug#18740)
Fixed aliased column names where length of name > 251 are corrupted. (Bug#18554)
Improved performance of retrieving BigDecimal, Time, Timestamp and Date values from server-side prepared statements by
creating fewer short-lived instances of Strings when the native type is not an exact match for the requested type. (Bug#18496)
Added performance feature, re-writing of batched executes for Statement.executeBatch() (for all DML statements) and
PreparedStatement.executeBatch() (for INSERTs with VALUE clauses only). Enable by using "rewriteBatchedState-
ments=true" in your JDBC URL. (Bug#18041)
Fixed issue where server-side prepared statements don't cause truncation exceptions to be thrown when truncation happens.
(Bug#18041)
Fixed CallableStatement.registerOutParameter() not working when some parameters pre-populated. Still waiting
for feedback from JDBC experts group to determine what correct parameter count from getMetaData() should be, however.
(Bug#17898)
MySQL Change History
3118
Fixed calling clearParameters() on a closed prepared statement causes NPE. (Bug#17587)
Map "latin1" on MySQL server to CP1252 for MySQL > 4.1.0. (Bug#17587)
Added additional accessor and mutator methods on ConnectionProperties so that DataSource users can use same naming as regular
URL properties. (Bug#17587)
Fixed ResultSet.wasNull() not always reset correctly for booleans when done via conversion for server-side prepared state-
ments. (Bug#17450)
Fixed Statement.getGeneratedKeys() throws NullPointerException when no query has been processed.
(Bug#17099)
Fixed updatable result set doesn't return AUTO_INCREMENT values for insertRow() when multiple column primary keys are
used. (the driver was checking for the existence of single-column primary keys and an autoincrement value > 0 instead of a straight-
forward isAutoIncrement() check). (Bug#16841)
DBMD.getColumns() returns wrong type for BIT. (Bug#15854)
lib-nodist directory missing from package breaks out-of-box build. (Bug#15676)
Fixed issue with ReplicationConnection incorrectly copying state, doesn't transfer connection context correctly when trans-
itioning between the same read-only states. (Bug#15570)
No "dos" character set in MySQL > 4.1.0. (Bug#15544)
INOUT parameter does not store IN value. (Bug#15464)
PreparedStatement.setObject() serializes BigInteger as object, rather than sending as numeric value (and is thus not
complementary to .getObject() on an UNSIGNED LONG type). (Bug#15383)
Fixed issue where driver was unable to initialize character set mapping tables. Removed reliance on .properties files to hold
this information, as it turns out to be too problematic to code around class loader hierarchies that change depending on how an ap-
plication is deployed. Moved information back into the CharsetMapping class. (Bug#14938)
Exception thrown for new decimal type when using updatable result sets. (Bug#14609)
Driver now aware of fix for BIT type metadata that went into MySQL-5.0.21 for server not reporting length consistently .
(Bug#13601)
Added support for Apache Commons logging, use "com.mysql.jdbc.log.CommonsLogger" as the value for the "logger" configura-
tion property. (Bug#13469)
Fixed driver trying to call methods that don't exist on older and newer versions of Log4j. The fix is not trying to auto-detect pres-
ence of log4j, too many different incompatible versions out there in the wild to do this reliably.
If you relied on autodetection before, you will need to add "logger=com.mysql.jdbc.log.Log4JLogger" to your JDBC URL to enable
Log4J usage, or alternatively use the new "CommonsLogger" class to take care of this. (Bug#13469)
LogFactory now prepends "com.mysql.jdbc.log" to log class name if it can't be found as-specified. This allows you to use "short
names" for the built-in log factories, for example "logger=CommonsLogger" instead of "log-
ger=com.mysql.jdbc.log.CommonsLogger". (Bug#13469)
ResultSet.getShort() for UNSIGNED TINYINT returned wrong values. (Bug#11874)
C.6.3.4. Changes in MySQL Connector/J 3.1.12 (30 November 2005)
Bugs fixed:
Process escape tokens in Connection.prepareStatement(...). You can disable this behavior by setting the JDBC URL
configuration property processEscapeCodesForPrepStmts to false. (Bug#15141)
Usage advisor complains about unreferenced columns, even though they've been referenced. (Bug#15065)
MySQL Change History
3119
Driver incorrectly closes streams passed as arguments to PreparedStatements. Reverts to legacy behavior by setting the JD-
BC configuration property autoClosePStmtStreams to true (also included in the 3-0-Compat configuration bundle).
(Bug#15024)
Deadlock while closing server-side prepared statements from multiple threads sharing one connection. (Bug#14972)
Unable to initialize character set mapping tables (due to J2EE classloader differences). (Bug#14938)
Escape processor replaces quote character in quoted string with string delimiter. (Bug#14909)
DatabaseMetaData.getColumns() doesn't return TABLE_NAME correctly. (Bug#14815)
storesMixedCaseIdentifiers() returns false (Bug#14562)
storesLowerCaseIdentifiers() returns true (Bug#14562)
storesMixedCaseQuotedIdentifiers() returns false (Bug#14562)
storesMixedCaseQuotedIdentifiers() returns true (Bug#14562)
If lower_case_table_names=0 (on server):
storesLowerCaseIdentifiers() returns false
storesLowerCaseQuotedIdentifiers() returns false
storesMixedCaseIdentifiers() returns true
storesMixedCaseQuotedIdentifiers() returns true
storesUpperCaseIdentifiers() returns false
storesUpperCaseQuotedIdentifiers() returns true
(Bug#14562)
storesUpperCaseIdentifiers() returns false (Bug#14562)
storesUpperCaseQuotedIdentifiers() returns true (Bug#14562)
If lower_case_table_names=1 (on server):
storesLowerCaseIdentifiers() returns true
storesLowerCaseQuotedIdentifiers() returns true
storesMixedCaseIdentifiers() returns false
storesMixedCaseQuotedIdentifiers() returns false
storesUpperCaseIdentifiers() returns false
storesUpperCaseQuotedIdentifiers() returns true
(Bug#14562)
storesLowerCaseQuotedIdentifiers() returns true (Bug#14562)
Fixed DatabaseMetaData.stores*Identifiers():
If lower_case_table_names=0 (on server):
storesLowerCaseIdentifiers() returns false
storesLowerCaseQuotedIdentifiers() returns false
storesMixedCaseIdentifiers() returns true
MySQL Change History
3120
storesMixedCaseQuotedIdentifiers() returns true
storesUpperCaseIdentifiers() returns false
storesUpperCaseQuotedIdentifiers() returns true
If lower_case_table_names=1 (on server):
storesLowerCaseIdentifiers() returns true
storesLowerCaseQuotedIdentifiers() returns true
storesMixedCaseIdentifiers() returns false
storesMixedCaseQuotedIdentifiers() returns false
storesUpperCaseIdentifiers() returns false
storesUpperCaseQuotedIdentifiers() returns true
(Bug#14562)
storesMixedCaseIdentifiers() returns true (Bug#14562)
storesLowerCaseQuotedIdentifiers() returns false (Bug#14562)
Java type conversion may be incorrect for MEDIUMINT. (Bug#14562)
storesLowerCaseIdentifiers() returns false (Bug#14562)
Added configuration property useGmtMillisForDatetimes which when set to true causes ResultSet.getDate(),
.getTimestamp() to return correct millis-since GMT when .getTime() is called on the return value (currently default is
false for legacy behavior). (Bug#14562)
Extraneous sleep on autoReconnect. (Bug#13775)
Reconnect during middle of executeBatch() should not occur if autoReconnect is enabled. (Bug#13255)
maxQuerySizeToLog is not respected. Added logging of bound values for execute() phase of server-side prepared state-
ments when profileSQL=true as well. (Bug#13048)
OpenOffice expects DBMD.supportsIntegrityEnhancementFacility() to return true if foreign keys are supported
by the datasource, even though this method also covers support for check constraints, which MySQL doesn't have. Setting the con-
figuration property overrideSupportsIntegrityEnhancementFacility to true causes the driver to return true for
this method. (Bug#12975)
Added com.mysql.jdbc.testsuite.url.default system property to set default JDBC url for testsuite (to speed up bug
resolution when I'm working in Eclipse). (Bug#12975)
logSlowQueries should give better info. (Bug#12230)
Don't increase timeout for failover/reconnect. (Bug#6577)
Fixed client-side prepared statement bug with embedded ? characters inside quoted identifiers (it was recognized as a placeholder,
when it was not).
Don't allow executeBatch() for CallableStatements with registered OUT/INOUT parameters (JDBC compliance).
Fall back to platform-encoding for URLDecoder.decode() when parsing driver URL properties if the platform doesn't have a
two-argument version of this method.
C.6.3.5. Changes in MySQL Connector/J 3.1.11 (07 October 2005)
MySQL Change History
3121
Bugs fixed:
The configuration property sessionVariables now allows you to specify variables that start with the @ sign. (Bug#13453)
URL configuration parameters don't allow & or = in their values. The JDBC driver now parses configuration parameters as if
they are encoded using the application/x-www-form-urlencoded format as specified by java.net.URLDecoder (ht-
tp://java.sun.com/j2se/1.5.0/docs/api/java/net/URLDecoder.html).
If the % character is present in a configuration property, it must now be represented as %25, which is the encoded form of %
when using application/x-www-form-urlencoded encoding. (Bug#13453)
Workaround for Bug#13374: ResultSet.getStatement() on closed result set returns NULL (as per JDBC 4.0 spec, but not
backward-compatible). Set the connection property retainStatementAfterResultSetClose to true to be able to re-
trieve a ResultSet's statement after the ResultSet has been closed via .getStatement() (the default is false, to be JD-
BC-compliant and to reduce the chance that code using JDBC leaks Statement instances). (Bug#13277)
ResultSetMetaData from Statement.getGeneratedKeys() caused a NullPointerException to be thrown
whenever a method that required a connection reference was called. (Bug#13277)
Backport of VAR[BINARY|CHAR] [BINARY] types detection from 5.0 branch. (Bug#13277)
Fixed NullPointerException when converting catalog parameter in many DatabaseMetaDataMethods to byte[]s
(for the result set) when the parameter is null. (null isn't technically allowed by the JDBC specification, but we've historically al-
lowed it). (Bug#13277)
Backport of Field class, ResultSetMetaData.getColumnClassName(), and ResultSet.getObject(int)
changes from 5.0 branch to fix behavior surrounding VARCHAR BINARY/VARBINARY and related types. (Bug#13277)
Read response in MysqlIO.sendFileToServer(), even if the local file can't be opened, otherwise next query issued will fail,
because it is reading the response to the empty LOAD DATA INFILE packet sent to the server. (Bug#13277)
When gatherPerfMetrics is enabled for servers older than 4.1.0, a NullPointerException is thrown from the con-
structor of ResultSet if the query doesn't use any tables. (Bug#13043)
java.sql.Types.OTHER returned for BINARY and VARBINARY columns when using Database-
MetaData.getColumns(). (Bug#12970)
ServerPreparedStatement.getBinding() now checks if the statement is closed before attempting to reference the list of
parameter bindings, to avoid throwing a NullPointerException. (Bug#12970)
Tokenizer for = in URL properties was causing sessionVariables=.... to be parameterized incorrectly. (Bug#12753)
cp1251 incorrectly mapped to win1251 for servers newer than 4.0.x. (Bug#12752)
getExportedKeys() (Bug#12541)
Specifying a catalog works as stated in the API docs. (Bug#12541)
Specifying NULL means that catalog will not be used to filter the results (thus all databases will be searched), unless you've set
nullCatalogMeansCurrent=true in your JDBC URL properties. (Bug#12541)
getIndexInfo() (Bug#12541)
getProcedures() (and thus indirectly getProcedureColumns()) (Bug#12541)
getImportedKeys() (Bug#12541)
Specifying "" means current catalog, even though this isn't quite JDBC spec compliant, it is there for legacy users. (Bug#12541)
getCrossReference() (Bug#12541)
Added Connection.isMasterConnection() for clients to be able to determine if a multi-host master/slave connection is
connected to the first host in the list. (Bug#12541)
getColumns() (Bug#12541)
MySQL Change History
3122
Handling of catalog argument in DatabaseMetaData.getIndexInfo(), which also means changes to the following meth-
ods in DatabaseMetaData:
getBestRowIdentifier()
getColumns()
getCrossReference()
getExportedKeys()
getImportedKeys()
getIndexInfo()
getPrimaryKeys()
getProcedures() (and thus indirectly getProcedureColumns())
getTables()
The catalog argument in all of these methods now behaves in the following way:
Specifying NULL means that catalog will not be used to filter the results (thus all databases will be searched), unless you've set
nullCatalogMeansCurrent=true in your JDBC URL properties.
Specifying "" means current catalog, even though this isn't quite JDBC spec compliant, it is there for legacy users.
Specifying a catalog works as stated in the API docs.
Made Connection.clientPrepare() available from wrapped connections in the jdbc2.optional package
(connections built by ConnectionPoolDataSource instances).
(Bug#12541)
getBestRowIdentifier() (Bug#12541)
Made Connection.clientPrepare() available from wrapped connections in the jdbc2.optional package
(connections built by ConnectionPoolDataSource instances). (Bug#12541)
getTables() (Bug#12541)
getPrimaryKeys() (Bug#12541)
Connection.prepareCall() is database name case-sensitive (on Windows systems). (Bug#12417)
explainSlowQueries hangs with server-side prepared statements. (Bug#12229)
Properties shared between master and slave with replication connection. (Bug#12218)
Geometry types not handled with server-side prepared statements. (Bug#12104)
maxPerformance.properties mis-spells elideSetAutoCommits. (Bug#11976)
ReplicationConnection won't switch to slave, throws Catalog can't be null exception. (Bug#11879)
Pstmt.setObject(...., Types.BOOLEAN) throws exception. (Bug#11798)
Escape tokenizer doesn't respect stacked single quotes for escapes. (Bug#11797)
GEOMETRY type not recognized when using server-side prepared statements. (Bug#11797)
Foreign key information that is quoted is parsed incorrectly when DatabaseMetaData methods use that information.
(Bug#11781)
The sendBlobChunkSize property is now clamped to max_allowed_packet with consideration of stream buffer size and
packet headers to avoid PacketTooBigExceptions when max_allowed_packet is similar in size to the default send-
MySQL Change History
3123
BlobChunkSize which is 1M. (Bug#11781)
CallableStatement.clearParameters() now clears resources associated with INOUT/OUTPUT parameters as well as
INPUT parameters. (Bug#11781)
Fixed regression caused by fix for Bug#11552 that caused driver to return incorrect values for unsigned integers when those integers
where within the range of the positive signed type. (Bug#11663)
Moved source code to Subversion repository. (Bug#11663)
Incorrect generation of testcase scripts for server-side prepared statements. (Bug#11663)
Fixed statements generated for testcases missing ; for plain statements. (Bug#11629)
Spurious ! on console when character encoding is utf8. (Bug#11629)
StringUtils.getBytes() doesn't work when using multi-byte character encodings and a length in characters is specified.
(Bug#11614)
DBMD.storesLower/Mixed/UpperIdentifiers() reports incorrect values for servers deployed on Windows.
(Bug#11575)
Reworked Field class, *Buffer, and MysqlIO to be aware of field lengths > Integer.MAX_VALUE. (Bug#11498)
Escape processor didn't honor strings demarcated with double quotes. (Bug#11498)
Updated DBMD.supportsCorrelatedQueries() to return true for versions > 4.1, supportsGroupByUnrelated()
to return true and getResultSetHoldability() to return HOLD_CURSORS_OVER_COMMIT. (Bug#11498)
Lifted restriction of changing streaming parameters with server-side prepared statements. As long as all streaming parameters
were set before execution, .clearParameters() does not have to be called. (due to limitation of client/server protocol, pre-
pared statements can not reset individual stream data on the server side). (Bug#11498)
ResultSet.moveToCurrentRow() fails to work when preceded by a call to ResultSet.moveToInsertRow().
(Bug#11190)
VARBINARY data corrupted when using server-side prepared statements and .setBytes(). (Bug#11115)
Statement.getWarnings() fails with NPE if statement has been closed. (Bug#10630)
Only get char[] from SQL in PreparedStatement.ParseInfo() when needed. (Bug#10630)
C.6.3.6. Changes in MySQL Connector/J 3.1.10 (23 June 2005)
Bugs fixed:
Initial implemention of ParameterMetadata for PreparedStatement.getParameterMetadata(). Only works fully
for CallableStatements, as current server-side prepared statements return every parameter as a VARCHAR type.
Fixed connecting without a database specified raised an exception in MysqlIO.changeDatabaseTo().
C.6.3.7. Changes in MySQL Connector/J 3.1.9 (22 June 2005)
Bugs fixed:
Production package doesn't include JBoss integration classes. (Bug#11411)
Removed nonsensical costly type conversion warnings when using usage advisor. (Bug#11411)
Fixed PreparedStatement.setClob() not accepting null as a parameter. (Bug#11360)
Connector/J dumping query into SQLException twice. (Bug#11360)
MySQL Change History
3124
autoReconnect ping causes exception on connection startup. (Bug#11259)
Connection.setCatalog() is now aware of the useLocalSessionState configuration property, which when set to
true will prevent the driver from sending USE ... to the server if the requested catalog is the same as the current catalog.
(Bug#11115)
3-0-Compat Compatibility with Connector/J 3.0.x functionality (Bug#11115)
maxPerformance maximum performance without being reckless (Bug#11115)
solarisMaxPerformance maximum performance for Solaris, avoids syscalls where it can (Bug#11115)
Added maintainTimeStats configuration property (defaults to true), which tells the driver whether or not to keep track of
the last query time and the last successful packet sent to the server's time. If set to false, removes two syscalls per query.
(Bug#11115)
VARBINARY data corrupted when using server-side prepared statements and ResultSet.getBytes(). (Bug#11115)
Added the following configuration bundles, use one or many via the useConfigs configuration property:
maxPerformance maximum performance without being reckless
solarisMaxPerformance maximum performance for Solaris, avoids syscalls where it can
3-0-Compat Compatibility with Connector/J 3.0.x functionality
(Bug#11115)
Try to handle OutOfMemoryErrors more gracefully. Although not much can be done, they will in most cases close the connec-
tion they happened on so that further operations don't run into a connection in some unknown state. When an OOM has happened,
any further operations on the connection will fail with a Connection closed exception that will also list the OOM exception as the
reason for the implicit connection close event. (Bug#10850)
Setting cachePrepStmts=true now causes the Connection to also cache the check the driver performs to determine if a
prepared statement can be server-side or not, as well as caches server-side prepared statements for the lifetime of a connection. As
before, the prepStmtCacheSize parameter controls the size of these caches. (Bug#10850)
Don't send COM_RESET_STMT for each execution of a server-side prepared statement if it isn't required. (Bug#10850)
0-length streams not sent to server when using server-side prepared statements. (Bug#10850)
Driver detects if you're running MySQL-5.0.7 or later, and does not scan for LIMIT ?[,?] in statements being prepared, as the
server supports those types of queries now. (Bug#10850)
Reorganized directory layout. Sources now are in src folder. Don't pollute parent directory when building, now output goes to
./build, distribution goes to ./dist. (Bug#10496)
Added support/bug hunting feature that generates .sql test scripts to STDERR when autoGenerateTestcaseScript is set
to true. (Bug#10496)
SQLException is thrown when using property characterSetResults with cp932 or eucjpms. (Bug#10496)
The datatype returned for TINYINT(1) columns when tinyInt1isBit=true (the default) can be switched between
Types.BOOLEAN and Types.BIT using the new configuration property transformedBitIsBoolean, which defaults to
false. If set to false (the default), DatabaseMetaData.getColumns() and ResultSet-
MetaData.getColumnType() will return Types.BOOLEAN for TINYINT(1) columns. If true, Types.BOOLEAN will
be returned instead. Regardless of this configuration property, if tinyInt1isBit is enabled, columns with the type TINY-
INT(1) will be returned as java.lang.Boolean instances from ResultSet.getObject(...), and ResultSet-
MetaData.getColumnClassName() will return java.lang.Boolean. (Bug#10485)
SQLException thrown when retrieving YEAR(2) with ResultSet.getString(). The driver will now always treat YEAR
types as java.sql.Dates and return the correct values for getString(). Alternatively, the yearIsDateType connection
property can be set to false and the values will be treated as SHORTs. (Bug#10485)
Driver doesn't support {?=CALL(...)} for calling stored functions. This involved adding support for function retrieval to Data-
baseMetaData.getProcedures() and getProcedureColumns() as well. (Bug#10310)
MySQL Change History
3125
Unsigned SMALLINT treated as signed for ResultSet.getInt(), fixed all cases for UNSIGNED integer values and server-side
prepared statements, as well as ResultSet.getObject() for UNSIGNED TINYINT. (Bug#10156)
Made ServerPreparedStatement.asSql() work correctly so auto-explain functionality would work with server-side pre-
pared statements. (Bug#10155)
Double quotes not recognized when parsing client-side prepared statements. (Bug#10155)
Made JDBC2-compliant wrappers public in order to allow access to vendor extensions. (Bug#10155)
DatabaseMetaData.supportsMultipleOpenResults() now returns true. The driver has supported this for some
time, DBMD just missed that fact. (Bug#10155)
Cleaned up logging of profiler events, moved code to dump a profiler event as a string to com.mysql.jdbc.log.LogUtils
so that third parties can use it. (Bug#10155)
Made enableStreamingResults() visible on com.mysql.jdbc.jdbc2.optional.StatementWrapper.
(Bug#10155)
Actually write manifest file to correct place so it ends up in the binary jar file. (Bug#10144)
Added createDatabaseIfNotExist property (default is false), which will cause the driver to ask the server to create the
database specified in the URL if it doesn't exist. You must have the appropriate privileges for database creation for this to work.
(Bug#10144)
Memory leak in ServerPreparedStatement if serverPrepare() fails. (Bug#10144)
com.mysql.jdbc.PreparedStatement.ParseInfo does unnecessary call to toCharArray(). (Bug#9064)
Driver now correctly uses CP932 if available on the server for Windows-31J, CP932 and MS932 java encoding names, otherwise it
resorts to SJIS, which is only a close approximation. Currently only MySQL-5.0.3 and newer (and MySQL-4.1.12 or .13, depending
on when the character set gets backported) can reliably support any variant of CP932.
Overhaul of character set configuration, everything now lives in a properties file.
C.6.3.8. Changes in MySQL Connector/J 3.1.8 (14 April 2005)
Bugs fixed:
Should accept null for catalog (meaning use current) in DBMD methods, even though it is not JDBC-compliant for legacy's sake.
Disable by setting connection property nullCatalogMeansCurrent to false (which will be the default value in C/J 3.2.x).
(Bug#9917)
Fixed driver not returning true for -1 when ResultSet.getBoolean() was called on result sets returned from server-side
prepared statements. (Bug#9778)
Added a Manifest.MF file with implementation information to the .jar file. (Bug#9778)
More tests in Field.isOpaqueBinary() to distinguish opaque binary (that is, fields with type CHAR(n) and CHARACTER
SET BINARY) from output of various scalar and aggregate functions that return strings. (Bug#9778)
DBMD.getTables() shouldn't return tables if views are asked for, even if the database version doesn't support views.
(Bug#9778)
Should accept null for name patterns in DBMD (meaning %), even though it isn't JDBC compliant, for legacy's sake. Disable by
setting connection property nullNamePatternMatchesAll to false (which will be the default value in C/J 3.2.x).
(Bug#9769)
The performance metrics feature now gathers information about number of tables referenced in a SELECT. (Bug#9704)
The logging system is now automatically configured. If the value has been set by the user, via the URL property logger or the
system property com.mysql.jdbc.logger, then use that, otherwise, autodetect it using the following steps:
1. Log4j, if it is available,
MySQL Change History
3126
2. Then JDK1.4 logging,
3. Then fallback to our STDERR logging.
(Bug#9704)
Statement.getMoreResults() could throw NPE when existing result set was .close()d. (Bug#9704)
Stored procedures with DECIMAL parameters with storage specifications that contained , in them would fail. (Bug#9682)
PreparedStatement.setObject(int, Object, int type, int scale) now uses scale value for BigDecimal
instances. (Bug#9682)
Added support for the c3p0 connection pool's (http://c3p0.sf.net/) validation/connection checker interface which uses the light-
weight COM_PING call to the server if available. To use it, configure your c3p0 connection pool's connectionTesterClass-
Name property to use com.mysql.jdbc.integration.c3p0.MysqlConnectionTester. (Bug#9320)
PreparedStatement.getMetaData() inserts blank row in database under certain conditions when not using server-side
prepared statements. (Bug#9320)
Better detection of LIMIT inside/outside of quoted strings so that the driver can more correctly determine whether a prepared state-
ment can be prepared on the server or not. (Bug#9320)
Connection.canHandleAsPreparedStatement() now makes best effort to distinguish LIMIT clauses with placehold-
ers in them from ones without in order to have fewer false positives when generating work-arounds for statements the server cannot
currently handle as server-side prepared statements. (Bug#9320)
Fixed build.xml to not compile log4j logging if log4j not available. (Bug#9320)
Added finalizers to ResultSet and Statement implementations to be JDBC spec-compliant, which requires that if not expli-
citly closed, these resources should be closed upon garbage collection. (Bug#9319)
Stored procedures with same name in different databases confuse the driver when it tries to determine parameter counts/types.
(Bug#9319)
A continuation of Bug#8868, where functions used in queries that should return nonstring types when resolved by temporary tables
suddenly become opaque binary strings (work-around for server limitation). Also fixed fields with type of CHAR(n) CHARACTER
SET BINARY to return correct/matching classes for RSMD.getColumnClassName() and ResultSet.getObject().
(Bug#9236)
Cannot use UTF-8 for characterSetResults configuration property. (Bug#9206)
PreparedStatement.addBatch() doesn't work with server-side prepared statements and streaming BINARY data.
(Bug#9040)
ServerPreparedStatements now correctly stream BLOB/CLOB data to the server. You can configure the threshold chunk
size using the JDBC URL property blobSendChunkSize (the default is 1MB). (Bug#8868)
DATE_FORMAT() queries returned as BLOBs from getObject(). (Bug#8868)
Server-side session variables can be preset at connection time by passing them as a comma-delimited list for the connection property
sessionVariables. (Bug#8868)
BlobFromLocator now uses correct identifier quoting when generating prepared statements. (Bug#8868)
Fixed regression in ping() for users using autoReconnect=true. (Bug#8868)
Check for empty strings ('') when converting CHAR/VARCHAR column data to numbers, throw exception if emptyString-
sConvertToZero configuration property is set to false (for backward-compatibility with 3.0, it is now set to true by default,
but will most likely default to false in 3.2). (Bug#8803)
DATA_TYPE column from DBMD.getBestRowIdentifier() causes ArrayIndexOutOfBoundsException when ac-
cessed (and in fact, didn't return any value). (Bug#8803)
DBMD.supportsMixedCase*Identifiers() returns wrong value on servers running on case-sensitive file systems.
MySQL Change History
3127
Bug#8800)
DBMD.supportsResultSetConcurrency() not returning true for forward-only/read-only result sets (we obviously sup-
port this). (Bug#8792)
Fixed ResultSet.getTime() on a NULL value for server-side prepared statements throws NPE.
Made Connection.ping() a public method.
Added support for new precision-math DECIMAL type in MySQL 5.0.3 and up.
Fixed DatabaseMetaData.getTables() returning views when they were not asked for as one of the requested table types.
C.6.3.9. Changes in MySQL Connector/J 3.1.7 (18 February 2005)
Bugs fixed:
PreparedStatements not creating streaming result sets. (Bug#8487)
Don't pass NULL to String.valueOf() in ResultSet.getNativeConvertToString(), as it stringifies it (that is, re-
turns null), which is not correct for the method in question. (Bug#8487)
Fixed NPE in ResultSet.realClose() when using usage advisor and result set was already closed. (Bug#8428)
ResultSet.getString() doesn't maintain format stored on server, bug fix only enabled when noDatetimeStringSync
property is set to true (the default is false). (Bug#8428)
Added support for BIT type in MySQL-5.0.3. The driver will treat BIT(1-8) as the JDBC standard BIT type (which maps to
java.lang.Boolean), as the server does not currently send enough information to determine the size of a bitfield when < 9 bits
are declared. BIT(>9) will be treated as VARBINARY, and will return byte[] when getObject() is called. (Bug#8424)
Added useLocalSessionState configuration property, when set to true the JDBC driver trusts that the application is well-
behaved and only sets autocommit and transaction isolation levels using the methods provided on java.sql.Connection, and
therefore can manipulate these values in many cases without incurring round-trips to the database server. (Bug#8424)
Added enableStreamingResults() to Statement for connection pool implementations that check State-
ment.setFetchSize() for specification-compliant values. Call Statement.setFetchSize(>=0) to disable the stream-
ing results for that statement. (Bug#8424)
ResultSet.getBigDecimal() throws exception when rounding would need to occur to set scale. The driver now chooses a
rounding mode of half up if nonrounding BigDecimal.setScale() fails. (Bug#8424)
Fixed synchronization issue with ServerPreparedStatement.serverPrepare() that could cause deadlocks/crashes if
connection was shared between threads. (Bug#8096)
Emulated locators corrupt binary data when using server-side prepared statements. (Bug#8096)
Infinite recursion when falling back to master in failover configuration. (Bug#7952)
Disable multi-statements (if enabled) for MySQL-4.1 versions prior to version 4.1.10 if the query cache is enabled, as the server re-
turns wrong results in this configuration. (Bug#7952)
Removed dontUnpackBinaryResults functionality, the driver now always stores results from server-side prepared statements
as is from the server and unpacks them on demand. (Bug#7952)
Fixed duplicated code in configureClientCharset() that prevented useOldUTF8Behavior=true from working prop-
erly. (Bug#7952)
Added holdResultsOpenOverStatementClose property (default is false), that keeps result sets open over state-
ment.close() or new execution on same statement (suggested by Kevin Burton). (Bug#7715)
Detect new sql_mode variable in string form (it used to be integer) and adjust quoting method for strings appropriately.
(Bug#7715)
MySQL Change History
3128
Timestamps converted incorrectly to strings with server-side prepared statements and updatable result sets. (Bug#7715)
Timestamp key column data needed _binary stripped for UpdatableResultSet.refreshRow(). (Bug#7686)
Choose correct direction to apply time adjustments when both client and server are in GMT time zone when using Result-
Set.get(..., cal) and PreparedStatement.set(...., cal). (Bug#4718)
Remove _binary introducer from parameters used as in/out parameters in CallableStatement. (Bug#4718)
Always return byte[]s for output parameters registered as *BINARY. (Bug#4718)
By default, the driver now scans SQL you are preparing via all variants of Connection.prepareStatement() to determine
if it is a supported type of statement to prepare on the server side, and if it is not supported by the server, it instead prepares it as a
client-side emulated prepared statement. You can disable this by passing emulateUnsupportedPstmts=false in your JDBC
URL. (Bug#4718)
Added dontTrackOpenResources option (default is false, to be JDBC compliant), which helps with memory use for non-
well-behaved apps (that is, applications that don't close Statement objects when they should). (Bug#4718)
Send correct value for boolean true to server for PreparedStatement.setObject(n, "true", Types.BIT).
(Bug#4718)
Fixed bug with Connection not caching statements from prepareStatement() when the statement wasn't a server-side pre-
pared statement. (Bug#4718)
C.6.3.10. Changes in MySQL Connector/J 3.1.6 (23 December 2004)
Bugs fixed:
DBMD.getProcedures() doesn't respect catalog parameter. (Bug#7026)
Fixed hang on SocketInputStream.read() with Statement.setMaxRows() and multiple result sets when driver has to
truncate result set directly, rather than tacking a LIMIT n on the end of it.
C.6.3.11. Changes in MySQL Connector/J 3.1.5 (02 December 2004)
Bugs fixed:
Use 1MB packet for sending file for LOAD DATA LOCAL INFILE if that is < max_allowed_packet on server. (Bug#6537)
SUM() on DECIMAL with server-side prepared statement ignores scale if zero-padding is needed (this ends up being due to conver-
sion to DOUBLE by server, which when converted to a string to parse into BigDecimal, loses all padding zeros). (Bug#6537)
Use DatabaseMetaData.getIdentifierQuoteString() when building DBMD queries. (Bug#6537)
Use our own implementation of buffered input streams to get around blocking behavior of java.io.BufferedInputStream.
Disable this with useReadAheadInput=false. (Bug#6399)
Make auto-deserialization of java.lang.Objects stored in BLOB columns configurable via autoDeserialize property
(defaults to false). (Bug#6399)
ResultSetMetaData.getColumnDisplaySize() returns incorrect values for multi-byte charsets. (Bug#6399)
Re-work Field.isOpaqueBinary() to detect CHAR(n) CHARACTER SET BINARY to support fixed-length binary fields
for ResultSet.getObject(). (Bug#6399)
Failing to connect to the server when one of the addresses for the given host name is IPV6 (which the server does not yet bind on).
The driver now loops through all IP addresses for a given host, and stops on the first one that accepts() a sock-
et.connect(). (Bug#6348)
Removed unwanted new Throwable() in ResultSet constructor due to bad merge (caused a new object instance that was nev-
er used for every result set created). Found while profiling for Bug#6359. (Bug#6225)
MySQL Change History
3129
ServerSidePreparedStatement allocating short-lived objects unnecessarily. (Bug#6225)
Use null-safe-equals for key comparisons in updatable result sets. (Bug#6225)
Fixed too-early creation of StringBuffer in EscapeProcessor.escapeSQL(), also return String when escaping not
needed (to avoid unnecessary object allocations). Found while profiling for Bug#6359. (Bug#6225)
UNSIGNED BIGINT unpacked incorrectly from server-side prepared statement result sets. (Bug#5729)
Added experimental configuration property dontUnpackBinaryResults, which delays unpacking binary result set values until
they're asked for, and only creates object instances for nonnumerical values (it is set to false by default). For some usecase/jvm
combinations, this is friendlier on the garbage collector. (Bug#5706)
Don't throw exceptions for Connection.releaseSavepoint(). (Bug#5706)
Inefficient detection of pre-existing string instances in ResultSet.getNativeString(). (Bug#5706)
Use a per-session Calendar instance by default when decoding dates from ServerPreparedStatements (set to old, less
performant behavior by setting property dynamicCalendars=true). (Bug#5706)
Fixed batched updates with server prepared statements weren't looking if the types had changed for a given batched set of paramet-
ers compared to the previous set, causing the server to return the error Wrong arguments to mysql_stmt_execute(). (Bug#5235)
Handle case when string representation of timestamp contains trailing . with no numbers following it. (Bug#5235)
Server-side prepared statements did not honor zeroDateTimeBehavior property, and would cause class-cast exceptions when
using ResultSet.getObject(), as the all-zero string was always returned. (Bug#5235)
Fix comparisons made between string constants and dynamic strings that are converted with either toUpperCase() or to-
LowerCase() to use Locale.ENGLISH, as some locales override case rules for English. Also use Strin-
gUtils.indexOfIgnoreCase() instead of .toUpperCase().indexOf(), avoids creating a very short-lived transient
String instance.
C.6.3.12. Changes in MySQL Connector/J 3.1.4 (04 September 2004)
Bugs fixed:
Fixed ServerPreparedStatement to read prepared statement metadata off the wire, even though it is currently a placeholder
instead of using MysqlIO.clearInputStream() which didn't work at various times because data wasn't available to read
from the server yet. This fixes sporadic errors users were having with ServerPreparedStatements throwing ArrayIndex-
OutOfBoundExceptions. (Bug#5032)
Added three ways to deal with all-zero datetimes when reading them from a ResultSet: exception (the default), which throws
an SQLException with an SQLState of S1009; convertToNull, which returns NULL instead of the date; and round, which
rounds the date to the nearest closest value which is '0001-01-01'. (Bug#5032)
The driver is more strict about truncation of numerics on ResultSet.get*(), and will throw an SQLException when trunca-
tion is detected. You can disable this by setting jdbcCompliantTruncation to false (it is enabled by default, as this func-
tionality is required for JDBC compliance). (Bug#5032)
You can now use URLs in LOAD DATA LOCAL INFILE statements, and the driver will use Java's built-in handlers for retreiving
the data and sending it to the server. This feature is not enabled by default, you must set the allowUrlInLocalInfile connec-
tion property to true. (Bug#5032)
ResultSet.getObject() doesn't return type Boolean for pseudo-bit types from prepared statements on 4.1.x (shortcut for
avoiding extra type conversion when using binary-encoded result sets obscured test in getObject() for pseudo bit type).
(Bug#5032)
Use com.mysql.jdbc.Message's classloader when loading resource bundle, should fix sporadic issues when the caller's class-
loader can't locate the resource bundle. (Bug#5032)
ServerPreparedStatements dealing with return of DECIMAL type don't work. (Bug#5012)
Track packet sequence numbers if enablePacketDebug=true, and throw an exception if packets received out-of-order.
MySQL Change History
3130
Bug#4689)
ResultSet.wasNull() does not work for primatives if a previous null was returned. (Bug#4689)
Optimized integer number parsing, enable old slower integer parsing using JDK classes via useFastIntParsing=false
property. (Bug#4642)
Added useOnlyServerErrorMessages property, which causes message text in exceptions generated by the server to only
contain the text sent by the server (as opposed to the SQLState's standard description, followed by the server's error message).
This property is set to true by default. (Bug#4642)
ServerPreparedStatement.execute*() sometimes threw ArrayIndexOutOfBoundsException when unpacking
field metadata. (Bug#4642)
Connector/J 3.1.3 beta does not handle integers correctly (caused by changes to support unsigned reads in Buffer.readInt() -
> Buffer.readShort()). (Bug#4510)
Added support in DatabaseMetaData.getTables() and getTableTypes() for views, which are now available in
MySQL server 5.0.x. (Bug#4510)
ResultSet.getObject() returns wrong type for strings when using prepared statements. (Bug#4482)
Calling MysqlPooledConnection.close() twice (even though an application error), caused NPE. Fixed. (Bug#4482)
C.6.3.13. Changes in MySQL Connector/J 3.1.3 (07 July 2004)
Bugs fixed:
Support new time zone variables in MySQL-4.1.3 when useTimezone=true. (Bug#4311)
Error in retrieval of mediumint column with prepared statements and binary protocol. (Bug#4311)
Support for unsigned numerics as return types from prepared statements. This also causes a change in Result-
Set.getObject() for the bigint unsigned type, which used to return BigDecimal instances, it now returns instances of
java.lang.BigInteger. (Bug#4311)
Externalized more messages (on-going effort). (Bug#4119)
Null bitmask sent for server-side prepared statements was incorrect. (Bug#4119)
Added constants for MySQL error numbers (publicly accessible, see com.mysql.jdbc.MysqlErrorNumbers), and the abil-
ity to generate the mappings of vendor error codes to SQLStates that the driver uses (for documentation purposes). (Bug#4119)
Added packet debuging code (see the enablePacketDebug property documentation). (Bug#4119)
Use SQL Standard SQL states by default, unless useSqlStateCodes property is set to false. (Bug#4119)
Mangle output parameter names for CallableStatements so they will not clash with user variable names.
Added support for INOUT parameters in CallableStatements.
C.6.3.14. Changes in MySQL Connector/J 3.1.2 (09 June 2004)
Bugs fixed:
Don't enable server-side prepared statements for server version 5.0.0 or 5.0.1, as they aren't compatible with the '4.1.2+' style that
the driver uses (the driver expects information to come back that isn't there, so it hangs). (Bug#3804)
getWarnings() returns SQLWarning instead of DataTruncation. (Bug#3804)
getProcedureColumns() doesn't work with wildcards for procedure name. (Bug#3540)
MySQL Change History
3131
getProcedures() does not return any procedures in result set. (Bug#3539)
Fixed DatabaseMetaData.getProcedures() when run on MySQL-5.0.0 (output of SHOW PROCEDURE STATUS
changed between 5.0.0 and 5.0.1. (Bug#3520)
Added connectionCollation property to cause driver to issue set collation_connection=... query on connection
init if default collation for given charset is not appropriate. (Bug#3520)
DBMD.getSQLStateType() returns incorrect value. (Bug#3520)
Correctly map output parameters to position given in prepareCall() versus. order implied during registerOutParamet-
er(). (Bug#3146)
Cleaned up detection of server properties. (Bug#3146)
Correctly detect initial character set for servers >= 4.1.0. (Bug#3146)
Support placeholder for parameter metadata for server >= 4.1.2. (Bug#3146)
Added gatherPerformanceMetrics property, along with properties to control when/where this info gets logged (see docs for
more info).
Fixed case when no parameters could cause a NullPointerException in CallableState-
ment.setOutputParameters().
Enabled callable statement caching via cacheCallableStmts property.
Fixed sending of split packets for large queries, enabled nio ability to send large packets as well.
Added .toString() functionality to ServerPreparedStatement, which should help if you're trying to debug a query that
is a prepared statement (it shows SQL as the server would process).
Added logSlowQueries property, along with slowQueriesThresholdMillis property to control when a query should be
considered slow.
Removed wrapping of exceptions in MysqlIO.changeUser().
Fixed stored procedure parameter parsing info when size was specified for a parameter (for example, char(), varchar()).
ServerPreparedStatements weren't actually de-allocating server-side resources when .close() was called.
Fixed case when no output parameters specified for a stored procedure caused a bogus query to be issued to retrieve out parameters,
leading to a syntax error from the server.
C.6.3.15. Changes in MySQL Connector/J 3.1.1 (14 February 2004 alpha)
Bugs fixed:
Use DocBook version of docs for shipped versions of drivers. (Bug#2671)
NULL fields were not being encoded correctly in all cases in server-side prepared statements. (Bug#2671)
Fixed rare buffer underflow when writing numbers into buffers for sending prepared statement execution requests. (Bug#2671)
Fixed ConnectionProperties that weren't properly exposed via accessors, cleaned up ConnectionProperties code.
(Bug#2623)
Class-cast exception when using scrolling result sets and server-side prepared statements. (Bug#2623)
Merged unbuffered input code from 3.0. (Bug#2623)
Enabled streaming of result sets from server-side prepared statements. (Bug#2606)
Server-side prepared statements were not returning datatype YEAR correctly. (Bug#2606)
MySQL Change History
3132
Fixed charset conversion issue in getTables(). (Bug#2502)
Implemented multiple result sets returned from a statement or stored procedure. (Bug#2502)
Implemented Connection.prepareCall(), and DatabaseMetaData. getProcedures() and getProcedure-
Columns(). (Bug#2359)
Merged prepared statement caching, and .getMetaData() support from 3.0 branch. (Bug#2359)
Fixed off-by-1900 error in some cases for years in TimeUtil.fastDate/TimeCreate() when unpacking results from server-
side prepared statements. (Bug#2359)
Reset long binary parameters in ServerPreparedStatement when clearParameters() is called, by sending
COM_RESET_STMT to the server. (Bug#2359)
NULL values for numeric types in binary encoded result sets causing NullPointerExceptions. (Bug#2359)
Display where/why a connection was implicitly closed (to aid debugging). (Bug#1673)
DatabaseMetaData.getColumns() is not returning correct column ordinal info for non-'%' column name patterns.
(Bug#1673)
Fixed NullPointerException in ServerPreparedStatement.setTimestamp(), as well as year and month descre-
pencies in ServerPreparedStatement.setTimestamp(), setDate(). (Bug#1673)
Added ability to have multiple database/JVM targets for compliance and regression/unit tests in build.xml. (Bug#1673)
Fixed sending of queries larger than 16M. (Bug#1673)
Merged fix of datatype mapping from MySQL type FLOAT to java.sql.Types.REAL from 3.0 branch. (Bug#1673)
Fixed NPE and year/month bad conversions when accessing some datetime functionality in ServerPreparedStatements and
their resultant result sets. (Bug#1673)
Added named and indexed input/output parameter support to CallableStatement. MySQL-5.0.x or newer. (Bug#1673)
CommunicationsException implemented, that tries to determine why communications was lost with a server, and displays
possible reasons when .getMessage() is called. (Bug#1673)
Detect collation of column for RSMD.isCaseSensitive(). (Bug#1673)
Optimized Buffer.readLenByteArray() to return shared empty byte array when length is 0.
Fix support for table aliases when checking for all primary keys in UpdatableResultSet.
Unpack unknown data types from server prepared statements as Strings.
Implemented Statement.getWarnings() for MySQL-4.1 and newer (using SHOW WARNINGS).
Ensure that warnings are cleared before executing queries on prepared statements, as-per JDBC spec (now that we support warn-
ings).
Correctly initialize datasource properties from JNDI Refs, including explicitly specified URLs.
Implemented long data (Blobs, Clobs, InputStreams, Readers) for server prepared statements.
Deal with 0-length tokens in EscapeProcessor (caused by callable statement escape syntax).
DatabaseMetaData now reports supportsStoredProcedures() for MySQL versions >= 5.0.0
Support for mysql_change_user(). See the changeUser() method in com.mysql.jdbc.Connection.
Removed useFastDates connection property.
Support for NIO. Use useNIO=true on platforms that support NIO.
Check for closed connection on delete/update/insert row operations in UpdatableResultSet.
MySQL Change History
3133
Support for transaction savepoints (MySQL >= 4.0.14 or 4.1.1).
Support old profileSql capitalization in ConnectionProperties. This property is deprecated, you should use pro-
fileSQL if possible.
Fixed character encoding issues when converting bytes to ASCII when MySQL doesn't provide the character set, and the JVM is set
to a multi-byte encoding (usually affecting retrieval of numeric values).
Centralized setting of result set type and concurrency.
Fixed bug with UpdatableResultSets not using client-side prepared statements.
Default result set type changed to TYPE_FORWARD_ONLY (JDBC compliance).
Fixed IllegalAccessError to Calendar.getTimeInMillis() in DateTimeValue (for JDK < 1.4).
Allow contents of PreparedStatement.setBlob() to be retained between calls to .execute*().
Fixed stack overflow in Connection.prepareCall() (bad merge).
Refactored how connection properties are set and exposed as DriverPropertyInfo as well as Connection and Data-
Source properties.
Reduced number of methods called in average query to be more efficient.
Prepared Statements will be re-prepared on auto-reconnect. Any errors encountered are postponed until first attempt to re-
execute the re-prepared statement.
C.6.3.16. Changes in MySQL Connector/J 3.1.0 (18 February 2003 alpha)
Bugs fixed:
Added useServerPrepStmts property (default false). The driver will use server-side prepared statements when the server
version supports them (4.1 and newer) when this property is set to true. It is currently set to false by default until all bind/fetch
functionality has been implemented. Currently only DML prepared statements are implemented for 4.1 server-side prepared state-
ments.
Added requireSSL property.
Track open Statements, close all when Connection.close() is called (JDBC compliance).
C.6.4. Changes in MySQL Connector/J 3.0.x
C.6.4.1. Changes in MySQL Connector/J 3.0.17 (23 June 2005)
Bugs fixed:
Workaround for server Bug#9098: Default values of CURRENT_* for DATE, TIME, DATETIME, and TIMESTAMP columns can't
be distinguished from string values, so UpdatableResultSet.moveToInsertRow() generates bad SQL for inserting
default values. (Bug#8812)
NON_UNIQUE column from DBMD.getIndexInfo() returned inverted value. (Bug#8812)
EUCKR charset is sent as SET NAMES euc_kr which MySQL-4.1 and newer doesn't understand. (Bug#8629)
Added support for the EUC_JP_Solaris character encoding, which maps to a MySQL encoding of eucjpms (backported from
3.1 branch). This only works on servers that support eucjpms, namely 5.0.3 or later. (Bug#8629)
Use hex escapes for PreparedStatement.setBytes() for double-byte charsets including aliases Windows-31J,
CP934, MS932. (Bug#8629)
MySQL Change History
3134
DatabaseMetaData.supportsSelectForUpdate() returns correct value based on server version. (Bug#8629)
Which requires hex escaping of binary data when using multi-byte charsets with prepared statements. (Bug#8064)
Fixed duplicated code in configureClientCharset() that prevented useOldUTF8Behavior=true from working prop-
erly. (Bug#7952)
Backported SQLState codes mapping from Connector/J 3.1, enable with useSqlStateCodes=true as a connection property, it
defaults to false in this release, so that we don't break legacy applications (it defaults to true starting with Connector/J 3.1).
(Bug#7686)
Timestamp key column data needed _binary stripped for UpdatableResultSet.refreshRow(). (Bug#7686)
MS932, SHIFT_JIS, and Windows_31J not recognized as aliases for sjis. (Bug#7607)
Handle streaming result sets with more than 2 billion rows properly by fixing wraparound of row number counter. (Bug#7601)
PreparedStatement.fixDecimalExponent() adding extra +, making number unparseable by MySQL server.
(Bug#7601)
Escape sequence {fn convert(..., type)} now supports ODBC-style types that are prepended by SQL_. (Bug#7601)
Statements created from a pooled connection were returning physical connection instead of logical connection when getConnec-
tion() was called. (Bug#7316)
Support new protocol type MYSQL_TYPE_VARCHAR. (Bug#7081)
Added useOldUTF8Behavior' configuration property, which causes JDBC driver to act like it did with MySQL-4.0.x and earli-
er when the character encoding is utf-8 when connected to MySQL-4.1 or newer. (Bug#7081)
DatabaseMetaData.getIndexInfo() ignored unique parameter. (Bug#7081)
PreparedStatement.fixDecimalExponent() adding extra +, making number unparseable by MySQL server.
(Bug#7061)
PreparedStatements don't encode Big5 (and other multi-byte) character sets correctly in static SQL strings. (Bug#7033)
Connections starting up failed-over (due to down master) never retry master. (Bug#6966)
Adding CP943 to aliases for sjis. (Bug#6549, Bug#7607)
Timestamp/Time conversion goes in the wrong direction when useTimeZone=true and server time zone differs from client
time zone. (Bug#5874)
C.6.4.2. Changes in MySQL Connector/J 3.0.16 (15 November 2004)
Bugs fixed:
Made TINYINT(1) -> BIT/Boolean conversion configurable via tinyInt1isBit property (default true to be JDBC com-
pliant out of the box). (Bug#5664)
Off-by-one bug in Buffer.readString(string). (Bug#5664)
ResultSet.updateByte() when on insert row throws ArrayOutOfBoundsException. (Bug#5664)
Fixed regression where useUnbufferedInput was defaulting to false. (Bug#5664)
ResultSet.getTimestamp() on a column with TIME in it fails. (Bug#5664)
Fixed DatabaseMetaData.getTypes() returning incorrect (this is, nonnegative) scale for the NUMERIC type. (Bug#5664)
Only set character_set_results during connection establishment if server version >= 4.1.1. (Bug#5664)
Fixed ResultSetMetaData.isReadOnly() to detect nonwritable columns when connected to MySQL-4.1 or newer, based
MySQL Change History
3135
on existence of original table and column names.
Re-issue character set configuration commands when re-using pooled connections and/or Connection.changeUser() when
connected to MySQL-4.1 or newer.
C.6.4.3. Changes in MySQL Connector/J 3.0.15 (04 September 2004)
Bugs fixed:
ResultSet.getMetaData() should not return incorrectly initialized metadata if the result set has been closed, but should in-
stead throw an SQLException. Also fixed for getRow() and getWarnings() and traversal methods by calling check-
Closed() before operating on instance-level fields that are nullified during .close(). (Bug#5069)
Use _binary introducer for PreparedStatement.setBytes() and set*Stream() when connected to MySQL-4.1.x or
newer to avoid misinterpretation during character conversion. (Bug#5069)
Parse new time zone variables from 4.1.x servers. (Bug#5069)
ResultSet should release Field[] instance in .close(). (Bug#5022)
RSMD.getPrecision() returning 0 for nonnumeric types (should return max length in chars for nonbinary types, max length in
bytes for binary types). This fix also fixes mapping of RSMD.getColumnType() and RSMD.getColumnTypeName() for the
BLOB types based on the length sent from the server (the server doesn't distinguish between TINYBLOB, BLOB, MEDIUMBLOB or
LONGBLOB at the network protocol level). (Bug#4880)
Production is now GA (General Availability) in naming scheme of distributions. (Bug#4860, Bug#4138)
DBMD.getColumns() returns incorrect JDBC type for unsigned columns. This affects type mappings for all numeric types in the
RSMD.getColumnType() and RSMD.getColumnTypeNames() methods as well, to ensure that like types from DB-
MD.getColumns() match up with what RSMD.getColumnType() and getColumnTypeNames() return. (Bug#4860,
Bug#4138)
Calling .close() twice on a PooledConnection causes NPE. (Bug#4808)
DOUBLE mapped twice in DBMD.getTypeInfo(). (Bug#4742)
Added FLOSS license exemption. (Bug#4742)
Removed redundant calls to checkRowPos() in ResultSet. (Bug#4334)
Failover for autoReconnect not using port numbers for any hosts, and not retrying all hosts.
Warning
This required a change to the SocketFactory connect() method signature, which is now public Socket
connect(String host, int portNumber, Properties props); therefore, any third-party socket factor-
ies will have to be changed to support this signature.
(Bug#4334)
Logical connections created by MysqlConnectionPoolDataSource will now issue a rollback() when they are closed
and sent back to the pool. If your application server/connection pool already does this for you, you can set the rollbackOn-
PooledClose property to false to avoid the overhead of an extra rollback(). (Bug#4334)
StringUtils.escapeEasternUnicodeByteStream was still broken for GBK. (Bug#4010)
C.6.4.4. Changes in MySQL Connector/J 3.0.14 (28 May 2004)
Bugs fixed:
Fixed URL parsing error.
MySQL Change History
3136
C.6.4.5. Changes in MySQL Connector/J 3.0.13 (27 May 2004)
Bugs fixed:
No Database Selected when using MysqlConnectionPoolDataSource. (Bug#3920)
PreparedStatement.getGeneratedKeys() method returns only 1 result for batched insertions. (Bug#3873)
Using a MySQLDatasource without server name fails. (Bug#3848)
C.6.4.6. Changes in MySQL Connector/J 3.0.12 (18 May 2004)
Bugs fixed:
Inconsistent reporting of data type. The server still doesn't return all types for *BLOBs *TEXT correctly, so the driver won't return
those correctly. (Bug#3570)
UpdatableResultSet not picking up default values for moveToInsertRow(). (Bug#3557)
Not specifying database in URL caused MalformedURL exception. (Bug#3554)
Auto-convert MySQL encoding names to Java encoding names if used for characterEncoding property. (Bug#3554)
Use junit.textui.TestRunner for all unit tests (to allow them to be run from the command line outside of Ant or Eclipse).
(Bug#3554)
Added encoding names that are recognized on some JVMs to fix case where they were reverse-mapped to MySQL encoding names
incorrectly. (Bug#3554)
Made StringRegressionTest 4.1-unicode aware. (Bug#3520)
Fixed regression in PreparedStatement.setString() and eastern character encodings. (Bug#3520)
DBMD.getSQLStateType() returns incorrect value. (Bug#3520)
Renamed StringUtils.escapeSJISByteStream() to more appropriate escapeEasternUnicodeByteStream().
(Bug#3511)
StringUtils.escapeSJISByteStream() not covering all eastern double-byte charsets correctly. (Bug#3511)
Return creating statement for ResultSets created by getGeneratedKeys(). (Bug#2957)
Use SET character_set_results during initialization to allow any charset to be returned to the driver for result sets.
(Bug#2670)
Don't truncate BLOB or CLOB values when using setBytes() and/or setBinary/CharacterStream(). . (Bug#2670)
Dynamically configure character set mappings for field-level character sets on MySQL-4.1.0 and newer using SHOW COLLATION
when connecting. (Bug#2670)
Map binary character set to US-ASCII to support DATETIME charset recognition for servers >= 4.1.2. (Bug#2670)
Use charsetnr returned during connect to encode queries before issuing SET NAMES on MySQL >= 4.1.0. (Bug#2670)
Add helper methods to ResultSetMetaData (getColumnCharacterEncoding() and getColumnCharacterSet())
to allow end-users to see what charset the driver thinks it should be using for the column. (Bug#2670)
Only set character_set_results for MySQL >= 4.1.0. (Bug#2670)
Allow url parameter for MysqlDataSource and MysqlConnectionPool DataSource so that passing of other properties
is possible from inside appservers.
Don't escape SJIS/GBK/BIG5 when using MySQL-4.1 or newer.
MySQL Change History
3137
Backport documentation tooling from 3.1 branch.
Added failOverReadOnly property, to allow end-user to configure state of connection (read-only/writable) when failed over.
Allow java.util.Date to be sent in as parameter to PreparedStatement.setObject(), converting it to a
Timestamp to maintain full precision. . (Bug#103)
Add unsigned attribute to DatabaseMetaData.getColumns() output in the TYPE_NAME column.
Map duplicate key and foreign key errors to SQLState of 23000.
Backported change user and reset server state functionality from 3.1 branch, to allow clients of MysqlConnection-
PoolDataSource to reset server state on getConnection() on a pooled connection.
C.6.4.7. Changes in MySQL Connector/J 3.0.11 (19 February 2004)
Bugs fixed:
Return java.lang.Double for FLOAT type from ResultSetMetaData.getColumnClassName(). (Bug#2855)
Return [B instead of java.lang.Object for BINARY, VARBINARY and LONGVARBINARY types from ResultSet-
MetaData.getColumnClassName() (JDBC compliance). (Bug#2855)
Issue connection events on all instances created from a ConnectionPoolDataSource. (Bug#2855)
Return java.lang.Integer for TINYINT and SMALLINT types from ResultSet-
MetaData.getColumnClassName(). (Bug#2852)
Added useUnbufferedInput parameter, and now use it by default (due to JVM issue ht-
tp://developer.java.sun.com/developer/bugParade/bugs/4401235.html) (Bug#2578)
Fixed failover always going to last host in list. (Bug#2578)
Detect on/off or 1, 2, 3 form of lower_case_table_names value on server. (Bug#2578)
AutoReconnect time was growing faster than exponentially. (Bug#2447)
Trigger a SET NAMES utf8 when encoding is forced to utf8 or utf-8 via the characterEncoding property. Previously,
only the Java-style encoding name of utf-8 would trigger this.
C.6.4.8. Changes in MySQL Connector/J 3.0.10 (13 January 2004)
Bugs fixed:
Enable caching of the parsing stage of prepared statements via the cachePrepStmts, prepStmtCacheSize, and prepSt-
mtCacheSqlLimit properties (disabled by default). (Bug#2006)
Fixed security exception when used in Applets (applets can't read the system property file.encoding which is needed for LOAD
DATA LOCAL INFILE). (Bug#2006)
Speed up parsing of PreparedStatements, try to use one-pass whenever possible. (Bug#2006)
Fixed exception Unknown character set 'danish' on connect with JDK-1.4.0 (Bug#2006)
Fixed mappings in SQLError to report deadlocks with SQLStates of 41000. (Bug#2006)
Removed static synchronization bottleneck from instance factory method of SingleByteCharsetConverter. (Bug#2006)
Removed static synchronization bottleneck from PreparedStatement.setTimestamp(). (Bug#2006)
ResultSet.findColumn() should use first matching column name when there are duplicate column names in SELECT query
(JDBC-compliance). (Bug#2006)
MySQL Change History
3138
maxRows property would affect internal statements, so check it for all statement creation internal to the driver, and set to 0 when it
is not. (Bug#2006)
Use constants for SQLStates. (Bug#2006)
Map charset ko18_ru to ko18r when connected to MySQL-4.1.0 or newer. (Bug#2006)
Ensure that Buffer.writeString() saves room for the \0. (Bug#2006)
ArrayIndexOutOfBounds when parameter number == number of parameters + 1. (Bug#1958)
Connection property maxRows not honored. (Bug#1933)
Statements being created too many times in DBMD.extractForeignKeyFromCreateTable(). (Bug#1925)
Support escape sequence {fn convert ... }. (Bug#1914)
Implement ResultSet.updateClob(). (Bug#1913)
Autoreconnect code didn't set catalog upon reconnect if it had been changed. (Bug#1913)
ResultSet.getObject() on TINYINT and SMALLINT columns should return Java type Integer. (Bug#1913)
Added more descriptive error message Server Configuration Denies Access to DataSource, as well as retrieval
of message from server. (Bug#1913)
ResultSetMetaData.isCaseSensitive() returned wrong value for CHAR/VARCHAR columns. (Bug#1913)
Added alwaysClearStream connection property, which causes the driver to always empty any remaining data on the input
stream before each query. (Bug#1913)
DatabaseMetaData.getSystemFunction() returning bad function VResultsSion. (Bug#1775)
Foreign Keys column sequence is not consistent in
DatabaseMetaData.getImported/Exported/CrossReference(). (Bug#1731)
Fix for ArrayIndexOutOfBounds exception when using Statement.setMaxRows(). (Bug#1695)
Subsequent call to ResultSet.updateFoo() causes NPE if result set is not updatable. (Bug#1630)
Fix for 4.1.1-style authentication with no password. (Bug#1630)
Cross-database updatable result sets are not checked for updatability correctly. (Bug#1592)
DatabaseMetaData.getColumns() should return Types.LONGVARCHAR for MySQL LONGTEXT type. (Bug#1592)
Fixed regression of Statement.getGeneratedKeys() and REPLACE statements. (Bug#1576)
Barge blobs and split packets not being read correctly. (Bug#1576)
Backported fix for aliased tables and UpdatableResultSets in checkUpdatability() method from 3.1 branch.
(Bug#1534)
Friendlier exception message for PacketTooLargeException. (Bug#1534)
Don't count quoted IDs when inside a 'string' in PreparedStatement parsing. (Bug#1511)
C.6.4.9. Changes in MySQL Connector/J 3.0.9 (07 October 2003)
Bugs fixed:
ResultSet.get/setString mashing char 127. (Bug#1247)
Added property to clobber streaming results, by setting the clobberStreamingResults property to true (the default is
MySQL Change History
3139
false). This will cause a streaming ResultSet to be automatically closed, and any oustanding data still streaming from the
server to be discarded if another query is executed before all the data has been read from the server. (Bug#1247)
Added com.mysql.jdbc.util.BaseBugReport to help creation of testcases for bug reports. (Bug#1247)
Backported authentication changes for 4.1.1 and newer from 3.1 branch. (Bug#1247)
Made databaseName, portNumber, and serverName optional parameters for MysqlDataSourceFactory. (Bug#1246)
Optimized CLOB.setChracterStream(). (Bug#1131)
Fixed CLOB.truncate(). (Bug#1130)
Fixed deadlock issue with Statement.setMaxRows(). (Bug#1099)
DatabaseMetaData.getColumns() getting confused about the keyword set in character columns. (Bug#1099)
Clip +/- INF (to smallest and largest representative values for the type in MySQL) and NaN (to 0) for setDouble/setFloat(),
and issue a warning on the statement when the server does not support +/- INF or NaN. (Bug#884)
Don't fire connection closed events when closing pooled connections, or on PooledConnection.getConnection() with
already open connections. (Bug#884)
Double-escaping of '\' when charset is SJIS or GBK and '\' appears in nonescaped input. (Bug#879)
When emptying input stream of unused rows for streaming result sets, have the current thread yield() every 100 rows in order
to not monopolize CPU time. (Bug#879)
Issue exception on ResultSet.getXXX() on empty result set (wasn't caught in some cases). (Bug#848)
Don't hide messages from exceptions thrown in I/O layers. (Bug#848)
Fixed regression in large split-packet handling. (Bug#848)
Better diagnostic error messages in exceptions for streaming result sets. (Bug#848)
Don't change timestamp TZ twice if useTimezone==true. (Bug#774)
Don't wrap SQLExceptions in RowDataDynamic. (Bug#688)
Don't try and reset isolation level on reconnect if MySQL doesn't support them. (Bug#688)
The insertRow in an UpdatableResultSet is now loaded with the default column values when moveToInsertRow() is
called. (Bug#688)
DatabaseMetaData.getColumns() wasn't returning NULL for default values that are specified as NULL. (Bug#688)
Change default statement type/concurrency to TYPE_FORWARD_ONLY and CONCUR_READ_ONLY (spec compliance). (Bug#688)
Fix UpdatableResultSet to return values for getXXX() when on insert row. (Bug#675)
Support InnoDB contraint names when extracting foreign key information in DatabaseMetaData (implementing ideas from
Parwinder Sekhon). (Bug#664, Bug#517)
Backported 4.1 protocol changes from 3.1 branch (server-side SQL states, new field information, larger client capability flags, con-
nect-with-database, and so forth). (Bug#664, Bug#517)
refreshRow didn't work when primary key values contained values that needed to be escaped (they ended up being doubly es-
caped). (Bug#661)
Fixed ResultSet.previous() behavior to move current position to before result set when on first row of result set. (Bug#496)
Fixed Statement and PreparedStatement issuing bogus queries when setMaxRows() had been used and a LIMIT clause
was present in the query. (Bug#496)
Faster date handling code in ResultSet and PreparedStatement (no longer uses Date methods that synchronize on static
calendars).
MySQL Change History
3140
Fixed test for end of buffer in Buffer.readString().
C.6.4.10. Changes in MySQL Connector/J 3.0.8 (23 May 2003)
Bugs fixed:
Fixed SJIS encoding bug, thanks to Naoto Sato. (Bug#378)
Fix problem detecting server character set in some cases. (Bug#378)
Allow multiple calls to Statement.close(). (Bug#378)
Return correct number of generated keys when using REPLACE statements. (Bug#378)
Unicode character 0xFFFF in a string would cause the driver to throw an ArrayOutOfBoundsException. . (Bug#378)
Fix row data decoding error when using very large packets. (Bug#378)
Optimized row data decoding. (Bug#378)
Issue exception when operating on an already closed prepared statement. (Bug#378)
Optimized usage of EscapeProcessor. (Bug#378)
Use JVM charset with file names and LOAD DATA [LOCAL] INFILE.
Fix infinite loop with Connection.cleanup().
Changed Ant target compile-core to compile-driver, and made testsuite compilation a separate target.
Fixed result set not getting set for Statement.executeUpdate(), which affected getGeneratedKeys() and getUp-
dateCount() in some cases.
Return list of generated keys when using multi-value INSERTS with Statement.getGeneratedKeys().
Allow bogus URLs in Driver.getPropertyInfo().
C.6.4.11. Changes in MySQL Connector/J 3.0.7 (08 April 2003)
Bugs fixed:
Fixed charset issues with database metadata (charset was not getting set correctly).
You can now toggle profiling on/off using Connection.setProfileSql(boolean).
4.1 Column Metadata fixes.
Fixed MysqlPooledConnection.close() calling wrong event type.
Fixed StringIndexOutOfBoundsException in PreparedStatement.setClob().
IOExceptions during a transaction now cause the Connection to be closed.
Remove synchronization from Driver.connect() and Driver.acceptsUrl().
Fixed missing conversion for YEAR type in ResultSetMetaData.getColumnTypeName().
Updatable ResultSets can now be created for aliased tables/columns when connected to MySQL-4.1 or newer.
Fixed LOAD DATA LOCAL INFILE bug when file > max_allowed_packet.
Don't pick up indexes that start with pri as primary keys for DBMD.getPrimaryKeys().
MySQL Change History
3141
Ensure that packet size from alignPacketSize() does not exceed max_allowed_packet (JVM bug)
Don't reset Connection.isReadOnly() when autoReconnecting.
Fixed escaping of 0x5c ('\') character for GBK and Big5 charsets.
Fixed ResultSet.getTimestamp() when underlying field is of type DATE.
Throw SQLExceptions when trying to do operations on a forcefully closed Connection (that is, when a communication link
failure occurs).
C.6.4.12. Changes in MySQL Connector/J 3.0.6 (18 February 2003)
Bugs fixed:
Backported 4.1 charset field info changes from Connector/J 3.1.
Fixed Statement.setMaxRows() to stop sending LIMIT type queries when not needed (performance).
Fixed DBMD.getTypeInfo() and DBMD.getColumns() returning different value for precision in TEXT and BLOB types.
Fixed SQLExceptions getting swallowed on initial connect.
Fixed ResultSetMetaData to return "" when catalog not known. Fixes NullPointerExceptions with Sun's Cached-
RowSet.
Allow ignoring of warning for non transactional tables during rollback (compliance/usability) by setting ignoreNonTxTables
property to true.
Clean up Statement query/method mismatch tests (that is, INSERT not allowed with .executeQuery()).
Fixed ResultSetMetaData.isWritable() to return correct value.
More checks added in ResultSet traversal method to catch when in closed state.
Implemented Blob.setBytes(). You still need to pass the resultant Blob back into an updatable ResultSet or Prepared-
Statement to persist the changes, because MySQL does not support locators.
Add window of different NULL sorting behavior to DBMD.nullsAreSortedAtStart (4.0.2 to 4.0.10, true; otherwise, no).
C.6.4.13. Changes in MySQL Connector/J 3.0.5 (22 January 2003)
Bugs fixed:
Fixed ResultSet.isBeforeFirst() for empty result sets.
Added missing LONGTEXT type to DBMD.getColumns().
Implemented an empty TypeMap for Connection.getTypeMap() so that some third-party apps work with MySQL (IBM
WebSphere 5.0 Connection pool).
Added update options for foreign key metadata.
Fixed Buffer.fastSkipLenString() causing ArrayIndexOutOfBounds exceptions with some queries when unpack-
ing fields.
Quote table names in DatabaseMetaData.getColumns(), getPrimaryKeys(), getIndexInfo(), getBestRow-
Identifier().
Retrieve TX_ISOLATION from database for Connection.getTransactionIsolation() when the MySQL version sup-
ports it, instead of an instance variable.
MySQL Change History
3142
Greatly reduce memory required for setBinaryStream() in PreparedStatements.
C.6.4.14. Changes in MySQL Connector/J 3.0.4 (06 January 2003)
Bugs fixed:
Streamlined character conversion and byte[] handling in PreparedStatements for setByte().
Fixed PreparedStatement.executeBatch() parameter overwriting.
Added quoted identifiers to database names for Connection.setCatalog.
Added support for 4.0.8-style large packets.
Reduce memory footprint of PreparedStatements by sharing outbound packet with MysqlIO.
Added strictUpdates property to allow control of amount of checking for correctness of updatable result sets. Set this to
false if you want faster updatable result sets and you know that you create them from SELECT statements on tables with primary
keys and that you have selected all primary keys in your query.
Added support for quoted identifiers in PreparedStatement parser.
C.6.4.15. Changes in MySQL Connector/J 3.0.3 (17 December 2002)
Bugs fixed:
Allow user to alter behavior of Statement/ PreparedStatement.executeBatch() via continueBatchOnError
property (defaults to true).
More robust escape tokenizer: Recognize -- comments, and allow nested escape sequences (see test-
suite.EscapeProcessingTest).
Fixed Buffer.isLastDataPacket() for 4.1 and newer servers.
NamedPipeSocketFactory now works (only intended for Windows), see README for instructions.
Changed charsToByte in SingleByteCharConverter to be nonstatic.
Use nonaliased table/column names and database names to fully qualify tables and columns in UpdatableResultSet (requires
MySQL-4.1 or newer).
LOAD DATA LOCAL INFILE ... now works, if your server is configured to allow it. Can be turned off with the allow-
LoadLocalInfile property (see the README).
Implemented Connection.nativeSQL().
Fixed ResultSetMetaData.getColumnTypeName() returning BLOB for TEXT and TEXT for BLOB types.
Fixed charset handling in Fields.java.
Because of above, implemented ResultSetMetaData.isAutoIncrement() to use Field.isAutoIncrement().
Substitute '?' for unknown character conversions in single-byte character sets instead of '\0'.
Added CLIENT_LONG_FLAG to be able to get more column flags (isAutoIncrement() being the most important).
Honor lower_case_table_names when enabled in the server when doing table name comparisons in DatabaseMetaData
methods.
DBMD.getImported/ExportedKeys() now handles multiple foreign keys per table.
More robust implementation of updatable result sets. Checks that all primary keys of the table have been selected.
MySQL Change History
3143
Some MySQL-4.1 protocol support (extended field info from selects).
Check for connection closed in more Connection methods (createStatement, prepareStatement, setTransac-
tionIsolation, setAutoCommit).
Fixed ResultSetMetaData.getPrecision() returning incorrect values for some floating-point types.
Changed SingleByteCharConverter to use lazy initialization of each converter.
C.6.4.16. Changes in MySQL Connector/J 3.0.2 (08 November 2002)
Bugs fixed:
Implemented Clob.setString().
Added com.mysql.jdbc.MiniAdmin class, which allows you to send shutdown command to MySQL server. This is inten-
ded to be used when embedding Java and MySQL server together in an end-user application.
Added SSL support. See README for information on how to use it.
All DBMD result set columns describing schemas now return NULL to be more compliant with the behavior of other JDBC drivers
for other database systems (MySQL does not support schemas).
Use SHOW CREATE TABLE when possible for determining foreign key information for DatabaseMetaData. Also allows cas-
cade options for DELETE information to be returned.
Implemented Clob.setCharacterStream().
Failover and autoReconnect work only when the connection is in an autoCommit(false) state, in order to stay transaction-
safe.
Fixed DBMD.supportsResultSetConcurrency() so that it returns true for Result-
Set.TYPE_SCROLL_INSENSITIVE and ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.
Implemented Clob.setAsciiStream().
Removed duplicate code from UpdatableResultSet (it can be inherited from ResultSet, the extra code for each method to
handle updatability I thought might someday be necessary has not been needed).
Fixed UnsupportedEncodingException thrown when forcing a character encoding via properties.
Fixed incorrect conversion in ResultSet.getLong().
Implemented ResultSet.updateBlob().
Removed some not-needed temporary object creation by smarter use of Strings in EscapeProcessor, Connection and
DatabaseMetaData classes.
Escape 0x5c character in strings for the SJIS charset.
PreparedStatement now honors stream lengths in setBinary/Ascii/Character Stream() unless you set the connection property
useStreamLengthsInPrepStmts to false.
Fixed issue with updatable result sets and PreparedStatements not working.
Fixed start position off-by-1 error in Clob.getSubString().
Added connectTimeout parameter that allows users of JDK-1.4 and newer to specify a maximum time to wait to establish a
connection.
Fixed various non-ASCII character encoding issues.
Fixed ResultSet.isLast() for empty result sets (should return false).
MySQL Change History
3144
Added driver property useHostsInPrivileges. Defaults to true. Affects whether or not @hostname will be used in DB-
MD.getColumn/TablePrivileges.
Fixed ResultSet.setFetchDirection(FETCH_UNKNOWN).
Added queriesBeforeRetryMaster property that specifies how many queries to issue when failed over before attempting to
reconnect to the master (defaults to 50).
Fixed issue when calling Statement.setFetchSize() when using arbitrary values.
Properly restore connection properties when autoReconnecting or failing-over, including autoCommit state, and isolation level.
Implemented Clob.truncate().
C.6.4.17. Changes in MySQL Connector/J 3.0.1 (21 September 2002)
Bugs fixed:
Charsets now automatically detected. Optimized code for single-byte character set conversion.
Fixed ResultSetMetaData.isSigned() for TINYINT and BIGINT.
Fixed RowDataStatic.getAt() off-by-one bug.
Fixed ResultSet.getRow() off-by-one bug.
Massive code clean-up to follow Java coding conventions (the time had come).
Implemented ResultSet.getCharacterStream().
Added limited Clob functionality (ResultSet.getClob(), PreparedStatemtent.setClob(), PreparedState-
ment.setObject(Clob).
Connection.isClosed() no longer pings the server.
Connection.close() issues rollback() when getAutoCommit() is false.
Added socketTimeout parameter to URL.
Added LOCAL TEMPORARY to table types in DatabaseMetaData.getTableTypes().
Added paranoid parameter, which sanitizes error messages by removing sensitive information from them (such as host names,
ports, or user names), as well as clearing sensitive data structures when possible.
C.6.4.18. Changes in MySQL Connector/J 3.0.0 (31 July 2002)
Bugs fixed:
General source-code cleanup.
The driver now only works with JDK-1.2 or newer.
Fix and sort primary key names in DBMetaData (SF bugs 582086 and 582086).
ResultSet.getTimestamp() now works for DATE types (SF bug 559134).
Float types now reported as java.sql.Types.FLOAT (SF bug 579573).
Support for streaming (row-by-row) result sets (see README) Thanks to Doron.
Testsuite now uses Junit (which you can get from http://www.junit.org.
MySQL Change History
3145
JDBC Compliance: Passes all tests besides stored procedure tests.
ResultSet.getDate/Time/Timestamp now recognizes all forms of invalid values that have been set to all zeros by
MySQL (SF bug 586058).
Added multi-host failover support (see README).
Repackaging: New driver name is com.mysql.jdbc.Driver, old name still works, though (the driver is now provided by
MySQL-AB).
Support for large packets (new addition to MySQL-4.0 protocol), see README for more information.
Better checking for closed connections in Statement and PreparedStatement.
Performance improvements in string handling and field metadata creation (lazily instantiated) contributed by Alex Twisleton-Wyke-
ham-Fiennes.
JDBC-3.0 functionality including Statement/PreparedStatement.getGeneratedKeys() and Result-
Set.getURL().
Overall speed improvements via controlling transient object creation in MysqlIO class when reading packets.
!!! LICENSE CHANGE !!! The driver is now GPL. If you need non-GPL licenses, please contact me <[email protected]>.
Performance enchancements: Driver is now 50100% faster in most situations, and creates fewer temporary objects.
C.6.5. Changes in MySQL Connector/J 2.0.x
C.6.5.1. Changes in MySQL Connector/J 2.0.14 (16 May 2002)
Bugs fixed:
ResultSet.getDouble() now uses code built into JDK to be more precise (but slower).
Fixed typo for relaxAutoCommit parameter.
LogicalHandle.isClosed() calls through to physical connection.
Added SQL profiling (to STDERR). Set profileSql=true in your JDBC URL. See README for more information.
PreparedStatement now releases resources on .close(). (SF bug 553268)
More code cleanup.
Quoted identifiers not used if server version does not support them. Also, if server started with --ansi or -
-sql-mode=ANSI_QUOTES, " will be used as an identifier quote character, otherwise ' will be used.
C.6.5.2. Changes in MySQL Connector/J 2.0.13 (24 April 2002)
Bugs fixed:
Fixed unicode chars being read incorrectly. (SF bug 541088)
Faster blob escaping for PrepStmt.
Added setURL() to MySQLXADataSource. (SF bug 546019)
Added set/getPortNumber() to DataSource(s). (SF bug 548167)
PreparedStatement.toString() fixed. (SF bug 534026)
More code cleanup.
MySQL Change History
3146
Rudimentary version of Statement.getGeneratedKeys() from JDBC-3.0 now implemented (you need to be using JDK-1.4
for this to work, I believe).
DBMetaData.getIndexInfo() - bad PAGES fixed. (SF BUG 542201)
ResultSetMetaData.getColumnClassName() now implemented.
C.6.5.3. Changes in MySQL Connector/J 2.0.12 (07 April 2002)
Bugs fixed:
Fixed testsuite.Traversal afterLast() bug, thanks to Igor Lastric.
Added new types to getTypeInfo(), fixed existing types thanks to Al Davis and Kid Kalanon.
Fixed time zone off-by-1-hour bug in PreparedStatement (538286, 528785).
Added identifier quoting to all DatabaseMetaData methods that need them (should fix 518108).
Added support for BIT types (51870) to PreparedStatement.
ResultSet.insertRow() should now detect auto_increment fields in most cases and use that value in the new row. This de-
tection will not work in multi-valued keys, however, due to the fact that the MySQL protocol does not return this information.
Relaxed synchronization in all classes, should fix 520615 and 520393.
DataSources - fixed setUrl bug (511614, 525565), wrong datasource class name (532816, 528767).
Added support for YEAR type (533556).
Fixes for ResultSet updatability in PreparedStatement.
ResultSet: Fixed updatability (values being set to null if not updated).
Added getTable/ColumnPrivileges() to DBMD (fixes 484502).
Added getIdleFor() method to Connection and MysqlLogicalHandle.
ResultSet.refreshRow() implemented.
Fixed getRow() bug (527165) in ResultSet.
General code cleanup.
C.6.5.4. Changes in MySQL Connector/J 2.0.11 (27 January 2002)
Bugs fixed:
Full synchronization of Statement.java.
Fixed missing DELETE_RULE value in DBMD.getImported/ExportedKeys() and getCrossReference().
More changes to fix Unexpected end of input stream errors when reading BLOB values. This should be the last fix.
C.6.5.5. Changes in MySQL Connector/J 2.0.10 (24 January 2002)
Bugs fixed:
Fixed null-pointer-exceptions when using MysqlConnectionPoolDataSource with Websphere 4 (bug 505839).
MySQL Change History
3147
Fixed spurious Unexpected end of input stream errors in MysqlIO (bug 507456).
C.6.5.6. Changes in MySQL Connector/J 2.0.9 (13 January 2002)
Bugs fixed:
Fixed extra memory allocation in MysqlIO.readPacket() (bug 488663).
Added detection of network connection being closed when reading packets (thanks to Todd Lizambri).
Fixed casting bug in PreparedStatement (bug 488663).
DataSource implementations moved to org.gjt.mm.mysql.jdbc2.optional package, and (initial) implementations of
PooledConnectionDataSource and XADataSource are in place (thanks to Todd Wolff for the implementation and testing
of PooledConnectionDataSource with IBM WebSphere 4).
Fixed quoting error with escape processor (bug 486265).
Removed concatenation support from driver (the || operator), as older versions of VisualAge seem to be the only thing that use it,
and it conflicts with the logical || operator. You will need to start mysqld with the --ansi flag to use the || operator as concat-
enation (bug 491680).
Ant build was corrupting included jar files, fixed (bug 487669).
Report batch update support through DatabaseMetaData (bug 495101).
Implementation of DatabaseMetaData.getExported/ImportedKeys() and getCrossReference().
Fixed off-by-one-hour error in PreparedStatement.setTimestamp() (bug 491577).
Full synchronization on methods modifying instance and class-shared references, driver should be entirely thread-safe now (please
let me know if you have problems).
C.6.5.7. Changes in MySQL Connector/J 2.0.8 (25 November 2001)
Bugs fixed:
XADataSource/ConnectionPoolDataSource code (experimental)
DatabaseMetaData.getPrimaryKeys() and getBestRowIdentifier() are now more robust in identifying primary
keys (matches regardless of case or abbreviation/full spelling of Primary Key in Key_type column).
Batch updates now supported (thanks to some inspiration from Daniel Rall).
PreparedStatement.setAnyNumericType() now handles positive exponents correctly (adds + so MySQL can under-
stand it).
C.6.5.8. Changes in MySQL Connector/J 2.0.7 (24 October 2001)
Bugs fixed:
Character sets read from database if useUnicode=true and characterEncoding is not set. (thanks to Dmitry
Vereshchagin)
Initial transaction isolation level read from database (if available). (thanks to Dmitry Vereshchagin)
Fixed PreparedStatement generating SQL that would end up with syntax errors for some queries.
PreparedStatement.setCharacterStream() now implemented
MySQL Change History
3148
Captialize type names when captializeTypeNames=true is passed in URL or properties (for WebObjects. (thanks to Anjo
Krank)
ResultSet.getBlob() now returns null if column value was null.
Fixed ResultSetMetaData.getPrecision() returning one less than actual on newer versions of MySQL.
Fixed dangling socket problem when in high availability (autoReconnect=true) mode, and finalizer for Connection will
close any dangling sockets on GC.
Fixed time zone issue in PreparedStatement.setTimestamp(). (thanks to Erik Olofsson)
PreparedStatement.setDouble() now uses full-precision doubles (reverting a fix made earlier to truncate them).
Fixed DatabaseMetaData.supportsTransactions(), and supportsTransactionIsolationLevel() and
getTypeInfo() SQL_DATETIME_SUB and SQL_DATA_TYPE fields not being readable.
Updatable result sets now correctly handle NULL values in fields.
PreparedStatement.setBoolean() will use 1/0 for values if your MySQL version is 3.21.23 or higher.
Fixed ResultSet.isAfterLast() always returning false.
C.6.5.9. Changes in MySQL Connector/J 2.0.6 (16 June 2001)
Bugs fixed:
Fixed PreparedStatement parameter checking.
Fixed case-sensitive column names in ResultSet.java.
C.6.5.10. Changes in MySQL Connector/J 2.0.5 (13 June 2001)
Bugs fixed:
ResultSet.insertRow() works now, even if not all columns are set (they will be set to NULL).
Added Byte to PreparedStatement.setObject().
Fixed data parsing of TIMESTAMP values with 2-digit years.
Added ISOLATION level support to Connection.setIsolationLevel()
DataBaseMetaData.getCrossReference() no longer ArrayIndexOOB.
ResultSet.getBoolean() now recognizes -1 as true.
ResultSet has +/-Inf/inf support.
getObject() on ResultSet correctly does TINYINT->Byte and SMALLINT->Short.
Fixed ResultSetMetaData.getColumnTypeName for TEXT/BLOB.
Fixed ArrayIndexOutOfBounds when sending large BLOB queries. (Max size packet was not being set)
Fixed NPE on PreparedStatement.executeUpdate() when all columns have not been set.
Fixed ResultSet.getBlob() ArrayIndex out-of-bounds.
C.6.5.11. Changes in MySQL Connector/J 2.0.3 (03 December 2000)
MySQL Change History
3149
Bugs fixed:
Fixed composite key problem with updatable result sets.
Faster ASCII string operations.
Fixed off-by-one error in java.sql.Blob implementation code.
Fixed incorrect detection of MAX_ALLOWED_PACKET, so sending large blobs should work now.
Added detection of -/+INF for doubles.
Added ultraDevHack URL parameter, set to true to allow (broken) Macromedia UltraDev to use the driver.
Implemented getBigDecimal() without scale component for JDBC2.
C.6.5.12. Changes in MySQL Connector/J 2.0.1 (06 April 2000)
Bugs fixed:
Columns that are of type TEXT now return as Strings when you use getObject().
Cleaned up exception handling when driver connects.
Fixed RSMD.isWritable() returning wrong value. Thanks to Moritz Maass.
DatabaseMetaData.getPrimaryKeys() now works correctly with respect to key_seq. Thanks to Brian Slesinsky.
Fixed many JDBC-2.0 traversal, positioning bugs, especially with respect to empty result sets. Thanks to Ron Smits, Nick Brook,
Cessar Garcia and Carlos Martinez.
No escape processing is done on PreparedStatements anymore per JDBC spec.
Fixed some issues with updatability support in ResultSet when using multiple primary keys.
C.6.5.13. Changes in MySQL Connector/J 2.0.0pre5 (21 February 2000)
Fixed Bad Handshake problem.
C.6.5.14. Changes in MySQL Connector/J 2.0.0pre4 (10 January 2000)
Fixes to ResultSet for insertRow() - Thanks to Cesar Garcia
Fix to Driver to recognize JDBC-2.0 by loading a JDBC-2.0 class, instead of relying on JDK version numbers. Thanks to John
Baker.
Fixed ResultSet to return correct row numbers
Statement.getUpdateCount() now returns rows matched, instead of rows actually updated, which is more SQL-92 like.
10-29-99
Statement/PreparedStatement.getMoreResults() bug fixed. Thanks to Noel J. Bergman.
Added Short as a type to PreparedStatement.setObject(). Thanks to Jeff Crowder
Driver now automagically configures maximum/preferred packet sizes by querying server.
MySQL Change History
3150
Autoreconnect code uses fast ping command if server supports it.
Fixed various bugs with respect to packet sizing when reading from the server and when alloc'ing to write to the server.
C.6.5.15. Changes in MySQL Connector/J 2.0.0pre (17 August 1999)
Now compiles under JDK-1.2. The driver supports both JDK-1.1 and JDK-1.2 at the same time through a core set of classes. The
driver will load the appropriate interface classes at runtime by figuring out which JVM version you are using.
Fixes for result sets with all nulls in the first row. (Pointed out by Tim Endres)
Fixes to column numbers in SQLExceptions in ResultSet (Thanks to Blas Rodriguez Somoza)
The database no longer needs to specified to connect. (Thanks to Christian Motschke)
C.6.6. Changes in MySQL Connector/J 1.2b (04 July 1999)
Better Documentation (in progress), in doc/mm.doc/book1.html
DBMD now allows null for a column name pattern (not in spec), which it changes to '%'.
DBMD now has correct types/lengths for getXXX().
ResultSet.getDate(), getTime(), and getTimestamp() fixes. (contributed by Alan Wilken)
EscapeProcessor now handles \{ \} and { or } inside quotes correctly. (thanks to Alik for some ideas on how to fix it)
Fixes to properties handling in Connection. (contributed by Juho Tikkala)
ResultSet.getObject() now returns null for NULL columns in the table, rather than bombing out. (thanks to Ben Grosman)
ResultSet.getObject() now returns Strings for types from MySQL that it doesn't know about. (Suggested by Chris Perdue)
Removed DataInput/Output streams, not needed, 1/2 number of method calls per IO operation.
Use default character encoding if one is not specified. This is a work-around for broken JVMs, because according to spec, EVERY
JVM must support "ISO8859_1", but they do not.
Fixed Connection to use the platform character encoding instead of "ISO8859_1" if one isn't explicitly set. This fixes problems
people were having loading the character- converter classes that didn't always exist (JVM bug). (thanks to Fritz Elfert for pointing
out this problem)
Changed MysqlIO to re-use packets where possible to reduce memory usage.
Fixed escape-processor bugs pertaining to {} inside quotes.
C.6.7. Changes in MySQL Connector/J 1.2.x and lower
C.6.7.1. Changes in MySQL Connector/J 1.2a (14 April 1999)
Fixed character-set support for non-Javasoft JVMs (thanks to many people for pointing it out)
Fixed ResultSet.getBoolean() to recognize 'y' & 'n' as well as '1' & '0' as boolean flags. (thanks to Tim Pizey)
Fixed ResultSet.getTimestamp() to give better performance. (thanks to Richard Swift)
Fixed getByte() for numeric types. (thanks to Ray Bellis)
Fixed DatabaseMetaData.getTypeInfo() for DATE type. (thanks to Paul Johnston)
MySQL Change History
3151
Fixed EscapeProcessor for "fn" calls. (thanks to Piyush Shah at locomotive.org)
Fixed EscapeProcessor to not do extraneous work if there are no escape codes. (thanks to Ryan Gustafson)
Fixed Driver to parse URLs of the form "jdbc:mysql://host:port" (thanks to Richard Lobb)
C.6.7.2. Changes in MySQL Connector/J 1.1i (24 March 1999)
Fixed Timestamps for PreparedStatements
Fixed null pointer exceptions in RSMD and RS
Re-compiled with jikes for valid class files (thanks ms!)
C.6.7.3. Changes in MySQL Connector/J 1.1h (08 March 1999)
Fixed escape processor to deal with unmatched { and } (thanks to Craig Coles)
Fixed escape processor to create more portable (between DATETIME and TIMESTAMP types) representations so that it will work
with BETWEEN clauses. (thanks to Craig Longman)
MysqlIO.quit() now closes the socket connection. Before, after many failed connections some OS's would run out of file descriptors.
(thanks to Michael Brinkman)
Fixed NullPointerException in Driver.getPropertyInfo. (thanks to Dave Potts)
Fixes to MysqlDefs to allow all *text fields to be retrieved as Strings. (thanks to Chris at Leverage)
Fixed setDouble in PreparedStatement for large numbers to avoid sending scientific notation to the database. (thanks to J.S. Fer-
guson)
Fixed getScale() and getPrecision() in RSMD. (contrib'd by James Klicman)
Fixed getObject() when field was DECIMAL or NUMERIC (thanks to Bert Hobbs)
DBMD.getTables() bombed when passed a null table-name pattern. Fixed. (thanks to Richard Lobb)
Added check for "client not authorized" errors during connect. (thanks to Hannes Wallnoefer)
C.6.7.4. Changes in MySQL Connector/J 1.1g (19 February 1999)
Result set rows are now byte arrays. Blobs and Unicode work bidriectonally now. The useUnicode and encoding options are imple-
mented now.
Fixes to PreparedStatement to send binary set by setXXXStream to be sent untouched to the MySQL server.
Fixes to getDriverPropertyInfo().
C.6.7.5. Changes in MySQL Connector/J 1.1f (31 December 1998)
Changed all ResultSet fields to Strings, this should allow Unicode to work, but your JVM must be able to convert between the char-
acter sets. This should also make reading data from the server be a bit quicker, because there is now no conversion from StringBuf-
fer to String.
Changed PreparedStatement.streamToString() to be more efficient (code from Uwe Schaefer).
URL parsing is more robust (throws SQL exceptions on errors rather than NullPointerExceptions)
MySQL Change History
3152
PreparedStatement now can convert Strings to Time/Date values via setObject() (code from Robert Currey).
IO no longer hangs in Buffer.readInt(), that bug was introduced in 1.1d when changing to all byte-arrays for result sets. (Pointed out
by Samo Login)
C.6.7.6. Changes in MySQL Connector/J 1.1b (03 November 1998)
Fixes to DatabaseMetaData to allow both IBM VA and J-Builder to work. Let me know how it goes. (thanks to Jac Kersing)
Fix to ResultSet.getBoolean() for NULL strings (thanks to Barry Lagerweij)
Beginning of code cleanup, and formatting. Getting ready to branch this off to a parallel JDBC-2.0 source tree.
Added "final" modifier to critical sections in MysqlIO and Buffer to allow compiler to inline methods for speed.
9-29-98
If object references passed to setXXX() in PreparedStatement are null, setNull() is automatically called for you. (Thanks for the sug-
gestion goes to Erik Ostrom)
setObject() in PreparedStatement will now attempt to write a serialized representation of the object to the database for objects of
Types.OTHER and objects of unknown type.
Util now has a static method readObject() which given a ResultSet and a column index will re-instantiate an object serialized in the
above manner.
C.6.7.7. Changes in MySQL Connector/J 1.1 (02 September 1998)
Got rid of "ugly hack" in MysqlIO.nextRow(). Rather than catch an exception, Buffer.isLastDataPacket() was fixed.
Connection.getCatalog() and Connection.setCatalog() should work now.
Statement.setMaxRows() works, as well as setting by property maxRows. Statement.setMaxRows() overrides maxRows set via
properties or url parameters.
Automatic re-connection is available. Because it has to "ping" the database before each query, it is turned off by default. To use it,
pass in "autoReconnect=true" in the connection URL. You may also change the number of reconnect tries, and the initial timeout
value via "maxReconnects=n" (default 3) and "initialTimeout=n" (seconds, default 2) parameters. The timeout is an exponential
backoff type of timeout; for example, if you have initial timeout of 2 seconds, and maxReconnects of 3, then the driver will timeout
2 seconds, 4 seconds, then 16 seconds between each re-connection attempt.
C.6.7.8. Changes in MySQL Connector/J 1.0 (24 August 1998)
Fixed handling of blob data in Buffer.java
Fixed bug with authentication packet being sized too small.
The JDBC Driver is now under the LPGL
8-14-98
Fixed Buffer.readLenString() to correctly read data for BLOBS.
Fixed PreparedStatement.stringToStream to correctly read data for BLOBS.
Fixed PreparedStatement.setDate() to not add a day. (above fixes thanks to Vincent Partington)
MySQL Change History
3153
Added URL parameter parsing (?user=... and so forth).
C.6.7.9. Changes in MySQL Connector/J 0.9d (04 August 1998)
Big news! New package name. Tim Endres from ICE Engineering is starting a new source tree for GNU GPL'd Java software. He's
graciously given me the org.gjt.mm package directory to use, so now the driver is in the org.gjt.mm.mysql package scheme. I'm "leg-
al" now. Look for more information on Tim's project soon.
Now using dynamically sized packets to reduce memory usage when sending commands to the DB.
Small fixes to getTypeInfo() for parameters, and so forth.
DatabaseMetaData is now fully implemented. Let me know if these drivers work with the various IDEs out there. I've heard that
they're working with JBuilder right now.
Added JavaDoc documentation to the package.
Package now available in .zip or .tar.gz.
C.6.7.10. Changes in MySQL Connector/J 0.9 (28 July 1998)
Implemented getTypeInfo(). Connection.rollback() now throws an SQLException per the JDBC spec.
Added PreparedStatement that supports all JDBC API methods for PreparedStatement including InputStreams. Please check this out
and let me know if anything is broken.
Fixed a bug in ResultSet that would break some queries that only returned 1 row.
Fixed bugs in DatabaseMetaData.getTables(), DatabaseMetaData.getColumns() and DatabaseMetaData.getCatalogs().
Added functionality to Statement that allows executeUpdate() to store values for IDs that are automatically generated for
AUTO_INCREMENT fields. Basically, after an executeUpdate(), look at the SQLWarnings for warnings like
"LAST_INSERTED_ID = 'some number', COMMAND = 'your SQL query'". If you are using AUTO_INCREMENT fields in your
tables and are executing a lot of executeUpdate()s on one Statement, be sure to clearWarnings() every so often to save memory.
C.6.7.11. Changes in MySQL Connector/J 0.8 (06 July 1998)
Split MysqlIO and Buffer to separate classes. Some ClassLoaders gave an IllegalAccess error for some fields in those two classes.
Now mm.mysql works in applets and all classloaders. Thanks to Joe Ennis <[email protected]> for pointing out the problem and
working on a fix with me.
C.6.7.12. Changes in MySQL Connector/J 0.7 (01 July 1998)
Fixed DatabaseMetadata problems in getColumns() and bug in switch statement in the Field constructor. Thanks to Costin Mano-
lache <[email protected]> for pointing these out.
C.6.7.13. Changes in MySQL Connector/J 0.6 (21 May 1998)
Incorporated efficiency changes from Richard Swift <[email protected]> in MysqlIO.java and ResultSet.java:
We're now 15% faster than gwe's driver.
Started working on DatabaseMetaData.
The following methods are implemented:
MySQL Change History
3154
getTables()
getTableTypes()
getColumns()
getCatalogs()
C.7. MySQL Connector/MXJ Change History
C.7.1. Changes in MySQL Connector/MXJ 5.0.6 (04 May 2007)
Functionality added or changed:
Updated internal jar file names to include version information and be more consistent with Connector/J jar naming. For example,
connector-mxj.jar is now mysql-connector-mxj-${mxj-version}.jar.
Updated commercial license files.
Added copyright notices to some classes which were missing them.
Added InitializeUser and QueryUtil classes to support new feature.
Added new tests for initial-user & expanded some existing tests.
ConnectorMXJUrlTestExample and ConnectorMXJObjectTestExample now demonstrate the initialization of user/
password and creating the initial database (rather than using "test").
Added new connection property initialize-user which, if set to true will remove the default, un-passworded anonymous
and root users, and create the user/password from the connection url.
Removed obsolete field SimpleMysqldDynamicMBean.lastInvocation.
Clarified code in DefaultsMap.entrySet().
Removed obsolete PatchedStandardSocketFactory java file.
Added main(String[]) to com/mysql/management/AllTestsSuite.java.
Errors reading portFile are now reported using stacktrace(err), previously System.err was used.
portFile now contains a new-line to be consistent with pidFile.
Fixed where versionString.trim() was ignored.
Removed references to File.deleteOnExit, a warning is printed instead.
Bugs fixed:
Changed tests to shutdown mysqld prior to deleting files.
Fixed port file to always be writen to datadir.
Added os.name-os.arch to resource directory mapping properties file.
Swapped out commercial binaries for v5.0.40.
Delete portFile on shutdown.
Moved platform-map.properties into db-files.jar.
MySQL Change History
3155
Clarified the startup max wait numbers.
Updated build.xml in preperation for next beta build.
Removed use-default-architecture property replaced.
Added null-check to deal with C/MXJ being loaded by the bootstrap classloaders with JVMs for which getClassLoader() re-
turns null.
Added robustness around reading portfile.
Removed PatchedStandardSocketFactory (fixed in Connetor/J 5.0.6).
Refactored duplication from tests and examples to QueryUtil.
Removed obsolete InitializePasswordExample
C.7.2. Changes in MySQL Connector/MXJ 5.0.5 (14 March 2007)
Bugs fixed:
Moved MysqldFactory to main package.
Reformatting: Added newlines some files which did not end in them.
Swapped out commercial binaries for v5.0.36.
Found and removed dynamic linking in mysql_kill; updated solution.
Changed protected constructor of SimpleMysqldDynamicMBean from taking a MysqldResource to taking a Mysqld-
Factory, in order to lay groundwork for addressing BUG discovered by Andrew Rubinger. See: MySQL Forums (Actual testing
with JBoss, and filing a bug, is still required.)
build.xml: usage now slightly more verbose; some reformatting.
Now incoporates Reggie Bernett's SafeTerminateProcess and only calls the unsafe TerminateProcess as a final last resort.
New windows kill.exe fixes bug where mysqld was being force terminated. Issue reported by bruno haleblian and others, see:
MySQL Forums.
Replaced Boolean.parseBoolean with JDK 1.4 compliant valueOf.
Changed connector-mxj.properties default mysql version to 5.0.37.
In testing so far mysqld reliably shuts down cleanly much faster.
Added testcase to com.mysql.management.jmx.AcceptanceTest which demonstrats that dataDir is a mutable MBean
property.
Updated build.xml in prep for next release.
Changed SimpleMysqldDynamicMBean to create MysqldResource on demand in order to allow setting of datadir.
(Rubinger bug groundwork).
Clarified the synchronization of MysqldResource methods.
SIGHUP is replaced with MySQLShutdown<PID> event.
Clarified the immutability of baseDir, dataDir, pidFile, portFile.
Added 5.1.15 binaries to the repository.
Removed 5.1.14 binaries from the repository.
MySQL Change History
3156
Added getDataDir() to interface MysqldResourceI.
Added 5.1.14 binaries to repository.
Replaced windows kill.exe resource with re-written version specific to mysqld.
Added Patched StandardSocketFactory from Connector/J 5-0 HEAD.
Ensured 5.1.14 compatibility.
Swapped out gpl binaries for v5.0.37.
Removed 5.0.22 binaries from the repository.
C.7.3. Changes in MySQL Connector/MXJ 5.0.4 (28 January 2007)
Bugs fixed:
Allow multiple calls to start server from URL connection on non-3306 port. (Bug#24004)
Updated build.xml to build to handle with different gpl and commercial mysld version numbers.
Only populate the options map from the help text if specifically requested or in the MBean case.
Introduced property for Linux & WinXX to default to 32bit versions.
Swapped out gpl binaries for v5.0.27.
Swapped out commercial binaries for v5.0.32.
Moved mysqld binary resourced into separate jar file NOTICE: CLASSPATH will now need to connector-
mxj-db-files.jar.
Minor test robustness improvements.
Moved default version string out of java class into a text editable properties file (connector-mxj.properties) in the re-
sources directory.
Fixed test to be tollerant of /tmp being a symlink to /foo/tmp.
C.7.4. Changes in MySQL Connector/MXJ 5.0.3 (24 June 2006)
Bugs fixed:
Removed unused imports, formatted code, made minor edits to tests.
Removed "TeeOutputStream" - no longer needed.
Swapped out the mysqld binaries for MySQL v5.0.22.
C.7.5. Changes in MySQL Connector/MXJ 5.0.2 (15 June 2006)
Bugs fixed:
Replaced string parsing with JDBC connection attempt for determining if a mysqld is "ready for connections" CLASSPATH will
now need to include Connector/J jar.
"platform" directories replace spaces with underscores
MySQL Change History
3157
extracted array and list printing to ListToString utility class
Swapped out the mysqld binaries for MySQL v5.0.21
Added trace level logging with Aspect/J. CLASSPATH will now need to include lib/aspectjrt.jar
reformatted code
altered to be "basedir" rather than "port" oriented.
help parsing test reflects current help options
insulated users from problems with "." in basedir
swapped out the mysqld binaries for MySQL v5.0.18
Made tests more robust be deleting the /tmp/test-c.mxj directory before running tests.
ServerLauncherSocketFactory.shutdown API change: now takes File parameter (basedir) instead of port.
socket is now "mysql.sock" in datadir
added ability to specify "mysql-version" as an url parameter
Extended timeout for help string parsing, to avoid cases where the help text was getting prematurely flushed, and thus truncated.
swapped out the mysqld binaries for MySQL v5.0.19
MysqldResource now tied to dataDir as well as basedir (API CHANGE)
moved PID file into datadir
ServerLauncherSocketFactory.shutdown now works across JVMs.
extracted splitLines(String) to Str utility class
ServerLauncherSocketFactory.shutdown(port) no longer throws, only reports to System.err
ServerLauncherSocketFactory now treats URL parameters in the form of &server.foo=null as serverOption-
Map.put("foo", null)
ServerLauncherSocketFactory.shutdown API change: now takes 2 File parameters (basedir, datadir)
C.7.6. Changes in MySQL Connector/MXJ 5.0.1 (Never released)
This was an internal only release.
C.7.7. Changes in MySQL Connector/MXJ 5.0.0 (09 December 2005)
Bugs fixed:
Removed HelpOptionsParser's need to reference a MysqldResource.
Reorganized utils into a single "Utils" collaborator.
Minor test tweaks
Altered examples and tests to use new Connector/J 5.0 URL syntax for launching Connector/MXJ ("jdbc:mysql:mxj://")
Swapped out the mysqld binaries for MySQL v5.0.16.
Ditched "ClassUtil" (merged with Str).
Minor refactorings for type casting and exception handling.
MySQL Change History
3158
C.8. MySQL Connector/C++ Change History
C.8.1. Changes in MySQL Connector/C++ 1.0.x
C.8.1.1. Changes in MySQL Connector/CPP 1.0.5 (21 April 2009)
This is the first Generally Available (GA) release.
Functionality added or changed:
The interface of sql::ConnectionMetaData, sql::ResultSetMetaData and sql::ParameterMetaData was
modified to have a protected destructor. As a result the client code has no need to destruct the metadata objects returned by the con-
nector. MySQL Connector/C++ handles the required destruction. This enables statements such as:
connection->getMetaData->getSchema();
This avoids potential memory leaks that could occur as a result of losing the pointer returned by getMetaData().
Improved memory management. Potential memory leak situations are handled more robustly.
Changed the interface of sql::Driver and sql::Connection so they accept the options map by alias instead of by value.
Changed the return type of sql::SQLException::getSQLState() from std::string to const char * to be con-
sistent with std::exception::what().
Implemented getResultSetType() and setResultSetType() for Statement. Uses TYPE_FORWARD_ONLY, which
means unbuffered result set and TYPE_SCROLL_INSENSITIVE, which means buffered result set.
Implemented getResultSetType() for PreparedStatement. The setter is not implemented because currently Pre-
paredStatement cannot do refetching. Storing the result means the bind buffers will be correct.
Added the option defaultStatementResultType to MySQL_Connection::setClientOption(). Also, the method
now returns sql::Connection *.
Added Result::getType(). Implemented for the three result set classes.
Enabled tracing functionality when building with Microsoft Visual C++ 8 and later, which corresponds to Microsoft Visual Studio
2005 and later.
Added better support for named pipes, on Windows. Use pipe:// and add the path to the pipe. Shared memory connections are
currently not supported.
Bugs fixed:
A bug was fixed in MySQL_Connection::setSessionVariable(), which had been causing exceptions to be thrown.
C.8.1.2. Changes in MySQL Connector/CPP 1.0.4 (31 March 2009 beta)
Functionality added or changed:
An installer was added for the Windows operating system.
Minimum CMake version required was changed from 2.4.2 to 2.6.2. The latest version is required for building on Windows.
metadataUseInfoSchema was added to the connection property map, which allows control of the INFORMATION_SCHEMA
for meta data.
Implemented MySQL_ConnectionMetaData::supportsConvert(from, to).
Added support for MySQL Connector/C.
MySQL Change History
3159
Bugs fixed:
A bug was fixed in all implementations of ResultSet::relative() which was giving a wrong return value although position-
ing was working correctly.
A leak was fixed in MySQL_PreparedResultSet, which occurred when the result contained a BLOB column.
C.8.1.3. Changes in MySQL Connector/CPP 1.0.3 (02 March 2009 alpha)
Functionality added or changed:
Added new tests in test/unit/classes. Those tests are mostly about code coverage. Most of the actual functionality of the
driver is tested by the tests found in test/CJUnitPort.
New data types added to the list returned by DatabaseMetaData::getTypeInfo() are FLOAT UNSIGED, DECIMAL UN-
SIGNED, DOUBLE UNSIGNED. Those tests may not be in the JDBC specification. However, due to the change you should be able
to look up every type and type name returned by, for example, ResultSetMetaData::getColumnTypeName().
MySQL_Driver::getPatchVersion introduced.
Major performance improvements due to new buffered ResultSet implementation.
Addition of test/unit/README with instructions for writing bug and regression tests.
Experimental support for STLPort. This feature may be removed again at any time later without prior warning! Type cmake -L
for configuration instructions.
Added properties enabled methods for connecting, which add many connect options. This uses a dictionary (map) of key value pairs.
Methods added are Driver::connect(map), and Connection::Connection(map).
New BLOB implementation. sql::Blob was removed in favor of std::istream. C++'s IOStream library is very powerful,
similar to PHP's streams. It makes no sense to reinvent the wheel. For example, you can pass a std::istringstream object to
setBlob() if the data is in memory, or just open a file std::fstream and let it stream to the DB, or write its own stream. This
is also true for getBlob() where you can just copy data (if a buffered result set), or stream data (if implemented).
Implemented ResultSet::getBlob() which returns std::stream.
Fixed MySQL_DatabaseMetaData::getTablePrivileges(). Test cases were added in the first unit testing framework.
Implemented MySQL_Connection::setSessionVariable() for setting variables like sql_mode.
Implemented MySQL_DatabaseMetaData::getColumnPrivileges().
cppconn/datatype.h has changed and is now used again. Reimplemented the type subsystem to be more usable - more types
for binary and nonbinary strings.
Implementation for MySQL_DatabaseMetaData::getImportedKeys() for MySQL versions before 5.1.16 using SHOW,
and above using INFORMATION_SCHEMA.
Implemented MySQL_ConnectionMetaData::getProcedureColumns().
make package_source now packs with bzip2.
Re-added getTypeInfo() with information about all types supported by MySQL and the sql::DataType.
Changed the implementation of MySQL_ConstructedResultSet to use the more efficient O(1) access method. This should
improve the speed with which the metadata result sets are used. Also, there is less copying during the construction of the result set,
which means that all result sets returned from the meta data functions will be faster.
Introduced, internally, sql::mysql::MyVal which has implicit constructors. Used in mysql_metadata.cpp to create result
sets with native data instead of always string (varchar).
Renamed ResultSet::getLong() to ResultSet::getInt64(). resultset.h includes typdefs for Windows to be
MySQL Change History
3160
able to use int64_t.
Introduced ResultSet::getUInt() and ResultSet::getUInt64().
Improved the implementation for ResultSetMetaData::isReadOnly(). Values generated from views are read-only. These
generated values don't have db in MYSQL_FIELD set, while all normal columns do have.
Implemented MySQL_DatabaseMetaData::getExportedKeys().
Implemented MySQL_DatabaseMetaData::getCrossReference().
Bugs fixed:
Bug fixed in MySQL_PreparedResultSet::getString(). Returned string that had real data but the length was random.
Now, the string is initialized with the correct length and thus is binary safe.
Corrected handling of unsigned server types. Now returning correct values.
Fixed handling of numeric columns in ResultSetMetaData::isCaseSensitive to return false.
C.8.1.4. Changes in MySQL Connector/CPP 1.0.2 (19 December 2008 alpha)
Functionality added or changed:
Implemented getScale(), getPrecision() and getColumnDisplaySize() for MySQL_ResultSetMetaData and
MySQL_Prepared_ResultSetMetaData.
Changed ResultSetMetaData methods getColumnDisplaySize(), getPrecision(), getScale() to return un-
signed int instead of signed int.
DATE, DATETIME and TIME are now being handled when calling the MySQL_PreparedResultSet methods getString(),
getDouble(), getInt(), getLong(), getBoolean().
Reverted implementation of MySQL_DatabaseMetaData::getTypeInfo(). Now unimplemented. In addition, removed
cppconn/datatype.h for now, until a more robust implementation of the types can be developed.
Implemented MySQL_PreparedStatement::setNull().
Implemented MySQL_PreparedStatement::clearParameters().
Added PHP script examples/cpp_trace_analyzer.php to filter the output of the debug trace. Please see the inline com-
ments for documentation. This script is unsupported.
Implemented MySQL_ResultSetMetaData::getPrecision() and
MySQL_Prepared_ResultSetMetaData::getPrecision(), updating example.
Added new unit test framework for JDBC compliance and regression testing.
Added test/unit as a basis for general unit tests using the new test framework, see test/unit/example for basic usage ex-
amples.
Bugs fixed:
Fixed MySQL_PreparedStatementResultSet::getDouble() to return the correct value when the underlying type is
MYSQL_TYPE_FLOAT.
Fixed bug in MySQL_ConnectionMetaData::getIndexInfo(). The method did not work because the schema name
wasn't included in the query sent to the server.
Fixed a bug in MySQL_ConnectionMetaData::getColumns() which was performing a cartesian product of the columns in
MySQL Change History
3161
the table times the columns matching columnNamePattern. The example example/connec-
tion_meta_schemaobj.cpp was extended to cover the function.
Fixed bugs in MySQL_DatabaseMetaData. All supportsCatalogXXXXX methods were incorrectly returning true and all
supportsSchemaXXXX methods were incorrectly returning false. Now supportsCatalogXXXXX returns false and
supportsSchemaXXXXX returns true.
Fixed bugs in the MySQL_PreparedStatements methods setBigInt() and setDatetime(). They decremented the in-
ternal column index before forwarding the request. This resulted in a double-decrement and therefore the wrong internal column in-
dex. The error message generated was:
setString() ... invalid "parameterIndex"
Fixed a bug in getString(). getString() is now binary safe. A new example was also added.
Fixed bug in FLOAT handling.
Fixed MySQL_PreparedStatement::setBlob(). In the tests there is a simple example of a class implementing
sql::Blob.
C.8.1.5. Changes in MySQL Connector/CPP 1.0.1 (01 December 2008 alpha)
Functionality added or changed:
sql::mysql::MySQL_SQLException was removed. The distinction between server and client (connector) errors, based on
the type of the exception, has been removed. However, the error code can still be checked in order to evaluate the error type.
Support for (n)make install was added. You can change the default installation path. Carefully read the messages displayed after ex-
ecuting cmake. The following are installed:
Static and the dynamic version of the library, libmysqlcppconn.
Generic interface, cppconn.
Two MySQL specific headers:
mysql_driver.h, use this if you want to get your connections from the driver instead of instantiating a
MySQL_Connection object. This makes your code portable when using the common interface.
mysql_connection.h, use this if you intend to link directly to the MySQL_Connection class and use its specifics not
found in sql::Connection.
However, you can make your application fully abstract by using the generic interface rather than these two headers.
Driver Manager was removed.
Added ConnectionMetaData::getSchemas() and Connection::setSchema().
ConnectionMetaData::getCatalogTerm() returns not applicable, there is no counterpart to catalog in MySQL Connect-
or/C++.
Added experimental GCov support, cmake -DMYSQLCPPCONN_GCOV_ENABLE:BOOL=1
All examples can be given optional connection parameters on the command line, for example:
examples/connect tcp://host:port user pass database
or
examples/connect unix:///path/to/mysql.sock user pass database
Renamed ConnectionMetaData::getTables: TABLE_COMMENT to REMARKS.
MySQL Change History
3162
Renamed ConnectionMetaData::getProcedures: PROCEDURE_SCHEMA to PROCEDURE_SCHEM.
Renamed ConnectionMetaData::getPrimaryKeys(): COLUMN to COLUMN_NAME, SEQUENCE to KEY_SEQ, and IN-
DEX_NAME to PK_NAME.
Renamed ConnectionMetaData::getImportedKeys(): PKTABLE_CATALOG to PKTABLE_CAT, PKT-
ABLE_SCHEMA to PKTABLE_SCHEM, FKTABLE_CATALOG to FKTABLE_CAT, FKTABLE_SCHEMA to FKTABLE_SCHEM.
Changed metadata column name TABLE_CATALOG to TABLE_CAT and TABLE_SCHEMA to TABLE_SCHEM to ensure JDBC
compliance.
Introduced experimental CPack support, see make help.
All tests changed to create TAP compliant output.
Renamed sql::DbcMethodNotImplemented to sql::MethodNotImplementedException
Renamed sql::DbcInvalidArgument to sql::InvalidArgumentException
Changed sql::DbcException to implement the interface of JDBC's SQLException. Renamed to sql::SQLException.
Converted Connector/J tests added.
MySQL Workbench 5.1 changed to use MySQL Connector/C++ for its database connectivity.
New directory layout.
C.9. MySQL Proxy Change History
C.9.1. Changes in MySQL Proxy 0.7.0 (Not yet released)
Bugs fixed:
Security Enhancement: Accessing mysql-proxy using a client or backend with a MySQL protocol less than MySQL 5.0 would
result in mysql-proxy aborting with an assertion. This is because mysql-proxy only supports MySQL Protocol 5.0 or higher.
The proxy will now report a fault. (Bug#31419)
Using mysql-proxy with very large return datasets from queries, with or without manipulate of the dataset within the Lua engine
could cause a crash. (Bug#39332)
If a submitted packet was smaller than expected by the protocol, MySQL Proxy would terminate. (Bug#36743)
When using mysql-proxy in a master-master replication scenario, a failure in one of the replication masters would fail to be
identified by the proxy and connections would not be redirected to the other master. (Bug#35295)
C.9.2. Changes in MySQL Proxy 0.6.1 (06 February 2008)
Functionality added or changed:
Fixed assertions on write-errors
Fixed sending fake server-greetings in connect_server().
Fixed error handling for socket functions on Windows.
Added new features to run-tests.lua.
C.9.3. Changes in MySQL Proxy 0.6.0 (11 September 2007)
MySQL Change History
3163
Functionality added or changed:
When using read/write splitting and the rw-splitting.lua example script, connecting a second user to the proxy returns an er-
ror message. (Bug#30867)
Added support in read_query_result() to overwrite the result-set.
Added --no-daemon and --pid-file.
Added hooks for read_auth(), read_handshake() and read_auth_result().
Added handling of proxy.connection.backend_ndx in connect_server() and read_query() to support read/write
splitting.
Added support for proxy.response.packets.
Added testcases.
Added --no-proxy to disable the proxy.
Added support for listening UNIX sockets.
Added a global lua-scope proxy.global.*.
Added connection pooling.
Bugs fixed:
Fixed assertion on COM_BINLOG_DUMP. (Bug#29764)
Fixed assertion on result-packets like [ field-len | fields | EOF | ERR ]. (Bug#29732)
Fixed assertion at login with empty password + empty default db. (Bug#29719)
Fixed assertion at COM_SHUTDOWN. (Bug#29719)
Fixed crash if proxy.connection is used in connect_server().
Fixed check for glib2 to require at least 2.6.0.
Fixed assertion when all backends are down and we try to connect.
Fixed connection-stalling if read_query_result() throws an assert()ion.
Fixed len-encoding on proxy.resulsets.
Fixed compilation on win32.
Fixed assertion when connecting to the MySQL 6.0.1.
Fixed decoding of len-encoded ints for 3-byte notation.
Fixed inj.resultset.affected_rows on SELECT queries.
Fixed handling of (SQL) NULL in result-sets.
Fixed mem-leak with proxy.response.* is used.
C.9.4. Changes in MySQL Proxy 0.5.1 (30 June 2007)
Functionality added or changed:
MySQL Change History
3164
Added resultset.affected_rows and resultset.insert_id.
Changed --proxy.profiling to --proxy-skip-profiling.
Added missing dependency to libmysqlclient-dev to the INSTALL file.
Added inj.query_time and inj.response_time into the lua scripts.
Added support for pre-4.1 passwords in a 4.1 connection.
Added script examples for rewriting and injection.
Added proxy.VERSION.
Added support for UNIX sockets.
Added protection against duplicate resultsets from a script.
Bugs fixed:
Fixed mysql check in configure to die when mysql.h isn't detected.
Fixed handling of duplicate ERR on COM_CHANGE_USER in MySQL 5.1.18+.
Fixed compile error with MySQL 4.1.x on missing COM_STMT_*.
Fixed crash on fields > 250 bytes when the resultset is inspected.
Fixed warning if connect_server() is not provided.
Fixed assertion when a error occurs at initial script exec time.
Fixed assertion when read_query_result() is not provided when PROXY_SEND_QUERY is used.
C.9.5. Changes in MySQL Proxy 0.5.0 (19 June 2007)
This is the first beta release.
Bugs fixed:
Added automake/autoconf support.
Added cmake support.
MySQL Change History
3165
Appendix D. Restrictions and Limits
The discussion here describes restrictions that apply to the use of MySQL features such as subqueries or views.
D.1. Restrictions on Stored Routines, Triggers, and Events
Some of the restrictions noted here apply to all stored routines; that is, both to stored procedures and stored functions. Some of these re-
strictions apply to stored functions but not to stored procedures.
The restrictions for stored functions also apply to triggers. There are also some restrictions specific to triggers.
The restrictions for stored procedures also apply to the DO clause of Event Scheduler event definitions. There are also some restrictions
specific to events.
Stored routines cannot contain arbitrary SQL statements. The following statements are disallowed:
The locking statements LOCK TABLES and UNLOCK TABLES.
ALTER VIEW. (Before MySQL 5.1.21, this restriction is enforced only for stored functions.)
LOAD DATA and LOAD TABLE.
SQL prepared statements (PREPARE, EXECUTE, DEALLOCATE PREPARE) can be used in stored procedures, but not stored func-
tions or triggers. Implication: You cannot use dynamic SQL within stored functions or triggers (where you construct dynamically
statements as strings and then execute them).
In addition, SQL statements that are not permitted within prepared statements are also not permitted in stored routines. See Sec-
tion 12.7, SQL Syntax for Prepared Statements, for a list of statements supported as prepared statements. Statements not listed
there are not supported for SQL prepared statements and thus are also not supported for stored routines unless noted otherwise in
Section 19.2, Using Stored Routines (Procedures and Functions).
Inserts cannot be delayed. INSERT DELAYED syntax is accepted but the statement is handled as a normal INSERT.
Within all stored programs (stored procedures and functions, triggers, and events), the parser treats BEGIN [WORK] as the begin-
ning of a BEGIN ... END block. Begin a transaction in this context with START TRANSACTION instead.
For stored functions (but not stored procedures), the following additional statements or operations are disallowed:
Statements that perform explicit or implicit commit or rollback. Support for these statements is not required by the SQL standard,
which states that each DBMS vendor may decide whether to allow them.
Statements that return a result set. This includes SELECT statements that do not have an INTO var_list clause and other state-
ments such as SHOW, EXPLAIN, and CHECK TABLE. A function can process a result set either with SELECT ... INTO
var_list or by using a cursor and FETCH statements. See Section 12.8.3.3, SELECT ... INTO Statement.
FLUSH statements.
Stored functions cannot be used recursively.
Within a stored function or trigger, it is not permitted to modify a table that is already being used (for reading or writing) by the
statement that invoked the function or trigger.
If you refer to a temporary table multiple times in a stored function under different aliases, a Can't reopen table:
'tbl_name' error occurs, even if the references occur in different statements within the function.
A stored function acquires table locks before executing, to avoid inconsistency in the binary log due to mismatch of the order in
which statements execute and when they appear in the log. When statement-based binary logging is used, statements that invoke a
function are recorded rather than the statements executed within the function. Consequently, stored functions that update the same
underlying tables do not execute in parallel. In contrast, stored procedures do not acquire table-level locks. All statements executed
within stored procedures are written to the binary log even for statement-based binary logging. See Section 19.6, Binary Logging
of Stored Programs.
3166
Although some restrictions normally apply to stored functions and triggers but not to stored procedures, those restrictions do apply to
stored procedures if they are invoked from within a stored function or trigger. For example, if you use FLUSH in a stored procedure,
that stored procedure cannot be called from a stored function or trigger.
It is possible for the same identifier to be used for a routine parameter, a local variable, and a table column. Also, the same local vari-
able name can be used in nested blocks. For example:
CREATE PROCEDURE p (i INT)
BEGIN
DECLARE i INT DEFAULT 0;
SELECT i FROM t;
BEGIN
DECLARE i INT DEFAULT 1;
SELECT i FROM t;
END;
END;
In such cases the identifier is ambiguous and the following precedence rules apply:
A local variable takes precedence over a routine parameter or table column
A routine parameter takes precedence over a table column
A local variable in an inner block takes precedence over a local variable in an outer block
The behavior that variables take precedence over table columns is nonstandard.
Use of stored routines can cause replication problems. This issue is discussed further in Section 19.6, Binary Logging of Stored Pro-
grams.
INFORMATION_SCHEMA does not have a PARAMETERS table until MySQL 6.0, so applications that need to acquire routine paramet-
er information at runtime must use workarounds such as parsing the output of SHOW CREATE statements or the param_list column
of the mysql.proc table. param_list contents can be processed from within a stored routine, unlike the output from SHOW.
There are no stored routine debugging facilities.
Before MySQL 5.1.4, CALL statements cannot be prepared. This true both for server-side prepared statements and for SQL prepared
statements.
UNDO handlers are not supported.
FOR loops are not supported.
To prevent problems of interaction between server threads, when a client issues a statement, the server uses a snapshot of routines and
triggers available for execution of the statement. That is, the server calculates a list of procedures, functions, and triggers that may be
used during execution of the statement, loads them, and then proceeds to execute the statement. This means that while the statement ex-
ecutes, it will not see changes to routines performed by other threads.
For triggers, the following additional statements or operations are disallowed:
Triggers currently are not activated by foreign key actions.
When using row-based replication, triggers on the slave are not activated by statements originating on the master. This does not ap-
ply when using statement-based replication. For more information, see Section 16.3.1.26, Replication and Triggers.
The RETURN statement is disallowed in triggers, which cannot return a value. To exit a trigger immediately, use the LEAVE state-
ment.
Triggers are not allowed on tables in the mysql database.
The following limitations are specific to the Event Scheduler:
In MySQL 5.1.6 only, any table referenced in an event's action statement must be fully qualified with the name of the schema in
Restrictions and Limits
3167
which it occurs (that is, as schema_name.table_name).
Beginning with MySQL 5.1.8, event names are handled in case-insensitive fashion. For example, this means that you cannot have
two events in the same database (and prior to MySQL 5.1.12 with the same definer) with the names anEvent and
AnEvent.
Important
If you have events created in MySQL 5.1.7 or earlier which are assigned to the same database and have the same definer,
and whose names differ only with respect to lettercase, then you must rename these events to respect case-sensitive hand-
ling before upgrading to MySQL 5.1.8 or later.
An event may not be created, altered, or dropped by a stored routine, trigger, or another event. An event also may not create, alter,
or drop stored routines or triggers. (Bug#16409, Bug#18896)
Event timings using the intervals YEAR, QUARTER, MONTH, and YEAR_MONTH are resolved in months; those using any other inter-
val are resolved in seconds. There is no way to cause events scheduled to occur at the same second to execute in a given order. In
addition due to rounding, the nature of threaded applications, and the fact that a nonzero length of time is required to create
events and to signal their execution events may be delayed by as much as 1 or 2 seconds. However, the time shown in the IN-
FORMATION_SCHEMA.EVENTS table's LAST_EXECUTED column or the mysql.event table's last_executed column is
always accurate to within one second of the actual event execution time. (See also Bug#16522.)
Each execution of the statements contained in the body of an event takes place in a new connection; thus, these statements has no ef-
fect in a given user session on the server's statement counts such as Com_select and Com_insert that are displayed by SHOW
STATUS. However, such counts are updated in the global scope. (Bug#16422)
Prior to MySQL 5.1.12, you could not view another user's events in the INFORMATION_SCHEMA.EVENTS table. In other words,
any query made against this table was treated as though it contained the condition DEFINER = CURRENT_USER() in the WHERE
clause.
Events do not support times later than the end of the Unix Epoch; this is approximately the beginning of the year 2038. Prior to
MySQL 5.1.8, handling in scheduled events of dates later than this was buggy; starting with MySQL 5.1.8, such dates are specific-
ally disallowed by the Event Scheduler. (Bug#16396)
In MySQL 5.1.6, INFORMATION_SCHEMA.EVENTS shows NULL in the SQL_MODE column. Beginning with MySQL 5.1.7, the
SQL_MODE displayed is that in effect when the event was created.
In MySQL 5.1.6, the only way to drop or alter an event created by a user who was not the definer of that event was by manipulation
of the mysql.event system table by the MySQL root user or by another user with privileges on this table. Beginning with
MySQL 5.1.7, DROP USER drops all events for which that user was the definer; also beginning with MySQL 5.1.7 DROP SCHEMA
drops all events associated with the dropped schema.
References to stored functions, user-defined functions, and tables in the ON SCHEDULE clauses of CREATE EVENT and ALTER
EVENT statements are not supported. Beginning with MySQL 5.1.13, these sorts of references are disallowed. (See Bug#22830 for
more information.)
Generally speaking, statements which are not permitted in stored routines or in SQL prepared statements are also not allowed in the
body of an event. For more information, see Section 12.7, SQL Syntax for Prepared Statements.
When upgrading to MySQL 5.1.18 or 5.1.19 from a previous MySQL version where scheduled events were in use, the upgrade util-
ities mysql_upgrade and mysql_fix_privilege_tables do not accomodate changes in system tables relating to the
Event Scheduler. This issue was fixed in MySQL 5.1.20 (see Bug#28521).
Stored routines and triggers in MySQL Cluster. Stored functions, stored procedures, and triggers are all supported by tables using
the NDB storage engine; however, it is important to keep in mind that they do not propagate automatically between MySQL Servers act-
ing as Cluster SQL nodes. This is because of the following:
Stored routine definitions are kept in tables in the mysql system database using the MyISAM storage engine, and so do not particip-
ate in clustering.
The .TRN and .TRG files containing trigger definitions are not read by the NDB storage engine, and are not copied between Cluster
nodes.
Any stored routine or trigger that interacts with MySQL Cluster tables must be re-created by running the appropriate CREATE PRO-
Restrictions and Limits
3168
CEDURE, CREATE FUNCTION, or CREATE TRIGGER statements on each MySQL Server that participates in the cluster where you
wish to use the stored routine or trigger. Similarly, any changes to existing stored routines or triggers must be carried out explicitly on
all Cluster SQL nodes, using the appropriate ALTER or DROP statements on each MySQL Server accessing the cluster.
Warning
Do not attempt to work around the issue described in the first item mentioned previously by converting any mysql data-
base tables to use the NDB storage engine. Altering the system tables in the mysql database is not supported and is very
likely to produce undesirable results.
D.2. Restrictions on Server-Side Cursors
Server-side cursors are implemented in the C API via the mysql_stmt_attr_set() function. The same implementation is used for
cursors in stored routines. A server-side cursor allows a result set to be generated on the server side, but not transferred to the client ex-
cept for those rows that the client requests. For example, if a client executes a query but is only interested in the first row, the remaining
rows are not transferred.
In MySQL, a server-side cursor is materialized into a temporary table. Initially, this is a MEMORY table, but is converted to a MyISAM
table if its size reaches the value of the max_heap_table_size system variable. One limitation of the implementation is that for a
large result set, retrieving its rows through a cursor might be slow.
Cursors are read only; you cannot use a cursor to update rows.
UPDATE WHERE CURRENT OF and DELETE WHERE CURRENT OF are not implemented, because updatable cursors are not sup-
ported.
Cursors are nonholdable (not held open after a commit).
Cursors are asensitive.
Cursors are nonscrollable.
Cursors are not named. The statement handler acts as the cursor ID.
You can have open only a single cursor per prepared statement. If you need several cursors, you must prepare several statements.
You cannot use a cursor for a statement that generates a result set if the statement is not supported in prepared mode. This includes
statements such as CHECK TABLE, HANDLER READ, and SHOW BINLOG EVENTS.
D.3. Restrictions on Subqueries
In MySQL 5.1 before 5.1.16, if you compare a NULL value to a subquery using ALL, ANY, or SOME, and the subquery returns an
empty result, the comparison might evaluate to the nonstandard result of NULL rather than to TRUE or FALSE. As of 5.1.16, the
comparison evaluates to TRUE or FALSE except for subqueries inside IS NULL, such as this:
SELECT ... WHERE NULL IN (SELECT ...) IS NULL
As of 5.1.32, the IS NULL limitation is removed and the comparison evaluates to TRUE or FALSE.
A subquery's outer statement can be any one of: SELECT, INSERT, UPDATE, DELETE, SET, or DO.
Subquery optimization for IN is not as effective as for the = operator or for the IN(value_list) operator.
A typical case for poor IN subquery performance is when the subquery returns a small number of rows but the outer query returns a
large number of rows to be compared to the subquery result.
The problem is that, for a statement that uses an IN subquery, the optimizer rewrites it as a correlated subquery. Consider the fol-
lowing statement that uses an uncorrelated subquery:
SELECT ... FROM t1 WHERE t1.a IN (SELECT b FROM t2);
The optimizer rewrites the statement to a correlated subquery:
SELECT ... FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a);
Restrictions and Limits
3169
If the inner and outer queries return M and N rows, respectively, the execution time becomes on the order of O(MN), rather than
O(M+N) as it would be for an uncorrelated subquery.
An implication is that an IN subquery can be much slower than a query written using an IN(value_list) operator that lists the
same values that the subquery would return.
In general, you cannot modify a table and select from the same table in a subquery. For example, this limitation applies to state-
ments of the following forms:
DELETE FROM t WHERE ... (SELECT ... FROM t ...);
UPDATE t ... WHERE col = (SELECT ... FROM t ...);
{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);
Exception: The preceding prohibition does not apply if you are using a subquery for the modified table in the FROM clause. Ex-
ample:
UPDATE t ... WHERE col = (SELECT * FROM (SELECT ... FROM t...) AS _t ...);
Here the prohibition does not apply because the result from a subquery in the FROM clause is stored as a temporary table, so the rel-
evant rows in t have already been selected by the time the update to t takes place.
Row comparison operations are only partially supported:
For expr IN (subquery), expr can be an n-tuple (specified via row constructor syntax) and the subquery can return rows
of n-tuples.
For expr op {ALL|ANY|SOME} (subquery), expr must be a scalar value and the subquery must be a column sub-
query; it cannot return multiple-column rows.
In other words, for a subquery that returns rows of n-tuples, this is supported:
(val_1, ..., val_n) IN (subquery)
But this is not supported:
(val_1, ..., val_n) op {ALL|ANY|SOME} (subquery)
The reason for supporting row comparisons for IN but not for the others is that IN is implemented by rewriting it as a sequence of =
comparisons and AND operations. This approach cannot be used for ALL, ANY, or SOME.
Row constructors are not well optimized. The following two expressions are equivalent, but only the second can be optimized:
(col1, col2, ...) = (val1, val2, ...)
col1 = val1 AND col2 = val2 AND ...
Subqueries in the FROM clause cannot be correlated subqueries. They are materialized (executed to produce a result set) before eval-
uating the outer query, so they cannot be evaluated per row of the outer query.
The optimizer is more mature for joins than for subqueries, so in many cases a statement that uses a subquery can be executed more
efficiently if you rewrite it as a join.
An exception occurs for the case where an IN subquery can be rewritten as a SELECT DISTINCT join. Example:
SELECT col FROM t1 WHERE id_col IN (SELECT id_col2 FROM t2 WHERE condition);
That statement can be rewritten as follows:
SELECT DISTINCT col FROM t1, t2 WHERE t1.id_col = t2.id_col AND condition;
But in this case, the join requires an extra DISTINCT operation and is not more efficient than the subquery.
Restrictions and Limits
3170
Possible future optimization: MySQL does not rewrite the join order for subquery evaluation. In some cases, a subquery could be
executed more efficiently if MySQL rewrote it as a join. This would give the optimizer a chance to choose between more execution
plans. For example, it could decide whether to read one table or the other first.
Example:
SELECT a FROM outer_table AS ot
WHERE a IN (SELECT a FROM inner_table AS it WHERE ot.b = it.b);
For that query, MySQL always scans outer_table first and then executes the subquery on inner_table for each row. If
outer_table has a lot of rows and inner_table has few rows, the query probably will not be as fast as it could be.
The preceding query could be rewritten like this:
SELECT a FROM outer_table AS ot, inner_table AS it
WHERE ot.a = it.a AND ot.b = it.b;
In this case, we can scan the small table (inner_table) and look up rows in outer_table, which will be fast if there is an in-
dex on (ot.a,ot.b).
Possible future optimization: A correlated subquery is evaluated for each row of the outer query. A better approach is that if the out-
er row values do not change from the previous row, do not evaluate the subquery again. Instead, use its previous result.
Possible future optimization: A subquery in the FROM clause is evaluated by materializing the result into a temporary table, and this
table does not use indexes. This does not allow the use of indexes in comparison with other tables in the query, although that might
be useful.
Possible future optimization: If a subquery in the FROM clause resembles a view to which the merge algorithm can be applied, re-
write the query and apply the merge algorithm so that indexes can be used. The following statement contains such a subquery:
SELECT * FROM (SELECT * FROM t1 WHERE t1.t1_col)
AS _t1, t2 WHERE t2.t2_col;
The statement can be rewritten as a join like this:
SELECT * FROM t1, t2 WHERE t1.t1_col AND t2.t2_col;
This type of rewriting would provide two benefits:
It avoids the use of a temporary table for which no indexes can be used. In the rewritten query, the optimizer can use indexes on
t1.
It gives the optimizer more freedom to choose between different execution plans. For example, rewriting the query as a join al-
lows the optimizer to use t1 or t2 first.
Possible future optimization: For IN, = ANY, <> ANY, = ALL, and <> ALL with uncorrelated subqueries, use an in-memory hash
for a result or a temporary table with an index for larger results. Example:
SELECT a FROM big_table AS bt
WHERE non_key_field IN (SELECT non_key_field FROM table WHERE condition)
In this case, we could create a temporary table:
CREATE TABLE t (key (non_key_field))
(SELECT non_key_field FROM table WHERE condition)
Then, for each row in big_table, do a key lookup in t based on bt.non_key_field.
D.4. Restrictions on Views
View processing is not optimized:
Restrictions and Limits
3171
It is not possible to create an index on a view.
Indexes can be used for views processed using the merge algorithm. However, a view that is processed with the temptable algorithm
is unable to take advantage of indexes on its underlying tables (although indexes can be used during generation of the temporary
tables).
Subqueries cannot be used in the FROM clause of a view.
There is a general principle that you cannot modify a table and select from the same table in a subquery. See Section D.3, Restrictions
on Subqueries.
The same principle also applies if you select from a view that selects from the table, if the view selects from the table in a subquery and
the view is evaluated using the merge algorithm. Example:
CREATE VIEW v1 AS
SELECT * FROM t2 WHERE EXISTS (SELECT 1 FROM t1 WHERE t1.a = t2.a);
UPDATE t1, v2 SET t1.a = 1 WHERE t1.b = v2.b;
If the view is evaluated using a temporary table, you can select from the table in the view subquery and still modify that table in the out-
er query. In this case the view will be stored in a temporary table and thus you are not really selecting from the table in a subquery and
modifying it at the same time. (This is another reason you might wish to force MySQL to use the temptable algorithm by specifying
ALGORITHM = TEMPTABLE in the view definition.)
You can use DROP TABLE or ALTER TABLE to drop or alter a table that is used in a view definition. No warning results from the
DROP or ALTER operation, even though this invalidates the view. Instead, an error occurs later, when the view is used. CHECK TABLE
can be used to check for views that have been invalidated by DROP or ALTER operations.
A view definition is frozen by certain statements:
If a statement prepared by PREPARE refers to a view, the view definition seen each time the statement is executed later will be the
definition of the view at the time it was prepared. This is true even if the view definition is changed after the statement is prepared
and before it is executed. Example:
CREATE VIEW v AS SELECT RAND();
PREPARE s FROM 'SELECT * FROM v';
ALTER VIEW v AS SELECT NOW();
EXECUTE s;
The result returned by the EXECUTE statement is a random number, not the current date and time.
If a statement in a stored routine refers to a view, the view definition seen by the statement are its definition the first time that state-
ment is executed. For example, this means that if the statement is executed in a loop, further iterations of the statement see the same
view definition, even if the definition is changed later in the loop. Example:
CREATE VIEW v AS SELECT 1;
delimiter //
CREATE PROCEDURE p ()
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < 5 DO
SELECT * FROM v;
SET i = i + 1;
ALTER VIEW v AS SELECT 2;
END WHILE;
END;
//
delimiter ;
CALL p();
When the procedure p() is called, the SELECT returns 1 each time through the loop, even though the view definition is changed
within the loop.
As of MySQL 5.1.21, ALTER VIEW is prohibited within stored routines, so this restriction does not apply.
With regard to view updatability, the overall goal for views is that if any view is theoretically updatable, it should be updatable in prac-
tice. This includes views that have UNION in their definition. Currently, not all views that are theoretically updatable can be updated.
Restrictions and Limits
3172
The initial view implementation was deliberately written this way to get usable, updatable views into MySQL as quickly as possible.
Many theoretically updatable views can be updated now, but limitations still exist:
Updatable views with subqueries anywhere other than in the WHERE clause. Some views that have subqueries in the SELECT list
may be updatable.
You cannot use UPDATE to update more than one underlying table of a view that is defined as a join.
You cannot use DELETE to update a view that is defined as a join.
There exists a shortcoming with the current implementation of views. If a user is granted the basic privileges necessary to create a view
(the CREATE VIEW and SELECT privileges), that user will be unable to call SHOW CREATE VIEW on that object unless the user is
also granted the SHOW VIEW privilege.
That shortcoming can lead to problems backing up a database with mysqldump, which may fail due to insufficient privileges. This
problem is described in Bug#22062.
The workaround to the problem is for the administrator to manually grant the SHOW VIEW privilege to users who are granted CREATE
VIEW, since MySQL doesn't grant it implicitly when views are created.
Views do not have indexes, so index hints do not apply. Use of index hints when selecting from a view is disallowed.
SHOW CREATE VIEW displays view definitions using an AS alias_name clause for each column. If a column is created from an
expression, the default alias is the expression text, which can be quite long. As of MySQL 5.1.23, aliases for column names in CREATE
VIEW statements are checked against the maximum column length of 64 characters (not the maximum alias length of 256 characters).
As a result, views created from the output of SHOW CREATE VIEW fail if any column alias exceeds 64 characters. This can cause
problems in the following circumstances for views with too-long aliases:
View definitions fail to replicate to newer slaves that enforce the column-length restriction.
Dump files created with mysqldump cannot be loaded into servers that enforce the column-length restriction.
A workaround for either problem is the modify each problematic view definition to use aliases that provide shorter column names. Then
the view will replicate properly, and can be dumped and reloaded without causing an error. To modify the definition, drop and create
the view again with DROP VIEW and CREATE VIEW, or replace the definition with CREATE OR REPLACE VIEW.
For problems that occur when reloading view definitions in dump files, another workaround is to edit the dump file to modify its CRE-
ATE VIEW statements. However, this does not change the original view definitions, which may cause problems for subsequent dump
operations.
D.5. Restrictions on XA Transactions
XA transaction support is limited to the InnoDB storage engine.
For external XA, a MySQL server acts as a Resource Manager and client programs act as Transaction Managers. For Internal XA,
storage engines within a MySQL server act as RMs, and the server itself acts as a TM. Internal XA support is limited by the capabilities
of individual storage engines. Internal XA is required for handling XA transactions that involve more than one storage engine. The im-
plementation of internal XA requires that a storage engine support two-phase commit at the table handler level, and currently this is true
only for InnoDB.
For XA START, the JOIN and RESUME clauses are not supported.
For XA END, the SUSPEND [FOR MIGRATE] clause is not supported.
The requirement that the bqual part of the xid value be different for each XA transaction within a global transaction is a limitation of
the current MySQL XA implementation. It is not part of the XA specification.
If an XA transaction has reached the PREPARED state and the MySQL server is killed (for example, with kill -9 on Unix) or shuts
down abnormally, the transaction can be continued after the server restarts. However, if the client reconnects and commits the transac-
tion, the transaction will be absent from the binary log even though it has been committed. This means the data and the binary log have
gone out of synchrony. An implication is that XA cannot be used safely together with replication.
Restrictions and Limits
3173
It is possible that the server will roll back a pending XA transaction, even one that has reached the PREPARED state. This happens if a
client connection terminates and the server continues to run, or if clients are connected and the server shuts down gracefully. (In the lat-
ter case, the server marks each connection to be terminated, and then rolls back the PREPARED XA transaction associated with it.) It
should be possible to commit or roll back a PREPARED XA transaction, but this cannot be done without changes to the binary logging
mechanism.
D.6. Restrictions on Character Sets
Identifiers are stored in mysql database tables (user, db, and so forth) using utf8, but identifiers can contain only characters in
the Basic Multilingual Plane (BMP). Supplementary characters are not allowed in identifiers.
The ucs2 character sets has the following restrictions:
It cannot be used as a client character set, which means that it does not work for SET NAMES or SET CHARACTER SET. (See
Section 9.1.4, Connection Character Sets and Collations.)
It is currently not possible to use LOAD DATA INFILE to load data files that use this character set.
FULLTEXT indexes cannot be created on a column that this character set. However, you can perform IN BOOLEAN MODE
searches on the column without an index.
The REGEXP and RLIKE operators work in byte-wise fashion, so they are not multi-byte safe and may produce unexpected results
with multi-byte character sets. In addition, these operators compare characters by their byte values and accented characters may not
compare as equal even if a given collation treats them as equal.
D.7. Limits in MySQL
This section lists current limits in MySQL 5.1.
D.7.1. Limits of Joins
The maximum number of tables that can be referenced in a single join is 61. This also applies to the number of tables that can be refer-
enced in the definition of a view.
D.7.2. The Maximum Number of Columns Per Table
There is a hard limit of 4096 columns per table, but the effective maximum may be less for a given table. The exact limit depends on
several interacting factors, listed in the following discussion.
Every table has a maximum row size of 65,535 bytes. This maximum applies to all storage engines, but a given engine might have
additional constraints that result in a lower effective maximum row size.
The maximum row size constrains the number of columns because the total width of all columns cannot exceed this size. For ex-
ample, utf8 characters require up to three bytes per character, so for a CHAR(255) CHARACTER SET utf8 column, the serv-
er must allocate 255 3 = 765 bytes per value. Consequently, a table cannot contain more than 65,535 / 765 = 85 such columns.
Storage for variable-length columns includes length bytes, which are assessed against the row size. For example, a
VARCHAR(255) CHARACTER SET utf8 column takes two bytes to store the length of the value, so each value can take up to
767 bytes.
BLOB and TEXT columns count from one to four plus eight bytes each toward the row-size limit because their contents are stored
separately.
Declaring columns NULL can reduce the maximum number of columns allowed. NULL columns require additional space in the row
to record whether or not their values are NULL.
For MyISAM tables, each NULL column takes one bit extra, rounded up to the nearest byte. The maximum row length in bytes can
be calculated as follows:
row length = 1
+ (sum of column lengths)
Restrictions and Limits
3174
+ (number of NULL columns + delete_flag + 7)/8
+ (number of variable-length columns)
delete_flag is 1 for tables with static row format. Static tables use a bit in the row record for a flag that indicates whether the
row has been deleted. delete_flag is 0 for dynamic tables because the flag is stored in the dynamic row header.
These calculations do not apply for InnoDB tables, for which storage size is no different for NULL columns than for NOT NULL
columns.
The following statement to create table t1 succeeds because the columns require 32,765 + 2 bytes and 32,766 + 2 bytes, which falls
within the maximum row size of 65,535 bytes:
mysql> CREATE TABLE t1
-> (c1 VARCHAR(32765) NOT NULL, c2 VARCHAR(32766) NOT NULL);
Query OK, 0 rows affected (0.01 sec)
The following statement to create table t2 fails because the columns are NULL and require additional space that causes the row size
to exceed 65,535 bytes:
mysql> CREATE TABLE t2
-> (c1 VARCHAR(32765) NULL, c2 VARCHAR(32766) NULL);
ERROR 1118 (42000): Row size too large. The maximum row size for the
used table type, not counting BLOBs, is 65535. You have to change some
columns to TEXT or BLOBs
Each table has an .frm file that contains the table definition. The .frm file size limit is fixed at 64KB. If a table definition reaches
this size, no more columns can be added. The expression that checks information to be stored in the .frm file against the limit
looks like this:
if (info_length+(ulong) create_fields.elements*FCOMP+288+
n_length+int_length+com_length > 65535L || int_count > 255)
The relevant factors in this expression are:
info_length is space needed for screens. This is related to MySQL's Unireg heritage.
create_fields.elements is the number of columns.
FCOMP is 17.
n_length is the total length of all column names, including one byte per name as a separator.
int_length is related to the list of values for SET and ENUM columns.
com_length is the total length of column and table comments.
Thus, using long column names can reduce the maximum number of columns, as can the inclusion of ENUM or SET columns, or use
of column or table comments.
Individual storage engines might impose additional restrictions that limit table column count. Examples:
InnoDB allows no more than 1000 columns.
InnoDB restricts row size to something less than half a database page (approximately 8000 bytes), not including VARBINARY,
VARCHAR, BLOB, or TEXT columns.
Different InnoDB storage formats (COMPRESSED, REDUNDANT) use different amounts of page header and trailer data, which
affects the amount of storage available for rows.
D.7.3. Windows Platform Limitations
The following limitations apply only to the Windows platform:
The number of open file descriptors on Windows is limited to a maximum of 2048, which may limit the ability to open a large num-
Restrictions and Limits
3175
ber of tables simultaneously. This limit is due to the compatibility functions used to open files on Windows that use the POSIX
compatibility layer.
This limitation will also cause problems if you try to set open_files_limit to a value greater than the 2048 file limit.
On Windows 32-bit platforms it is not possible to use more than 2GB of RAM within a single process, including MySQL. This is
because the physical address limit on Windows 32-bit is 4GB and the default setting within Windows is to split the virtual address
space between kernel (2GB) and user/applications (2GB).
To use more memory than this you will need to use a 64-bit version of Windows.
When using MyISAM tables, you cannot use aliases within Windows link to the data files on another volume and then link back to
the main MySQL datadir location.
This facility is often used to move the data and index files to a RAID or other fast solution, while retaining the main .FRM files in
the default data directory configured with the datadir option.
The timers within MySQL used on Windows are of a lower precision than the timers used on Linux. For most situations you may
not notice a difference, but the delay implied by a call to SLEEP() on Windows and Linux may differ slightly due to the differ-
ences in precision.
There is no 64-bit OLEDB Provider for ODBC (MSDASQL) in any 64-bit Windows operating system up to and including Windows
Vista. In practical terms this means that you can't use the MySQL ODBC driver from ADO and other users of OLEDB.
Restrictions and Limits
3176
Index
Symbols
! (logical NOT), 766
!= (not equal), 762
", 659
#mysql50 identifier prefix, 660, 663
%, 787
% (modulo), 791
% (wildcard character), 657
& (bitwise AND), 835
&& (logical AND), 766
() (parentheses), 759
(Control-Z) \Z, 657, 962
* (multiplication), 787
+ (addition), 786
- (subtraction), 786
- (unary minus), 787
--bind-address option (ndb_mgmd), 1594
--character-sets-dir option
MySQL Cluster programs, 1620, 1620
--config-file option (ndb_mgmd), 1595
--configdir option (ndb_mgmd), 1595
--connect-string option (MySQL Cluster), 1620
--core-file option (MySQL Cluster), 1620
--daemon option (ndb_mgmd), 1595
--debug option (MySQL Cluster), 1620
--execute option (MySQL Cluster), 1621
--help option
MySQL Cluster programs, 1620
--initial option (ndbd), 1590
--initial option (ndbmtd), 1590
--initial option (ndb_mgmd), 1596
--initial-start option (ndbd), 1590
--initial-start option (ndbmtd), 1590
--ndb-log-update-as-write (mysqld option), 1694
--ndb-mgmd-host option (MySQL Cluster), 1621
--ndb-nodeid option (MySQL Cluster), 1621
--ndb-optimized-node-selection option (MySQL Cluster), 1621
--nodaemon option (ndbd), 1591
--nodaemon option (ndbmtd), 1591
--nodaemon option (ndb_mgmd), 1596
--nostart option (ndbd), 1591
--nostart option (ndbmtd), 1591
--nowait-nodes option (ndbd), 1591
--nowait-nodes option (ndbmtd), 1591
--password option, 522
--print-full-config option (ndb_mgmd), 1596
--reload option (ndb_mgmd), 1596
--usage option
MySQL Cluster programs, 1620
--version option (MySQL Cluster), 1621
-? option
MySQL Cluster programs, 1620
-c option (MySQL Cluster), 1620
-c option (ndb_mgmd) (OBSOLETE), 1595
-d option (ndb_mgmd), 1595
-e option (MySQL Cluster), 1621
-f option (ndb_mgmd), 1595
-n option (ndbd), 1591
-n option (ndbmtd), 1591
-p option, 522
-P option (ndb_mgmd), 1596
-V option (MySQL Cluster), 1621
.my.cnf file, 192, 195, 196, 512, 522, 542
.mysql_history file, 227, 522
.pid (process ID) file, 559
/ (division), 787
/etc/passwd, 494, 969
:= (assignment), 670
< (less than), 762
<<, 180
<< (left shift), 835
<= (less than or equal), 762
<=> (equal to), 762
<> (not equal), 762
<errortext>Table is full</errortext> error
MySQL Cluster, 2712, 2716
= (assignment), 670
= (equal), 762
> (greater than), 762
>= (greater than or equal), 762
>> (right shift), 835
[api] (MySQL Cluster), 1567
[mgm] (MySQL Cluster), 1566
[ndbd default] (MySQL Cluster), 1557
[ndbd] (MySQL Cluster), 1557
[ndb_mgmd] (MySQL Cluster), 1566
[SQL] (MySQL Cluster), 1567
\" (double quote), 657
\' (single quote), 657
\. (mysql client command), 176, 233
\0 (ASCII NUL), 656, 961
\b (backspace), 657, 961
\n (linefeed), 657, 961
\n (newline), 657, 961
\N (NULL), 962
\r (carriage return), 657, 961
\t (tab), 657, 962
\Z (Control-Z) ASCII 26, 657, 962
\\ (escape), 657
^ (bitwise XOR), 835
_ (wildcard character), 657
_rowid, 922
`, 659
| (bitwise OR), 835
|| (logical OR), 766
~, 835
A
abort-slave-event-count option
mysqld, 1447
aborted clients, 2747
aborted connection, 2747
ABS(), 788
access control, 507
access denied errors, 2740
access privileges, 497
account names, 505
account privileges
adding, 516
accounts
anonymous user, 112
root, 112
ACID, 20, 1097
ACLs, 497
3177
ACOS(), 788
Active Server Pages (ASP), 2021
ActiveState Perl, 154
add-drop-database option
mysqldump, 251
add-drop-table option
mysqldump, 251
add-locks option
mysqldump, 251
add-user option
mysqlmanager, 308
ADDDATE(), 797
adding
character sets, 708
native functions, 2687
new account privileges, 516
new functions, 2678
new user privileges, 516
new users, 82, 85
procedures, 2689
user-defined functions, 2679
addition (+), 786
ADDTIME(), 797
addtodest option
mysqlhotcopy, 306
administration
server, 235
administration of MySQL Cluster, 1597
administrative programs, 187
AES_DECRYPT(), 836
AES_ENCRYPT(), 836
After create
thread state, 639
age
calculating, 167
alias, 2762
alias names
case sensitivity, 661
aliases
for expressions, 855
for tables, 967
in GROUP BY clauses, 855
names, 659
on expressions, 966
ALL, 970, 982
ALL join type
optimizer, 567
all-databases option
mysqlcheck, 244
mysqldump, 251
all-in-1 option
mysqlcheck, 244
all-tablespaces option
mysqldump, 251
allocating local table
thread state, 644
allow-keywords option
mysqldump, 251
allow-suspicious-udfs option
mysqld, 346, 495
allowold option
mysqlhotcopy, 306
ALLOW_INVALID_DATES SQL mode, 470
ALTER COLUMN, 897
ALTER DATABASE, 888
ALTER EVENT, 888
ALTER FUNCTION, 891
ALTER LOGFILE GROUP, 890
(see also MySQL Cluster Disk Data)
ALTER PROCEDURE, 891
ALTER SCHEMA, 888
ALTER SERVER, 891
ALTER TABLE, 892, 898, 2765
ALTER TABLESPACE, 904
(see also MySQL Cluster Disk Data)
ALTER VIEW, 905
altering
database, 888
schema, 888
analyze option
myisamchk, 283
mysqlcheck, 244
ANALYZE TABLE, 1016
and partitioning, 1876
Analyzing
thread state, 640
AND
bitwise, 835
logical, 766
angel-pid-file option
mysqlmanager, 308
anonymous user, 112, 112, 507, 509
ANSI mode
running, 17
ansi option
mysqld, 346
ANSI SQL mode, 470, 474
ANSI_QUOTES SQL mode, 471
answering questions
etiquette, 12
ANY, 982
Apache, 184
API node (MySQL Cluster)
defined, 1497
API nodes (see SQL nodes)
API's
list of, 33
APIs, 1940
Perl, 2661
apply_status table (OBSOLETE), 1678
(see also MySQL Cluster replication)
approximate-value literals, 880
ArbitrationDelay, 1525, 1551
ArbitrationRank, 1525, 1551
ArbitrationTimeout (DEPRECATED), 1542
arbitrator, 2712, 2719
ARCHIVE storage engine, 1084, 1191
Area(), 873, 873
argument processing, 2683
arithmetic expressions, 786
arithmetic functions, 834
AS, 967, 971
AS/400, 76
AsBinary(), 869
ASCII(), 770
ASIN(), 788
AsText(), 869
asynchronous replication (see MySQL Cluster replication)
ATAN(), 789
ATAN2(), 789
Index
3178
attackers
security against, 493
attribute promotion
ndb_restore, 1607
replication, 1474
auto-generate-sql option
mysqlslap, 271
auto-generate-sql-add-autoincrement option
mysqlslap, 271
auto-generate-sql-execute-number option
mysqlslap, 271
auto-generate-sql-guid-primary option
mysqlslap, 271
auto-generate-sql-load-type option
mysqlslap, 271
auto-generate-sql-secondary-indexes option
mysqlslap, 271
auto-generate-sql-unique-query-number option
mysqlslap, 271
auto-generate-sql-unique-write-number option
mysqlslap, 272
auto-generate-sql-write-number option
mysqlslap, 272
AUTO-INCREMENT
ODBC, 2018
auto-rehash option
mysql, 222
auto-repair option
mysqlcheck, 244
autoclose option
mysqld_safe, 205
autocommit session variable, 441
automatic_sp_privileges system variable, 380
AUTO_INCREMENT, 181, 731
and NULL values, 2762
and replication, 1470
auto_increment_increment system variable, 1435
auto_increment_offset system variable, 1438
AVG(), 850
AVG(DISTINCT), 850
B
backslash
escape character, 656
backspace (\b), 657, 961
backup identifiers
native backup and restore, 1633
backup option
myisamchk, 282
myisampack, 286
BACKUP TABLE, 1017
BackupDataBufferSize, 1634
BackupDataBufferSize (MySQL Cluster configuration parameter), 1544
BackupDataDir, 1528
BackupLogBufferSize, 1545, 1634
BackupMaxWriteSize, 1545, 1635
BackupMemory, 1545, 1634
BackupReportFrequency, 1545
backups, 543
database, 1017
databases and tables, 247, 305
in MySQL Cluster, 1606, 1631, 1631, 1632, 1634
in MySQL Cluster replication, 1684
backups, troubleshooting
in MySQL Cluster, 1635
BackupWriteSize, 1545, 1634
back_log system variable, 381
base64-output option
mysqlbinlog, 295
basedir option
mysql.server, 208
mysqld, 347
mysqld_safe, 205
mysql_install_db, 215
mysql_upgrade, 218
basedir system variable, 381
batch mode, 175
batch option
mysql, 222
batch SQL files, 218
BatchByteSize, 1551
batched updates (MySQL Cluster Replication), 1682
BatchSize, 1551
BatchSizePerLocalScan, 1533
Bazaar tree, 93
BdMPolyFromText(), 865
BdMPolyFromWKB(), 866
BdPolyFromText(), 865
BdPolyFromWKB(), 866
BEGIN, 995, 1074
XA transactions, 1005
benchmark suite, 563
BENCHMARK(), 840
benchmarks, 563
BETWEEN ... AND, 763
big-tables option
mysqld, 347
big5, 2721, 2724
BIGINT data type, 725
big_tables session variable, 441
BIN(), 770
BINARY, 822
BINARY data type, 729, 742
binary distributions, 40
installing, 80
on Linux, 127
binary log, 481
event groups, 1069
binary logging
and MySQL Cluster, 1709
bind-address option
mysqld, 347
mysqlmanager, 308
BINLOG, 1060
Binlog Dump
thread command, 638
BINLOG statement
mysqlbinlog output, 300
binlog-do-db option
mysqld, 1451
binlog-format option
mysqld, 347
binlog-ignore-db option
mysqld, 1452
binlog-row-event-max-size option
mysqld, 1450
binlog_cache_size system variable, 1453
binlog_format system variable, 1454
binlog_index table (OBSOLETE), 1677
Index
3179
(see also MySQL Cluster replication)
BIT data type, 724
BitKeeper tree, 93
BIT_AND(), 850
BIT_COUNT, 180
BIT_COUNT(), 836
bit_functions
example, 180
BIT_LENGTH(), 770
BIT_OR, 180
BIT_OR(), 850
BIT_XOR(), 850
BLACKHOLE storage engine, 1084, 1194
BLOB
inserting binary data, 658
size, 750
BLOB columns
default values, 743
indexing, 616, 923
BLOB data type, 729, 743
Block Nested-Loop join algorithm, 583
block-search option
myisamchk, 283
BOOL data type, 724
BOOLEAN data type, 724
boolean options, 195
bootstrap option
mysqld, 348
Borland Builder 4, 2022
Boundary(), 870
brackets
square, 724
brief option
mysqlaccess, 291
buffer sizes
client, 1940
mysqld server, 627
Buffer(), 875
bug reports
criteria for, 13
bugs
known, 2767
MySQL Cluster
reporting, 1604
reporting, 13
bugs database, 13
bugs.mysql.com, 13
building
client programs, 2422
bulk_insert_buffer_size system variable, 381
C
C API
data types, 2337
functions, 2342
linking problems, 2418
C prepared statement API
functions, 2393
C++ APIs, 2661
C++ Builder, 2022
C++ compiler
gcc, 90
C++ compiler cannot create executables, 95
C:\my.cnf file, 542
CACHE INDEX, 1060
and partitioning, 1884
caches
clearing, 1060
calculating
dates, 167
calendar, 811
CALL, 945
calling sequences for aggregate functions
UDF, 2682
calling sequences for simple functions
UDF, 2681
can't create/write to file, 2749
carriage return (\r), 657, 961
CASE, 767, 1081
case sensitivity
in access checking, 504
in identifiers, 661
in names, 661
in searches, 2759
in string comparisons, 778
case-sensitivity
of database names, 18
of table names, 18
CAST, 822
cast functions, 822
cast operators, 822
casts, 760, 761, 822
CC environment variable, 90, 90, 96, 152
cc1plus problems, 95
CEIL(), 789
CEILING(), 789
Centroid(), 874
CFLAGS environment variable, 90, 96, 152
cflags option
mysql_config, 323
CHANGE MASTER TO, 1066
in MySQL Cluster, 1680
Change user
thread command, 638
ChangeLog, 2836
changes
log, 2836
MySQL 5.1, 2836
MySQL Cluster, 1724, 1800
changes to privileges, 510
changing
column, 897
column order, 2766
field, 897
table, 892, 898, 2765
Changing master
thread state, 647
changing socket location, 90, 109, 2758
CHAR data type, 729, 741
CHAR VARYING data type, 729
CHAR(), 770
CHARACTER data type, 729
character sets, 91, 707
adding, 708
and replication, 1471
Character sets, 674
CHARACTER VARYING data type, 729
character-set-client-handshake option
mysqld, 349
Index
3180
character-set-filesystem option
mysqld, 349
character-set-server option
mysqld, 349
character-sets-dir option
myisamchk, 282
myisampack, 286
mysql, 222
mysqladmin, 239
mysqlbinlog, 295
mysqlcheck, 244
mysqld, 348
mysqldump, 252
mysqlimport, 262
mysqlshow, 266
characters
multi-byte, 711
CHARACTER_LENGTH(), 771
CHARACTER_SETS
INFORMATION_SCHEMA table, 1918
character_sets_dir system variable, 384
character_set_client system variable, 382
character_set_connection system variable, 382
character_set_database system variable, 382
character_set_filesystem system variable, 383
character_set_results system variable, 383
character_set_server system variable, 383
character_set_system system variable, 383
charset command
mysql, 228
charset option
comp_err, 212
CHARSET(), 840
CHAR_LENGTH(), 771
check option
myisamchk, 281
mysqlcheck, 244
check options
myisamchk, 281
CHECK TABLE, 1017
and partitioning, 1876
check-only-changed option
myisamchk, 281
mysqlcheck, 244
check-password-file option
mysqlmanager, 309
check-upgrade option
mysqlcheck, 244
checking
tables for errors, 552
Checking master version
thread state, 645
checking permissions
thread state, 640
Checking table
thread state, 640
CHECKPOINT Events (MySQL Cluster), 1638
checkpoint option
mysqlhotcopy, 306
Checksum, 1553
Checksum (MySQL Cluster), 1554, 1556
checksum errors, 133
CHECKSUM TABLE, 1019
Chinese, Japanese, Korean character sets
frequently asked questions, 2721
choosing
a MySQL version, 37
choosing types, 750
chroot option
mysqld, 349
mysqlhotcopy, 306
circular replication
in MySQL Cluster, 1672
CJK
FAQ, 2721
CJK (Chinese, Japanese, Korean)
Access, PHP, etc., 2721, 2726
availability of specific characters, 2721, 2728
available character sets, 2721, 2722
big5, 2721, 2724
character sets available, 2721, 2722
characters displayed as question marks, 2721
CJKV, 2722, 2730
collations, 2721, 2722, 2729, 2730
conversion problems with Japanese character sets, 2721, 2724
data truncation, 2721, 2725
Database and table names, 2722, 2730
documentation in Chinese, 2722, 2731
documentation in Japanese, 2722, 2731
documentation in Korean, 2722, 2731
gb2312, gbk, 2721, 2722
Japanese character sets, 2721, 2724
Korean character set, 2721, 2725
LIKE and FULLTEXT, 2721, 2728
MySQL 4.0 behavior, 2721, 2727
ORDER BY treatment, 2721, 2722, 2729, 2730
problems with Access, PHP, etc., 2721, 2726
problems with Big5 character sets (Chinese), 2721, 2724
problems with data truncation, 2721, 2725
problems with euckr character set (Korean), 2721, 2725
problems with GB character sets (Chinese), 2721, 2722
problems with LIKE and FULLTEXT, 2721, 2728
problems with Yen sign (Japanese), 2721, 2725
rejected characters, 2722, 2730
sort order problems, 2721, 2722, 2729, 2730
sorting problems, 2721, 2722, 2729, 2730
testing availability of characters, 2721, 2728
Unicode collations, 2722, 2730
Vietnamese, 2722, 2730
Yen sign, 2721, 2725
clean-password-file option
mysqlmanager, 309
cleaning up
thread state, 640
clear command
mysql, 228
Clearing
thread state, 648
clearing
caches, 1060
client connection threads, 648
client programs, 186
building, 2422
client tools, 1940
clients
debugging, 2696
threaded, 2423
CLOSE, 1080
Close stmt
thread command, 638
Index
3181
closing
tables, 624
closing tables
thread state, 640
cluster database (OBSOLETE), 1677
(see also MySQL Cluster replication)
cluster logs, 1635, 1636
cluster.binlog_index table (OBSOLETE) (see MySQL Cluster replica-
tion)
clustered index
InnoDB, 1140
Clustering (see MySQL Cluster)
CLUSTERLOG commands (MySQL Cluster), 1636
CLUSTERLOG STATISTICS command (MySQL Cluster), 1640
cluster_replication database (OBSOLETE) (see MySQL Cluster replica-
tion)
CMake, 99
COALESCE(), 764
COERCIBILITY(), 841
ColdFusion, 2022
collating
strings, 711
collation
adding, 711
COLLATION(), 841
collation-server option
mysqld, 349
COLLATIONS
INFORMATION_SCHEMA table, 1919
COLLATION_CHARACTER_SET_APPLICABILITY
INFORMATION_SCHEMA table, 1919
collation_connection system variable, 384
collation_database system variable, 384
collation_server system variable, 384
column
changing, 897
types, 724
column comments, 921
column format, 921
column names
case sensitivity, 661
column storage, 922
column-names option
mysql, 222
column-type-info option
mysql, 222
columns
changing, 2766
displaying, 264
indexes, 615
names, 659
other types, 751
selecting, 165
storage requirements, 748
COLUMNS
INFORMATION_SCHEMA table, 1915
columns option
mysqlimport, 262
COLUMN_PRIVILEGES
INFORMATION_SCHEMA table, 1918
comma-separated values data, reading, 960, 969
command options
mysql, 219
mysqladmin, 238
mysqld, 345
command options (MySQL Cluster)
mysqld, 1571
ndbd, 1589, 1622
ndb_mgm, 1597, 1623
ndb_mgmd, 1594, 1622
command syntax, 3, 1297
command-line history
mysql, 227
command-line options (MySQL Cluster), 1619
command-line tool, 218
commands
for binary distribution, 80
commands out of sync, 2750
Comment syntax, 672
comments
adding, 672
starting, 24
comments option
mysql, 222
mysqldump, 252
COMMIT, 20, 995
XA transactions, 1005
commit option
mysqlaccess, 291
mysqlslap, 272
Committing events to binlog
thread state, 647
compact option
mysqldump, 252
comparison operators, 761
compatibility
between MySQL versions, 115
with mSQL, 780
with ODBC, 661, 726, 760, 763, 921, 972
with Oracle, 18, 852, 992
with PostgreSQL, 19
with standard SQL, 16
with Sybase, 995
compatible option
mysqldump, 252
compiler
C++ gcc, 90
compiling
on Windows, 101
optimizing, 626
problems, 95
speed, 625
statically, 90
user-defined functions, 2685
complete-insert option
mysqldump, 252
completion_type system variable, 384
compliance
Y2K, 740
composite partitioning, 1864
compound statements, 1074
compress option
mysql, 222
mysqladmin, 239
mysqlcheck, 244
mysqldump, 252
mysqlimport, 262
mysqlshow, 266
mysqlslap, 272
COMPRESS(), 837
Index
3182
compressed tables, 285, 1095
CompressedBackup, 1537
CompressedLCP, 1537
comp_err, 185, 212
charset option, 212
debug option, 212
debug-info option, 212
header_file option, 213
help option, 212
in_file option, 213
name_file option, 213
out_dir option, 213
out_file option, 213
statefile option, 213
version option, 213
CONCAT(), 771
concatenation
string, 656, 771
CONCAT_WS(), 771
concurrency option
mysqlslap, 272
concurrent inserts, 611, 613
concurrent_insert system variable, 385
Conditions, 1076
config-file option
mysqld_multi, 210
my_print_defaults, 325
ndb_config, 1598
config.cache, 95
config.cache file, 95
config.ini (MySQL Cluster), 1507, 1516, 1516, 1597
configinfo option
ndb_config, 1600
configuration
MySQL Cluster, 1556
configuration files, 512
configuration options, 86
configure
disable-grant-options option, 92
enable-community-features option, 92
enable-profiling option, 92
enable-thread-safe-client option, 91
localstatedir option, 90
prefix option, 90
running after prior invocation, 95
with-big-tables option, 92
with-charset option, 91
with-client-ldflags option, 90
with-collation option, 91
with-debug option, 91
with-embedded-server option, 89
with-extra-charsets option, 91, 91
with-unix-socket-path option, 90
with-zlib-dir option, 92
without-server option, 89
configure option
--with-low-memory, 95
configure script, 86
configuring backups
in MySQL Cluster, 1634
configuring MySQL Cluster, 1501, 1513, 1588, 1597
Configuring MySQL Cluster (concepts), 1497
conflict resolution
enabling, 1695
in MySQL Cluster Replication, 1694
mysqld startup options, 1694
Connect
thread command, 638
connect command
mysql, 228
Connect Out
thread command, 638
connecting
remotely with SSH, 535
to the server, 157, 190
verification, 507
Connecting to master
thread state, 645
connection
aborted, 2747
CONNECTION Events (MySQL Cluster), 1638
CONNECTION_ID(), 841
Connector/C, 1940
Connector/C++, 1940
Connector/JDBC, 1940
Connector/MXJ, 1940
Connector/NET, 1940, 2028
reporting problems, 2200
Connector/ODBC, 1940, 1942
Borland, 2021
Borland Database Engine, 2021
reporting problems, 2027, 2027
Connector/OpenOffice.org, 1940
Connectors
MySQL, 1940
connectstring (see MySQL Cluster)
connect_timeout system variable, 385
connect_timeout variable, 227, 241
console option
mysqld, 350
const table
optimizer, 566, 970
constant table, 574
constraints, 24
CONSTRAINTS
INFORMATION_SCHEMA table, 1919
Contains(), 876
contributing companies
list of, 34
contributors
list of, 27
control flow functions, 767
CONV(), 789
conventions
syntax, 2
typographical, 2, 1296
CONVERT, 822
CONVERT TO, 899
converting HEAP to MyISAM
thread state, 640
CONVERT_TZ(), 797
ConvexHull(), 875
copy option
mysqlaccess, 291
copy to tmp table
thread state, 640
copying databases, 126
copying tables, 931
Copying to group table
thread state, 640
Index
3183
Copying to tmp table
thread state, 640
Copying to tmp table on disk
thread state, 640
core-file option
mysqld, 350
core-file-size option
mysqld_safe, 205
correct-checksum option
myisamchk, 282
correlated subqueries, 984
COS(), 790
COT(), 790
count option
myisam_ftdump, 275
mysqladmin, 239
mysqlshow, 266
COUNT(), 850
COUNT(DISTINCT), 851
counting
table rows, 171
crash, 2690
recovery, 551
repeated, 2755
replication, 1479
crash-me, 563
crash-me program, 561, 563
CRC32(), 790
CREATE DATABASE, 905
Create DB
thread command, 638
CREATE EVENT, 905
CREATE FUNCTION, 913, 1023
CREATE INDEX, 909
CREATE LOGFILE GROUP, 912
(see also MySQL Cluster Disk Data)
CREATE NODEGROUP command (MySQL Cluster), 1630
create option
mysqlslap, 272
CREATE PROCEDURE, 913
CREATE SCHEMA, 905
CREATE SERVER, 917
CREATE TABLE, 918
DIRECTORY options
and replication, 1475
CREATE TABLE ... SELECT
and replication, 1471
CREATE TABLESPACE, 933
(see also MySQL Cluster Disk Data)
CREATE TRIGGER, 934
CREATE USER, 1007
CREATE VIEW, 937
create-options option
mysqldump, 252
create-schema option
mysqlslap, 272
creating
bug reports, 13
database, 905
databases, 160
default startup options, 195
function, 1023
schema, 905
tables, 161
Creating delayed handler
thread state, 644
Creating index
thread state, 640
Creating sort index
thread state, 640
creating table
thread state, 640
Creating table from master dump
thread state, 647
Creating tmp table
thread state, 640
creating user accounts, 1007
CROSS JOIN, 971
Crosses(), 876
CR_SERVER_GONE_ERROR, 2745
CR_SERVER_LOST_ERROR, 2745
CSV data, reading, 960, 969
csv option
mysqlslap, 272
CSV storage engine, 1084, 1192
CURDATE(), 798
CURRENT_DATE, 798
CURRENT_TIME, 798
CURRENT_TIMESTAMP, 798
CURRENT_USER(), 841
Cursors, 1079
CURTIME(), 798
customers
of MySQL, 562
CXX environment variable, 90, 90, 95, 96, 96, 152
CXXFLAGS environment variable, 90, 96, 152
D
Daemon
thread command, 638
data
character sets, 707
importing, 233, 260
loading into tables, 163
retrieving, 163
size, 615
DATA DIRECTORY
and replication, 1475
data node (MySQL Cluster)
defined, 1497
data nodes (MySQL Cluster), 1589, 1593
Data truncation with CJK characters, 2721, 2725
data type
BIGINT, 725
BINARY, 729, 742
BIT, 724
BLOB, 729, 743
BOOL, 724, 751
BOOLEAN, 724, 751
CHAR, 729, 741
CHAR VARYING, 729
CHARACTER, 729
CHARACTER VARYING, 729
DATE, 727, 735
DATETIME, 727, 735
DEC, 727
DECIMAL, 726, 880
DOUBLE, 726
DOUBLE PRECISION, 726
Index
3184
ENUM, 730, 744
FIXED, 727
FLOAT, 726, 726, 726
GEOMETRY, 864
GEOMETRYCOLLECTION, 864
INT, 725
INTEGER, 725
LINESTRING, 864
LONG, 743
LONGBLOB, 730
LONGTEXT, 730
MEDIUMBLOB, 730
MEDIUMINT, 725
MEDIUMTEXT, 730
MULTILINESTRING, 864
MULTIPOINT, 864
MULTIPOLYGON, 864
NATIONAL CHAR, 729
NATIONAL VARCHAR, 729
NCHAR, 729
NUMERIC, 727
NVARCHAR, 729
POINT, 864
POLYGON, 864
REAL, 726
SET, 730, 746
SMALLINT, 725
TEXT, 730, 743
TIME, 727, 739
TIMESTAMP, 727, 735
TINYBLOB, 729
TINYINT, 724
TINYTEXT, 729
VARBINARY, 729, 742
VARCHAR, 729, 741
VARCHARACTER, 729
YEAR, 727, 740
data types, 724
C API, 2337
overview, 724
data-file-length option
myisamchk, 282
database
altering, 888
creating, 905
deleting, 941
Database information
obtaining, 1027
database metadata, 1912
database names
case sensitivity, 661
case-sensitivity, 18
database option
mysql, 222
mysqlbinlog, 295
DATABASE(), 842
databases
backups, 543
copying, 126
creating, 160
defined, 3
displaying, 264
dumping, 247, 305
information about, 174
names, 659
replicating, 1419
selecting, 161
symbolic links, 653
using, 160
databases option
mysqlcheck, 245
mysqldump, 252
DataDir, 1525, 1528
datadir option
mysql.server, 208
mysqld, 350
mysqld_safe, 205
mysql_install_db, 215
mysql_upgrade, 218
datadir system variable, 386
DataJunction, 2023
DataMemory, 1528, 1568
DATE, 2760
date and time functions, 795
Date and Time types, 733
date calculations, 167
DATE columns
problems, 2760
DATE data type, 727, 735
date functions
Y2K compliance, 740
date types, 749
Y2K issues, 740
date values
problems, 736
DATE(), 798
DATEDIFF(), 798
dates
used with partitioning, 1855
used with partitioning (examples), 1858, 1860, 1864, 1880
DATETIME data type, 727, 735
datetime_format system variable, 386
DATE_ADD(), 798
date_format system variable, 386
DATE_FORMAT(), 800
DATE_SUB(), 798, 801
DAY(), 802
DAYNAME(), 802
DAYOFMONTH(), 802
DAYOFWEEK(), 802
DAYOFYEAR(), 802
db option
mysqlaccess, 291
db table
sorting, 509
DB2 SQL mode, 475
DBI interface, 2661
DBI->quote, 658
DBI->trace, 2693
DBI/DBD interface, 2661
DBI_TRACE environment variable, 152, 2693
DBI_USER environment variable, 152
DBUG package, 2696
DEALLOCATE PREPARE, 1071, 1074
Debug
thread command, 638
debug option
comp_err, 212
make_win_bin_dist, 213
myisamchk, 279
Index
3185
myisampack, 286
mysql, 222
mysqlaccess, 291
mysqladmin, 240
mysqlbinlog, 295
mysqlcheck, 245
mysqld, 350
mysqldump, 252
mysqldumpslow, 304
mysqlhotcopy, 306
mysqlimport, 262
mysqlmanager, 309
mysqlshow, 266
mysqlslap, 272
my_print_defaults, 325
debug system variable, 386
debug-check option
mysql, 223
mysqladmin, 240
mysqlbinlog, 295
mysqlcheck, 245
mysqldump, 252
mysqlimport, 262
mysqlshow, 266
mysqlslap, 272
mysql_upgrade, 218
debug-info option
comp_err, 212
mysql, 223
mysqladmin, 240
mysqlbinlog, 295
mysqlcheck, 245
mysqldump, 252
mysqlimport, 262
mysqlshow, 266
mysqlslap, 272
mysql_upgrade, 218
debugging
client, 2696
server, 2690
debugging support, 86
DEC data type, 727
decimal arithmetic, 880
DECIMAL data type, 726, 880
decimal point, 724
DECLARE, 1075
DECODE(), 837
decode_bits myisamchk variable, 280
DEFAULT
constraint, 25
default
privileges, 112
default host name, 190
default installation location, 43
default options, 195
DEFAULT value clause, 730, 921
default values, 561, 730, 921, 951
BLOB and TEXT columns, 743
explicit, 730
implicit, 730
suppression, 25
DEFAULT(), 846
default-character-set option
mysql, 223
mysqladmin, 240
mysqlcheck, 245
mysqld, 351
mysqldump, 253
mysqlimport, 262
mysqlshow, 266
default-collation option
mysqld, 351
default-mysqld-path option
mysqlmanager, 309
default-storage-engine option
mysqld, 351
default-table-type option
mysqld, 351
default-time-zone option
mysqld, 352
defaults
embedded, 2334
defaults-extra-file option, 198
mysqld_multi, 209
mysqld_safe, 205
my_print_defaults, 325
defaults-file option, 198
mysqld_multi, 209
mysqld_safe, 205
mysqlmanager, 309
my_print_defaults, 325
defaults-group-suffix option, 199
my_print_defaults, 325
default_week_format system variable, 387
DEGREES(), 790
delay-key-write option
mysqld, 352, 1092
DELAYED, 954
when ignored, 953
Delayed insert
thread command, 638
delayed inserts
thread states, 644
delayed-insert option
mysqldump, 253
delayed_insert_limit, 955
delayed_insert_limit system variable, 388
delayed_insert_timeout system variable, 388
delayed_queue_size system variable, 388
delay_key_write system variable, 387
DELETE, 946
and MySQL Cluster, 1706
delete option
mysqlimport, 262
delete-master-logs option
mysqldump, 253
deleting
database, 941
foreign key, 898, 1122
function, 1023
index, 897, 942
primary key, 897
rows, 2763
schema, 941
table, 943
user, 519, 1008
users, 519, 1008
deleting from main table
thread state, 640
deleting from reference tables
Index
3186
thread state, 641
deletion
mysql.sock, 2758
delimiter command
mysql, 228
delimiter option
mysql, 223
mysqlslap, 272
ndb_select_all, 1612
Delphi, 2022
derived tables, 985
des-key-file option
mysqld, 352
DESC, 992
descending option
ndb_select_all, 1612
DESCRIBE, 174, 992
description option
myisamchk, 283
design
issues, 2767
limitations, 561
DES_DECRYPT(), 837
DES_ENCRYPT(), 838
detach option
mysqlslap, 272
development source tree, 93
Difference(), 875
digits, 724
Dimension(), 869
directory structure
default, 43
disable named command
mysql, 223
disable-grant-options option
configure, 92
disable-keys option
mysqldump, 253
disable-log-bin option
mysqlbinlog, 295
DISCARD TABLESPACE, 898, 1102
discard_or_import_tablespace
thread state, 641
disconnect-slave-event-count option
mysqld, 1447
disconnecting
from the server, 157
Disjoint(), 876
Disk Data tables (MySQL Cluster) (see MySQL Cluster Disk Data)
disk full, 2757
disk issues, 652
disk option
ndb_select_all, 1612
DiskCheckpointSpeed, 1540
DiskCheckpointSpeedInRestart, 1541
DiskIOThreadPool, 1547, 1550
Diskless, 1536
DiskPageBufferMemory, 1547, 1549
disks
splitting data across, 655
DiskSyncSize, 1540
display size, 724
display triggers, 1056
display width, 724
displaying
database information, 264
information
Cardinality, 1041
Collation, 1041
SHOW, 1027, 1030, 1041, 1042, 1056
table status, 1054
Distance(), 876
DISTINCT, 166, 595, 970
AVG(), 850
COUNT(), 851
MAX(), 852
MIN(), 852
SUM(), 852
DISTINCTROW, 970
DIV, 787
division (/), 787
div_precision_increment system variable, 389
DNS, 652
DO, 949
DocBook XML
documentation source format, 1
Documentation
in Chinese, 2722, 2731
in Japanese, 2722, 2731
in Korean, 2722, 2731
Documenters
list of, 31
DOUBLE data type, 726
DOUBLE PRECISION data type, 726
double quote (\"), 657
downgrades
MySQL Cluster, 1580, 1580, 1582
downgrading, 114, 122
downloading, 40
drbd
FAQ, 2731
DRBD, 2731, 2732
DRBD license, 2732, 2732
DROP ... IF EXISTS
and replication, 1475
DROP DATABASE, 941
Drop DB
thread command, 638
DROP EVENT, 941
DROP FOREIGN KEY, 898, 1122
DROP FUNCTION, 942, 1023
DROP INDEX, 897, 942
DROP LOGFILE GROUP, 942
(see also MySQL Cluster Disk Data)
DROP NODEGROUP command (MySQL Cluster), 1630
DROP PREPARE, 1074
DROP PRIMARY KEY, 897
DROP PROCEDURE, 942
DROP SCHEMA, 941
DROP SERVER, 942
DROP TABLE, 943
and MySQL Cluster, 1706
DROP TABLESPACE, 943
(see also MySQL Cluster Disk Data)
DROP TRIGGER, 944
DROP USER, 1008
DROP VIEW, 944
drop-user option
mysqlmanager, 309
dropping
Index
3187
user, 519, 1008
dryrun option
mysqlhotcopy, 306
DUAL, 966
dump option
myisam_ftdump, 276
dump-date option
mysqldump, 253
DUMPFILE, 969
dumping
databases and tables, 247, 305
dynamic table characteristics, 1094
E
edit command
mysql, 229
edit-user option
mysqlmanager, 309
ego command
mysql, 229
Eiffel Wrapper, 2662
ELT(), 771
email lists, 10
embedded MySQL server library, 2333
embedded option
make_win_bin_dist, 213
mysql_config, 324
enable-community-features option
configure, 92
enable-named-pipe option
mysqld, 352
enable-profiling option
configure, 92
enable-pstack option
mysqld, 353
enable-thread-safe-client option
configure, 91
ENCODE(), 837
ENCRYPT(), 838
encryption, 527
encryption functions, 836
end
thread state, 641
END, 1074
EndPoint(), 871
engine option
mysqlslap, 272
ENGINES
INFORMATION_SCHEMA table, 1925
engine_condition_pushdown system variable, 389
ENTER SINGLE USER MODE command (MySQL Cluster), 1630
entering
queries, 158
ENUM
size, 750
ENUM data type, 730, 744
Envelope(), 870
environment variable
CC, 90, 90, 96, 152
CFLAGS, 90, 96, 152
CXX, 90, 90, 95, 96, 152
CXXFLAGS, 90, 96, 152
DBI_TRACE, 152, 2693
DBI_USER, 152
HOME, 152, 227
LD_LIBRARY_PATH, 154
LD_RUN_PATH, 129, 134, 152, 154
MYSQL_DEBUG, 152, 189, 2696
MYSQL_GROUP_SUFFIX, 152
MYSQL_HISTFILE, 152, 227
MYSQL_HOME, 152
MYSQL_HOST, 152, 193
MYSQL_PS1, 152
MYSQL_PWD, 152, 189, 193
MYSQL_TCP_PORT, 152, 189, 541, 541
MYSQL_UNIX_PORT, 107, 152, 189, 541, 541
PATH, 81, 152, 190
TMPDIR, 107, 152, 189, 2757
TZ, 152, 2759
UMASK, 152, 2752
UMASK_DIR, 152, 2753
USER, 152, 193
environment variables, 189, 202, 512
CXX, 96
list of, 151
equal (=), 762
Equals(), 877
eq_ref join type
optimizer, 566
Errcode, 326
errno, 326
Error
thread command, 638
ERROR Events (MySQL Cluster), 1640
error logs (MySQL Cluster), 1591
error messages
can't find file, 2752
displaying, 326
languages, 708, 708
errors
access denied, 2740
and replication, 1480
checking tables for, 552
common, 2739
directory checksum, 133
handling for UDFs, 2685
in subqueries, 986
known, 2767
linking, 2752
list of, 2740
lost connection, 2742
reporting, 1, 13, 13
error_count session variable, 441
ERROR_FOR_DIVISION_BY_ZERO SQL mode, 471
escape (\\), 657
escape characters, 656
estimating
query performance, 572
event groups, 1069
event log format (MySQL Cluster), 1637
event logs (MySQL Cluster), 1635, 1636, 1637
event restrictions, 3166
event scheduler, 1890
thread states, 648
Event Scheduler, 1896
altering events, 888
and MySQL privileges, 1900
and mysqladmin debug, 1899
and replication, 1475
Index
3188
and SHOW PROCESSLIST, 1897
concepts, 1896
creating events, 905
dropping events, 941
enabling and disabling, 1897
event metadata, 1899
obtaining status information, 1048, 1899
SQL statements, 1899
starting and stopping, 1897
event severity levels (MySQL Cluster), 1637
event types (MySQL Cluster), 1635, 1638
event-scheduler option
mysqld, 353
events, 1890, 1896
altering, 888
creating, 905
dropping, 941
metadata, 1899
status variables, 1902
EVENTS
INFORMATION_SCHEMA table, 1901, 1928
events option
mysqldump, 253
event_scheduler system variable, 390
exact-value literals, 880
example option
mysqld_multi, 210
EXAMPLE storage engine, 1084, 1185
examples
compressed tables, 287
myisamchk output, 555
queries, 176
exe-suffix option
make_win_bin_dist, 214
Execute
thread command, 638
EXECUTE, 1071, 1074
execute option
mysql, 223
ExecuteOnComputer, 1524, 1527, 1551
executing
thread state, 641
executing SQL statements from text files, 175, 233
Execution of init_command
thread state, 641
EXISTS
with subqueries, 983
exit command
mysql, 229
EXIT command (MySQL Cluster), 1630
EXIT SINGLE USER MODE command (MySQL Cluster), 1630
exit-info option
mysqld, 353
EXP(), 790
expire_logs_days system variable, 390
EXPLAIN, 564, 992
EXPLAIN PARTITIONS, 1877, 1878
EXPLAIN used with partitioned tables, 1877
explicit default values, 730
EXPORT_SET(), 771
expression aliases, 855, 966
expressions
extended, 169
extend-check option
myisamchk, 281, 282
extended option
mysqlcheck, 245
extended-insert option
mysqldump, 253
extensions
to standard SQL, 16
ExteriorRing(), 873
external locking, 354, 365, 428, 551, 614, 643
external-locking option
mysqld, 354
extra-file option
my_print_defaults, 325
extra-partition-info option
ndb_desc, 1603
EXTRACT(), 802
extracting
dates, 167
ExtractValue(), 826
F
failover
in MySQL Cluster replication, 1683
FALSE, 658, 659
testing for, 763, 763
fast option
myisamchk, 281
mysqlcheck, 245
fatal signal 11, 95
features of MySQL, 4
FEDERATED storage engine, 1084, 1186
Fetch
thread command, 638
FETCH, 1079
field
changing, 897
Field List
thread command, 638
FIELD(), 772
fields option
ndb_config, 1599
fields-enclosed-by option
mysqldump, 253, 263
fields-escaped-by option
mysqldump, 253, 263
fields-optionally-enclosed-by option
mysqldump, 253, 263
fields-terminated-by option
mysqldump, 253, 263
FILE, 773
files
binary log, 481
config.cache, 95
error messages, 708
general query log, 480
log, 86, 490
my.cnf, 1470
not found message, 2752
permissions, 2752
repairing, 282
script, 175
size limits, 2748
slow query log, 489
text, 233, 260
tmp, 107
Index
3189
FILES
INFORMATION_SCHEMA table, 1931
(see also MySQL Cluster Disk Data)
filesort optimization, 592
FileSystemPath, 1528
FileSystemPathDataFiles, 1548
FileSystemPathDD, 1547
FileSystemPathUndoFiles, 1548
FIND_IN_SET(), 772
Finished reading one binlog; switching to next binlog
thread state, 645
firewalls (software)
and MySQL Cluster, 1665, 1666
first-slave option
mysqldump, 253
fix-db-names option
mysqlcheck, 245
fix-table-names option
mysqlcheck, 245
FIXED data type, 727
fixed-point arithmetic, 880
FLOAT data type, 726, 726, 726
floating-point number, 726
floating-point values
and replication, 1477
floats, 658
FLOOR(), 790
FLUSH, 1060
and replication, 1477
flush option
mysqld, 354
flush system variable, 391
flush tables, 237
flush-logs option
mysqldump, 253
flush-privileges option
mysqldump, 253
Flushing tables
thread state, 641
flushlog option
mysqlhotcopy, 306
flush_time system variable, 391
FOR UPDATE, 970
FORCE INDEX, 977, 2765
FORCE KEY, 977
force option
myisamchk, 281, 282
myisampack, 286
mysql, 223
mysqladmin, 240
mysqlcheck, 245
mysqldump, 253
mysqlimport, 263
mysql_convert_table_format, 319
mysql_install_db, 215
mysql_upgrade, 218
force-read option
mysqlbinlog, 296
foreign key
constraint, 25
deleting, 898, 1122
foreign keys, 22, 179, 898
foreign_key_checks session variable, 441
FORMAT(), 772
Forums, 12
FOUND_ROWS(), 842
FragmentLogFileSize, 1534
FreeBSD troubleshooting, 96
freeing items
thread state, 641
frequently-asked questions about DRBD, 2731
frequently-asked questions about MySQL Cluster, 2711
FROM, 967
FROM_DAYS(), 802
FROM_UNIXTIME(), 802
ft_boolean_syntax system variable, 391
ft_max_word_len myisamchk variable, 280
ft_max_word_len system variable, 392
ft_min_word_len myisamchk variable, 280
ft_min_word_len system variable, 392
ft_query_expansion_limit system variable, 392
ft_stopword_file myisamchk variable, 280
ft_stopword_file system variable, 393
full disk, 2757
full-text search, 811
FULLTEXT, 811
fulltext
stopword list, 821
FULLTEXT initialization
thread state, 641
fulltext join type
optimizer, 567
function
creating, 1023
deleting, 1023
function names
parsing, 664
resolving ambiguity, 664
functions, 752
and replication, 1477
arithmetic, 834
bit, 834
C API, 2342
C prepared statement API, 2393
cast, 822
control flow, 767
date and time, 795
encryption, 836
GROUP BY, 849
grouping, 759
information, 839
mathematical, 788
miscellaneous, 846
native
adding, 2687
new, 2678
stored, 1891
string, 768
string comparison, 778
user-defined, 2678
adding, 2679
Functions
user-defined, 1023, 1023
functions for SELECT and WHERE clauses, 752
Future development of MySQL Cluster, 1713
G
gap lock
InnoDB, 1110, 1130, 1134, 1135
Index
3190
gb2312, gbk, 2721, 2722
gcc, 90
gci option
ndb_select_all, 1612
GCP Stop errors (MySQL Cluster), 1549
gdb
using, 2692
gdb option
mysqld, 354
general information, 1
General Public License, 4
general query log, 480
general-log option
mysqld, 354
general_log system variable, 393
general_log_file system variable, 393
geographic feature, 856
GeomCollFromText(), 864
GeomCollFromWKB(), 865
geometry, 856
GEOMETRY data type, 864
GEOMETRYCOLLECTION data type, 864
GeometryCollection(), 866
GeometryCollectionFromText(), 864
GeometryCollectionFromWKB(), 865
GeometryFromText(), 864
GeometryFromWKB(), 865
GeometryN(), 874
GeometryType(), 870
GeomFromText(), 864, 869
GeomFromWKB(), 865, 869
geospatial feature, 856
getting MySQL, 40
GET_FORMAT(), 803
GET_LOCK(), 846
GIS, 856, 856
GLength(), 871, 872
global privileges, 1008, 1015
GLOBAL_STATUS
INFORMATION_SCHEMA table, 1936
GLOBAL_VARIABLES
INFORMATION_SCHEMA table, 1937
go command
mysql, 229
goals of MySQL, 4
got handler lock
thread state, 644
got old table
thread state, 644
GRANT, 1008
GRANT statement, 516
grant tables
re-creating, 107
sorting, 508, 509
structure, 502
upgrading, 214
granting
privileges, 1008
GRANTS, 1040
greater than (>), 762
greater than or equal (>=), 762
GREATEST(), 764
GROUP BY, 593
aliases in, 855
extensions to standard SQL, 855, 967
GROUP BY functions, 849
grouping
expressions, 759
GROUP_CONCAT(), 851
group_concat_max_len system variable, 394
H
HANDLER, 949
Handlers, 1077
handling
errors, 2685
Has read all relay log; waiting for the slave I/O thread to update it
thread state, 646
Has sent all binlog to slave; waiting for binlog to be updated
thread state, 645
hash partitioning, 1860
hash partitions
managing, 1875
splitting and merging, 1875
have_archive system variable, 394
have_blackhole_engine system variable, 394
have_community_features system variable, 394
have_compress system variable, 394
have_crypt system variable, 394
have_csv system variable, 394
have_dynamic_loading system variable, 395
have_example_engine system variable, 395
have_federated_engine system variable, 395
have_geometry system variable, 395
have_innodb system variable, 395
have_isam system variable, 395
have_merge_engine system variable, 395
have_openssl system variable, 395
have_partitioning system variable, 395
have_query_cache system variable, 395
have_raid system variable, 395
have_row_based_replication system variable, 395
have_rtree_keys system variable, 396
have_ssl system variable, 396
have_symlink system variable, 396
HAVING, 967
header option
ndb_select_all, 1612
header_file option
comp_err, 213
HEAP storage engine, 1084, 1183
HeartbeatIntervalDbApi, 1538
HeartbeatIntervalDbDb, 1538
help command
mysql, 228
HELP command (MySQL Cluster), 1629
help option
comp_err, 212
myisamchk, 279
myisampack, 286
myisam_ftdump, 275
mysql, 222
mysqlaccess, 291
mysqladmin, 239
mysqlbinlog, 295
mysqlcheck, 244
mysqld, 346
mysqldump, 251
mysqldumpslow, 304
Index
3191
mysqld_multi, 210
mysqld_safe, 205
mysqlhotcopy, 306
mysqlimport, 262
mysqlmanager, 308
mysqlshow, 266
mysqlslap, 271
mysql_convert_table_format, 319
mysql_find_rows, 321
mysql_setpermission, 321
mysql_upgrade, 218
mysql_waitpid, 322
my_print_defaults, 325
perror, 326
resolveip, 327
resolve_stack_dump, 325
HELP option
myisamchk, 279
HELP statement, 993
HEX(), 772, 790
hex-blob option
mysqldump, 254
hexadecimal values, 658
hexdump option
mysqlbinlog, 296
HIGH_NOT_PRECEDENCE SQL mode, 471
HIGH_PRIORITY, 970
hints, 17
index, 967, 977
history of MySQL, 4
HOME environment variable, 152, 227
host name
default, 190
host name caching, 652
host name resolution, 652
host option, 191
mysql, 223
mysqlaccess, 292
mysqladmin, 240
mysqlbinlog, 296
mysqlcheck, 245
mysqldump, 254
mysqlhotcopy, 306
mysqlimport, 263
mysqlshow, 267
mysqlslap, 272
mysql_convert_table_format, 320
mysql_setpermission, 321
ndb_config, 1599
host table, 510
sorting, 509
Host*SciId* parameters, 1555
host.frm
problems finding, 104
HostName, 1524, 1527, 1551
HostName (MySQL Cluster), 1663
hostname system variable, 396
HOUR(), 803
howto option
mysqlaccess, 292
html option
mysql, 223
I
i-am-a-dummy option
mysql, 225
i5/OS, 76
IBM i5/OS, 76
IBMDB2I storage engine, 1084
icc
and MySQL Cluster support>, 2690
Id, 1524, 1526, 1550
ID
unique, 2417
id option
ndb_config, 1599
identifiers, 659
case sensitivity, 661
quoting, 659
identity session variable, 441
IF, 1080
IF(), 767
IFNULL(), 768
IGNORE
with partitioned tables, 953
IGNORE INDEX, 977
IGNORE KEY, 977
ignore option
mysqlimport, 263
ignore-builtin-innodb option
mysqld, 1107
ignore-lines option
mysqlimport, 263
ignore-spaces option
mysql, 223
ignore-table option
mysqldump, 254
IGNORE_SPACE SQL mode, 471
implicit default values, 730
IMPORT TABLESPACE, 898, 1102
importing
data, 233, 260
IN, 764, 982
include option
mysql_config, 323
increasing
performance, 1483, 1485
increasing with replication
speed, 1419
index
deleting, 897, 942
rebuilding, 125
INDEX DIRECTORY
and replication, 1475
index hints, 967, 977
index join type
optimizer, 567
index-record lock
InnoDB, 1110, 1130, 1134, 1135
indexes, 909
and BLOB columns, 616, 923
and IS NULL, 618
and LIKE, 618
and NULL values, 922
and TEXT columns, 616, 923
assigning to key cache, 1060
block size, 398
columns, 615
leftmost prefix of, 617
Index
3192
multi-column, 616
multiple-part, 909
names, 659
use of, 617
IndexMemory, 1529, 1568
index_merge join type
optimizer, 567
index_subquery join type
optimizer, 567
INET_ATON(), 847
INET_NTOA(), 847
INFO Events (MySQL Cluster), 1640
information functions, 839
information option
myisamchk, 281
INFORMATION_SCHEMA, 1912
and security issues, 1668
INFORMATION_SCHEMA.ENGINES table
used with MySQL Cluster, 1653
INFORMATION_SCHEMA.GLOBAL_STATUS table
used with MySQL Cluster, 1654
INFORMATION_SCHEMA.GLOBAL_VARIABLES table
used with MySQL Cluster, 1653
init
thread state, 641
Init DB
thread command, 638
init-file option
mysqld, 355
InitFragmentLogFiles, 1534
Initialized
thread state, 648
InitialLogFileGroup, 1548
InitialNoOfOpenFiles, 1534
InitialTablespace, 1549
init_connect system variable, 396
init_file system variable, 396
init_slave system variable, 1447
INNER JOIN, 971
innochecksum, 187, 274
InnoDB, 1097
clustered index, 1140
gap lock, 1110, 1130, 1134, 1135
index-record lock, 1110, 1130, 1134, 1135
Monitors, 1128, 1143, 1151, 1159, 1160
next-key lock, 1110, 1130, 1134, 1135
NFS, 1099, 1160
record-level locks, 1110, 1130, 1134, 1135
secondary index, 1140
semi-consistent read, 1110
Solaris 10 x86_64 issues, 133
transaction isolation levels, 1130
innodb option
mysqld, 1107
InnoDB storage engine, 1084, 1097
InnoDB tables, 20
innodb_status_file option
mysqld, 1107
INSERT, 605, 951
insert
thread state, 644
INSERT ... SELECT, 954
INSERT DELAYED, 954, 954
INSERT statement
grant privileges, 517
INSERT(), 772
insert-ignore option
mysqldump, 254
insertable views
insertable, 1904
inserting
speed of, 605
inserts
concurrent, 611, 613
insert_id session variable, 442
install option
mysqlmanager, 309
INSTALL PLUGIN, 1023
installation layouts, 43
installation overview, 83
installing
binary distribution, 80
Linux RPM packages, 71
Mac OS X PKG packages, 73
overview, 35
Perl, 152
Perl on Windows, 154
Solaris PKG packages, 75
source distribution, 83
user-defined functions, 2685
installing MySQL Cluster, 1501, 1504, 1514
installing plugins, 1023
INSTR(), 773
INT data type, 725
integer arithmetic, 880
INTEGER data type, 725
integers, 658
interactive_timeout system variable, 397
InteriorRingN(), 873
internal compiler errors, 95
internal locking, 610
internals, 2663
internationalization, 674
Internet Relay Chat, 12
Intersection(), 875
Intersects(), 877
INTERVAL(), 765
introducer
string literal, 656, 679
invalid data
constraint, 25
in_file option
comp_err, 213
IRC, 12
IS boolean_value, 763
IS NOT boolean_value, 763
IS NOT NULL, 763
IS NULL, 581, 763
and indexes, 618
isamlog, 187, 284
IsClosed(), 872
IsEmpty(), 870
ISNULL(), 764
ISOLATION LEVEL, 1002
IsRing(), 872
IsSimple(), 870
IS_FREE_LOCK(), 847
IS_USED_LOCK(), 847
ITERATE, 1082
iterations option
Index
3193
mysqlslap, 272
J
Japanese character sets
conversion, 2721, 2724
Japanese, Korean, Chinese character sets
frequently asked questions, 2721
join
nested-loop algorithm, 586
JOIN, 971
join algorithm
Block Nested-Loop, 583
Nested-Loop, 583
join option
myisampack, 286
join type
ALL, 567
const, 566
eq_ref, 566
fulltext, 567
index, 567
index_merge, 567
index_subquery, 567
range, 567
ref, 566
ref_or_null, 567
system, 566
unique_subquery, 567
join_buffer_size system variable, 397
K
keepold option
mysqlhotcopy, 306
keep_files_on_create system variable, 398
Key cache
MyISAM, 619
key cache
assigning indexes to, 1060
key partitioning, 1863
key partitions
managing, 1875
splitting and merging, 1875
key space
MyISAM, 1093
keys, 615
foreign, 22, 179
multi-column, 616
searching on two, 180
keys option
mysqlshow, 267
keys-used option
myisamchk, 282
keywords, 667
key_buffer_size myisamchk variable, 280
key_buffer_size system variable, 398
key_cache_age_threshold system variable, 399
key_cache_block_size system variable, 399
key_cache_division_limit system variable, 400
KEY_COLUMN_USAGE
INFORMATION_SCHEMA table, 1920
Kill
thread command, 638
KILL, 1062
Killed
thread state, 641
Killing slave
thread state, 647
known errors, 2767
Korean, 2721, 2725
Korean, Chinese, Japanese character sets
frequently asked questions, 2721
L
language option
mysqld, 355
language support
error messages, 708
language system variable, 400
large page support, 650
large-pages option
mysqld, 355
large_files_support system variable, 400
large_pages system variable, 400
large_page_size system variable, 401
last row
unique ID, 2417
LAST_DAY(), 803
last_insert_id session variable, 442
LAST_INSERT_ID(), 22, 953
and replication, 1470
LAST_INSERT_ID() and stored routines, 1893
LAST_INSERT_ID() and triggers, 1893
LAST_INSERT_ID([<replaceable>expr</replaceable>]), 843
layout of installation, 43
LCASE(), 773
lc_time_names system variable, 401
ldata option
mysql_install_db, 215
LD_LIBRARY_PATH environment variable, 154
LD_RUN_PATH environment variable, 129, 134, 152, 154
LEAST(), 765
LEAVE, 1082
ledir option
mysqld_safe, 205
LEFT JOIN, 582, 971
LEFT OUTER JOIN, 971
LEFT(), 773
leftmost prefix of indexes, 617
legal names, 659
length option
myisam_ftdump, 276
LENGTH(), 773
less than (<), 762
less than or equal (<=), 762
libmysqld, 2333
options, 2334
libmysqld-libs option
mysql_config, 324
libraries
list of, 32
library
mysqlclient, 1940
mysqld, 1940
libs option
mysql_config, 324
libs_r option
mysql_config, 324
license system variable, 401
Index
3194
LIKE, 778
and indexes, 618
and wildcards, 618
LIMIT, 599, 842, 968
and replication, 1478
limitations
design, 561
MySQL Limitations, 3174
replication, 1470
limitations of MySQL Cluster, 1704
limits
file-size, 2748
MySQL Limits, limits in MySQL, 3174
line-numbers option
mysql, 223
linear hash partitioning, 1862
linear key partitioning, 1864
linefeed (\n), 657, 961
LineFromText(), 864
LineFromWKB(), 865
lines-terminated-by option
mysqldump, 254, 263
LINESTRING data type, 864
LineString(), 866
LineStringFromText(), 864
LineStringFromWKB(), 865
linking, 2422
errors, 2752
problems, 2418
speed, 625
links
symbolic, 653
Linux
binary distribution, 127
source distribution, 128
list partitioning, 1858
list partitions
adding and dropping, 1871
managing, 1871
list-users option
mysqlmanager, 309
literals, 656
LN(), 791
LOAD DATA
and replication, 1478
LOAD DATA FROM MASTER, 1068
LOAD DATA INFILE, 957, 2762
load emulation, 268
LOAD INDEX INTO CACHE
and partitioning, 1884
LOAD TABLE FROM MASTER, 1069
loading
tables, 163
LOAD_FILE(), 773
local checkpoints (MySQL Cluster), 1568
local option
mysqlimport, 263
local-infile option
mysql, 223
mysqld, 495
local-load option
mysqlbinlog, 296
localization, 674
localstatedir option
configure, 90
LOCALTIME, 804
LOCALTIMESTAMP, 804
local_infile system variable, 401
LOCATE(), 773
LOCK IN SHARE MODE, 970
Lock Monitor
InnoDB, 1151
lock option
ndb_select_all, 1612
LOCK TABLES, 998
lock-all-tables option
mysqldump, 254
lock-directory option
mysqlslap, 273
lock-tables option
mysqldump, 254
mysqlimport, 263
Locked
thread state, 641
locked_in_memory system variable, 401
LockExecuteThreadToCPU, 1546
locking, 626
external, 354, 365, 428, 551, 614, 643
internal, 610
row-level, 22, 610
table-level, 610
locking methods, 610
LockMaintThreadsToCPU, 1546
LockPagesInMainMemory, 1536
log
changes, 2836
log files, 86
maintaining, 490
log files (MySQL Cluster), 1591
ndbmtd, 1594
log option
mysqld, 356
mysqld_multi, 210
mysqlmanager, 309
log system variable, 402
LOG(), 791
log-bin option
mysqld, 1450
log-bin-index option
mysqld, 1451
log-bin-trust-function-creators option
mysqld, 1452
log-error option
mysqld, 356
mysqldump, 254
mysqld_safe, 205
log-isam option
mysqld, 356
log-long-format option
mysqld, 357
log-output option
mysqld, 357
log-queries-not-using-indexes option
mysqld, 357
log-short-format option
mysqld, 358
log-slave-updates option
mysqld, 1440
log-slow-admin-statements option
mysqld, 358
Index
3195
log-slow-queries option
mysqld, 358
log-slow-slave-statements option
mysqld, 1440
log-tc option
mysqld, 358
log-tc-size option
mysqld, 359
log-warnings option
mysqld, 359, 1440
LOG10(), 791
LOG2(), 791
LogDestination, 1525
logging commands (MySQL Cluster), 1636
logging slow query
thread state, 641
logical operators, 765
login
thread state, 641
LogLevelCheckpoint (MySQL Cluster configuration parameter), 1543
LogLevelCongestion, 1544
LogLevelConnection (MySQL Cluster configuration parameter), 1544
LogLevelError, 1544
LogLevelInfo, 1544
LogLevelNodeRestart (MySQL Cluster configuration parameter), 1544
LogLevelShutdown, 1543
LogLevelStartup, 1543
LogLevelStatistic (MySQL Cluster configuration parameter), 1543
logs
server, 477
log_bin system variable, 402
log_bin_trust_function_creators system variable, 402
log_error system variable, 402
log_output system variable, 402
log_queries_not_using_indexes system variable, 403
log_slave_updates system variable, 403
log_slow_queries system variable, 403
log_warnings system variable, 404
Long Data
thread command, 638
LONG data type, 743
LONGBLOB data type, 730
LongMessageBuffer, 1533
LONGTEXT data type, 730
long_query_time system variable, 404
LOOP, 1081
loops option
ndb_show_tables, 1614
lost connection errors, 2742
low-priority option
mysqlimport, 263
low-priority-updates option
mysqld, 359
LOWER(), 774
lower_case_file_system system variable, 405
lower_case_table_names system variable, 405
low_priority_updates system variable, 404
LPAD(), 774
LTRIM(), 774
M
Mac OS X, 1942
installation, 73
mailing list address, 1
mailing lists, 10
archive location, 10
guidelines, 12
main features of MySQL, 4
maintaining
log files, 490
tables, 559
maintenance
tables, 241
MAKEDATE(), 804
MAKETIME(), 804
make_binary_distribution, 185
MAKE_SET(), 774
make_win_bin_dist, 186, 213
debug option, 213
embedded option, 213
exe-suffix option, 214
no-debug option, 214
no-embedded option, 214
only-debug option, 214
Making temp file
thread state, 646
malicious SQL statements
and MySQL Cluster, 1668
management client (MySQL Cluster), 1597
(see also mgm)
management node (MySQL Cluster)
defined, 1497
management nodes (MySQL Cluster), 1594
(see also mgmd)
managing MySQL Cluster, 1626
managing MySQL Cluster processes, 1588
manual
available formats, 1
online location, 1
syntax conventions, 2
typographical conventions, 2
master-connect-retry option
mysqld, 1440
master-data option
mysqldump, 254
master-host option
mysqld, 1441
master-info-file option
mysqld, 1441
master-password option
mysqld, 1441
master-port option
mysqld, 1441
master-retry-count option
mysqld, 1441
master-ssl option
mysqld, 1441
master-ssl-ca option
mysqld, 1441
master-ssl-capath option
mysqld, 1441
master-ssl-cert option
mysqld, 1441
master-ssl-cipher option
mysqld, 1441
master-ssl-key option
mysqld, 1441
master-user option
mysqld, 1441
Index
3196
MASTER_POS_WAIT(), 847, 1069
MATCH ... AGAINST(), 811
matching
patterns, 169
math, 880
mathematical functions, 788
MAX(), 852
MAX(DISTINCT), 852
max-binlog-dump-events option
mysqld, 1453
max-record-length option
myisamchk, 282
max-relay-log-size option
mysqld, 1441
MaxBufferedEpochs, 1539
MAXDB SQL mode, 475
maximum memory used, 238
maximums
maximum columns per table, 3174
maximum tables per join, 3174
MaxLCPStartDelay, 1534
MaxNoOfAttributes, 1535
MaxNoOfConcurrentIndexOperations, 1532
MaxNoOfConcurrentOperations, 1531
MaxNoOfConcurrentScans, 1532
MaxNoOfConcurrentTransactions, 1530
MaxNoOfExecutionThreads
ndbmtd, 1593
MaxNoOfFiredTriggers, 1532
MaxNoOfIndexes, 1536
MaxNoOfLocalOperations, 1531
MaxNoOfLocalScans, 1532
MaxNoOfOpenFiles, 1534
MaxNoOfOrderedIndexes, 1535
MaxNoOfSavedMessages, 1534
MaxNoOfTables, 1535
MaxNoOfTriggers, 1535
MaxNoOfUniqueHashIndexes, 1535
MaxScanBatchSize, 1551
max_allowed_packet system variable, 405
max_allowed_packet variable, 227
max_binlog_cache_size system variable, 1455
max_binlog_size system variable, 1455
max_connections system variable, 406
MAX_CONNECTIONS_PER_HOUR, 519
max_connect_errors system variable, 406
max_delayed_threads system variable, 407
max_error_count system variable, 407
max_heap_table_size system variable, 407
max_insert_delayed_threads system variable, 408
max_join_size system variable, 408
max_join_size variable, 227
max_length_for_sort_data system variable, 409
max_prepared_stmt_count system variable, 409
MAX_QUERIES_PER_HOUR, 519
max_relay_log_size system variable, 409
max_seeks_for_key system variable, 410
max_sort_length system variable, 410
max_sp_recursion_depth system variable, 410
max_tmp_tables system variable, 411
MAX_UPDATES_PER_HOUR, 519
MAX_USER_CONNECTIONS, 519
max_user_connections system variable, 411
max_write_lock_count system variable, 412
MBR, 875
MBRContains(), 875
MBRDisjoint(), 875
MBREqual(), 875
MBRIntersects(), 875
MBROverlaps(), 875
MBRTouches(), 876
MBRWithin(), 876
MD5(), 838
medium-check option
myisamchk, 281
mysqlcheck, 245
MEDIUMBLOB data type, 730
MEDIUMINT data type, 725
MEDIUMTEXT data type, 730
memlock option
mysqld, 360
MEMORY storage engine, 1084, 1183
and replication, 1479
memory usage
myisamchk, 284
memory use, 238, 649
in MySQL Cluster, 1706
MemReportFrequency, 1544
MERGE storage engine, 1084, 1179
MERGE tables
defined, 1179
metadata
database, 1912
stored routines, 1893
triggers, 1895
views, 1906
method option
mysqlhotcopy, 306
methods
locking, 610
mgmd (MySQL Cluster)
defined, 1497
(see also management node (MySQL Cluster))
MICROSECOND(), 804
Microsoft Access, 2019
Microsoft ADO, 2021
Microsoft Excel, 2020
Microsoft Visual Basic, 2020
Microsoft Visual InterDev, 2020
MID(), 774
MIN(), 852
MIN(DISTINCT), 852
min-examined-row-limit option
mysqld, 360
Minimum Bounding Rectangle, 875
minus
unary (-), 787
MINUTE(), 804
min_examined_row_limit system variable, 412
mirror sites, 40
miscellaneous functions, 846
MIT-pthreads, 97
MLineFromText(), 864
MLineFromWKB(), 865
MOD (modulo), 791
MOD(), 791
modes
batch, 175
modulo (%), 791
modulo (MOD), 791
Index
3197
monitor
terminal, 157
monitoring-interval option
mysqlmanager, 309
Monitors
InnoDB, 1128, 1143, 1151, 1159, 1160
Mono, 2028
MONTH(), 804
MONTHNAME(), 804
MPointFromText(), 865
MPointFromWKB(), 865
MPolyFromText(), 865
MPolyFromWKB(), 865
mSQL compatibility, 780
msql2mysql, 323
MSSQL SQL mode, 475
multi mysqld, 209
multi-byte character sets, 2750
and MySQL Cluster (replication), 1672
multi-byte characters, 711
multi-column indexes, 616
MULTILINESTRING data type, 864
MultiLineString(), 866
MultiLineStringFromText(), 864
MultiLineStringFromWKB(), 865
multiple servers, 536
multiple-part index, 909
multiplication (*), 787
MULTIPOINT data type, 864
MultiPoint(), 866
MultiPointFromText(), 865
MultiPointFromWKB(), 865
MULTIPOLYGON data type, 864
MultiPolygon(), 866
MultiPolygonFromText(), 865
MultiPolygonFromWKB(), 865
My
derivation, 4
my.cnf
and MySQL Cluster, 1507, 1516, 1516
in MySQL Cluster, 1588
my.cnf file, 1470
MyISAM
compressed tables, 285, 1095
MyISAM key cache, 619
MyISAM storage engine, 1084, 1090
myisam-block-size option
mysqld, 361
myisam-recover option
mysqld, 361, 1092
myisamchk, 91, 187, 276
analyze option, 283
backup option, 282
block-search option, 283
character-sets-dir option, 282
check option, 281
check-only-changed option, 281
correct-checksum option, 282
data-file-length option, 282
debug option, 279
description option, 283
example output, 555
extend-check option, 281, 282
fast option, 281
force option, 281, 282
help option, 279
HELP option, 279
information option, 281
keys-used option, 282
max-record-length option, 282
medium-check option, 281
no-symlinks option, 282
options, 279
parallel-recover option, 282
quick option, 282
read-only option, 281
recover option, 282
safe-recover option, 282
set-auto-increment[ option, 283
set-character-set option, 283
set-collation option, 283
silent option, 279
sort-index option, 283
sort-records option, 283
sort-recover option, 283
tmpdir option, 283
unpack option, 283
update-state option, 281
verbose option, 279
version option, 279
wait option, 279
myisamlog, 187, 284
myisampack, 187, 285, 933, 1095
backup option, 286
character-sets-dir option, 286
debug option, 286
force option, 286
help option, 286
join option, 286
silent option, 286
test option, 286
tmpdir option, 286
verbose option, 286
version option, 287
wait option, 287
myisam_block_size myisamchk variable, 280
myisam_data_pointer_size system variable, 412
myisam_ftdump, 187, 275
count option, 275
dump option, 276
help option, 275
length option, 276
stats option, 276
verbose option, 276
myisam_max_sort_file_size system variable, 413
myisam_recover_options system variable, 413
myisam_repair_threads system variable, 413
myisam_sort_buffer_size system variable, 414
myisam_stats_method system variable, 414
myisam_use_mmap system variable, 415
MyODBC, 1942
MySQL
defined, 3
introduction, 3
pronunciation, 4
upgrading, 217
mysql, 186, 218
auto-rehash option, 222
batch option, 222
character-sets-dir option, 222
Index
3198
charset command, 228
clear command, 228
column-names option, 222
column-type-info option, 222
comments option, 222
compress option, 222
connect command, 228
database option, 222
debug option, 222
debug-check option, 223
debug-info option, 223
default-character-set option, 223
delimiter command, 228
delimiter option, 223
disable named commands, 223
edit command, 229
ego command, 229
execute option, 223
exit command, 229
force option, 223
go command, 229
help command, 228
help option, 222
host option, 223
html option, 223
i-am-a-dummy option, 225
ignore-spaces option, 223
line-numbers option, 223
local-infile option, 223
named-commands option, 223
no-auto-rehash option, 224
no-beep option, 224
no-named-commands option, 224
no-pager option, 224
no-tee option, 224
nopager command, 229
notee command, 229
nowarning command, 229
one-database option, 224
pager command, 229
pager option, 224
password option, 224
pipe option, 224
port option, 224
print command, 229
prompt command, 229
prompt option, 224
protocol option, 224
quick option, 224
quit command, 229
raw option, 225
reconnect option, 225
rehash command, 230
safe-updates option, 225
secure-auth option, 225
show-warnings option, 225
sigint-ignore option, 225
silent option, 225
skip-column-names option, 225
skip-line-numbers option, 226
socket option, 226
source command, 230
SSL options, 226
status command, 230
system command, 230
table option, 226
tee command, 230
tee option, 226
unbuffered option, 226
use command, 230
user option, 226
verbose option, 226
version option, 226
vertical option, 226
wait option, 226
warnings command, 230
xml option, 226
MySQL binary distribution, 37
MYSQL C type, 2338
MySQL Cluster, 1495
"quick" configuration, 1514
<errortext>Table is full</errortext> error, 2712, 2716
<foreignphrase>vs</foreignphrase> replication, 2712, 2713
administration, 1571, 1589, 1594, 1597, 1597, 1619, 1622, 1622,
1623, 1623, 1628, 1640
and DNS, 1502
and INFORMATION_SCHEMA, 1668
and IP addressing, 1502
and MySQL privileges, 1667
and MySQL root user, 1667, 1669
and networking, 1503
and transactions, 2712, 2717
API node, 1497, 1550
arbitrator, 2712, 2719
available platforms, 1495
backups, 1606, 1631, 1631, 1632, 1634, 1635
benchmarks, 1704
CHECKPOINT Events, 1638
cluster logs, 1635, 1636
CLUSTERLOG commands, 1636
CLUSTERLOG STATISTICS command, 1640
commands, 1571, 1589, 1594, 1597, 1622, 1622, 1623, 1628
compiling from source, 1513
compiling with icc, 2690
concepts, 1497
configuration, 1501, 1513, 1514, 1524, 1524, 1526, 1550, 1568,
1588, 1597
configuration (example), 1516
configuration changes, 1580
configuration files, 1507, 1516
configuration parameters, 1556, 1557, 1566, 1567
configuring, 1634
CONNECTION Events, 1638
connectstring, 1522
CREATE NODEGROUP command, 1630
data node, 1497, 1526
data nodes, 1589, 1593
data types supported, 2712, 2719
defining node hosts, 1524
direct connections between nodes, 1553
Disk Data tables (see MySQL Cluster Disk Data)
DROP NODEGROUP command, 1630
ENTER SINGLE USER MODE command, 1630
ERROR Events, 1640
error logs, 1591
error messages, 2712, 2717
event log format, 1637
event logging thresholds, 1637
event logs, 1635, 1636
event severity levels, 1637
Index
3199
event types, 1635, 1638
EXIT command, 1630
EXIT SINGLE USER MODE command, 1630
FAQ, 2711
features new in MySQL 5.1, 1714
GCP Stop errors, 1549
general description, 1497
hardware requirements, 2712, 2715
HELP command, 1629
HostName parameter
and security, 1663
how to obtain, 2711, 2713
importing existing tables, 2712, 2719
INFO Events, 1640
information sources, 1496
insecurity of communication protocols, 1663
installation, 1501, 1504, 1514
interconnects, 1703
log files, 1591, 1594
logging commands, 1636
management client (ndb_mgm), 1597
management commands, 1640
management node, 1497, 1524
management nodes, 1594
managing, 1626
master node, 2712, 2714
memory requirements, 2712, 2715
memory usage and recovery, 1580, 1706
mgm, 1619
mgm client, 1628
mgm management client, 1640
mgm process, 1597, 1623
mgmd, 1619
mgmd process, 1594, 1622
mysqld process, 1571, 1588
ndbd, 1589, 1619
ndbd process, 1589, 1622, 1642
ndbd_redo_log_reader, 1623
ndbmtd, 1593
ndb_config, 1623
ndb_error_reporter, 1624
ndb_mgm, 1509, 1597
ndb_mgmd process, 1594
ndb_restore, 1624
ndb_show_tables, 1626
ndb_size.pl, 1626
ndb_size.pl (utility), 2716
network configuration
and security, 1664
network transporters, 1703, 1703
networking, 1553, 1554, 1555
networking requirements, 2712, 2712, 2714, 2717
node failure (single user mode), 1652
node identifiers, 1554, 1555
node logs, 1635
node types, 2714
NODERESTART Events, 1638
nodes and node groups, 1499
nodes and types, 1497
number of computers required, 2712, 2714
obtaining, 1504
partitioning support, 1705
partitions, 1499
performance, 1704
performing queries, 1510
platforms supported, 2712, 2715
preparing for replication, 1679
process management, 1588
programs, 1623, 1623, 1624, 1624, 1626, 1626
QUIT command, 1630
replicas, 1499
replication, 1669
(see also MySQL Cluster replication)
REPORT command, 1629
requirements, 1503
resetting, 1580
RESTART command, 1629
restarting, 1512
restoring backups, 1606
roles of computers, 2712, 2714
runtime statistics, 1640
SCI (Scalable Coherent Interface), 1555, 1703
security, 1663, 2717
and firewalls, 1665, 1666
and HostName parameter, 1663
and network configuration, 1664
and network ports, 1667
and remote administration, 1667
networking, 1663
security procedures, 1668
shared memory transport, 1554
SHOW command, 1629
SHUTDOWN command, 1630
shutting down, 1512
single user mode, 1630, 1652
SQL node, 1497, 1550
SQL nodes, 1588
SQL statements, 2712, 2717
SQL statements for monitoring, 1653
START BACKUP command, 1684
START command, 1629
start phases (summary), 1627
starting, 1514
starting and stopping, 2712, 2719
starting nodes, 1509
starting or restarting, 1627
STARTUP Events, 1638
STATISTICS Events, 1639
STATUS command, 1629
STOP command, 1629
storage requirements, 748
terminology, 1722
thread states, 647
trace files, 1592
transaction handling, 1707
transactions, 1529
transporters
Scalable Coherent Interface (SCI), 1555
shared memory (SHM), 1554
TCP/IP, 1553
troubleshooting backups, 1635
upgrades and downgrades, 1580, 1580, 1582
using in a virtual machine, 2712, 2716
using tables and data, 1510
MySQL Cluster Disk Data, 1698
creating log file groups, 1699
creating tables, 1698, 1700
creating tablespaces, 1699
dropping Disk Data objects, 1701
storage requirements, 1703
Index
3200
MySQL Cluster Glossary, 1722
MySQL Cluster How-To, 1501
MySQL Cluster in MySQL 5.1, 1713
MySQL Cluster limitations, 1704
and differences from standard MySQL limits, 1706
autodiscovery, 1711
binary logging, 1709
character sets, 1711
CREATE TABLE statements, 1712
database objects, 1708
Disk Data storage, 1710
error handling and reporting, 1708
geometry data types, 1705
implementation, 1709
imposed by configuration, 1706
INSERT IGNORE, UPDATE IGNORE, and REPLACE statements,
1712
memory usage and transaction handling, 1707
multiple data nodes, 1712, 1717
multiple management servers, 1710, 1711
multiple MySQL servers, 1710
partitioning, 1705
performance, 1709
replication, 1706, 1711
resolved in current version from previous versions, 1711
syntax, 1705
transactions, 1707
unsupported features, 1708
MySQL Cluster NDB 6.x, 1713
MySQL Cluster processes, 1588
MySQL Cluster programs, 1588
MySQL Cluster replication, 1669, 1682
and --initial option, 1675
and auto_increment* variables, 1675
and circular replication, 1672
and DDL, 1675
and multi-byte character sets, 1672
and primary key, 1675
backups, 1684, 1686
concepts, 1670, 1671
failover, 1683
known issues, 1671
loss of connection, 1671
preparing, 1679
reset-slave.pl backup automation script, 1686
restoring from backups, 1684
starting, 1681
storage engines other than NDB on slave, 1675
system tables used, 1677
mysql command options, 219
mysql commands
list of, 228
MySQL Dolphin name, 4
MySQL history, 4
mysql history file, 227
MySQL Instance Manager, 307
MySQL mailing lists, 10
MySQL name, 4
MySQL privileges
and MySQL Cluster, 1667
mysql prompt command, 231
MySQL server
mysqld, 203, 328
mysql source (command for reading from text files), 176, 233
MySQL source distribution, 37
MySQL storage engines, 1084
MySQL system tables
and MySQL Cluster, 1667
and replication, 1479
MySQL version, 40
mysql \. (command for reading from text files), 176, 233
MySQL++, 2661
mysql.event table, 1902
mysql.ndb_binlog_index table (see MySQL Cluster replication)
mysql.server, 185, 208
basedir option, 208
datadir option, 208
pid-file option, 208
service-startup-timeout option, 208
use-manager option, 208
use-mysqld_safe option, 208
user option, 209
mysql.sock
changing location of, 90
protection, 2758
MYSQL323 SQL mode, 475
MYSQL40 SQL mode, 475
mysqlaccess, 187, 290
brief option, 291
commit option, 291
copy option, 291
db option, 291
debug option, 291
help option, 291
host option, 292
howto option, 292
old_server option, 292
password option, 292
plan option, 292
preview option, 292
relnotes option, 292
rhost option, 292
rollback option, 292
spassword option, 292
superuser option, 292
table option, 292
user option, 292
version option, 292
mysqladmin, 186, 235, 905, 941, 1053, 1057, 1060, 1062
character-sets-dir option, 239
compress option, 239
count option, 239
debug option, 240
debug-check option, 240
debug-info option, 240
default-character-set option, 240
force option, 240
help option, 239
host option, 240
no-beep option, 240
password option, 240
pipe option, 240
port option, 240
protocol option, 240
relative option, 240
silent option, 240
sleep option, 241
socket option, 241
SSL options, 241
user option, 241
Index
3201
verbose option, 241
version option, 241
vertical option, 241
wait option, 241
mysqladmin command options, 238
mysqladmin option
mysqld_multi, 210
mysqlbinlog, 187, 293
base64-output option, 295
character-sets-dir option, 295
database option, 295
debug option, 295
debug-check option, 295
debug-info option, 295
disable-log-bin option, 295
force-read option, 296
help option, 295
hexdump option, 296
host option, 296
local-load option, 296
offset option, 296
password option, 296
port option, 296
position option, 296
protocol option, 296
read-from-remote-server option, 296
result-file option, 296
server-id option, 296
set-charset option, 296
short-form option, 297
socket option, 297
start-datetime option, 297
start-position option, 297
stop-datetime option, 297
stop-position option, 297
to-last-log option, 297
user option, 297
verbose option, 297
version option, 297
write-binlog option, 297
mysqlbug, 214
mysqlbug script, 16
mysqlcheck, 186, 241
all-databases option, 244
all-in-1 option, 244
analyze option, 244
auto-repair option, 244
character-sets-dir option, 244
check option, 244
check-only-changed option, 244
check-upgrade option, 244
compress option, 244
databases option, 245
debug option, 245
debug-check option, 245
debug-info option, 245
default-character-set option, 245
extended option, 245
fast option, 245
fix-db-names option, 245
fix-table-names option, 245
force option, 245
help option, 244
host option, 245
medium-check option, 245
optimize option, 245
password option, 245
pipe option, 246
port option, 246
protocol option, 246
quick option, 246
repair option, 246
silent option, 246
socket option, 246
SSL options, 246
tables option, 246
use-frm option, 246
user option, 246
verbose option, 246
version option, 246
mysqlclient library, 1940
mysqld, 185
abort-slave-event-count option, 1447
allow-suspicious-udfs option, 346, 495
ansi option, 346
as MySQL Cluster process, 1571, 1588
basedir option, 347
big-tables option, 347
bind-address option, 347
binlog-do-db option, 1451
binlog-format option, 347
binlog-ignore-db option, 1452
binlog-row-event-max-size option, 1450
bootstrap option, 348
character-set-client-handshake option, 349
character-set-filesystem option, 349
character-set-server option, 349
character-sets-dir option, 348
chroot option, 349
collation-server option, 349
command options, 345
console option, 350
core-file option, 350
datadir option, 350
debug option, 350
default-character-set option, 351
default-collation option, 351
default-storage-engine option, 351
default-table-type option, 351
default-time-zone option, 352
delay-key-write option, 352, 1092
des-key-file option, 352
disconnect-slave-event-count option, 1447
enable-named-pipe option, 352
enable-pstack option, 353
event-scheduler option, 353
exit-info option, 353
external-locking option, 354
flush option, 354
gdb option, 354
general-log option, 354
help option, 346
ignore-builtin-innodb option, 1107
init-file option, 355
innodb option, 1107
innodb_status_file option, 1107
language option, 355
large-pages option, 355
local-infile option, 495
log option, 356
Index
3202
log-bin option, 1450
log-bin-index option, 1451
log-bin-trust-function-creators option, 1452
log-error option, 356
log-isam option, 356
log-long-format option, 357
log-output option, 357
log-queries-not-using-indexes option, 357
log-short-format option, 358
log-slave-updates option, 1440
log-slow-admin-statements option, 358
log-slow-queries option, 358
log-slow-slave-statements option, 1440
log-tc option, 358
log-tc-size option, 359
log-warnings option, 359, 1440
low-priority-updates option, 359
master-connect-retry option, 1440
master-host option, 1441
master-info-file option, 1441
master-password option, 1441
master-port option, 1441
master-retry-count option, 1441
master-ssl option, 1441
master-ssl-ca option, 1441
master-ssl-capath option, 1441
master-ssl-cert option, 1441
master-ssl-cipher option, 1441
master-ssl-key option, 1441
master-user option, 1441
max-binlog-dump-events option, 1453
max-relay-log-size option, 1441
memlock option, 360
min-examined-row-limit option, 360
myisam-block-size option, 361
myisam-recover option, 361, 1092
MySQL server, 203, 328
ndb-batch-size option, 1571
ndb-cluster-connection-pool option, 1572
ndb-connectstring option, 1572
ndb-nodeid, 1573
ndbcluster option, 1573
old-passwords option, 362, 495
old-style-user-limits option, 362
one-thread option, 362
open-files-limit option, 362
pid-file option, 363
plugin-load option, 363
port option, 363
port-open-timeout option, 364
read-only option, 1441
relay-log option, 1441
relay-log-index option, 1442
relay-log-info-file option, 1442
relay-log-purge option, 1442
relay-log-space-limit option, 1442
replicate-do-db option, 1442
replicate-do-table option, 1444
replicate-ignore-db option, 1443
replicate-ignore-table option, 1444
replicate-rewrite-db option, 1444
replicate-same-server-id option, 1444
replicate-wild-do-table option, 1445
replicate-wild-ignore-table option, 1445
report-host option, 1445
report-password option, 1445
report-port option, 1445
report-user option, 1445
role in MySQL Cluster (see SQL Node (MySQL Cluster))
safe-mode option, 364
safe-show-database option, 364, 495
safe-user-create option, 364, 495
secure-auth option, 365, 495
secure-file-priv option, 365, 495
server-id option, 1433
shared-memory option, 365
shared-memory-base-name option, 365
show-slave-auth-info option, 1445
skip-concurrent-insert option, 365
skip-external-locking option, 365
skip-grant-tables option, 366, 495
skip-host-cache option, 366
skip-innodb option, 366
skip-merge option, 496
skip-name-resolve option, 366, 496
skip-ndbcluster option, 1573
skip-networking option, 366, 496
skip-safemalloc option, 366
skip-show-database option, 367, 496
skip-slave-start option, 1445
skip-stack-trace option, 367
skip-symbolic-links option, 366
skip-thread-priority option, 367
slave-load-tmpdir option, 1446
slave-net-timeout option, 1446
slave-skip-errors option, 1446
slave_compressed_protocol option, 1445
slow-query-log option, 367
socket option, 368
sporadic-binlog-dump-fail option, 1453
sql-mode option, 368
SSL options, 366, 496
standalone option, 366
starting, 497
symbolic-links option, 366
sysdate-is-now option, 368
tc-heuristic-recover option, 369
temp-pool option, 369
tmpdir option, 369
transaction-isolation option, 369
user option, 370
verbose option, 370
version option, 370
mysqld (MySQL Cluster), 1588
mysqld library, 1940
mysqld option
mysqld_multi, 210
mysqld_safe, 206
mysqld options, 627
mysqld server
buffer sizes, 627
mysqld-safe-compatible option
mysqlmanager, 310
mysqld-version option
mysqld_safe, 206
mysqldump, 126, 186, 247
add-drop-database option, 251
add-drop-table option, 251
add-locks option, 251
all-databases option, 251
Index
3203
all-tablespaces option, 251
allow-keywords option, 251
character-sets-dir option, 252
comments option, 252
compact option, 252
compatible option, 252
complete-insert option, 252
compress option, 252
create-options option, 252
databases option, 252
debug option, 252
debug-check option, 252
debug-info option, 252
default-character-set option, 253
delayed-insert option, 253
delete-master-logs option, 253
disable-keys option, 253
dump-date option, 253
events option, 253
extended-insert option, 253
fields-enclosed-by option, 253, 263
fields-escaped-by option, 253, 263
fields-optionally-enclosed-by option, 253, 263
fields-terminated-by option, 253, 263
first-slave option, 253
flush-logs option, 253
flush-privileges option, 253
force option, 253
help option, 251
hex-blob option, 254
host option, 254
ignore-table option, 254
insert-ignore option, 254
lines-terminated-by option, 254, 263
lock-all-tables option, 254
lock-tables option, 254
log-error option, 254
master-data option, 254
no-autocommit option, 255
no-create-db option, 255
no-create-info option, 255
no-data option, 255
no-set-names option, 255
opt option, 255
order-by-primary option, 255
password option, 256
pipe option, 256
port option, 256
problems, 260, 3173
protocol option, 256
quick option, 256
quote-names option, 256
replace option, 256
result-file option, 256
routines option, 256
set-charset option, 256
single-transaction option, 257
skip-comments option, 257
skip-opt option, 257
socket option, 257
SSL options, 257
tab option, 257
tables option, 257
triggers option, 258
tz-utc option, 258
user option, 258
verbose option, 258
version option, 258
views, 260, 3173
where option, 258
workarounds, 260, 3173
xml option, 258
mysqldumpslow, 187, 303
debug option, 304
help option, 304
verbose option, 304
mysqld_multi, 185, 209
config-file option, 210
defaults-extra-file option, 209
defaults-file option, 209
example option, 210
help option, 210
log option, 210
mysqladmin option, 210
mysqld option, 210
no-defaults option, 209
no-log option, 210
password option, 210
silent option, 210
tcp-ip option, 210
user option, 210
verbose option, 210
version option, 210
mysqld_safe, 185, 203
autoclose option, 205
basedir option, 205
core-file-size option, 205
datadir option, 205
defaults-extra-file option, 205
defaults-file option, 205
help option, 205
ledir option, 205
log-error option, 205
mysqld option, 206
mysqld-version option, 206
nice option, 206
no-defaults option, 206
open-files-limit option, 206
pid-file option, 206
port option, 206
skip-kill-mysqld option, 206
skip-syslog option, 206
socket option, 206
syslog option, 206
syslog-tag option, 206
timezone option, 206
user option, 206
mysqlhotcopy, 187, 305
addtodest option, 306
allowold option, 306
checkpoint option, 306
chroot option, 306
debug option, 306
dryrun option, 306
flushlog option, 306
help option, 306
host option, 306
keepold option, 306
method option, 306
noindices option, 306
Index
3204
password option, 306
port option, 307
quiet option, 307
record_log_pos option, 307
regexp option, 307
resetmaster option, 307
resetslave option, 307
socket option, 307
suffix option, 307
tmpdir option, 307
user option, 307
mysqlimport, 126, 186, 260, 957
character-sets-dir option, 262
columns option, 262
compress option, 262
debug option, 262
debug-check option, 262
debug-info option, 262
default-character-set option, 262
delete option, 262
force option, 263
help option, 262
host option, 263
ignore option, 263
ignore-lines option, 263
local option, 263
lock-tables option, 263
low-priority option, 263
password option, 263
pipe option, 263
port option, 263
protocol option, 263
replace option, 264
silent option, 264
socket option, 264
SSL options, 264
use-threads option, 264
user option, 264
verbose option, 264
version option, 264
mysqlmanager, 187, 307
add-user option, 308
angel-pid-file option, 308
bind-address option, 308
check-password-file option, 309
clean-password-file option, 309
debug option, 309
default-mysqld-path option, 309
defaults-file option, 309
drop-user option, 309
edit-user option, 309
help option, 308
install option, 309
list-users option, 309
log option, 309
monitoring-interval option, 309
mysqld-safe-compatible option, 310
password option, 310
password-file option, 310
pid-file option, 310
port option, 310
print-defaults option, 310
print-password-line option, 310
remove option, 310
run-as-service option, 310
socket option, 310
standalone option, 310
user option, 311
username option, 311
version option, 311
wait-timeout option, 311
mysqlshow, 186, 264
character-sets-dir option, 266
compress option, 266
count option, 266
debug option, 266
debug-check option, 266
debug-info option, 266
default-character-set option, 266
help option, 266
host option, 267
keys option, 267
password option, 267
pipe option, 267
port option, 267
protocol option, 267
show-table-type option, 267
socket option, 267
SSL options, 267
status option, 267
user option, 267
verbose option, 267
version option, 267
mysqlslap, 187, 268
auto-generate-sql option, 271
auto-generate-sql-add-autoincrement option, 271
auto-generate-sql-execute-number option, 271
auto-generate-sql-guid-primary option, 271
auto-generate-sql-load-type option, 271
auto-generate-sql-secondary-indexes option, 271
auto-generate-sql-unique-query-number option, 271
auto-generate-sql-unique-write-number option, 272
auto-generate-sql-write-number option, 272
commit option, 272
compress option, 272
concurrency option, 272
create option, 272
create-schema option, 272
csv option, 272
debug option, 272
debug-check option, 272
debug-info option, 272
delimiter option, 272
detach option, 272
engine option, 272
help option, 271
host option, 272
iterations option, 272
lock-directory option, 273
number-char-cols option, 273
number-int-cols option, 273
number-of-queries option, 273
only-print option, 273
password option, 273, 273
pipe option, 273
port option, 273
post-query option, 273
post-system option, 273
pre-query option, 273
pre-system option, 273
Index
3205
preserve-schema option, 273
protocol option, 274
query option, 274
shared-memory-base-name option, 273
silent option, 274
slave option, 274
socket option, 274
SSL options, 274
use-threads option, 274
user option, 274
verbose option, 274
version option, 274
mysqltest
MySQL Test Suite, 2663
mysql_affected_rows(), 2345
mysql_autocommit(), 2346
MYSQL_BIND C type, 2389
mysql_change_user(), 2346
mysql_character_set_name(), 2347
mysql_close(), 2348
mysql_commit(), 2348
mysql_config, 323
cflags option, 323
embedded option, 324
include option, 323
libmysqld-libs option, 324
libs option, 324
libs_r option, 324
plugindir option, 324
port option, 324
socket option, 324
version option, 324
mysql_connect(), 2348
mysql_convert_table_format, 188, 319
force option, 319
help option, 319
host option, 320
password option, 320
port option, 320
socket option, 320
type option, 320
user option, 320
verbose option, 320
version option, 320
mysql_create_db(), 2348
mysql_data_seek(), 2349
MYSQL_DEBUG environment variable, 152, 189, 2696
mysql_debug(), 2349
mysql_drop_db(), 2350
mysql_dump_debug_info(), 2350
mysql_eof(), 2351
mysql_errno(), 2352
mysql_error(), 2352
mysql_escape_string(), 2353
mysql_fetch_field(), 2353
mysql_fetch_fields(), 2354
mysql_fetch_field_direct(), 2353
mysql_fetch_lengths(), 2354
mysql_fetch_row(), 2355
MYSQL_FIELD C type, 2338
mysql_field_count(), 2355, 2368
MYSQL_FIELD_OFFSET C type, 2338
mysql_field_seek(), 2356
mysql_field_tell(), 2357
mysql_find_rows, 188, 320
help option, 321
regexp option, 321
rows option, 321
skip-use-db option, 321
start_row option, 321
mysql_fix_extensions, 188, 321
mysql_fix_privilege_tables, 186, 214
mysql_free_result(), 2357
mysql_get_character_set_info(), 2357
mysql_get_client_info(), 2357
mysql_get_client_version(), 2358
mysql_get_host_info(), 2358
mysql_get_proto_info(), 2358
mysql_get_server_info(), 2358
mysql_get_server_version(), 2359
mysql_get_ssl_cipher(), 2359
MYSQL_GROUP_SUFFIX environment variable, 152
mysql_hex_string(), 2359
MYSQL_HISTFILE environment variable, 152, 227
MYSQL_HOME environment variable, 152
MYSQL_HOST environment variable, 152, 193
mysql_info(), 902, 953, 964, 991, 2360
mysql_init(), 2361
mysql_insert_id(), 22, 953, 2361
mysql_install_db, 106, 186, 215
basedir option, 215
datadir option, 215
force option, 215
ldata option, 215
rpm option, 215
skip-name-resolve option, 216
srcdir option, 216
user option, 216
verbose option, 216
windows option, 216
mysql_kill(), 2362
mysql_library_end(), 2363
mysql_library_init(), 2363
mysql_list_dbs(), 2364
mysql_list_fields(), 2365
mysql_list_processes(), 2365
mysql_list_tables(), 2366
mysql_more_results(), 2366
mysql_next_result(), 2367
mysql_num_fields(), 2368
mysql_num_rows(), 2368
mysql_options(), 2369
mysql_ping(), 2372
MYSQL_PS1 environment variable, 152
MYSQL_PWD environment variable, 152, 189, 193
mysql_query(), 2373, 2417
mysql_real_connect(), 2373
mysql_real_escape_string(), 658, 2376
mysql_real_query(), 2377
mysql_refresh(), 2378
mysql_reload(), 2379
MYSQL_RES C type, 2338
mysql_rollback(), 2379
MYSQL_ROW C type, 2338
mysql_row_seek(), 2380
mysql_row_tell(), 2380
mysql_secure_installation, 186, 216
mysql_select_db(), 2380
mysql_server_end(), 2416
mysql_server_init(), 2416
Index
3206
mysql_setpermission, 188, 321
help option, 321
host option, 321
password option, 321
port option, 322
socket option, 322
user option, 322
mysql_set_character_set(), 2381
mysql_set_local_infile_default(), 2381, 2381
mysql_set_server_option(), 2383
mysql_shutdown(), 2383
mysql_sqlstate(), 2384
mysql_ssl_set(), 2384
mysql_stat(), 2385
MYSQL_STMT C type, 2389
mysql_stmt_affected_rows(), 2396
mysql_stmt_attr_get(), 2396
mysql_stmt_attr_set(), 2397
mysql_stmt_bind_param(), 2398
mysql_stmt_bind_result(), 2398
mysql_stmt_close(), 2399
mysql_stmt_data_seek(), 2399
mysql_stmt_errno(), 2400
mysql_stmt_error(), 2400
mysql_stmt_execute(), 2400
mysql_stmt_fetch(), 2403
mysql_stmt_fetch_column(), 2407
mysql_stmt_field_count(), 2408
mysql_stmt_free_result(), 2408
mysql_stmt_init(), 2408
mysql_stmt_insert_id(), 2408
mysql_stmt_num_rows(), 2409
mysql_stmt_param_count(), 2409
mysql_stmt_param_metadata(), 2409
mysql_stmt_prepare(), 2410
mysql_stmt_reset(), 2410
mysql_stmt_result_metadata, 2411
mysql_stmt_row_seek(), 2412
mysql_stmt_row_tell(), 2412
mysql_stmt_send_long_data(), 2412
mysql_stmt_sqlstate(), 2414
mysql_stmt_store_result(), 2414
mysql_store_result(), 2385, 2417
MYSQL_TCP_PORT environment variable, 152, 189, 541, 541
mysql_thread_end(), 2415
mysql_thread_id(), 2386
mysql_thread_init(), 2416
mysql_thread_safe(), 2416
MYSQL_TIME C type, 2391
mysql_tzinfo_to_sql, 186, 216
MYSQL_UNIX_PORT environment variable, 107, 152, 189, 541, 541
mysql_upgrade, 186, 217, 512
basedir option, 218
datadir option, 218
debug-check option, 218
debug-info option, 218
force option, 218
help option, 218
mysql_upgrade_info file, 218
tmpdir option, 218
user option, 218
verbose option, 218
mysql_upgrade_info file
mysql_upgrade, 218
mysql_use_result(), 2387
mysql_waitpid, 188, 322
help option, 322
verbose option, 322
version option, 322
mysql_warning_count(), 2388
mysql_zap, 188, 322
my_bool C type, 2338
my_bool values
printing, 2338
my_init(), 2415
my_print_defaults, 188, 324
config-file option, 325
debug option, 325
defaults-extra-file option, 325
defaults-file option, 325
defaults-group-suffix option, 325
extra-file option, 325
help option, 325
no-defaults option, 325
verbose option, 325
version option, 325
my_ulonglong C type, 2338
my_ulonglong values
printing, 2338
N
named pipes, 63, 66
named-commands option
mysql, 223
named_pipe system variable, 415
names, 659
case sensitivity, 661
variables, 670
NAME_CONST(), 847, 1910
name_file option
comp_err, 213
naming
releases of MySQL, 38
NATIONAL CHAR data type, 729
NATIONAL VARCHAR data type, 729
native backup and restore
backup identifiers, 1633
native functions
adding, 2687
native thread support, 36
NATURAL LEFT JOIN, 971
NATURAL LEFT OUTER JOIN, 971
NATURAL RIGHT JOIN, 971
NATURAL RIGHT OUTER JOIN, 971
NCHAR data type, 729
NDB, 2712, 2713
ndb option
perror, 326
NDB storage engine (see MySQL Cluster)
FAQ, 2711
NDB tables
and MySQL root user, 1667
NDB utilities
security issues, 1669
ndb-batch-size option
mysqld, 1571
ndb-cluster-connection-pool option
mysqld, 1572
ndb-connectstring option
Index
3207
mysqld, 1572
ndb_config, 1598
ndb-nodeid option
mysqld, 1573
NDBCLUSTER, 2712, 2713
ndbcluster option
mysqld, 1573
NDBCLUSTER storage engine (see MySQL Cluster)
ndbd, 1588, 1589
ndbd (MySQL Cluster)
defined, 1497
(see also data node (MySQL Cluster))
ndbd_redo_log_reader, 1606, 1623
ndbmtd, 1588, 1593
MaxNoOfExecutionThreads, 1593
trace files, 1593, 1594
ndb_apply_status table (MySQL Cluster replication), 1678, 1683
(see also MySQL Cluster replication)
ndb_binlog_index table (MySQL Cluster replication), 1677, 1683
(see also MySQL Cluster replication)
ndb_config, 1588, 1598, 1623
config-file option, 1598
configinfo option, 1600
fields option, 1599
host option, 1599
id option, 1599
ndb-connectstring option, 1598
nodeid option, 1599
nodes option, 1599
query option, 1598, 1599
rows option, 1600
type option, 1599
usage option, 1598
version option, 1598
xml option, 1600
ndb_cpcd, 1588, 1602
ndb_delete_all, 1588, 1602
transactional option, 1602
ndb_desc, 1588, 1603
extra-partition-info option, 1603
ndb_drop_index, 1588, 1603
ndb_drop_table, 1588, 1604
ndb_error_reporter, 1588, 1604, 1624
ndb_mgm, 1588, 1597 (see mgm)
ndb_mgm (MySQL Cluster management node client), 1509
ndb_mgmd, 1588 (see mgmd)
ndb_mgmd (MySQL Cluster process), 1594
ndb_mgmd (MySQL Cluster)
defined, 1497
(see also management node (MySQL Cluster))
ndb_print_backup_file, 1588, 1605
ndb_print_schema_file, 1588, 1605
ndb_print_sys_file, 1588, 1605
ndb_restore, 1606, 1624
and circular replication, 1692
attribute promotion, 1607
errors, 1611
ndb_schema table (MySQL Cluster replication), 1679
(see also MySQL Cluster replication)
ndb_select_all, 1588, 1611
delimiter option, 1612
descending option, 1612
disk option, 1612
gci option, 1612
header option, 1612
lock option, 1612
nodata option, 1612
order option, 1612
rowid option, 1612
tupscan option, 1612
useHexFormat option, 1612
ndb_select_count, 1588, 1613
ndb_show_tables, 1588, 1613, 1626
loops option, 1614
parsable option, 1614
type option, 1614
unqualified option, 1614
ndb_size.pl, 1588, 1614, 1626
ndb_size.pl (utility), 2716
ndb_waiter, 1588, 1618
no-contact option, 1618
not-started option, 1618
timeout option, 1618
negative values, 658
nested queries, 980
Nested-Loop join algorithm, 583
nested-loop join algorithm, 586
net etiquette, 12
netmask notation
in account names, 506
NetWare, 78
network ports
and MySQL Cluster, 1667
net_buffer_length system variable, 415
net_buffer_length variable, 227
net_read_timeout system variable, 416
net_retry_count system variable, 416
net_write_timeout system variable, 416
New features in MySQL Cluster, 1713
new procedures
adding, 2689
new system variable, 417
new users
adding, 82, 85
newline (\n), 657, 961
next-key lock
InnoDB, 1110, 1130, 1134, 1135
NFS
InnoDB, 1099, 1160
nice option
mysqld_safe, 206
no matching rows, 2763
no-auto-rehash option
mysql, 224
no-autocommit option
mysqldump, 255
no-beep option
mysql, 224
mysqladmin, 240
no-contact option
ndb_waiter, 1618
no-create-db option
mysqldump, 255
no-create-info option
mysqldump, 255
no-data option
mysqldump, 255
no-debug option
make_win_bin_dist, 214
no-defaults option, 199
Index
3208
mysqld_multi, 209
mysqld_safe, 206
my_print_defaults, 325
no-embedded option
make_win_bin_dist, 214
no-log option
mysqld_multi, 210
no-named-commands option
mysql, 224
no-pager option
mysql, 224
no-set-names option
mysqldump, 255
no-symlinks option
myisamchk, 282
no-tee option
mysql, 224
nodata option
ndb_select_all, 1612
node groups (MySQL Cluster), 1499
node identifiers (MySQL Cluster), 1554, 1555
node logs (MySQL Cluster), 1635
NodeGroup, 1527
nodeid option
ndb_config, 1599
NODERESTART Events (MySQL Cluster), 1638
nodes option
ndb_config, 1599
noindices option
mysqlhotcopy, 306
nondelimited strings, 736
Nontransactional tables, 2762
NoOfDiskPagesToDiskAfterRestartACC
calculating, 1568
NoOfDiskPagesToDiskAfterRestartACC (DEPRECATED), 1541
NoOfDiskPagesToDiskAfterRestartTUP
calculating, 1568
NoOfDiskPagesToDiskAfterRestartTUP (DEPRECATED), 1541
NoOfDiskPagesToDiskDuringRestartACC (DEPRECATED), 1541
NoOfDiskPagesToDiskDuringRestartTUP (DEPRECATED), 1541
NoOfFragmentLogFiles, 1533
calculating, 1568
NoOfReplicas, 1527
nopager command
mysql, 229
NOT
logical, 766
NOT BETWEEN, 764
not equal (!=), 762
not equal (<>), 762
NOT EXISTS
with subqueries, 983
NOT IN, 764
NOT LIKE, 779
NOT NULL
constraint, 25
NOT REGEXP, 780
not-started option
ndb_waiter, 1618
notee command
mysql, 229
Novell NetWare, 78
NOW(), 805
NOWAIT (START BACKUP command), 1632
nowarning command
mysql, 229
NO_AUTO_CREATE_USER SQL mode, 471
NO_AUTO_VALUE_ON_ZERO SQL mode, 471
NO_BACKSLASH_ESCAPES SQL mode, 471
NO_DIR_IN_CREATE SQL mode, 472
NO_ENGINE_SUBSTITUTION SQL mode, 472
NO_FIELD_OPTIONS SQL mode, 472
NO_KEY_OPTIONS SQL mode, 472
NO_TABLE_OPTIONS SQL mode, 472
NO_UNSIGNED_SUBTRACTION SQL mode, 472
NO_ZERO_DATE SQL mode, 473
NO_ZERO_IN_DATE SQL mode, 473
NUL, 656, 961
NULL, 169, 2761
ORDER BY, 592, 967
testing for null, 762, 763, 763, 764, 768
thread state, 641
NULL value, 169, 659
NULL values
and AUTO_INCREMENT columns, 2762
and indexes, 922
and TIMESTAMP columns, 2762
vs. empty values, 2761
NULLIF(), 768
number-char-cols option
mysqlslap, 273
number-int-cols option
mysqlslap, 273
number-of-queries option
mysqlslap, 273
numbers, 658
NUMERIC data type, 727
numeric types, 748
numeric-dump-file option
resolve_stack_dump, 325
NumGeometries(), 874
NumInteriorRings(), 873
NumPoints(), 871
NVARCHAR data type, 729
O
obtaining information about partitions, 1877
Obtaining MySQL Cluster, 1504
OCT(), 792
OCTET_LENGTH(), 774
ODBC, 1942
ODBC compatibility, 661, 726, 760, 763, 921, 972
ODirect, 1537
offset option
mysqlbinlog, 296
OLAP, 853
old system variable, 417
old-passwords option
mysqld, 362, 495
old-style-user-limits option
mysqld, 362
OLD_PASSWORD(), 839
old_passwords system variable, 417
old_server option
mysqlaccess, 292
ON DUPLICATE KEY UPDATE, 951
one-database option
mysql, 224
one-thread option
Index
3209
mysqld, 362
one_shot system variable, 418
online location of manual, 1
only-debug option
make_win_bin_dist, 214
only-print option
mysqlslap, 273
ONLY_FULL_GROUP_BY
SQL mode, 855
ONLY_FULL_GROUP_BY SQL mode, 473
OPEN, 1079
Open Source
defined, 4
open tables, 238, 624
open-files-limit option
mysqld, 362
mysqld_safe, 206
OpenGIS, 856
opening
tables, 624
Opening master dump table
thread state, 647
Opening mysql.ndb_apply_status
thread state, 647
Opening table
thread state, 641
Opening tables
thread state, 641
opens, 237
OpenSSL, 526, 527
open_files_limit system variable, 418
open_files_limit variable, 298
operating systems
file-size limits, 2748
supported, 36
Windows versus Unix, 69
operations
arithmetic, 786
operators, 752
assignment, 670
cast, 786, 822
logical, 765
precedence, 759
opt option
mysqldump, 255
optimization
subquery, 595
tips, 607
optimizations, 573, 577
optimize option
mysqlcheck, 245
OPTIMIZE TABLE, 1020
and partitioning, 1876
optimizer
and replication, 1479
controlling, 631
optimizer_prune_level system variable, 418
optimizer_search_depth system variable, 418
optimizer_switch system variable, 419, 599
optimizing
DISTINCT, 595
filesort, 592
GROUP BY, 593
LEFT JOIN, 582
LIMIT, 599
tables, 554
option files, 195, 512
option modifiers, 195
options
boolean, 195
command-line
mysql, 219
mysqladmin, 238
configure, 86
embedded server, 2334
libmysqld, 2334
myisamchk, 279
provided by MySQL, 157
replication, 1470
OR, 180, 577
bitwise, 835
logical, 766
OR Index Merge optimization, 577
Oracle compatibility, 18, 852, 992
ORACLE SQL mode, 475
ORD(), 774
ORDER BY, 166, 898, 967
NULL, 592, 967
order option
ndb_select_all, 1612
order-by-primary option
mysqldump, 255
OUTFILE, 969
out_dir option
comp_err, 213
out_file option
comp_err, 213
Overlaps(), 877
OverloadLimit, 1553
overview, 1
P
packages
list of, 33
PAD_CHAR_TO_FULL_LENGTH SQL mode, 473
pager command
mysql, 229
pager option
mysql, 224
parallel-recover option
myisamchk, 282
parameters
server, 627
parentheses ( and ), 759
parsable option
ndb_show_tables, 1614
PARTITION, 1852
partition management, 1870
partition pruning, 1879
partitioning, 1852
advantages, 1854
and dates, 1855
and foreign keys, 1883
and FULLTEXT indexes, 1883
and key cache, 1884
and server SQL mode, 1882
and subqueries, 1884
and temporary tables, 1884, 1884
by hash, 1860
Index
3210
by key, 1863
by linear hash, 1862
by linear key, 1864
by list, 1858
by range, 1856
concepts, 1853
data type of partitioning key, 1884
enabling, 1852
functions supported in partitioning expressions, 1888
limitations, 1881
operators disallowed in partitioning expressions, 1881
operators supported in partitioning expressions, 1881
optimization, 1878, 1879
resources, 1853
storage engines (limitations), 1887
subpartitioning, 1884
support, 1852
support in MySQL Cluster, 1705
types, 1855
Partitioning
maximum number of partitions, 1883
partitioning information statements, 1877
partitioning keys and primary keys, 1884
partitioning keys and unique keys, 1884
partitions
adding and dropping, 1870
analyzing, 1876
checking, 1876
managing, 1870
modifying, 1870
optimizing, 1876
repairing, 1876
splitting and merging, 1870
PARTITIONS
INFORMATION_SCHEMA table, 1925
partitions (MySQL Cluster), 1499
password
root user, 112
password encryption
reversibility of, 839
password option, 191
mysql, 224
mysqlaccess, 292
mysqladmin, 240
mysqlbinlog, 296
mysqlcheck, 245
mysqldump, 256
mysqld_multi, 210
mysqlhotcopy, 306
mysqlimport, 263
mysqlmanager, 310
mysqlshow, 267
mysqlslap, 273, 273
mysql_convert_table_format, 320
mysql_setpermission, 321
PASSWORD(), 507, 520, 839, 2750
password-file option
mysqlmanager, 310
passwords
administrator guidelines, 521
for users, 515
forgotten, 2753
hashing, 523
lost, 2753
resetting, 2753
security, 497, 521
setting, 520, 1012, 1015
user guidelines, 522
PATH environment variable, 81, 152, 190
pattern matching, 169, 780
performance
benchmarks, 563
disk issues, 652
estimating, 572
improving, 615, 1483, 1485
PERIOD_ADD(), 805
PERIOD_DIFF(), 805
Perl
installing, 152
installing on Windows, 154
Perl API, 2661
Perl DBI/DBD
installation problems, 154
permission checks
effect on speed, 564
perror, 188, 326
--ndb option, 2717
help option, 326
ndb option, 326
silent option, 326
verbose option, 326
version option, 326
phantom rows, 1135
PHP API, 2424
PI(), 792
pid-file option
mysql.server, 208
mysqld, 363
mysqld_safe, 206
mysqlmanager, 310
pid_file system variable, 419
Ping
thread command, 639
pipe option, 191
mysql, 224, 246
mysqladmin, 240
mysqldump, 256
mysqlimport, 263
mysqlshow, 267
mysqlslap, 273
PIPES_AS_CONCAT SQL mode, 473
plan option
mysqlaccess, 292
plugin API, 2664
plugin-load option
mysqld, 363
plugindir option
mysql_config, 324
plugins
adding, 2664
installing, 1023
uninstalling, 1024
PLUGINS
INFORMATION_SCHEMA table, 1924
plugin_dir system variable, 419
POINT data type, 864
point in time recovery, 549
Point(), 867
PointFromText(), 865
PointFromWKB(), 866
Index
3211
PointN(), 872
PointOnSurface(), 874
PolyFromText(), 865
PolyFromWKB(), 866
POLYGON data type, 864
Polygon(), 867
PolygonFromText(), 865
PolygonFromWKB(), 866
port option, 191
mysql, 224
mysqladmin, 240
mysqlbinlog, 296
mysqlcheck, 246
mysqld, 363
mysqldump, 256
mysqld_safe, 206
mysqlhotcopy, 307
mysqlimport, 263
mysqlmanager, 310
mysqlshow, 267
mysqlslap, 273
mysql_config, 324
mysql_convert_table_format, 320
mysql_setpermission, 322
port system variable, 420
port-open-timeout option
mysqld, 364
portability, 561
types, 751
porting
to other systems, 2690
PortNumber, 1524, 1553
position option
mysqlbinlog, 296
POSITION(), 775
post-install
multiple servers, 536
post-installation
setup and testing, 101
post-query option
mysqlslap, 273
post-system option
mysqlslap, 273
PostgreSQL compatibility, 19
POSTGRESQL SQL mode, 475
POW(), 792
POWER(), 792
pre-query option
mysqlslap, 273
pre-system option
mysqlslap, 273
precedence
operator, 759
precision
arithmetic, 880
precision math, 880
prefix option
configure, 90
preload_buffer_size system variable, 420
Prepare
thread command, 639
PREPARE, 1071, 1073
XA transactions, 1005
prepared statements, 1071, 1073, 1074, 1074, 2388
repreparation, 1074
prepared_stmt_count system variable, 420
preparing
thread state, 642
preserve-schema option
mysqlslap, 273
preview option
mysqlaccess, 292
primary key
constraint, 25
deleting, 897
PRIMARY KEY, 897, 922
primary keys
and partitioning keys, 1884
print command
mysql, 229
print-defaults option, 199
mysqlmanager, 310
print-password-line option
mysqlmanager, 310
privilege
changes, 510
privilege information
location, 502
privilege system, 497
privileges
access, 497
adding, 516
and replication, 1479
default, 112
deleting, 519, 1008
display, 1040
dropping, 519, 1008
granting, 1008
revoking, 1015
problems
access denied errors, 2740
common errors, 2739
compiling, 95
DATE columns, 2760
date values, 736
installing on IBM-AIX, 140
installing on Solaris, 133
installing Perl, 154
linking, 2752
lost connection errors, 2742
ODBC, 2027
reporting, 13
starting the server, 110
table locking, 612
time zone, 2759
PROCEDURE, 969
procedures
adding, 2689
stored, 22, 1891
process management (MySQL Cluster), 1588
process support, 36
processes
display, 1045
processing
arguments, 2683
Processing events
thread state, 647
Processing events from schema table
thread state, 647
Processlist
Index
3212
thread command, 639
PROCESSLIST, 1045
INFORMATION_SCHEMA table, 1935
PROFILING
INFORMATION_SCHEMA table, 1937
profiling session variable, 442
profiling_history_size session variable, 442
program options (MySQL Cluster), 1619
ndbd_redo_log_reader, 1623
ndb_config, 1623
ndb_error_reporter, 1624
ndb_restore, 1624
ndb_show_tables, 1626
ndb_size.pl, 1626
program variables
setting, 199
program-development utilities, 188
programs
administrative, 187
client, 186, 2422
crash-me, 561
stored, 1074, 1890
utility, 187
prompt command
mysql, 229
prompt option
mysql, 224
prompts
meanings, 159
pronunciation
MySQL, 4
protocol option, 192
mysql, 224
mysqladmin, 240
mysqlbinlog, 296
mysqlcheck, 246
mysqldump, 256
mysqlimport, 263
mysqlshow, 267
mysqlslap, 274
protocol_version system variable, 420
pseudo_thread_id system variable, 421
PURGE BINARY LOGS, 1064
PURGE MASTER LOGS, 1064
PURGE STALE SESSIONS, 1627
Purging old relay logs
thread state, 642
Python API, 2661
Q
QUARTER(), 805
queries
entering, 158
estimating performance, 572
examples, 176
speed of, 564
Twin Studies project, 182
Query
thread command, 639
Query Cache, 632
query end
thread state, 642
query option
mysqlslap, 274
ndb_config, 1598, 1599
query_alloc_block_size system variable, 421
query_cache_limit system variable, 421
query_cache_min_res_unit system variable, 422
query_cache_size system variable, 422
query_cache_type system variable, 423
query_cache_wlock_invalidate system variable, 423
query_prealloc_size system variable, 423
questions, 237
answering, 12
Queueing master event to the relay log
thread state, 646
quick option
myisamchk, 282
mysql, 224
mysqlcheck, 246
mysqldump, 256
quiet option
mysqlhotcopy, 307
Quit
thread command, 639
quit command
mysql, 229
QUIT command (MySQL Cluster), 1630
QUOTE(), 775
quote-names option
mysqldump, 256
quotes
in strings, 657
quoting, 658
quoting binary data, 657
quoting of identifiers, 659
R
RADIANS(), 792
RAND(), 792
rand_seed1 session variable, 442
rand_seed2 session variable, 442
range join type
optimizer, 567
range partitioning, 1856
range partitions
adding and dropping, 1871
managing, 1871
range_alloc_block_size system variable, 424
raw option
mysql, 225
re-creating
grant tables, 107
READ COMMITTED
transaction isolation level, 1003
READ UNCOMMITTED
transaction isolation level, 1003
read-from-remote-server option
mysqlbinlog, 296
read-only option
myisamchk, 281
mysqld, 1441
Reading event from the relay log
thread state, 646
Reading from net
thread state, 642
Reading master dump table data
thread state, 647
Index
3213
read_buffer_size myisamchk variable, 280
read_buffer_size system variable, 424
read_only system variable, 425
read_rnd_buffer_size system variable, 425
REAL data type, 726
RealtimeScheduler, 1546
REAL_AS_FLOAT SQL mode, 473
Rebuilding the index on master dump table
thread state, 647
ReceiveBufferMemory, 1553
reconfiguring, 95, 95
reconnect option
mysql, 225
Reconnecting after a failed binlog dump request
thread state, 646
Reconnecting after a failed master event read
thread state, 646
record-level locks
InnoDB, 1110, 1130, 1134, 1135
record_log_pos option
mysqlhotcopy, 307
RECOVER
XA transactions, 1005
recover option
myisamchk, 282
recovery
from crash, 551
point in time, 549
RedoBuffer, 1543
reducing
data size, 615
ref join type
optimizer, 566
references, 898
REFERENTIAL_CONSTRAINTS
INFORMATION_SCHEMA table, 1936
Refresh
thread command, 639
ref_or_null, 581
ref_or_null join type
optimizer, 567
REGEXP, 780
REGEXP operator, 780
regexp option
mysqlhotcopy, 307
mysql_find_rows, 321
Register Slave
thread command, 639
Registering slave on master
thread state, 645
regular expression syntax, 780
rehash command
mysql, 230
Related(), 877
relational databases
defined, 4
relative option
mysqladmin, 240
relay-log option
mysqld, 1441
relay-log-index option
mysqld, 1442
relay-log-info-file option
mysqld, 1442
relay-log-purge option
mysqld, 1442
relay-log-space-limit option
mysqld, 1442
relay_log_purge system variable, 425
relay_log_space_limit system variable, 426
release numbers, 37
RELEASE SAVEPOINT, 998
releases
naming scheme, 38
testing, 38
updating, 39
RELEASE_LOCK(), 848
relnotes option
mysqlaccess, 292
remote administration (MySQL Cluster)
and security issues, 1667
remove option
mysqlmanager, 310
Removing duplicates
thread state, 642
removing tmp table
thread state, 642
rename
thread state, 642
RENAME DATABASE, 944
rename result table
thread state, 642
RENAME TABLE, 944
RENAME USER, 1015
renaming user accounts, 1015
Reopen tables
thread state, 642
reordering
columns, 2766
repair
tables, 241
Repair by sorting
thread state, 642
Repair done
thread state, 642
repair option
mysqlcheck, 246
repair options
myisamchk, 282
REPAIR TABLE, 1021
and partitioning, 1876
Repair with keycache
thread state, 642
repairing
tables, 552
REPEAT, 1082
REPEAT(), 775
REPEATABLE READ
transaction isolation level, 1004
replace, 188
REPLACE, 964
replace option
mysqldump, 256
mysqlimport, 264
replace utility, 326
REPLACE(), 775
replicas (MySQL Cluster), 1499
replicate-do-db option
mysqld, 1442
replicate-do-table option
Index
3214
mysqld, 1444
replicate-ignore-db option
mysqld, 1443
replicate-ignore-table option
mysqld, 1444
replicate-rewrite-db option
mysqld, 1444
replicate-same-server-id option
mysqld, 1444
replicate-wild-do-table option
mysqld, 1445
replicate-wild-ignore-table option
mysqld, 1445
replication, 1419
and AUTO_INCREMENT, 1470
and character sets, 1471
and CREATE TABLE ... SELECT, 1471
and DATA DIRECTORY, 1475
and DROP ... IF EXISTS, 1475
and errors on slave, 1480
and floating-point values, 1477
and FLUSH, 1477
and functions, 1477
and INDEX DIRECTORY, 1475
and invoked features, 1475
and LAST_INSERT_ID(), 1470
and LIMIT, 1478
and LOAD DATA, 1478
and MEMORY tables, 1479
and mysql (system) database, 1479
and partial updates, 1481
and privileges, 1479
and query optimizer, 1479
and reserved words, 1479
and scheduled events, 1475
and slow query log, 1478
and stored routines, 1475
and temporary tables, 1480
and time zones, 1480
and TIMESTAMP, 1470
and transactions, 1480, 1481
and triggers, 1475, 1481
and TRUNCATE, 1482
and variables, 1482
and views, 1482
attribute promotion, 1474
circular, 1672
crashes, 1479
in MySQL Cluster, 1669
(see also MySQL Cluster replication)
row-based vs statement-based, 1429
shutdown and restart, 1479, 1480, 1480
statements incompatible with STATEMENT mode, 1429
timeouts, 1480
with differing tables on master and slave, 1472
replication formats
compared, 1429
replication implementation, 1488
replication limitations, 1470
replication master
thread states, 645
replication masters, 1479
statements, 1064
replication options, 1470
replication slave
thread states, 645, 646, 647
replication slaves
statements, 1066
replication, asynchronous (see MySQL Cluster replication)
REPORT command (MySQL Cluster), 1629
report-host option
mysqld, 1445
report-password option
mysqld, 1445
report-port option
mysqld, 1445
report-user option
mysqld, 1445
reporting
bugs, 13
Connector/NET problems, 2200
Connector/ODBC problems, 2027, 2027
errors, 1, 13
report_host system variable, 426
report_password system variable, 426
report_port system variable, 426
report_user system variable, 426
Requesting binlog dump
thread state, 645
REQUIRE GRANT option, 1013
reschedule
thread state, 645
reserved words, 667
and replication, 1479
ReservedSendBufferMemory, 1550
RESET MASTER, 1065
RESET SLAVE, 1069
Reset stmt
thread command, 639
reset-slave.pl (see MySQL Cluster replication)
resetmaster option
mysqlhotcopy, 307
resetslave option
mysqlhotcopy, 307
resolveip, 189, 327
help option, 327
silent option, 327
version option, 327
resolve_stack_dump, 188, 325
help option, 325
numeric-dump-file option, 325
symbols-file option, 325
version option, 326
RESTART command (MySQL Cluster), 1629
restarting
the server, 105
RestartOnErrorInsert, 1537
RESTORE TABLE, 1022
restoring backups
in MySQL Cluster, 1606
restoring from backups
in MySQL Cluster replication, 1684
restrictions
events, 3166
server-side cursors, 3169
stored routines, 3166
subqueries, 3169
triggers, 3166
views, 3171
result-file option
Index
3215
mysqlbinlog, 296
mysqldump, 256
retrieving
data from tables, 163
RETURN, 1083
return (\r), 657, 961
return values
UDFs, 2685
REVERSE(), 775
REVOKE, 1015
revoking
privileges, 1015
rhost option
mysqlaccess, 292
RIGHT JOIN, 971
RIGHT OUTER JOIN, 971
RIGHT(), 775
RLIKE, 780
ROLLBACK, 20, 995
XA transactions, 1005
rollback option
mysqlaccess, 292
ROLLBACK TO SAVEPOINT, 998
Rolling back
thread state, 642
rolling restart (MySQL Cluster), 1580
rolling upgrades and downgrades (MySQL Cluster), 1580
ROLLUP, 853
root password, 112
root user
password resetting, 2753
ROUND(), 793
rounding, 880
rounding errors, 726
ROUTINES
INFORMATION_SCHEMA table, 1921
routines option
mysqldump, 256
ROW, 983
row subqueries, 983
row-based replication
advantages, 1430
disadvantages, 1431
row-level locking, 610
rowid option
ndb_select_all, 1612
rows
counting, 171
deleting, 2763
locking, 22
matching problems, 2763
selecting, 164
sorting, 166
rows option
mysql_find_rows, 321
ndb_config, 1600
ROW_COUNT(), 845
RPAD(), 775
RPM file, 71
rpm option
mysql_install_db, 215
RPM Package Manager, 71
RTRIM(), 776
RTS-threads, 2697
Ruby API, 2662
run-as-service option
mysqlmanager, 310
running
ANSI mode, 17
batch mode, 175
multiple servers, 536
queries, 158
running configure after prior invocation, 95
S
safe-mode option
mysqld, 364
safe-recover option
myisamchk, 282
safe-show-database option
mysqld, 364, 495
safe-updates option, 234
mysql, 225
safe-user-create option
mysqld, 364, 495
Sakila, 4
SAVEPOINT, 998
Saving state
thread state, 642
scale
arithmetic, 880
SchedulerExecutionTimer, 1546
SchedulerSpinTimer, 1546
schema
altering, 888
creating, 905
deleting, 941
SCHEMA(), 845
SCHEMATA
INFORMATION_SCHEMA table, 1913
SCHEMA_PRIVILEGES
INFORMATION_SCHEMA table, 1917
SCI (Scalable Coherent Interface) (see MySQL Cluster)
script files, 175
scripts, 203, 209
mysqlbug, 16
mysql_install_db, 106
SQL, 218
searching
and case sensitivity, 2759
full-text, 811
MySQL Web pages, 13
two keys, 180
Searching rows for update
thread state, 642
SECOND(), 805
secondary index
InnoDB, 1140
secure-auth option
mysql, 225
mysqld, 365, 495
secure-file-priv option
mysqld, 365, 495
secure_auth system variable, 426
secure_file_priv system variable, 427
securing a MySQL Cluster, 1668
security
against attackers, 493
and malicious SQL statements, 1668
Index
3216
and NDB utilities, 1669
security system, 497
SEC_TO_TIME(), 805
SELECT
LIMIT, 965
optimizing, 564, 992
Query Cache, 632
SELECT INTO, 1076
SELECT INTO TABLE, 20
SELECT speed, 573
selecting
databases, 161
select_limit variable, 227
semi-consistent read
InnoDB, 1110
SendBufferMemory, 1553
Sending binlog event to slave
thread state, 645
SendLimit, 1555
SendSignalId, 1553, 1554, 1556
SEQUENCE, 181
sequence emulation, 844
sequences, 181
SERIAL, 724, 725
SERIAL DEFAULT VALUE, 731
SERIALIZABLE
transaction isolation level, 1004
server
connecting, 157, 190
debugging, 2690
disconnecting, 157
logs, 477
restart, 105
shutdown, 105
signal handling, 475
starting, 104
starting and stopping, 108
starting problems, 110
server administration, 235
server variables, 371, 1057
server-id option
mysqlbinlog, 296
mysqld, 1433
server-side cursor restrictions, 3169
ServerPort, 1527
servers
multiple, 536
server_id system variable, 427
service-startup-timeout option
mysql.server, 208
session server variables, 440
session system variables, 440
session variable
autocommit, 441
big_tables, 441
error_count, 441
foreign_key_checks, 441
identity, 441
insert_id, 442
last_insert_id, 442
profiling, 442
profiling_history_size, 442
rand_seed1, 442
rand_seed2, 442
sql_auto_is_null, 442
sql_big_selects, 442
sql_buffer_result, 442
sql_log_bin, 442
sql_log_off, 443
sql_log_update, 443
sql_notes, 443
sql_quote_show_create, 443
sql_safe_updates, 443
sql_warnings, 443
timestamp, 443
unique_checks, 443
warning_count, 443
session variables
and replication, 1482
server, 440
system, 440
SESSION_STATUS
INFORMATION_SCHEMA table, 1936
SESSION_USER(), 845
SESSION_VARIABLES
INFORMATION_SCHEMA table, 1937
SET, 1025, 1075
CHARACTER SET, 682, 1027
NAMES, 682, 684, 1027
ONE_SHOT, 1027
size, 750
SET data type, 730, 746
SET GLOBAL SQL_SLAVE_SKIP_COUNTER, 1069
Set option
thread command, 639
SET OPTION, 1025
SET PASSWORD, 1015
SET PASSWORD statement, 520
SET sql_log_bin, 1066
SET TRANSACTION, 1002
set-auto-increment[ option
myisamchk, 283
set-character-set option
myisamchk, 283
set-charset option
mysqlbinlog, 296
mysqldump, 256
set-collation option
myisamchk, 283
setting
passwords, 520
setting passwords, 1015
setting program variables, 199
setup
post-installation, 101
thread state, 643
SHA(), 839
SHA1(), 839
shared memory transporter (see MySQL Cluster)
shared-memory option
mysqld, 365
shared-memory-base-name option, 192
mysqld, 365
mysqlslap, 273
SharedBufferSize, 1555
SharedGlobalMemory, 1547
shared_memory system variable, 427
shared_memory_base_name system variable, 428
shell syntax, 3, 1297
ShmKey, 1554
Index
3217
ShmSize, 1554
short-form option
mysqlbinlog, 297
SHOW
in MySQL Cluster management client, 1515
SHOW AUTHORS, 1027, 1028
SHOW BINARY LOGS, 1028
SHOW BINLOG EVENTS, 1028, 1029
SHOW CHARACTER SET, 1027, 1029
SHOW COLLATION, 1027, 1029
SHOW COLUMNS, 1027, 1030
SHOW command (MySQL Cluster), 1629
SHOW CONTRIBUTORS, 1027, 1031
SHOW CREATE DATABASE, 1027, 1031
SHOW CREATE EVENT, 1027
SHOW CREATE FUNCTION, 1027, 1032
SHOW CREATE PROCEDURE, 1027, 1032
SHOW CREATE SCHEMA, 1027, 1031
SHOW CREATE TABLE, 1027, 1033
SHOW CREATE TRIGGER, 1027, 1033
SHOW CREATE VIEW, 1027, 1033
SHOW DATABASES, 1027, 1034
SHOW ENGINE, 1027, 1034
used with MySQL Cluster, 1653
SHOW ENGINE INNODB STATUS, 1034
SHOW ENGINE NDB STATUS, 1034, 1653
SHOW ENGINE NDBCLUSTER STATUS, 1034, 1653
SHOW ENGINES, 1027, 1037
used with MySQL Cluster, 1653
SHOW ERRORS, 1027, 1038
and MySQL Cluster, 2717
SHOW EVENTS, 1027, 1038
SHOW extensions, 1938
SHOW FIELDS, 1027, 1031
SHOW FUNCTION CODE, 1027, 1040
SHOW FUNCTION STATUS, 1027, 1040
SHOW GRANTS, 1027, 1040
SHOW INDEX, 1027, 1041
SHOW INNODB STATUS, 1027
SHOW KEYS, 1027, 1041
SHOW MASTER LOGS, 1028, 1028
SHOW MASTER STATUS, 1028, 1042
SHOW OPEN TABLES, 1027, 1042
SHOW PLUGINS, 1027, 1043
SHOW PRIVILEGES, 1027, 1043
SHOW PROCEDURE CODE, 1027, 1043
SHOW PROCEDURE STATUS, 1027, 1044
SHOW PROCESSLIST, 1027, 1045
SHOW PROFILE, 1027, 1046, 1046
SHOW PROFILES, 1027, 1046
SHOW SCHEDULER STATUS, 1027, 1899
SHOW SCHEMAS, 1027, 1034
SHOW SLAVE HOSTS, 1028, 1049
SHOW SLAVE STATUS, 1028, 1049
SHOW STATUS, 1027
used with MySQL Cluster, 1654
SHOW STORAGE ENGINES, 1037
SHOW TABLE STATUS, 1027
SHOW TABLE TYPES, 1027, 1037
SHOW TABLES, 1027, 1056
SHOW TRIGGERS, 1027, 1056
SHOW VARIABLES, 1027
used with MySQL Cluster, 1653
SHOW WARNINGS, 1027, 1058
and MySQL Cluster, 2717
SHOW with WHERE, 1912, 1938
show-slave-auth-info option
mysqld, 1445
show-table-type option
mysqlshow, 267
show-warnings option
mysql, 225
showing
database information, 264
Shutdown
thread command, 639
SHUTDOWN command (MySQL Cluster), 1630
shutdown_timeout variable, 241
shutting down
the server, 105
Shutting down
thread state, 647
sigint-ignore option
mysql, 225
SIGN(), 794
signals
server response, 475
SigNum, 1555
silent column changes, 932
silent option
myisamchk, 279
myisampack, 286
mysql, 225
mysqladmin, 240
mysqlcheck, 246
mysqld_multi, 210
mysqlimport, 264
mysqlslap, 274
perror, 326
resolveip, 327
SIN(), 794
single quote (\'), 657
single user mode (MySQL Cluster), 1630, 1652
and ndb_restore, 1607
single-transaction option
mysqldump, 257
size of tables, 2748
sizes
display, 724
skip-column-names option
mysql, 225
skip-comments option
mysqldump, 257
skip-concurrent-insert option
mysqld, 365
skip-external-locking option
mysqld, 365
skip-grant-tables option
mysqld, 366, 495
skip-host-cache option
mysqld, 366
skip-innodb option
mysqld, 366
skip-kill-mysqld option
mysqld_safe, 206
skip-line-numbers option
mysql, 226
skip-merge option
mysqld, 496
skip-name-resolve option
Index
3218
mysqld, 366, 496
mysql_install_db, 216
skip-ndbcluster option
mysqld, 1573
skip-networking option
mysqld, 366, 496
skip-opt option
mysqldump, 257
skip-safemalloc option
mysqld, 366
skip-show-database option
mysqld, 367, 496
skip-slave-start option
mysqld, 1445
skip-stack-trace option
mysqld, 367
skip-symbolic-links option
mysqld, 366
skip-syslog option
mysqld_safe, 206
skip-thread-priority option
mysqld, 367
skip-use-db option
mysql_find_rows, 321
skip_external_locking system variable, 428
skip_networking system variable, 428
skip_show_database system variable, 428
slave option
mysqlslap, 274
slave-load-tmpdir option
mysqld, 1446
slave-net-timeout option
mysqld, 1446
slave-skip-errors option
mysqld, 1446
slave_allow_batching, 1682
slave_compressed_protocol option
mysqld, 1445
slave_compressed_protocol system variable, 1448
slave_exec_mode system variable, 1448
slave_load_tmpdir system variable, 1448
slave_net_timeout system variable, 1448
slave_skip_errors system variable, 1449
slave_transaction_retries system variable, 1449
Sleep
thread command, 639
sleep option
mysqladmin, 241
SLEEP(), 848
slow queries, 237
slow query log, 489
and replication, 1478
slow-query-log option
mysqld, 367
slow_launch_time system variable, 428
slow_query_log system variable, 428
slow_query_log_file system variable, 428
SMALLINT data type, 725
SNAPSHOTEND (START BACKUP command), 1632
SNAPSHOTSTART (START BACKUP command), 1632
socket location
changing, 90
socket option, 192
mysql, 226
mysqladmin, 241
mysqlbinlog, 297
mysqlcheck, 246
mysqld, 368
mysqldump, 257
mysqld_safe, 206
mysqlhotcopy, 307
mysqlimport, 264
mysqlmanager, 310
mysqlshow, 267
mysqlslap, 274
mysql_config, 324
mysql_convert_table_format, 320
mysql_setpermission, 322
socket system variable, 429
Solaris
installation, 75
Solaris installation problems, 133
Solaris troubleshooting, 96
Solaris x86_64 issues, 1149
SOME, 982
sort-index option
myisamchk, 283
sort-records option
myisamchk, 283
sort-recover option
myisamchk, 283
sorting
character sets, 707
data, 166
grant tables, 508, 509
table rows, 166
Sorting for group
thread state, 643
Sorting for order
thread state, 643
Sorting index
thread state, 643
Sorting result
thread state, 643
sort_buffer_size myisamchk variable, 280
sort_buffer_size system variable, 429
sort_key_blocks myisamchk variable, 280
SOUNDEX(), 776
SOUNDS LIKE, 776
source (mysql client command), 176, 233
source command
mysql, 230
source distribution
installing, 83
source distributions
on Linux, 128
SPACE(), 776
spassword option
mysqlaccess, 292
Spatial Extensions in MySQL, 856
speed
compiling, 625
increasing with replication, 1419
inserting, 605
linking, 625
of queries, 564, 573
sporadic-binlog-dump-fail option
mysqld, 1453
SQL
defined, 4
Index
3219
SQL mode, 469
ALLOW_INVALID_DATES, 470
ANSI, 470, 474
ANSI_QUOTES, 471
DB2, 475
ERROR_FOR_DIVISION_BY_ZERO, 471
HIGH_NOT_PRECEDENCE, 471
IGNORE_SPACE, 471
MAXDB, 475
MSSQL, 475
MYSQL323, 475
MYSQL40, 475
NO_AUTO_CREATE_USER, 471
NO_AUTO_VALUE_ON_ZERO, 471
NO_BACKSLASH_ESCAPES, 471
NO_DIR_IN_CREATE, 472
NO_ENGINE_SUBSTITUTION, 472
NO_FIELD_OPTIONS, 472
NO_KEY_OPTIONS, 472
NO_TABLE_OPTIONS, 472
NO_UNSIGNED_SUBTRACTION, 472
NO_ZERO_DATE, 473
NO_ZERO_IN_DATE, 473
ONLY_FULL_GROUP_BY, 473, 855
ORACLE, 475
PAD_CHAR_TO_FULL_LENGTH, 473
PIPES_AS_CONCAT, 473
POSTGRESQL, 475
REAL_AS_FLOAT, 473
strict, 470
STRICT_ALL_TABLES, 474
STRICT_TRANS_TABLES, 470, 474
TRADITIONAL, 470, 475
SQL node (MySQL Cluster)
defined, 1497
SQL nodes (MySQL Cluster), 1588
SQL scripts, 218
SQL statements
replication masters, 1064
replication slaves, 1066
SQL statements relating to MySQL Cluster, 1653
SQL-92
extensions to, 16
sql-mode option
mysqld, 368
sql_auto_is_null session variable, 442
SQL_BIG_RESULT, 970
sql_big_selects session variable, 442
SQL_BUFFER_RESULT, 970
sql_buffer_result session variable, 442
SQL_CACHE, 634, 971
SQL_CALC_FOUND_ROWS, 971
sql_log_bin session variable, 442
sql_log_off session variable, 443
sql_log_update session variable, 443
sql_mode system variable, 430
sql_notes session variable, 443
SQL_NO_CACHE, 634, 971
sql_quote_show_create session variable, 443
sql_safe_updates session variable, 443
sql_select_limit system variable, 430
SQL_SLAVE_SKIP_COUNTER, 1069
sql_slave_skip_counter system variable, 1446, 1449
SQL_SMALL_RESULT, 971
sql_warnings session variable, 443
sql_yacc.cc problems, 95
SQRT(), 794
square brackets, 724
srcdir option
mysql_install_db, 216
SRID(), 870
SSH, 535
SSL, 527
SSL and X509 Basics, 526
SSL command options, 529
ssl option, 530
SSL options, 192
mysql, 226
mysqladmin, 241
mysqlcheck, 246
mysqld, 366, 496
mysqldump, 257
mysqlimport, 264
mysqlshow, 267
mysqlslap, 274
SSL related options, 1013
ssl-ca option, 530
ssl-capath option, 530
ssl-cert option, 530
ssl-cipher option, 530
ssl-key option, 530
ssl-verify-server-cert option, 530
ssl_ca system variable, 431
ssl_capath system variable, 431
ssl_cert system variable, 431
ssl_cipher system variable, 431
ssl_key system variable, 432
standalone option
mysqld, 366
mysqlmanager, 310
Standard Monitor
InnoDB, 1151
Standard SQL
differences from, 20, 1014
extensions to, 16, 17
standards compatibility, 16
START
XA transactions, 1005
START BACKUP
NOWAIT, 1632
SNAPSHOTEND, 1632
SNAPSHOTSTART, 1632
syntax, 1632
WAIT COMPLETED, 1632
WAIT STARTED, 1632
START command (MySQL Cluster), 1629
START SLAVE, 1070
START TRANSACTION, 995
start-datetime option
mysqlbinlog, 297
start-position option
mysqlbinlog, 297
StartFailureTimeout, 1538
starting
comments, 24
mysqld, 497
the server, 104
the server automatically, 108
Starting many servers, 536
starting slave
Index
3220
thread state, 647
StartPartialTimeout, 1538
StartPartitionedTimeout, 1538
StartPoint(), 872
STARTUP Events (MySQL Cluster), 1638
startup options
default, 195
startup parameters, 627
mysql, 219
mysqladmin, 238
tuning, 626
start_row option
mysql_find_rows, 321
statefile option
comp_err, 213
statement-based replication
advantages, 1429
disadvantages, 1429
unsafe statements, 1429
statements
compound, 1074
GRANT, 516
INSERT, 517
replication masters, 1064
replication slaves, 1066
statically
compiling, 90
Statistics
thread command, 639
statistics
thread state, 643
STATISTICS
INFORMATION_SCHEMA table, 1916
STATISTICS Events (MySQL Cluster), 1639
stats option
myisam_ftdump, 276
stats_method myisamchk variable, 280
status
tables, 1054
status command
mysql, 230
results, 237
STATUS command (MySQL Cluster), 1629
status option
mysqlshow, 267
status variables, 452, 1053
STD(), 852
STDDEV(), 852
STDDEV_POP(), 852
STDDEV_SAMP(), 852
STOP command (MySQL Cluster), 1629
STOP SLAVE, 1071
stop-datetime option
mysqlbinlog, 297
stop-position option
mysqlbinlog, 297
StopOnError, 1536
stopping
the server, 108
stopword list
user-defined, 821
storage engine
ARCHIVE, 1191
storage engines
choosing, 1084
storage nodes - see data nodes, ndbd (see data nodes, ndbd)
storage nodes - see data nodes, ndbd, ndbmtd (see data nodes, ndbd, ndb-
mtd)
storage requirements
data type, 748
storage space
minimizing, 615
storage_engine system variable, 432
stored functions, 1891
and INSERT DELAYED, 953
stored procedures, 1891
stored procedures and triggers
defined, 22
stored programs, 1074, 1890
stored routine restrictions, 3166
stored routines
and replication, 1475
LAST_INSERT_ID(), 1893
metadata, 1893
storing row into queue
thread state, 644
STRAIGHT_JOIN, 565, 572, 582, 582, 970, 971
STRCMP(), 780
strict SQL mode, 470
STRICT_ALL_TABLES SQL mode, 474
STRICT_TRANS_TABLES SQL mode, 470, 474
string collating, 711
string comparison functions, 778
string comparisons
case sensitivity, 778
string concatenation, 656, 771
string functions, 768
string literal introducer, 656, 679
string replacement
replace utility, 326
string types, 741
StringMemory, 1529
strings
defined, 656
escaping characters, 656
nondelimited, 736
striping
defined, 652
STR_TO_DATE(), 806
SUBDATE(), 806
subpartitioning, 1864
subpartitions, 1864
subqueries, 980
correlated, 984
errors, 986
rewriting as joins, 989
with ALL, 982
with ANY, IN, SOME, 982
with EXISTS, 983
with NOT EXISTS, 983
with ROW, 983
subquery, 980
subquery optimization, 595
subquery restrictions, 3169
subselects, 980
SUBSTR(), 776
SUBSTRING(), 776
SUBSTRING_INDEX(), 777
SUBTIME(), 807
subtraction (-), 786
Index
3221
suffix option
mysqlhotcopy, 307
SUM(), 852
SUM(DISTINCT), 852
superuser, 112
superuser option
mysqlaccess, 292
support
for operating systems, 36
suppression
default values, 25
Sybase compatibility, 995
symbolic links, 653, 655
symbolic-links option
mysqld, 366
symbols-file option
resolve_stack_dump, 325
SymDifference(), 875
Syncing ndb table schema operation and binlog
thread state, 647
sync_binlog system variable, 1456
sync_frm system variable, 432
syntax
regular expression, 780
syntax conventions, 2
SYSDATE(), 807
sysdate-is-now option
mysqld, 368
syslog option
mysqld_safe, 206
syslog-tag option
mysqld_safe, 206
system
privilege, 497
security, 491
system command
mysql, 230
System lock
thread state, 643
system optimization, 626
system table
optimizer, 566, 970
system variable
automatic_sp_privileges, 380
auto_increment_increment, 1435
auto_increment_offset, 1438
back_log, 381
basedir, 381
binlog_cache_size, 1453
binlog_format, 1454
bulk_insert_buffer_size, 381
character_sets_dir, 384
character_set_client, 382
character_set_connection, 382
character_set_database, 382
character_set_filesystem, 383
character_set_results, 383
character_set_server, 383
character_set_system, 383
collation_connection, 384
collation_database, 384
collation_server, 384
completion_type, 384
concurrent_insert, 385
connect_timeout, 385
datadir, 386
datetime_format, 386
date_format, 386
debug, 386
default_week_format, 387
delayed_insert_limit, 388
delayed_insert_timeout, 388
delayed_queue_size, 388
delay_key_write, 387
div_precision_increment, 389
engine_condition_pushdown, 389
event_scheduler, 390
expire_logs_days, 390
flush, 391
flush_time, 391
ft_boolean_syntax, 391
ft_max_word_len, 392
ft_min_word_len, 392
ft_query_expansion_limit, 392
ft_stopword_file, 393
general_log, 393
general_log_file, 393
group_concat_max_len, 394
have_archive, 394
have_blackhole_engine, 394
have_community_features, 394
have_compress, 394
have_crypt, 394
have_csv, 394
have_dynamic_loading, 395
have_example_engine, 395
have_federated_engine, 395
have_geometry, 395
have_innodb, 395
have_isam, 395
have_merge_engine, 395
have_openssl, 395
have_partitioning, 395
have_query_cache, 395
have_raid, 395
have_row_based_replication, 395
have_rtree_keys, 396
have_ssl, 396
have_symlink, 396
hostname, 396
init_connect, 396
init_file, 396
init_slave, 1447
interactive_timeout, 397
join_buffer_size, 397
keep_files_on_create, 398
key_buffer_size, 398
key_cache_age_threshold, 399
key_cache_block_size, 399
key_cache_division_limit, 400
language, 400
large_files_support, 400
large_pages, 400
large_page_size, 401
lc_time_names, 401
license, 401
local_infile, 401
locked_in_memory, 401
log, 402
log_bin, 402
Index
3222
log_bin_trust_function_creators, 402
log_error, 402
log_output, 402
log_queries_not_using_indexes, 403
log_slave_updates, 403
log_slow_queries, 403
log_warnings, 404
long_query_time, 404
lower_case_file_system, 405
lower_case_table_names, 405
low_priority_updates, 404
max_allowed_packet, 405
max_binlog_cache_size, 1455
max_binlog_size, 1455
max_connections, 406
max_connect_errors, 406
max_delayed_threads, 407
max_error_count, 407
max_heap_table_size, 407
max_insert_delayed_threads, 408
max_join_size, 408
max_length_for_sort_data, 409
max_prepared_stmt_count, 409
max_relay_log_size, 409
max_seeks_for_key, 410
max_sort_length, 410
max_sp_recursion_depth, 410
max_tmp_tables, 411
max_user_connections, 411
max_write_lock_count, 412
min_examined_row_limit, 412
myisam_data_pointer_size, 412
myisam_max_sort_file_size, 413
myisam_recover_options, 413
myisam_repair_threads, 413
myisam_sort_buffer_size, 414
myisam_stats_method, 414
myisam_use_mmap, 415
named_pipe, 415
net_buffer_length, 415
net_read_timeout, 416
net_retry_count, 416
net_write_timeout, 416
new, 417
old, 417
old_passwords, 417
one_shot, 418
open_files_limit, 418
optimizer_prune_level, 418
optimizer_search_depth, 418
optimizer_switch, 419
pid_file, 419
plugin_dir, 419
port, 420
preload_buffer_size, 420
prepared_stmt_count, 420
protocol_version, 420
pseudo_thread_id, 421
query_alloc_block_size, 421
query_cache_limit, 421
query_cache_min_res_unit, 422
query_cache_size, 422
query_cache_type, 423
query_cache_wlock_invalidate, 423
query_prealloc_size, 423
range_alloc_block_size, 424
read_buffer_size, 424
read_only, 425
read_rnd_buffer_size, 425
relay_log_purge, 425
relay_log_space_limit, 426
report_host, 426
report_password, 426
report_port, 426
report_user, 426
secure_auth, 426
secure_file_priv, 427
server_id, 427
shared_memory, 427
shared_memory_base_name, 428
skip_external_locking, 428
skip_networking, 428
skip_show_database, 428
slave_compressed_protocol, 1448
slave_exec_mode, 1448
slave_load_tmpdir, 1448
slave_net_timeout, 1448
slave_skip_errors, 1449
slave_transaction_retries, 1449
slow_launch_time, 428
slow_query_log, 428
slow_query_log_file, 428
socket, 429
sort_buffer_size, 429
sql_mode, 430
sql_select_limit, 430
sql_slave_skip_counter, 1446, 1449
ssl_ca, 431
ssl_capath, 431
ssl_cert, 431
ssl_cipher, 431
ssl_key, 432
storage_engine, 432
sync_binlog, 1456
sync_frm, 432
system_time_zone, 432
table_cache, 433
table_definition_cache, 433
table_lock_wait_timeout, 433
table_open_cache, 434
table_type, 434
thread_cache_size, 434
thread_concurrency, 435
thread_handling, 435
thread_stack, 435
timed_mutexes, 436
time_format, 436
time_zone, 436
tmpdir, 437
tmp_table_size, 437
transaction_alloc_block_size, 437
transaction_prealloc_size, 438
tx_isolation, 438
updatable_views_with_limit, 439
version, 439
version_comment, 439
version_compile_machine, 439
version_compile_os, 439
wait_timeout, 439
system variables, 371, 443, 1057
Index
3223
and replication, 1482
system_time_zone system variable, 432
SYSTEM_USER(), 845
T
tab (\t), 657, 962
tab option
mysqldump, 257
table
changing, 892, 898, 2765
deleting, 943
rebuilding, 125
repair, 125
row size, 748
table aliases, 967
table cache, 624
Table Dump
thread command, 639
table is full, 441, 2748
Table lock
thread state, 643
Table Monitor
InnoDB, 1151, 1160
table names
case sensitivity, 661
case-sensitivity, 18
table option
mysql, 226
mysqlaccess, 292
table scans
avoiding, 600
table types
choosing, 1084
table-level locking, 610
tables
BLACKHOLE, 1194
changing column order, 2766
checking, 281
closing, 624
compressed, 285
compressed format, 1095
const, 566
constant, 574
copying, 931
counting rows, 171
creating, 161
CSV, 1192
defragment, 1094
defragmenting, 560, 1020
deleting rows, 2763
displaying, 264
displaying status, 1054
dumping, 247, 305
dynamic, 1094
error checking, 552
EXAMPLE, 1185
FEDERATED, 1186
flush, 237
fragmentation, 1020
HEAP, 1183
host, 510
improving performance, 615
information, 555
information about, 174
InnoDB, 1097
loading data, 163
maintenance, 241
maintenance schedule, 559
maximum size, 2748
MEMORY, 1183
MERGE, 1179
merging, 1179
multiple, 173
MyISAM, 1090
names, 659
open, 624
opening, 624
optimizing, 554
partitioning, 1179
repair, 241
repairing, 552
retrieving data, 163
selecting columns, 165
selecting rows, 164
sorting rows, 166
symbolic links, 654
system, 566
too many, 625
unique ID for last row, 2417
updating, 20
TABLES
INFORMATION_SCHEMA table, 1914
tables option
mysqlcheck, 246
mysqldump, 257
Tablespace Monitor
InnoDB, 1128, 1143, 1151
table_cache system variable, 433
table_definition_cache system variable, 433
table_lock_wait_timeout system variable, 433
table_open_cache, 624
table_open_cache system variable, 434
TABLE_PRIVILEGES
INFORMATION_SCHEMA table, 1917
table_type system variable, 434
TAN(), 794
tar
problems on Solaris, 75, 133
tc-heuristic-recover option
mysqld, 369
Tcl API, 2662
tcp-ip option
mysqld_multi, 210
TCP/IP, 63, 66
tee command
mysql, 230
tee option
mysql, 226
temp-pool option
mysqld, 369
temporary file
write access, 107
temporary files, 2757
temporary tables
and replication, 1480
internal, 651
problems, 2766
terminal monitor
defined, 157
Index
3224
test option
myisampack, 286
testing
connection to the server, 507
installation, 104
of MySQL releases, 38
post-installation, 101
testing mysqld
mysqltest, 2663
TEXT
size, 750
TEXT columns
default values, 743
indexing, 616, 923
TEXT data type, 730, 743
text files
importing, 233, 260
thread cache, 648
thread command
Binlog Dump, 638
Change user, 638
Close stmt, 638
Connect, 638
Connect Out, 638
Create DB, 638
Daemon, 638
Debug, 638
Delayed insert, 638
Drop DB, 638
Error, 638
Execute, 638
Fetch, 638
Field List, 638
Init DB, 638
Kill, 638
Long Data, 638
Ping, 639
Prepare, 639
Processlist, 639
Query, 639
Quit, 639
Refresh, 639
Register Slave, 639
Reset stmt, 639
Set option, 639
Shutdown, 639
Sleep, 639
Statistics, 639
Table Dump, 639
Time, 639
thread commands, 637
thread packages
differences between, 2698
thread state
After create, 639
allocating local table, 644
Analyzing, 640
Changing master, 647
Checking master version, 645
checking permissions, 640
Checking table, 640
cleaning up, 640
Clearing, 648
closing tables, 640
Committing events to binlog, 647
Connecting to master, 645
converting HEAP to MyISAM, 640
copy to tmp table, 640
Copying to group table, 640
Copying to tmp table, 640
Copying to tmp table on disk, 640
Creating delayed handler, 644
Creating index, 640
Creating sort index, 640
creating table, 640
Creating table from master dump, 647
Creating tmp table, 640
deleting from main table, 640
deleting from reference tables, 641
discard_or_import_tablespace, 641
end, 641
executing, 641
Execution of init_command, 641
Finished reading one binlog; switching to next binlog, 645
Flushing tables, 641
freeing items, 641
FULLTEXT initialization, 641
got handler lock, 644
got old table, 644
Has read all relay log; waiting for the slave I/O thread to update it,
646
Has sent all binlog to slave; waiting for binlog to be updated, 645
init, 641
Initialized, 648
insert, 644
Killed, 641
Killing slave, 647
Locked, 641
logging slow query, 641
login, 641
Making temp file, 646
NULL, 641
Opening master dump table, 647
Opening mysql.ndb_apply_status, 647
Opening table, 641
Opening tables, 641
preparing, 642
Processing events, 647
Processing events from schema table, 647
Purging old relay logs, 642
query end, 642
Queueing master event to the relay log, 646
Reading event from the relay log, 646
Reading from net, 642
Reading master dump table data, 647
Rebuilding the index on master dump table, 647
Reconnecting after a failed binlog dump request, 646
Reconnecting after a failed master event read, 646
Registering slave on master, 645
Removing duplicates, 642
removing tmp table, 642
rename, 642
rename result table, 642
Reopen tables, 642
Repair by sorting, 642
Repair done, 642
Repair with keycache, 642
Requesting binlog dump, 645
reschedule, 645
Rolling back, 642
Index
3225
Saving state, 642
Searching rows for update, 642
Sending binlog event to slave, 645
setup, 643
Shutting down, 647
Sorting for group, 643
Sorting for order, 643
Sorting index, 643
Sorting result, 643
starting slave, 647
statistics, 643
storing row into queue, 644
Syncing ndb table schema operation and binlog, 647
System lock, 643
Table lock, 643
update, 644
Updating, 643
updating main table, 643
updating reference tables, 643
upgrading lock, 645
User lock, 643
waiting for delay_list, 644
Waiting for event from ndbcluster, 647
Waiting for first event from ndbcluster, 648
waiting for handler insert, 644
waiting for handler lock, 644
waiting for handler open, 644
Waiting for INSERT, 645
Waiting for master to send event, 646
Waiting for master update, 645
Waiting for ndbcluster binlog update to reach current position, 648
Waiting for ndbcluster to start, 648
Waiting for next activation, 648
Waiting for scheduler to stop, 648
Waiting for schema epoch, 648
Waiting for slave mutex on exit, 646, 647
Waiting for table, 643
Waiting for tables, 643
Waiting for the next event in relay log, 646
Waiting for the slave SQL thread to free enough relay log space, 646
Waiting on cond, 643
Waiting on empty queue, 648
Waiting to finalize termination, 645
Waiting to reconnect after a failed binlog dump request, 646
Waiting to reconnect after a failed master event read, 646
Writing to net, 644
thread states
delayed inserts, 644
event scheduler, 648
general, 639
MySQL Cluster, 647
replication master, 645
replication slave, 645, 646, 647
thread support, 36
nonnative, 97
threaded clients, 2423
ThreadPool (OBSOLETE) (see DiskIOThreadPool)
threads, 237, 1045, 2663
display, 1045
RTS, 2697
thread_cache_size system variable, 434
thread_concurrency system variable, 435
thread_handling system variable, 435
thread_stack system variable, 435
Time
thread command, 639
TIME data type, 727, 739
time types, 749
time zone problems, 2759
time zone tables, 216
time zones
and replication, 1480
leap seconds, 721
support, 718
upgrading, 719
TIME(), 807
TimeBetweenEpochs, 1539
TimeBetweenEpochsTimeout, 1539
TimeBetweenGlobalCheckpoints, 1539
TimeBetweenInactiveTransactionAbortCheck, 1540
TimeBetweenLocalCheckpoints, 1539
TimeBetweenWatchDogCheck, 1538
TimeBetweenWatchDogCheckInitial, 1538
TIMEDIFF(), 807
timed_mutexes system variable, 436
timeout, 385, 846, 955
connect_timeout variable, 227, 241
shutdown_timeout variable, 241
timeout option
ndb_waiter, 1618
timeouts (replication), 1480
TIMESTAMP
and NULL values, 2762
and replication, 1470
TIMESTAMP data type, 727, 735
timestamp session variable, 443
TIMESTAMP(), 807
TIMESTAMPADD(), 808
TIMESTAMPDIFF(), 808
timezone option
mysqld_safe, 206
time_format system variable, 436
TIME_FORMAT(), 808
TIME_TO_SEC(), 808
time_zone system variable, 436
TINYBLOB data type, 729
TINYINT data type, 724
TINYTEXT data type, 729
tips
optimization, 607
TMPDIR environment variable, 107, 152, 189, 2757
tmpdir option
myisamchk, 283
myisampack, 286
mysqld, 369
mysqlhotcopy, 307
mysql_upgrade, 218
tmpdir system variable, 437
tmp_table_size system variable, 437
to-last-log option
mysqlbinlog, 297
TODO
symlinks, 654
tools
command-line, 218
list of, 34
mysqld_multi, 209
mysqld_safe, 203
TotalSendBufferMemory
API and SQL nodes, 1552
Index
3226
data nodes, 1550
management nodes, 1526
Touches(), 877
TO_DAYS(), 808
trace DBI method, 2693
trace files
ndbmtd, 1593
trace files (MySQL Cluster), 1592
TRADITIONAL SQL mode, 470, 475
transaction isolation level, 1002
READ COMMITTED, 1003
READ UNCOMMITTED, 1003
REPEATABLE READ, 1004
SERIALIZABLE, 1004
transaction-isolation option
mysqld, 369
transaction-safe tables, 20, 1097
transactional option
ndb_delete_all, 1602
TransactionBufferMemory, 1532
TransactionDeadlockDetectionTimeout, 1540
TransactionInactiveTimeout (MySQL Cluster configuration parameter),
1540
transactions
and replication, 1480, 1481
support, 20, 1097
transaction_alloc_block_size system variable, 437
transaction_prealloc_size system variable, 438
Translators
list of, 31
trigger restrictions, 3166
trigger, creating, 934
trigger, dropping, 944
triggers, 22, 1056, 1890, 1893
and INSERT DELAYED, 953
and replication, 1475, 1481
LAST_INSERT_ID(), 1893
metadata, 1895
TRIGGERS
INFORMATION_SCHEMA table, 1923
triggers option
mysqldump, 258
TRIM(), 777
troubleshooting
FreeBSD, 96
Solaris, 96
TRUE, 658, 659
testing for, 763, 763
TRUNCATE, 989
and MySQL Cluster, 1706
and replication, 1482
TRUNCATE(), 794
tupscan option
ndb_select_all, 1612
tutorial, 157
Twin Studies
queries, 182
tx_isolation system variable, 438
type conversions, 760, 761
type option
mysql_convert_table_format, 320
ndb_config, 1599
ndb_show_tables, 1614
types
column, 724
columns, 750
data, 724
date, 749
Date and Time, 733
numeric, 748
of tables, 1084
portability, 751
strings, 741
time, 749
typographical conventions, 2, 1296
TZ environment variable, 152, 2759
tz-utc option
mysqldump, 258
U
UCASE(), 777
UCS-2, 674
UDFs, 1023, 1023
compiling, 2685
defined, 2678
return values, 2685
ulimit, 2751
UMASK environment variable, 152, 2752
UMASK_DIR environment variable, 152, 2753
unary minus (-), 787
unbuffered option
mysql, 226
UNCOMPRESS(), 839
UNCOMPRESSED_LENGTH(), 839
UndoDataBuffer, 1542
UndoIndexBuffer, 1542
UNHEX(), 777
Unicode, 674
Unicode Collation Algorithm, 699
UNINSTALL PLUGIN, 1024
uninstalling plugins, 1024
UNION, 180, 979
Union(), 875
UNIQUE, 897
unique ID, 2417
unique key
constraint, 25
unique keys
and partitioning keys, 1884
unique_checks session variable, 443
unique_subquery join type
optimizer, 567
Unix, 1942, 2028
UNIX_TIMESTAMP(), 809
UNKNOWN
testing for, 763, 763
unloading
tables, 163
UNLOCK TABLES, 998
unnamed views, 985
unpack option
myisamchk, 283
unqualified option
ndb_show_tables, 1614
UNSIGNED, 724, 731
UNTIL, 1082
updatable views, 1904
updatable_views_with_limit system variable, 439
update
Index
3227
thread state, 644
UPDATE, 990
update-state option
myisamchk, 281
UpdateXML(), 827
updating
releases of MySQL, 39
tables, 20
Updating
thread state, 643
updating main table
thread state, 643
updating reference tables
thread state, 643
upgrades
MySQL Cluster, 1580, 1580, 1582
upgrades and downgrades (MySQL Cluster)
compatibility between versions, 1582
upgrading, 114, 114
different architecture, 126
grant tables, 214
to &current-series;, 115
upgrading lock
thread state, 645
upgrading MySQL, 217
UPPER(), 778
uptime, 237
URLs for downloading MySQL, 40
usage option
ndb_config, 1598
USE, 995
use command
mysql, 230
USE INDEX, 977
USE KEY, 977
use-frm option
mysqlcheck, 246
use-manager option
mysql.server, 208
use-mysqld_safe option
mysql.server, 208
use-threads option
mysqlimport, 264
mysqlslap, 274
useHexFormat option
ndb_select_all, 1612
user accounts
creating, 1007
renaming, 1015
USER environment variable, 152, 193
User lock
thread state, 643
user names
and passwords, 515
user option, 192
mysql, 226
mysql.server, 209
mysqlaccess, 292
mysqladmin, 241
mysqlbinlog, 297
mysqlcheck, 246
mysqld, 370
mysqldump, 258
mysqld_multi, 210
mysqld_safe, 206
mysqlhotcopy, 307
mysqlimport, 264
mysqlmanager, 311
mysqlshow, 267
mysqlslap, 274
mysql_convert_table_format, 320
mysql_install_db, 216
mysql_setpermission, 322
mysql_upgrade, 218
user privileges
adding, 516
deleting, 519, 1008
dropping, 519, 1008
user table
sorting, 508
user variables, 670
and replication, 1482
USER(), 845
User-defined functions, 1023, 1023
user-defined functions
adding, 2678, 2679
username option
mysqlmanager, 311
users
adding, 82, 85
deleting, 519, 1008
root, 112
USER_PRIVILEGES
INFORMATION_SCHEMA table, 1917
uses
of MySQL, 562
using multiple disks to start data, 655
using MySQL Cluster programs, 1588
UTC_DATE(), 809
UTC_TIME(), 809
UTC_TIMESTAMP(), 810
UTF-8, 674
utilities
program-development, 188
utility programs, 187
UUID(), 848
UUID_SHORT(), 849
V
valid numbers
examples, 658
VALUES(), 849
VARBINARY data type, 729, 742
VARCHAR
size, 750
VARCHAR data type, 729, 741
VARCHARACTER data type, 729
variables
and replication, 1482
environment, 189
mysqld, 627
server, 371, 1057
status, 452, 1053
system, 371, 443, 1057
user, 670
VARIANCE(), 853
VAR_POP(), 853
VAR_SAMP(), 853
verbose option
Index
3228
myisamchk, 279
myisampack, 286
myisam_ftdump, 276
mysql, 226
mysqladmin, 241
mysqlbinlog, 297
mysqlcheck, 246
mysqld, 370
mysqldump, 258
mysqldumpslow, 304
mysqld_multi, 210
mysqlimport, 264
mysqlshow, 267
mysqlslap, 274
mysql_convert_table_format, 320
mysql_install_db, 216
mysql_upgrade, 218
mysql_waitpid, 322
my_print_defaults, 325
perror, 326
version
choosing, 37
latest, 40
version option
comp_err, 213
myisamchk, 279
myisampack, 287
mysql, 226
mysqlaccess, 292
mysqladmin, 241
mysqlbinlog, 297
mysqlcheck, 246
mysqld, 370
mysqldump, 258
mysqld_multi, 210
mysqlimport, 264
mysqlmanager, 311
mysqlshow, 267
mysqlslap, 274
mysql_config, 324
mysql_convert_table_format, 320
mysql_waitpid, 322
my_print_defaults, 325
ndb_config, 1598
perror, 326
resolveip, 327
resolve_stack_dump, 326
version system variable, 439
VERSION(), 845
version_comment system variable, 439
version_compile_machine system variable, 439
version_compile_os system variable, 439
vertical option
mysql, 226
mysqladmin, 241
Vietnamese, 2722, 2730
view restrictions, 3171
views, 23, 937, 1890, 1902
algorithms, 1903
and replication, 1482
metadata, 1906
updatable, 23, 937, 1904
VIEWS
INFORMATION_SCHEMA table, 1921
Views
limitations, 3173
privileges, 3173
problems, 3173
virtual memory
problems while compiling, 95
Vision, 2023
Visual Objects, 2021
Visual Studio, 99
W
WAIT COMPLETED (START BACKUP command), 1632
wait option
myisamchk, 279
myisampack, 287
mysql, 226
mysqladmin, 241
WAIT STARTED (START BACKUP command), 1632
wait-timeout option
mysqlmanager, 311
waiting for delay_list
thread state, 644
Waiting for event from ndbcluster
thread state, 647
Waiting for first event from ndbcluster
thread state, 648
waiting for handler insert
thread state, 644
waiting for handler lock
thread state, 644
waiting for handler open
thread state, 644
Waiting for INSERT
thread state, 645
Waiting for master to send event
thread state, 646
Waiting for master update
thread state, 645
Waiting for ndbcluster binlog update to reach current position
thread state, 648
Waiting for ndbcluster to start
thread state, 648
Waiting for next activation
thread state, 648
Waiting for scheduler to stop
thread state, 648
Waiting for schema epoch
thread state, 648
Waiting for slave mutex on exit
thread state, 646, 647
Waiting for table
thread state, 643
Waiting for tables
thread state, 643
Waiting for the next event in relay log
thread state, 646
Waiting for the slave SQL thread to free enough relay log space
thread state, 646
Waiting on cond
thread state, 643
Waiting on empty queue
thread state, 648
Waiting to finalize termination
thread state, 645
Waiting to reconnect after a failed binlog dump request
Index
3229
thread state, 646
Waiting to reconnect after a failed master event read
thread state, 646
wait_timeout system variable, 439
warnings command
mysql, 230
warning_count session variable, 443
WEEK(), 810
WEEKDAY(), 811
WEEKOFYEAR(), 811
Well-Known Binary format, 863
Well-Known Text format, 862
WHERE, 573
with SHOW, 1912, 1938
where option
mysqldump, 258
WHILE, 1082
widths
display, 724
Wildcard character (%), 657
Wildcard character (_), 657
wildcards
and LIKE, 618
in account names, 506
in mysql.columns_priv table, 509
in mysql.db table, 509
in mysql.host table, 509
in mysql.procs_priv table, 509
in mysql.tables_priv table, 509
Windows, 1942, 2028
compiling on, 101
open issues, 70
upgrading, 68
versus Unix, 69
windows option
mysql_install_db, 216
with-big-tables option, 86
configure, 92
with-client-ldflags option
configure, 90
with-debug option
configure, 91
with-embedded-server option
configure, 89
with-extra-charsets option
configure, 91
with-unix-socket-path option
configure, 90
with-zlib-dir option
configure, 92
Within(), 877
without-server option, 86
configure, 89
WKB format, 863
WKT format, 862
wrappers
Eiffel, 2662
write access
tmp, 107
write-binlog option
mysqlbinlog, 297
write_buffer_size myisamchk variable, 280
Writing to net
thread state, 644
X
X(), 871
X509/Certificate, 527
XA BEGIN, 1005
XA COMMIT, 1005
XA PREPARE, 1005
XA RECOVER, 1005
XA ROLLBACK, 1005
XA START, 1005
XA transactions, 1004
transaction identifiers, 1005
xid
XA transaction identifier, 1005
xml option
mysql, 226
mysqldump, 258
ndb_config, 1600
XOR
bitwise, 835
logical, 766
Y
Y(), 871
yaSSL, 526, 527
Year 2000 compliance, 740
Year 2000 issues, 740
YEAR data type, 727, 740
YEAR(), 811
YEARWEEK(), 811
Yen sign (Japanese), 2721, 2725
Z
ZEROFILL, 724, 731, 2421
Index
3230
Standard Index
SYMBOLS
= (assignment), Section 8.4, User-Defined Variables
! (logical NOT), Section 11.2.4, Logical Operators
!= (not equal), Section 11.2.3, Comparison Functions and Operators
", Section 8.2, Schema Object Names
#mysql50 identifier prefix, Section 8.2, Schema Object Names, Sec-
tion 8.2.3, Mapping of Identifiers to File Names
%, Section 11.5.1, Arithmetic Operators
% (modulo), Section 11.5.2, Mathematical Functions
% (wildcard character), Section 8.1.1, Strings
& (bitwise AND), Section 11.11.1, Bit Functions
&& (logical AND), Section 11.2.4, Logical Operators
() (parentheses), Section 11.2.1, Operator Precedence
(Control-Z) \Z, Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
* (multiplication), Section 11.5.1, Arithmetic Operators
+ (addition), Section 11.5.1, Arithmetic Operators
- (subtraction), Section 11.5.1, Arithmetic Operators
- (unary minus), Section 11.5.1, Arithmetic Operators
--bind-address option (ndb_mgmd), Description
--character-sets-dir option
MySQL Cluster programs, Section 17.6.23, Options Common to
MySQL Cluster Programs
--config-file option (ndb_mgmd), Description
--configdir option (ndb_mgmd), Description
--connect-string option (MySQL Cluster), Section 17.6.23, Options
Common to MySQL Cluster Programs
--core-file option (MySQL Cluster), Section 17.6.23, Options Common
to MySQL Cluster Programs
--daemon option (ndb_mgmd), Description
--debug option (MySQL Cluster), Section 17.6.23, Options Common to
MySQL Cluster Programs
--execute option (MySQL Cluster), Section 17.6.23, Options Common
to MySQL Cluster Programs
--help option
MySQL Cluster programs, Section 17.6.23, Options Common to
MySQL Cluster Programs
--initial option (ndb_mgmd), Description
--initial option (ndbd), Description
--initial option (ndbmtd), Description
--initial-start option (ndbd), Description
--initial-start option (ndbmtd), Description
--ndb-mgmd-host option (MySQL Cluster), Section 17.6.23, Options
Common to MySQL Cluster Programs
--ndb-nodeid option (MySQL Cluster), Section 17.6.23, Options Com-
mon to MySQL Cluster Programs
--ndb-optimized-node-selection option (MySQL Cluster), Sec-
tion 17.6.23, Options Common to MySQL Cluster Programs
--nodaemon option (ndb_mgmd), Description
--nodaemon option (ndbd), Description
--nodaemon option (ndbmtd), Description
--nostart option (ndbd), Description
--nostart option (ndbmtd), Description
--nowait-nodes option (ndbd), Description
--nowait-nodes option (ndbmtd), Description
--password option, Section 5.5.6.2, End-User Guidelines for Password
Security
--print-full-config option (ndb_mgmd), Description
--reload option (ndb_mgmd), Description
--usage option
MySQL Cluster programs, Section 17.6.23, Options Common to
MySQL Cluster Programs
--version option (MySQL Cluster), Section 17.6.23, Options Common
to MySQL Cluster Programs
--with-raid link errors, Section 2.10.4, Dealing with Problems Compil-
ing MySQL
-? option
MySQL Cluster programs, Section 17.6.23, Options Common to
MySQL Cluster Programs
-P option (ndb_mgmd), Description
-V option (MySQL Cluster), Section 17.6.23, Options Common to
MySQL Cluster Programs
-c option (MySQL Cluster), Section 17.6.23, Options Common to
MySQL Cluster Programs
-c option (ndb_mgmd) (OBSOLETE), Description
-d option (ndb_mgmd), Description
-e option (MySQL Cluster), Section 17.6.23, Options Common to
MySQL Cluster Programs
-f option (ndb_mgmd), Description
-n option (ndbd), Description
-n option (ndbmtd), Description
-p option, Section 5.5.6.2, End-User Guidelines for Password Security
.my.cnf file, Section 5.5.6.2, End-User Guidelines for Password Secur-
ity, Section 4.2.2, Connecting to the MySQL Server, Section 5.4.7,
Causes of Access-Denied Errors, Section 5.6.3, Using Client Pro-
grams in a Multiple-Server Environment, Section 4.2.3.3, Using Op-
tion Files
.mysql_history file, Section 5.5.6.2, End-User Guidelines for Password
Security, Section 4.5.1.1, mysql Options
.pid (process ID) file, Section 6.4.6, Setting Up a Table Maintenance
Schedule
/ (division), Section 11.5.1, Arithmetic Operators
/etc/passwd, Section 5.3.2, Making MySQL Secure Against Attackers,
Section 12.2.8, SELECT Syntax
< (less than), Section 11.2.3, Comparison Functions and Operators
<<, Section 3.6.8, Calculating Visits Per Day
<< (left shift), Section 11.11.1, Bit Functions
<= (less than or equal), Section 11.2.3, Comparison Functions and Op-
erators
<=> (equal to), Section 11.2.3, Comparison Functions and Operators
<> (not equal), Section 11.2.3, Comparison Functions and Operators
<errortext>Table is full</errortext> error
MySQL Cluster, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
= (assignment), Section 8.4, User-Defined Variables
= (equal), Section 11.2.3, Comparison Functions and Operators
> (greater than), Section 11.2.3, Comparison Functions and Operators
>= (greater than or equal), Section 11.2.3, Comparison Functions and
Operators
>> (right shift), Section 11.11.1, Bit Functions
[SQL] (MySQL Cluster), Section 17.3.5.3, MySQL Cluster SQL Node
and API Node Configuration Parameters
[api] (MySQL Cluster), Section 17.3.5.3, MySQL Cluster SQL Node
and API Node Configuration Parameters
[mgm] (MySQL Cluster), Section 17.3.5.2, MySQL Cluster Manage-
ment Node Configuration Parameters
[ndb_mgmd] (MySQL Cluster), Section 17.3.5.2, MySQL Cluster Man-
agement Node Configuration Parameters
[ndbd default] (MySQL Cluster), Section 17.3.5.1, MySQL Cluster
Data Node Configuration Parameters
[ndbd] (MySQL Cluster), Section 17.3.5.1, MySQL Cluster Data Node
Configuration Parameters
\" (double quote), Section 8.1.1, Strings
\' (single quote), Section 8.1.1, Strings
\. (mysql client command), Section 3.5, Using mysql in Batch Mode,
3231
Section 4.5.1.4, Executing SQL Statements from a Text File
\0 (ASCII NUL), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
\N (NULL), Section 12.2.6, LOAD DATA INFILE Syntax
\Z (Control-Z) ASCII 26, Section 8.1.1, Strings, Section 12.2.6,
LOAD DATA INFILE Syntax
\\ (escape), Section 8.1.1, Strings
\b (backspace), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
\n (linefeed), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
\n (newline), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
\r (carriage return), Section 8.1.1, Strings, Section 12.2.6, LOAD
DATA INFILE Syntax
\t (tab), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA IN-
FILE Syntax
^ (bitwise XOR), Section 11.11.1, Bit Functions
_ (wildcard character), Section 8.1.1, Strings
_rowid, Section 12.1.17, CREATE TABLE Syntax
`, Section 8.2, Schema Object Names
| (bitwise OR), Section 11.11.1, Bit Functions
|| (logical OR), Section 11.2.4, Logical Operators
~, Section 11.11.1, Bit Functions
A
ABS(), Section 11.5.2, Mathematical Functions
ACID, Section 1.7.5.2, Transactions and Atomic Operations, Sec-
tion 13.6, The InnoDB Storage Engine
ACLs, Section 5.4, The MySQL Access Privilege System
ACOS(), Section 11.5.2, Mathematical Functions
ADDDATE(), Section 11.6, Date and Time Functions
ADDTIME(), Section 11.6, Date and Time Functions
AES_DECRYPT(), Section 11.11.2, Encryption and Compression
Functions
AES_ENCRYPT(), Section 11.11.2, Encryption and Compression
Functions
ALL, Section 12.2.9.4, Subqueries with ALL, Section 12.2.8, SE-
LECT Syntax
ALL join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
ALLOW_INVALID_DATES SQL mode, Section 5.1.8, Server SQL
Modes
ALTER COLUMN, Section 12.1.7, ALTER TABLE Syntax
ALTER DATABASE, Section 12.1.1, ALTER DATABASE Syntax
ALTER EVENT, Section 12.1.2, ALTER EVENT Syntax
ALTER FUNCTION, Section 12.1.4, ALTER FUNCTION Syntax
ALTER LOGFILE GROUP, Section 12.1.3, ALTER LOGFILE
GROUP Syntax
ALTER PROCEDURE, Section 12.1.5, ALTER PROCEDURE Syntax
ALTER SCHEMA, Section 12.1.1, ALTER DATABASE Syntax
ALTER SERVER, Section 12.1.6, ALTER SERVER Syntax
ALTER TABLE, Section B.1.7.1, Problems with ALTER TABLE,
Section 12.1.7, ALTER TABLE Syntax
ALTER TABLESPACE, Section 12.1.8, ALTER TABLESPACE Syn-
tax
ALTER VIEW, Section 12.1.9, ALTER VIEW Syntax
ANALYZE TABLE, Section 12.5.2.1, ANALYZE TABLE Syntax
and partitioning, Section 18.3.3, Maintenance of Partitions
AND
bitwise, Section 11.11.1, Bit Functions
logical, Section 11.2.4, Logical Operators
ANSI SQL mode, Section 5.1.8, Server SQL Modes
ANSI mode
running, Section 1.7.3, Running MySQL in ANSI Mode
ANSI_QUOTES SQL mode, Section 5.1.8, Server SQL Modes
ANY, Section 12.2.9.3, Subqueries with ANY, IN, and SOME
API node (MySQL Cluster)
defined, Section 17.1.1, MySQL Cluster Core Concepts
API nodes, Section 17.6.1, MySQL Server Usage for MySQL Cluster
APIs, Chapter 21, Connectors and APIs
Perl, Section 21.12, MySQL Perl API
ARCHIVE storage engine, Chapter 13, Storage Engines, Section 13.12,
The ARCHIVE Storage Engine
AS, Section 12.2.8.1, JOIN Syntax, Section 12.2.8, SELECT Syn-
tax
AS/400, Section 2.7, Installing MySQL on i5/OS
ASCII(), Section 11.4, String Functions
ASIN(), Section 11.5.2, Mathematical Functions
ATAN(), Section 11.5.2, Mathematical Functions
ATAN2(), Section 11.5.2, Mathematical Functions
AUTO_INCREMENT, Section 10.2, Numeric Types, Section 3.6.9,
Using AUTO_INCREMENT
and NULL values, Section B.1.5.3, Problems with NULL Values
and replication, Section 16.3.1.1, Replication and
AUTO_INCREMENT
AVG(), Section 11.12.1, GROUP BY (Aggregate) Functions
AVG(DISTINCT), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
ActiveState Perl, Section 2.15.2, Installing ActiveState Perl on Win-
dows
After create
thread state, Section 7.5.6.2, General Thread States
Analyzing
thread state, Section 7.5.6.2, General Thread States
Apache, Section 3.8, Using MySQL with Apache
ArbitrationDelay, Section 17.3.4.7, Defining SQL and Other API
Nodes in a MySQL Cluster, Section 17.3.4.5, Defining a MySQL
Cluster Management Server
ArbitrationRank, Section 17.3.4.7, Defining SQL and Other API Nodes
in a MySQL Cluster, Section 17.3.4.5, Defining a MySQL Cluster
Management Server
ArbitrationTimeout (DEPRECATED), Section 17.3.4.6, Defining
MySQL Cluster Data Nodes
Area(), Section 11.13.5.2.6, MultiPolygon Functions, Sec-
tion 11.13.5.2.5, Polygon Functions
AsBinary(), Section 11.13.5.1, Geometry Format Conversion Func-
tions
AsText(), Section 11.13.5.1, Geometry Format Conversion Functions
abort-slave-event-count option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
aborted clients, Section B.1.2.11, Communication Errors and Aborted
Connections
aborted connection, Section B.1.2.11, Communication Errors and Abor-
ted Connections
access control, Section 5.4.4, Access Control, Stage 1: Connection
Verification
access denied errors, Section B.1.2.1, Access denied
access privileges, Section 5.4, The MySQL Access Privilege System
account names, Section 5.4.3, Specifying Account Names
account privileges
adding, Section 5.5.2, Adding User Accounts
accounts
anonymous user, Section 2.11.3, Securing the Initial MySQL Ac-
counts
root, Section 2.11.3, Securing the Initial MySQL Accounts
add-drop-database option
mysqldump, Description
add-drop-table option
Standard Index
3232
mysqldump, Description
add-locks option
mysqldump, Description
add-user option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
adding
character sets, Section 9.4, Adding a New Character Set
native functions, Section 22.3.3, Adding a New Native Function
new account privileges, Section 5.5.2, Adding User Accounts
new functions, Section 22.3, Adding New Functions to MySQL
new user privileges, Section 5.5.2, Adding User Accounts
new users, Section 2.10.1, Source Installation Overview, Sec-
tion 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
procedures, Section 22.4, Adding New Procedures to MySQL
user-defined functions, Section 22.3.2, Adding a New User-Defined
Function
addition (+), Section 11.5.1, Arithmetic Operators
addtodest option
mysqlhotcopy, Description
administration
server, Section 4.5.2, mysqladmin Client for Administering a
MySQL Server
administration of MySQL Cluster, Section 17.6.5, ndb_mgm The
MySQL Cluster Management Client
administrative programs, Section 4.1, Overview of MySQL Programs
age
calculating, Section 3.3.4.5, Date Calculations
alias, Section B.1.5.4, Problems with Column Aliases
alias names
case sensitivity, Section 8.2.2, Identifier Case Sensitivity
aliases
for expressions, Section 11.12.3, GROUP BY and HAVING with
Hidden Columns
for tables, Section 12.2.8, SELECT Syntax
in GROUP BY clauses, Section 11.12.3, GROUP BY and HAVING
with Hidden Columns
names, Section 8.2, Schema Object Names
on expressions, Section 12.2.8, SELECT Syntax
all-databases option
mysqlcheck, Description
mysqldump, Description
all-in-1 option
mysqlcheck, Description
all-tablespaces option
mysqldump, Description
allocating local table
thread state, Section 7.5.6.3, Delayed-Insert Thread States
allow-keywords option
mysqldump, Description
allow-suspicious-udfs option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
allowold option
mysqlhotcopy, Description
altering
database, Section 12.1.1, ALTER DATABASE Syntax
schema, Section 12.1.1, ALTER DATABASE Syntax
analyze option
myisamchk, Section 4.6.3.4, Other myisamchk Options
mysqlcheck, Description
angel-pid-file option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
anonymous user, Section 5.4.5, Access Control, Stage 2: Request Veri-
fication, Section 5.4.4, Access Control, Stage 1: Connection Verifica-
tion, Section 2.11.3, Securing the Initial MySQL Accounts
ansi option
mysqld, Section 5.1.2, Server Command Options
arbitrator, Section A.10, MySQL 5.1 FAQ MySQL Cluster
argument processing, Section 22.3.2.3, UDF Argument Processing
arithmetic expressions, Section 11.5.1, Arithmetic Operators
arithmetic functions, Section 11.11.1, Bit Functions
attackers
security against, Section 5.3.2, Making MySQL Secure Against At-
tackers
attribute promotion
ndb_restore, Description
replication, Section 16.3.1.4.2, Replication of Columns Having Dif-
ferent Data Types
auto-generate-sql option
mysqlslap, Description
auto-generate-sql-add-autoincrement option
mysqlslap, Description
auto-generate-sql-execute-number option
mysqlslap, Description
auto-generate-sql-guid-primary option
mysqlslap, Description
auto-generate-sql-load-type option
mysqlslap, Description
auto-generate-sql-secondary-indexes option
mysqlslap, Description
auto-generate-sql-unique-query-number option
mysqlslap, Description
auto-generate-sql-unique-write-number option
mysqlslap, Description
auto-generate-sql-write-number option
mysqlslap, Description
auto-rehash option
mysql, Section 4.5.1.1, mysql Options
auto-repair option
mysqlcheck, Description
auto_increment_increment system variable, Section 16.1.3.2,
Replication Master Options and Variables
auto_increment_offset system variable, Section 16.1.3.2, Replication
Master Options and Variables
autoclose option
mysqld_safe, Description
autocommit session variable, Section 5.1.5, Session System Variables
automatic_sp_privileges system variable, Section 5.1.4, Server System
Variables
B
BACKUP TABLE, Section 12.5.2.2, BACKUP TABLE Syntax
BDB storage engine, Chapter 13, Storage Engines
BEGIN, Section 12.4.1, START TRANSACTION, COMMIT, and
ROLLBACK Syntax
XA transactions, Section 12.4.7.1, XA Transaction SQL Syntax
BENCHMARK(), Section 11.11.3, Information Functions
BETWEEN ... AND, Section 11.2.3, Comparison Functions and Oper-
ators
BIGINT data type, Section 10.1.1, Overview of Numeric Types
BIN(), Section 11.4, String Functions
BINARY, Section 11.9, Cast Functions and Operators
BINARY data type, Section 10.4.2, The BINARY and VARBINARY
Types, Section 10.1.3, Overview of String Types
BINLOG, Section 12.5.6.1, BINLOG Syntax
BINLOG statement
Standard Index
3233
mysqlbinlog output, Section 4.6.7.2, mysqlbinlog Row Event
Display
BIT data type, Section 10.1.1, Overview of Numeric Types
BIT_AND(), Section 11.12.1, GROUP BY (Aggregate) Functions
BIT_COUNT, Section 3.6.8, Calculating Visits Per Day
BIT_COUNT(), Section 11.11.1, Bit Functions
BIT_LENGTH(), Section 11.4, String Functions
BIT_OR, Section 3.6.8, Calculating Visits Per Day
BIT_OR(), Section 11.12.1, GROUP BY (Aggregate) Functions
BIT_XOR(), Section 11.12.1, GROUP BY (Aggregate) Functions
BLACKHOLE storage engine, Chapter 13, Storage Engines, Sec-
tion 13.14, The BLACKHOLE Storage Engine
BLOB
inserting binary data, Section 8.1.1, Strings
size, Section 10.5, Data Type Storage Requirements
BLOB columns
default values, Section 10.4.3, The BLOB and TEXT Types
indexing, Section 12.1.17, CREATE TABLE Syntax, Section 7.4.2,
Column Indexes
BLOB data type, Section 10.4.3, The BLOB and TEXT Types, Sec-
tion 10.1.3, Overview of String Types
BOOL data type, Section 10.1.1, Overview of Numeric Types
BOOLEAN data type, Section 10.1.1, Overview of Numeric Types
BackupDataBufferSize, Section 17.7.3.3, Configuration for MySQL
Cluster Backups
BackupDataBufferSize (MySQL Cluster configuration parameter), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
BackupDataDir, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
BackupLogBufferSize, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes, Section 17.7.3.3, Configuration for MySQL Cluster Backups
BackupMaxWriteSize, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes, Section 17.7.3.3, Configuration for MySQL Cluster Backups
BackupMemory, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes, Section 17.7.3.3, Configuration for MySQL Cluster Backups
BackupReportFrequency, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
BackupWriteSize, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes, Section 17.7.3.3, Configuration for MySQL Cluster Backups
BatchByteSize, Section 17.3.4.7, Defining SQL and Other API Nodes
in a MySQL Cluster
BatchSize, Section 17.3.4.7, Defining SQL and Other API Nodes in a
MySQL Cluster
BatchSizePerLocalScan, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
Bazaar tree, Section 2.10.3, Installing from the Development Source
Tree
BdMPolyFromText(), Section 11.13.4.2.1, Creating Geometry Values
Using WKT Functions
BdMPolyFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
BdPolyFromText(), Section 11.13.4.2.1, Creating Geometry Values Us-
ing WKT Functions
BdPolyFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
BerkeleyDB storage engine, Chapter 13, Storage Engines
Binlog Dump
thread command, Section 7.5.6.1, Thread Command Values
BitKeeper tree, Section 2.10.3, Installing from the Development Source
Tree
Block Nested-Loop join algorithm, Section 7.2.10, Nested-Loop Join
Algorithms
Boundary(), Section 11.13.5.2.1, General Geometry Functions
Buffer(), Section 11.13.5.3.2, Spatial Operators
back_log system variable, Section 5.1.4, Server System Variables
backslash
escape character, Section 8.1, Literal Values
backspace (\b), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
backup identifiers
native backup and restore, Section 17.7.3.2, Using The MySQL
Cluster Management Client to Create a Backup
backup option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
myisampack, Description
backup_history_log system variable, Section 5.1.4, Server System Vari-
ables
backup_history_log_file system variable, Section 5.1.4, Server System
Variables
backup_progress_log system variable, Section 5.1.4, Server System
Variables
backup_progress_log_file system variable, Section 5.1.4, Server Sys-
tem Variables
backup_wait_timeout session variable, Section 5.1.5, Session System
Variables
backupdir system variable, Section 5.1.4, Server System Variables
backups, Chapter 6, Backup and Recovery
database, Section 12.5.2.2, BACKUP TABLE Syntax
databases and tables, Section 4.5.4, mysqldump A Database
Backup Program, Section 4.6.9, mysqlhotcopy A Database
Backup Program
in MySQL Cluster, Section 17.7.3.1, MySQL Cluster Backup Con-
cepts, Section 17.6.17, ndb_restore Restore a MySQL
Cluster Backup, Section 17.7.3, Online Backup of MySQL
Cluster, Section 17.7.3.3, Configuration for MySQL Cluster
Backups, Section 17.7.3.2, Using The MySQL Cluster Manage-
ment Client to Create a Backup
backups, troubleshooting
in MySQL Cluster, Section 17.7.3.4, MySQL Cluster Backup
Troubleshooting
base64-output option
mysqlbinlog, Description
basedir option
mysql.server, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
basedir system variable, Section 5.1.4, Server System Variables
batch SQL files, Section 4.5.1, mysql The MySQL Command-Line
Tool
batch mode, Section 3.5, Using mysql in Batch Mode
batch option
mysql, Section 4.5.1.1, mysql Options
benchmark suite, Section 7.1.4, The MySQL Benchmark Suite
benchmarks, Section 7.1.5, Using Your Own Benchmarks
big-tables option
mysqld, Section 5.1.2, Server Command Options
big5, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese,
and Korean Character Sets
big_tables session variable, Section 5.1.5, Session System Variables
binary distributions, Section 2.1.2.4, MySQL Binaries Compiled by
Sun Microsystems, Inc.
installing, Section 2.9, Installing MySQL from tar.gz Packages
on Other Unix-Like Systems
on Linux, Section 2.13.1.2, Linux Binary Distribution Notes
binary log, Section 5.2.4, The Binary Log
event groups, Section 12.6.2.6, SET GLOBAL
SQL_SLAVE_SKIP_COUNTER Syntax
binary logging
and MySQL Cluster, Section 17.12.8, Issues Exclusive to MySQL
Cluster
Standard Index
3234
bind-address option
mysqld, Section 5.1.2, Server Command Options
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
binlog-do-db option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
binlog-format option
mysqld, Section 5.1.2, Server Command Options
binlog-ignore-db option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
binlog-row-event-max-size option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
binlog_cache_size system variable, Section 16.1.3.4, Binary Log Op-
tions and Variables
binlog_format system variable, Section 16.1.3.4, Binary Log Options
and Variables
bit_functions
example, Section 3.6.8, Calculating Visits Per Day
block-search option
myisamchk, Section 4.6.3.4, Other myisamchk Options
boolean options, Section 4.2.3.2, Program Option Modifiers
bootstrap option
mysqld, Section 5.1.2, Server Command Options
brackets
square, Chapter 10, Data Types
brief option
mysqlaccess, Description
buffer sizes
client, Chapter 21, Connectors and APIs
mysqld server, Section 7.5.3, Tuning Server Parameters
bug reports
criteria for, Section 1.6, How to Report Bugs or Problems
bugs
MySQL Cluster
reporting, Section 17.6.12, ndb_error_reporter NDB
Error-Reporting Utility
known, Section B.1.8, Known Issues in MySQL
reporting, Section 1.6, How to Report Bugs or Problems
bugs database, Section 1.6, How to Report Bugs or Problems
bugs.mysql.com, Section 1.6, How to Report Bugs or Problems
building
client programs, Section 21.10.16, Building Client Programs
bulk_insert_buffer_size system variable, Section 5.1.4, Server System
Variables
C
C
\my.cnf file, Section 5.6.3, Using Client Programs in a Multiple-Serv-
er Environment
C API
data types, Section 21.10, MySQL C API
functions, Section 21.10.2, C API Function Overview
linking problems, Section 21.10.10.4, Problems Linking with the C
API
C prepared statement API
functions, Section 21.10.6, C API Prepared Statement Function
Overview
C++ APIs, Section 21.13, MySQL C++ API
C++ compiler
gcc, Section 2.10.2, Typical configure Options
C++ compiler cannot create executables, Section 2.10.4, Dealing with
Problems Compiling MySQL
CACHE INDEX, Section 12.5.6.2, CACHE INDEX Syntax
and partitioning, Section 18.5, Restrictions and Limitations on Parti-
tioning
CALL, Section 12.2.1, CALL Syntax
CASE, Section 11.3, Control Flow Functions
CAST, Section 11.9, Cast Functions and Operators
CC environment variable, Section 2.10.4, Dealing with Problems Com-
piling MySQL, Section 2.10.2, Typical configure Options, Sec-
tion 2.14, Environment Variables
CEIL(), Section 11.5.2, Mathematical Functions
CEILING(), Section 11.5.2, Mathematical Functions
CFLAGS environment variable, Section 2.10.4, Dealing with Problems
Compiling MySQL, Section 2.10.2, Typical configure Options,
Section 2.14, Environment Variables
CHANGE MASTER TO, Section 12.6.2.1, CHANGE MASTER TO
Syntax
CHAR VARYING data type, Section 10.1.3, Overview of String
Types
CHAR data type, Section 10.4, String Types, Section 10.1.3,
Overview of String Types
CHAR(), Section 11.4, String Functions
CHARACTER VARYING data type, Section 10.1.3, Overview of
String Types
CHARACTER data type, Section 10.1.3, Overview of String Types
CHARACTER_LENGTH(), Section 11.4, String Functions
CHARACTER_SETS
INFORMATION_SCHEMA table, Section 20.9, The INFORMA-
TION_SCHEMA CHARACTER_SETS Table
CHARSET(), Section 11.11.3, Information Functions
CHAR_LENGTH(), Section 11.4, String Functions
CHECK TABLE, Section 12.5.2.3, CHECK TABLE Syntax
and partitioning, Section 18.3.3, Maintenance of Partitions
CHECKPOINT Events (MySQL Cluster), Section 17.7.4.2, MySQL
Cluster Log Events
CHECKSUM TABLE, Section 12.5.2.4, CHECKSUM TABLE Syntax
CJK
FAQ, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japan-
ese, and Korean Character Sets
CJK (Chinese, Japanese, Korean)
Access, PHP, etc., Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
CJKV, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japan-
ese, and Korean Character Sets
Database and table names, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
Japanese character sets, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
Korean character set, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
LIKE and FULLTEXT, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
MySQL 4.0 behavior, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
ORDER BY treatment, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
Unicode collations, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
Vietnamese, Section A.11, MySQL 5.1 FAQ MySQL Chinese,
Japanese, and Korean Character Sets
Yen sign, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
availability of specific characters, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
available character sets, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
big5, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japan-
ese, and Korean Character Sets
Standard Index
3235
character sets available, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
characters displayed as question marks, Section A.11, MySQL 5.1
FAQ MySQL Chinese, Japanese, and Korean Character Sets
collations, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
conversion problems with Japanese character sets, Section A.11,
MySQL 5.1 FAQ MySQL Chinese, Japanese, and Korean Char-
acter Sets
data truncation, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
documentation in Chinese, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
documentation in Japanese, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
documentation in Korean, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
gb2312, gbk, Section A.11, MySQL 5.1 FAQ MySQL Chinese,
Japanese, and Korean Character Sets
problems with Access, PHP, etc., Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
problems with Big5 character sets (Chinese), Section A.11, MySQL
5.1 FAQ MySQL Chinese, Japanese, and Korean Character Sets
problems with GB character sets (Chinese), Section A.11, MySQL
5.1 FAQ MySQL Chinese, Japanese, and Korean Character Sets
problems with LIKE and FULLTEXT, Section A.11, MySQL 5.1
FAQ MySQL Chinese, Japanese, and Korean Character Sets
problems with Yen sign (Japanese), Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
problems with data truncation, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
problems with euckr character set (Korean), Section A.11, MySQL
5.1 FAQ MySQL Chinese, Japanese, and Korean Character Sets
rejected characters, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
sort order problems, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
sorting problems, Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
testing availability of characters, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
CLUSTERLOG STATISTICS command (MySQL Cluster), Sec-
tion 17.7.4.3, Using CLUSTERLOG STATISTICS in the MySQL
Cluster Management Client
CLUSTERLOG commands (MySQL Cluster), Section 17.7.4.1,
MySQL Cluster Logging Management Commands
CMake, Section 2.10.6.1, Building MySQL from Source Using CMake
and Visual Studio
COALESCE(), Section 11.2.3, Comparison Functions and Operators
COERCIBILITY(), Section 11.11.3, Information Functions
COLLATION(), Section 11.11.3, Information Functions
COLLATIONS
INFORMATION_SCHEMA table, Section 20.10, The INFORMA-
TION_SCHEMA COLLATIONS Table
COLLATION_CHARACTER_SET_APPLICABILITY
INFORMATION_SCHEMA table, Section 20.11, The INFORMA-
TION_SCHEMA COLLA-
TION_CHARACTER_SET_APPLICABILITY Table
COLUMNS
INFORMATION_SCHEMA table, Section 20.3, The INFORMA-
TION_SCHEMA COLUMNS Table
COLUMN_PRIVILEGES
INFORMATION_SCHEMA table, Section 20.8, The INFORMA-
TION_SCHEMA COLUMN_PRIVILEGES Table
COMMIT, Section 12.4.1, START TRANSACTION, COMMIT, and
ROLLBACK Syntax, Section 1.7.5.2, Transactions and Atomic Opera-
tions
XA transactions, Section 12.4.7.1, XA Transaction SQL Syntax
COMPRESS(), Section 11.11.2, Encryption and Compression Func-
tions
CONCAT(), Section 11.4, String Functions
CONCAT_WS(), Section 11.4, String Functions
CONNECTION Events (MySQL Cluster), Section 17.7.4.2, MySQL
Cluster Log Events
CONNECTION_ID(), Section 11.11.3, Information Functions
CONSTRAINTS
INFORMATION_SCHEMA table, Section 20.12, The INFORMA-
TION_SCHEMA TABLE_CONSTRAINTS Table
CONV(), Section 11.5.2, Mathematical Functions
CONVERT, Section 11.9, Cast Functions and Operators
CONVERT TO, Section 12.1.7, ALTER TABLE Syntax
CONVERT_TZ(), Section 11.6, Date and Time Functions
COS(), Section 11.5.2, Mathematical Functions
COT(), Section 11.5.2, Mathematical Functions
COUNT(), Section 11.12.1, GROUP BY (Aggregate) Functions
COUNT(DISTINCT), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
CRC32(), Section 11.5.2, Mathematical Functions
CREATE DATABASE, Section 12.1.10, CREATE DATABASE Syn-
tax
CREATE EVENT, Section 12.1.11, CREATE EVENT Syntax
CREATE FUNCTION, Section 12.1.15, CREATE PROCEDURE and
CREATE FUNCTION Syntax, Section 12.5.3.1, CREATE FUNC-
TION Syntax
CREATE INDEX, Section 12.1.13, CREATE INDEX Syntax
CREATE LOGFILE GROUP, Section 12.1.14, CREATE LOGFILE
GROUP Syntax
CREATE NODEGROUP command (MySQL Cluster), Section 17.7.2,
Commands in the MySQL Cluster Management Client
CREATE PROCEDURE, Section 12.1.15, CREATE PROCEDURE and
CREATE FUNCTION Syntax
CREATE SCHEMA, Section 12.1.10, CREATE DATABASE Syntax
CREATE SERVER, Section 12.1.16, CREATE SERVER Syntax
CREATE TABLE, Section 12.1.17, CREATE TABLE Syntax
DIRECTORY options
and replication, Section 16.3.1.5, Replication and DIRECTORY
Table Options
CREATE TABLE ... SELECT
and replication, Section 16.3.1.3, Replication of CREATE TABLE
... SELECT Statements
CREATE TABLESPACE, Section 12.1.18, CREATE TABLESPACE
Syntax
CREATE TRIGGER, Section 12.1.19, CREATE TRIGGER Syntax
CREATE USER, Section 12.5.1.1, CREATE USER Syntax
CREATE VIEW, Section 12.1.20, CREATE VIEW Syntax
CROSS JOIN, Section 12.2.8.1, JOIN Syntax
CR_SERVER_GONE_ERROR, Section B.1.2.9, MySQL server
has gone away
CR_SERVER_LOST_ERROR, Section B.1.2.9, MySQL server
has gone away
CSV data, reading, Section 12.2.6, LOAD DATA INFILE Syntax,
Section 12.2.8, SELECT Syntax
CSV storage engine, Section 13.13, The CSV Storage Engine,
Chapter 13, Storage Engines
CURDATE(), Section 11.6, Date and Time Functions
CURRENT_DATE, Section 11.6, Date and Time Functions
CURRENT_TIME, Section 11.6, Date and Time Functions
CURRENT_TIMESTAMP, Section 11.6, Date and Time Functions
CURRENT_USER(), Section 11.11.3, Information Functions
CURTIME(), Section 11.6, Date and Time Functions
Standard Index
3236
CXX environment variable, Section 2.10.4, Dealing with Problems
Compiling MySQL, Section 2.10.2, Typical configure Options,
Section 2.14, Environment Variables
CXXFLAGS environment variable, Section 2.10.4, Dealing with Prob-
lems Compiling MySQL, Section 2.10.2, Typical configure Op-
tions, Section 2.14, Environment Variables
Centroid(), Section 11.13.5.2.6, MultiPolygon Functions
Change user
thread command, Section 7.5.6.1, Thread Command Values
ChangeLog, Appendix C, MySQL Change History
Changing master
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
Character sets, Section 9.1, Character Set Support
Checking master version
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Checking table
thread state, Section 7.5.6.2, General Thread States
Checksum, Section 17.3.4.8, MySQL Cluster TCP/IP Connections
Checksum (MySQL Cluster), Section 17.3.4.10, MySQL Cluster
Shared-Memory Connections, Section 17.3.4.11, SCI Transport Con-
nections in MySQL Cluster
Chinese, Japanese, Korean character sets
frequently asked questions, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
Clearing
thread state, Section 7.5.6.9, Event Scheduler Thread States
Close stmt
thread command, Section 7.5.6.1, Thread Command Values
Clustering, Chapter 17, MySQL Cluster NDB 6.X/7.X
Comment syntax, Section 8.5, Comment Syntax
Committing events to binlog
thread state, Section 7.5.6.8, MySQL Cluster Thread States
CompressedBackup, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
CompressedLCP, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Configuring MySQL Cluster (concepts), Section 17.1.1, MySQL
Cluster Core Concepts
Connect
thread command, Section 7.5.6.1, Thread Command Values
Connect Out
thread command, Section 7.5.6.1, Thread Command Values
Connecting to master
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Connector/C, Chapter 21, Connectors and APIs
Connector/C++, Chapter 21, Connectors and APIs
Connector/JDBC, Chapter 21, Connectors and APIs
Connector/MXJ, Chapter 21, Connectors and APIs
Connector/NET, Chapter 21, Connectors and APIs
Connector/ODBC, Chapter 21, Connectors and APIs, Section 21.1,
MySQL Connector/ODBC
Connector/OpenOffice.org, Chapter 21, Connectors and APIs
Connectors
MySQL, Chapter 21, Connectors and APIs
Contains(), Section 11.13.5.6, Functions That Test Spatial Relation-
ships Between Geometries
ConvexHull(), Section 11.13.5.3.2, Spatial Operators
Copying to group table
thread state, Section 7.5.6.2, General Thread States
Copying to tmp table
thread state, Section 7.5.6.2, General Thread States
Copying to tmp table on disk
thread state, Section 7.5.6.2, General Thread States
Create DB
thread command, Section 7.5.6.1, Thread Command Values
Creating delayed handler
thread state, Section 7.5.6.3, Delayed-Insert Thread States
Creating index
thread state, Section 7.5.6.2, General Thread States
Creating sort index
thread state, Section 7.5.6.2, General Thread States
Creating table from master dump
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
Creating tmp table
thread state, Section 7.5.6.2, General Thread States
Crosses(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
caches
clearing, Section 12.5.6.3, FLUSH Syntax
calculating
dates, Section 3.3.4.5, Date Calculations
calendar, Section 11.7, What Calendar Is Used By MySQL?
calling sequences for aggregate functions
UDF, Section 22.3.2.2, UDF Calling Sequences for Aggregate
Functions
calling sequences for simple functions
UDF, Section 22.3.2.1, UDF Calling Sequences for Simple Func-
tions
can't create/write to file, Section B.1.2.13, Can't create/write
to file
carriage return (\r), Section 8.1.1, Strings, Section 12.2.6, LOAD
DATA INFILE Syntax
case sensitivity
in access checking, Section 5.4.2, Privilege System Grant Tables
in identifiers, Section 8.2.2, Identifier Case Sensitivity
in names, Section 8.2.2, Identifier Case Sensitivity
in searches, Section B.1.5.1, Case Sensitivity in String Searches
in string comparisons, Section 11.4.1, String Comparison Func-
tions
case-sensitivity
of database names, Section 1.7.4, MySQL Extensions to Standard
SQL
of table names, Section 1.7.4, MySQL Extensions to Standard SQL
cast functions, Section 11.9, Cast Functions and Operators
cast operators, Section 11.9, Cast Functions and Operators
casts, Section 11.9, Cast Functions and Operators, Section 11.2.3,
Comparison Functions and Operators, Section 11.2.2, Type Conver-
sion in Expression Evaluation
cc1plus problems, Section 2.10.4, Dealing with Problems Compiling
MySQL
cflags option
mysql_config, Description
changes
Cluster, Changes in MySQL Cluster
InnoDB, Changes in InnoDB
log, Appendix C, MySQL Change History
changes to privileges, Section 5.4.6, When Privilege Changes Take Ef-
fect
changing
column, Section 12.1.7, ALTER TABLE Syntax
column order, Section B.1.7.2, How to Change the Order of
Columns in a Table
field, Section 12.1.7, ALTER TABLE Syntax
table, Section B.1.7.1, Problems with ALTER TABLE, Sec-
tion 12.1.7, ALTER TABLE Syntax
changing socket location, Section 2.11.2.2, Starting and Stopping
MySQL Automatically, Section 2.10.2, Typical configure Op-
tions, Section B.1.4.5, How to Protect or Change the MySQL Unix
Standard Index
3237
Socket File
character sets, Section 2.10.2, Typical configure Options, Sec-
tion 9.2, The Character Set Used for Data and Sorting
adding, Section 9.4, Adding a New Character Set
and replication, Section 16.3.1.2, Replication and Character Sets
character-set-client-handshake option
mysqld, Section 5.1.2, Server Command Options
character-set-filesystem option
mysqld, Section 5.1.2, Server Command Options
character-set-server option
mysqld, Section 5.1.2, Server Command Options
character-sets-dir option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
character_set_client system variable, Section 5.1.4, Server System
Variables
character_set_connection system variable, Section 5.1.4, Server System
Variables
character_set_database system variable, Section 5.1.4, Server System
Variables
character_set_filesystem system variable, Section 5.1.4, Server System
Variables
character_set_results system variable, Section 5.1.4, Server System
Variables
character_set_server system variable, Section 5.1.4, Server System
Variables
character_set_system system variable, Section 5.1.4, Server System
Variables
character_sets_dir system variable, Section 5.1.4, Server System Vari-
ables
characters
multi-byte, Section 9.4.3, Multi-Byte Character Support
charset command
mysql, Section 4.5.1.2, mysql Commands
charset option
comp_err, Description
check option
myisamchk, Section 4.6.3.2, myisamchk Check Options
mysqlcheck, Description
check options
myisamchk, Section 4.6.3.2, myisamchk Check Options
check-only-changed option
myisamchk, Section 4.6.3.2, myisamchk Check Options
mysqlcheck, Description
check-password-file option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
check-upgrade option
mysqlcheck, Description
checking
tables for errors, Section 6.4.2, How to Check MyISAM Tables for
Errors
checking permissions
thread state, Section 7.5.6.2, General Thread States
checkpoint option
mysqlhotcopy, Description
checksum errors, Section 2.13.3, Solaris Notes
choosing
a MySQL version, Section 2.1.2, Choosing Which MySQL Distribu-
tion to Install
choosing types, Section 10.6, Choosing the Right Type for a Column
chroot option
mysqld, Section 5.1.2, Server Command Options
mysqlhotcopy, Description
clean-password-file option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
cleaning up
thread state, Section 7.5.6.2, General Thread States
clear command
mysql, Section 4.5.1.2, mysql Commands
clearing
caches, Section 12.5.6.3, FLUSH Syntax
client connection threads, Section 7.5.7, How MySQL Uses Threads for
Client Connections
client programs, Section 4.1, Overview of MySQL Programs
building, Section 21.10.16, Building Client Programs
client tools, Chapter 21, Connectors and APIs
clients
debugging, Section 22.5.2, Debugging a MySQL Client
threaded, Section 21.10.17, How to Make a Threaded Client
closing
tables, Section 7.4.7, How MySQL Opens and Closes Tables
closing tables
thread state, Section 7.5.6.2, General Thread States
cluster logs, Section 17.7.4.1, MySQL Cluster Logging Management
Commands, Section 17.7.4, Event Reports Generated in MySQL
Cluster
clustered index
InnoDB, Section 13.6.10.1, Clustered and Secondary Indexes
collating
strings, Section 9.4.2, String Collating Support
collation
adding, Section 9.5, How to Add a New Collation to a Character
Set
collation-server option
mysqld, Section 5.1.2, Server Command Options
collation_connection system variable, Section 5.1.4, Server System
Variables
collation_database system variable, Section 5.1.4, Server System Vari-
ables
collation_server system variable, Section 5.1.4, Server System Vari-
ables
column
changing, Section 12.1.7, ALTER TABLE Syntax
types, Chapter 10, Data Types
column comments, Section 12.1.17, CREATE TABLE Syntax
column format, Section 12.1.17, CREATE TABLE Syntax
column names
case sensitivity, Section 8.2.2, Identifier Case Sensitivity
column storage, Section 12.1.17, CREATE TABLE Syntax
column-names option
mysql, Section 4.5.1.1, mysql Options
column-type-info option
mysql, Section 4.5.1.1, mysql Options
columns
changing, Section B.1.7.2, How to Change the Order of Columns in
a Table
displaying, Section 4.5.6, mysqlshow Display Database, Table,
and Column Information
indexes, Section 7.4.2, Column Indexes
names, Section 8.2, Schema Object Names
Standard Index
3238
other types, Section 10.7, Using Data Types from Other Database
Engines
selecting, Section 3.3.4.3, Selecting Particular Columns
storage requirements, Section 10.5, Data Type Storage Require-
ments
columns option
mysqlimport, Description
comma-separated values data, reading, Section 12.2.6, LOAD DATA
INFILE Syntax, Section 12.2.8, SELECT Syntax
command options
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqld, Section 5.1.2, Server Command Options
command options (MySQL Cluster)
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndb_mgm, Description, Section 17.6.24.4, Program Options for
ndb_mgm
ndb_mgmd, Description, Section 17.6.24.3, Program Options for
ndb_mgmd
ndbd, Section 17.6.24.2, Program Options for ndbd and ndbmtd,
Description
command syntax, Section 1.2, Typographical and Syntax Conventions
command-line history
mysql, Section 4.5.1.1, mysql Options
command-line options (MySQL Cluster), Section 17.6.23, Options
Common to MySQL Cluster Programs
command-line tool, Section 4.5.1, mysql The MySQL Command-
Line Tool
commands
for binary distribution, Section 2.9, Installing MySQL from
tar.gz Packages on Other Unix-Like Systems
commands out of sync, Section B.1.2.14, Commands out of
sync
comments
adding, Section 8.5, Comment Syntax
starting, Section 1.7.5.6, '--' as the Start of a Comment
comments option
mysql, Section 4.5.1.1, mysql Options
mysqldump, Description
commit option
mysqlaccess, Description
mysqlslap, Description
comp_err, Section 4.4.1, comp_err Compile MySQL Error Mes-
sage File, Section 4.1, Overview of MySQL Programs
charset option, Description
debug option, Description
debug-info option, Description
header_file option, Description
help option, Description
in_file option, Description
name_file option, Description
out_dir option, Description
out_file option, Description
statefile option, Description
version option, Description
compact option
mysqldump, Description
comparison operators, Section 11.2.3, Comparison Functions and Oper-
ators
compatibility
between MySQL versions, Section 2.12.1.1, Upgrading from
MySQL 5.0 to 5.1
with ODBC, Section 12.1.17, CREATE TABLE Syntax, Sec-
tion 8.2.1, Identifier Qualifiers, Section 10.1.1, Overview of Nu-
meric Types, Section 11.2.3, Comparison Functions and Operat-
ors, Section 11.2.2, Type Conversion in Expression Evaluation,
Section 12.2.8.1, JOIN Syntax
with Oracle, Section 11.12.1, GROUP BY (Aggregate) Functions,
Section 12.3.1, DESCRIBE Syntax, Section 1.7.4, MySQL Exten-
sions to Standard SQL
with PostgreSQL, Section 1.7.4, MySQL Extensions to Standard
SQL
with Sybase, Section 12.3.4, USE Syntax
with mSQL, Section 11.4.2, Regular Expressions
with standard SQL, Section 1.7, MySQL Standards Compliance
compatible option
mysqldump, Description
compiler
C++ gcc, Section 2.10.2, Typical configure Options
compiling
on Windows, Section 2.10.7, Compiling MySQL Clients on Win-
dows
optimizing, Section 7.5.2, System Factors and Startup Parameter
Tuning
problems, Section 2.10.4, Dealing with Problems Compiling
MySQL
speed, Section 7.5.1, How Compiling and Linking Affects the Speed
of MySQL
statically, Section 2.10.2, Typical configure Options
user-defined functions, Section 22.3.2.5, Compiling and Installing
User-Defined Functions
complete-insert option
mysqldump, Description
completion_type system variable, Section 5.1.4, Server System Vari-
ables
compliance
Y2K, Section 10.3.4, Year 2000 Issues and Date Types
composite partitioning, Section 18.2.5, Subpartitioning
compress option
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlcheck, Description
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
compressed tables, Section 4.6.5, myisampack Generate Com-
pressed, Read-Only MyISAM Tables, Section 13.5.3.3, Compressed
Table Characteristics
concatenation
string, Section 8.1.1, Strings, Section 11.4, String Functions
concurrency option
mysqlslap, Description
concurrent inserts, Section 7.3.1, Internal Locking Methods, Sec-
tion 7.3.3, Concurrent Inserts
concurrent_insert system variable, Section 5.1.4, Server System Vari-
ables
config-file option
my_print_defaults, Description
mysqld_multi, Description
ndb_config, Description
config.cache, Section 2.10.4, Dealing with Problems Compiling
MySQL
config.cache file, Section 2.10.4, Dealing with Problems Compiling
MySQL
config.ini (MySQL Cluster), Section 17.2.3, MySQL Cluster Multi-
Computer Configuration, Description, Section 17.3.4.1, MySQL
Cluster Configuration Basic Example, Section 17.3.4, MySQL
Cluster Configuration Files
Standard Index
3239
configinfo option
ndb_config, Description
configuration
MySQL Cluster, Section 17.3.5, Overview of MySQL Cluster Con-
figuration Parameters
configuration files, Section 5.4.7, Causes of Access-Denied Errors
configuration options, Section 2.10.2, Typical configure Options
configure
disable-grant-options option, Section 2.10.2, Typical configure
Options
enable-community-features option, Section 2.10.2, Typical con-
figure Options
enable-debug-sync option, Section 2.10.2, Typical configure
Options
enable-dtrace option, Section 2.10.2, Typical configure Options
enable-profiling option, Section 2.10.2, Typical configure Op-
tions
enable-thread-safe-client option, Section 2.10.2, Typical config-
ure Options
localstatedir option, Section 2.10.2, Typical configure Options
prefix option, Section 2.10.2, Typical configure Options
running after prior invocation, Section 2.10.4, Dealing with Prob-
lems Compiling MySQL
with-big-tables option, Section 2.10.2, Typical configure Op-
tions
with-charset option, Section 2.10.2, Typical configure Options
with-client-ldflags option, Section 2.10.2, Typical configure Op-
tions
with-collation option, Section 2.10.2, Typical configure Op-
tions
with-debug option, Section 2.10.2, Typical configure Options
with-embedded-server option, Section 2.10.2, Typical configure
Options
with-extra-charsets option, Section 2.10.2, Typical configure
Options
with-libevent option, Section 2.10.2, Typical configure Options
with-unix-socket-path option, Section 2.10.2, Typical configure
Options
with-zlib-dir option, Section 2.10.2, Typical configure Options
without-server option, Section 2.10.2, Typical configure Op-
tions
configure option
--with-low-memory, Section 2.10.4, Dealing with Problems Compil-
ing MySQL
configure script, Section 2.10.2, Typical configure Options
configuring MySQL Cluster, Description, Section 17.2, MySQL
Cluster Multi-Computer How-To, Section 17.6.1, MySQL Server Us-
age for MySQL Cluster, Section 17.3, MySQL Cluster Configuration
configuring backups
in MySQL Cluster, Section 17.7.3.3, Configuration for MySQL
Cluster Backups
connect command
mysql, Section 4.5.1.2, mysql Commands
connect_timeout system variable, Section 5.1.4, Server System Vari-
ables
connect_timeout variable, Description, Section 4.5.1.1, mysql Op-
tions
connecting
remotely with SSH, Section 5.5.8, Connecting to MySQL Remotely
from Windows with SSH
to the server, Section 3.1, Connecting to and Disconnecting from the
Server, Section 4.2.2, Connecting to the MySQL Server
verification, Section 5.4.4, Access Control, Stage 1: Connection
Verification
connection
aborted, Section B.1.2.11, Communication Errors and Aborted Con-
nections
connectstring, Section 17.3.4.3, The MySQL Cluster Connectstring
console option
mysqld, Section 5.1.2, Server Command Options
const table
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN, Sec-
tion 12.2.8, SELECT Syntax
constant table, Section 7.2.4, WHERE Clause Optimization
constraints, Section 1.7.6, How MySQL Deals with Constraints
control flow functions, Section 11.3, Control Flow Functions
conventions
syntax, Section 1.2, Typographical and Syntax Conventions
typographical, Section 1.2, Typographical and Syntax Conventions
converting HEAP to MyISAM
thread state, Section 7.5.6.2, General Thread States
copy option
mysqlaccess, Description
copy to tmp table
thread state, Section 7.5.6.2, General Thread States
copying databases, Section 2.12.5, Copying MySQL Databases to An-
other Machine
copying tables, Section 12.1.17, CREATE TABLE Syntax
core-file option
mysqld, Section 5.1.2, Server Command Options
core-file-size option
mysqld_safe, Description
correct-checksum option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
correlated subqueries, Section 12.2.9.7, Correlated Subqueries
count option
myisam_ftdump, Description
mysqladmin, Description
mysqlshow, Description
counting
table rows, Section 3.3.4.8, Counting Rows
crash, Section 22.5.1, Debugging a MySQL Server
recovery, Section 6.4.1, Using myisamchk for Crash Recovery
repeated, Section B.1.4.2, What to Do If MySQL Keeps Crashing
replication, Section 16.3.1.14, Replication During a Master Crash
crash-me, Section 7.1.4, The MySQL Benchmark Suite
crash-me program, Section 7.1.4, The MySQL Benchmark Suite, Sec-
tion 7.1.2, Designing Applications for Portability
create option
mysqlslap, Description
create-options option
mysqldump, Description
create-schema option
mysqlslap, Description
creating
bug reports, Section 1.6, How to Report Bugs or Problems
database, Section 12.1.10, CREATE DATABASE Syntax
databases, Section 3.3, Creating and Using a Database
default startup options, Section 4.2.3.3, Using Option Files
function, Section 12.5.3.1, CREATE FUNCTION Syntax
schema, Section 12.1.10, CREATE DATABASE Syntax
tables, Section 3.3.2, Creating a Table
creating table
thread state, Section 7.5.6.2, General Thread States
creating user accounts, Section 12.5.1.1, CREATE USER Syntax
csv option
mysqlslap, Description
customers
of MySQL, Section 7.1.3, What We Have Used MySQL For
Standard Index
3240
D
DATA DIRECTORY
and replication, Section 16.3.1.5, Replication and DIRECTORY Ta-
ble Options
DATABASE(), Section 11.11.3, Information Functions
DATE, Section B.1.5.2, Problems Using DATE Columns
DATE columns
problems, Section B.1.5.2, Problems Using DATE Columns
DATE data type, Section 10.1.2, Overview of Date and Time Types,
Section 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
DATE(), Section 11.6, Date and Time Functions
DATEDIFF(), Section 11.6, Date and Time Functions
DATETIME data type, Section 10.1.2, Overview of Date and Time
Types, Section 10.3.1, The DATETIME, DATE, and TIMESTAMP
Types
DATE_ADD(), Section 11.6, Date and Time Functions
DATE_FORMAT(), Section 11.6, Date and Time Functions
DATE_SUB(), Section 11.6, Date and Time Functions
DAY(), Section 11.6, Date and Time Functions
DAYNAME(), Section 11.6, Date and Time Functions
DAYOFMONTH(), Section 11.6, Date and Time Functions
DAYOFWEEK(), Section 11.6, Date and Time Functions
DAYOFYEAR(), Section 11.6, Date and Time Functions
DB2 SQL mode, Section 5.1.8, Server SQL Modes
DBI interface, Section 21.12, MySQL Perl API
DBI->quote, Section 8.1.1, Strings
DBI->trace, Section 22.5.1.4, Debugging mysqld under gdb
DBI/DBD interface, Section 21.12, MySQL Perl API
DBI_TRACE environment variable, Section 22.5.1.4, Debugging
mysqld under gdb, Section 2.14, Environment Variables
DBI_USER environment variable, Section 2.14, Environment Vari-
ables
DBUG package, Section 22.5.3, The DBUG Package
DEALLOCATE PREPARE, Section 12.7, SQL Syntax for Prepared
Statements, Section 12.7.3, DEALLOCATE PREPARE Syntax
DEC data type, Section 10.1.1, Overview of Numeric Types
DECIMAL data type, Section 10.1.1, Overview of Numeric Types
DECODE(), Section 11.11.2, Encryption and Compression Functions
DEFAULT
constraint, Section 1.7.6.2, Constraints on Invalid Data
DEFAULT value clause, Section 12.1.17, CREATE TABLE Syntax,
Section 10.1.4, Data Type Default Values
DEFAULT(), Section 11.11.4, Miscellaneous Functions
DEGREES(), Section 11.5.2, Mathematical Functions
DELAYED, Section 12.2.5.2, INSERT DELAYED Syntax
when ignored, Section 12.2.5, INSERT Syntax
DELETE, Section 12.2.2, DELETE Syntax
and MySQL Cluster, Section 17.12.2, Limits and Differences of
MySQL Cluster from Standard MySQL Limits
DESC, Section 12.3.1, DESCRIBE Syntax
DESCRIBE, Section 3.4, Getting Information About Databases and
Tables, Section 12.3.1, DESCRIBE Syntax
DES_DECRYPT(), Section 11.11.2, Encryption and Compression
Functions
DES_ENCRYPT(), Section 11.11.2, Encryption and Compression
Functions
DISCARD TABLESPACE, Section 12.1.7, ALTER TABLE Syntax,
Section 13.6.2.1, Using Per-Table Tablespaces
DISTINCT, Section 7.2.15, DISTINCT Optimization, Section 3.3.4.3,
Selecting Particular Columns, Section 12.2.8, SELECT Syntax
AVG(), Section 11.12.1, GROUP BY (Aggregate) Functions
COUNT(), Section 11.12.1, GROUP BY (Aggregate) Functions
MAX(), Section 11.12.1, GROUP BY (Aggregate) Functions
MIN(), Section 11.12.1, GROUP BY (Aggregate) Functions
SUM(), Section 11.12.1, GROUP BY (Aggregate) Functions
DISTINCTROW, Section 12.2.8, SELECT Syntax
DIV, Section 11.5.1, Arithmetic Operators
DNS, Section 7.5.11, How MySQL Uses DNS
DO, Section 12.2.3, DO Syntax
DOUBLE PRECISION data type, Section 10.1.1, Overview of Numeric
Types
DOUBLE data type, Section 10.1.1, Overview of Numeric Types
DRBD, Section A.14.1, Distributed Replicated Block Device (DRBD)
DRBD license, Section A.14.1, Distributed Replicated Block Device
(DRBD)
DROP ... IF EXISTS
and replication, Section 16.3.1.6, Replication of DROP ... IF
EXISTS Statements
DROP DATABASE, Section 12.1.21, DROP DATABASE Syntax
DROP EVENT, Section 12.1.22, DROP EVENT Syntax
DROP FOREIGN KEY, Section 13.6.4.4, FOREIGN KEY Con-
straints, Section 12.1.7, ALTER TABLE Syntax
DROP FUNCTION, Section 12.1.26, DROP PROCEDURE and DROP
FUNCTION Syntax, Section 12.5.3.2, DROP FUNCTION Syntax
DROP INDEX, Section 12.1.7, ALTER TABLE Syntax, Sec-
tion 12.1.24, DROP INDEX Syntax
DROP LOGFILE GROUP, Section 12.1.25, DROP LOGFILE GROUP
Syntax
DROP NODEGROUP command (MySQL Cluster), Section 17.7.2,
Commands in the MySQL Cluster Management Client
DROP PREPARE, Section 12.7.3, DEALLOCATE PREPARE Syntax
DROP PRIMARY KEY, Section 12.1.7, ALTER TABLE Syntax
DROP PROCEDURE, Section 12.1.26, DROP PROCEDURE and DROP
FUNCTION Syntax
DROP SCHEMA, Section 12.1.21, DROP DATABASE Syntax
DROP SERVER, Section 12.1.27, DROP SERVER Syntax
DROP TABLE, Section 12.1.28, DROP TABLE Syntax
and MySQL Cluster, Section 17.12.2, Limits and Differences of
MySQL Cluster from Standard MySQL Limits
DROP TABLESPACE, Section 12.1.29, DROP TABLESPACE Syn-
tax
DROP TRIGGER, Section 12.1.30, DROP TRIGGER Syntax
DROP USER, Section 12.5.1.2, DROP USER Syntax
DROP VIEW, Section 12.1.31, DROP VIEW Syntax
DUAL, Section 12.2.8, SELECT Syntax
DUMPFILE, Section 12.2.8, SELECT Syntax
Daemon
thread command, Section 7.5.6.1, Thread Command Values
Data truncation with CJK characters, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
DataDir, Section 17.3.4.6, Defining MySQL Cluster Data Nodes, Sec-
tion 17.3.4.5, Defining a MySQL Cluster Management Server
DataMemory, Section 17.3.4.6, Defining MySQL Cluster Data Nodes,
Section 17.3.6, Configuring MySQL Cluster Parameters for Local
Checkpoints
Database information
obtaining, Section 12.5.5, SHOW Syntax
Date and Time types, Section 10.3, Date and Time Types
Debug
thread command, Section 7.5.6.1, Thread Command Values
Delayed insert
thread command, Section 7.5.6.1, Thread Command Values
Difference(), Section 11.13.5.3.2, Spatial Operators
Dimension(), Section 11.13.5.2.1, General Geometry Functions
Disjoint(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
DiskCheckpointSpeed, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Standard Index
3241
DiskCheckpointSpeedInRestart, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
DiskIOThreadPool, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
DiskPageBufferMemory, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
DiskSyncSize, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Diskless, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Distance(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
DocBook XML
documentation source format, Section 1.1, About This Manual
Documentation
in Chinese, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
in Japanese, Section A.11, MySQL 5.1 FAQ MySQL Chinese,
Japanese, and Korean Character Sets
in Korean, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
Drop DB
thread command, Section 7.5.6.1, Thread Command Values
data
character sets, Section 9.2, The Character Set Used for Data and
Sorting
importing, Section 4.5.5, mysqlimport A Data Import Pro-
gram, Section 4.5.1.4, Executing SQL Statements from a Text File
loading into tables, Section 3.3.3, Loading Data into a Table
retrieving, Section 3.3.4, Retrieving Information from a Table
size, Section 7.4.1, Make Your Data as Small as Possible
data node (MySQL Cluster)
defined, Section 17.1.1, MySQL Cluster Core Concepts
data nodes (MySQL Cluster), Section 17.6.2, ndbd The MySQL
Cluster Data Node Daemon, Section 17.6.3, ndbmtd The MySQL
Cluster Data Node Daemon (Multi-Threaded)
data type
BIGINT, Section 10.1.1, Overview of Numeric Types
BINARY, Section 10.4.2, The BINARY and VARBINARY Types,
Section 10.1.3, Overview of String Types
BIT, Section 10.1.1, Overview of Numeric Types
BLOB, Section 10.4.3, The BLOB and TEXT Types, Sec-
tion 10.1.3, Overview of String Types
BOOL, Section 10.1.1, Overview of Numeric Types, Section 10.7,
Using Data Types from Other Database Engines
BOOLEAN, Section 10.1.1, Overview of Numeric Types, Sec-
tion 10.7, Using Data Types from Other Database Engines
CHAR, Section 10.4, String Types, Section 10.1.3, Overview of
String Types
CHAR VARYING, Section 10.1.3, Overview of String Types
CHARACTER, Section 10.1.3, Overview of String Types
CHARACTER VARYING, Section 10.1.3, Overview of String
Types
DATE, Section 10.1.2, Overview of Date and Time Types, Sec-
tion 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
DATETIME, Section 10.1.2, Overview of Date and Time Types,
Section 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
DEC, Section 10.1.1, Overview of Numeric Types
DECIMAL, Section 10.1.1, Overview of Numeric Types
DOUBLE, Section 10.1.1, Overview of Numeric Types
DOUBLE PRECISION, Section 10.1.1, Overview of Numeric
Types
ENUM, Section 10.4.4, The ENUM Type, Section 10.1.3,
Overview of String Types
FIXED, Section 10.1.1, Overview of Numeric Types
FLOAT, Section 10.1.1, Overview of Numeric Types
GEOMETRY, Section 11.13.4.1, MySQL Spatial Data Types
GEOMETRYCOLLECTION, Section 11.13.4.1, MySQL Spatial
Data Types
INT, Section 10.1.1, Overview of Numeric Types
INTEGER, Section 10.1.1, Overview of Numeric Types
LINESTRING, Section 11.13.4.1, MySQL Spatial Data Types
LONG, Section 10.4.3, The BLOB and TEXT Types
LONGBLOB, Section 10.1.3, Overview of String Types
LONGTEXT, Section 10.1.3, Overview of String Types
MEDIUMBLOB, Section 10.1.3, Overview of String Types
MEDIUMINT, Section 10.1.1, Overview of Numeric Types
MEDIUMTEXT, Section 10.1.3, Overview of String Types
MULTILINESTRING, Section 11.13.4.1, MySQL Spatial Data
Types
MULTIPOINT, Section 11.13.4.1, MySQL Spatial Data Types
MULTIPOLYGON, Section 11.13.4.1, MySQL Spatial Data Types
NATIONAL CHAR, Section 10.1.3, Overview of String Types
NATIONAL VARCHAR, Section 10.1.3, Overview of String
Types
NCHAR, Section 10.1.3, Overview of String Types
NUMERIC, Section 10.1.1, Overview of Numeric Types
NVARCHAR, Section 10.1.3, Overview of String Types
POINT, Section 11.13.4.1, MySQL Spatial Data Types
POLYGON, Section 11.13.4.1, MySQL Spatial Data Types
REAL, Section 10.1.1, Overview of Numeric Types
SET, Section 10.1.3, Overview of String Types, Section 10.4.5,
The SET Type
SMALLINT, Section 10.1.1, Overview of Numeric Types
TEXT, Section 10.4.3, The BLOB and TEXT Types, Section 10.1.3,
Overview of String Types
TIME, Section 10.1.2, Overview of Date and Time Types, Sec-
tion 10.3.2, The TIME Type
TIMESTAMP, Section 10.1.2, Overview of Date and Time Types,
Section 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
TINYBLOB, Section 10.1.3, Overview of String Types
TINYINT, Section 10.1.1, Overview of Numeric Types
TINYTEXT, Section 10.1.3, Overview of String Types
VARBINARY, Section 10.4.2, The BINARY and VARBINARY
Types, Section 10.1.3, Overview of String Types
VARCHAR, Section 10.4, String Types, Section 10.1.3,
Overview of String Types
VARCHARACTER, Section 10.1.3, Overview of String Types
YEAR, Section 10.1.2, Overview of Date and Time Types, Sec-
tion 10.3.3, The YEAR Type
data types, Chapter 10, Data Types
C API, Section 21.10, MySQL C API
overview, Section 10.1, Data Type Overview
data-file-length option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
database
altering, Section 12.1.1, ALTER DATABASE Syntax
creating, Section 12.1.10, CREATE DATABASE Syntax
deleting, Section 12.1.21, DROP DATABASE Syntax
database metadata, Chapter 20, INFORMATION_SCHEMA Tables
database names
case sensitivity, Section 8.2.2, Identifier Case Sensitivity
case-sensitivity, Section 1.7.4, MySQL Extensions to Standard
SQL
database option
mysql, Section 4.5.1.1, mysql Options
mysqlbinlog, Description
databases
backups, Chapter 6, Backup and Recovery
copying, Section 2.12.5, Copying MySQL Databases to Another
Machine
creating, Section 3.3, Creating and Using a Database
Standard Index
3242
displaying, Section 4.5.6, mysqlshow Display Database, Table,
and Column Information
dumping, Section 4.5.4, mysqldump A Database Backup Pro-
gram, Section 4.6.9, mysqlhotcopy A Database Backup Pro-
gram
information about, Section 3.4, Getting Information About Data-
bases and Tables
names, Section 8.2, Schema Object Names
replicating, Chapter 16, Replication
selecting, Section 3.3.1, Creating and Selecting a Database
symbolic links, Section 7.6.1.1, Using Symbolic Links for Data-
bases on Unix
using, Section 3.3, Creating and Using a Database
databases option
mysqlcheck, Description
mysqldump, Description
datadir option
mysql.server, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
datadir system variable, Section 5.1.4, Server System Variables
date and time functions, Section 11.6, Date and Time Functions
date calculations, Section 3.3.4.5, Date Calculations
date functions
Y2K compliance, Section 10.3.4, Year 2000 Issues and Date Types
date types, Section 10.5, Data Type Storage Requirements
Y2K issues, Section 10.3.4, Year 2000 Issues and Date Types
date values
problems, Section 10.3.1, The DATETIME, DATE, and
TIMESTAMP Types
date_format system variable, Section 5.1.4, Server System Variables
dates
used with partitioning, Section 18.2, Partition Types
used with partitioning (examples), Section 18.2.1, RANGE Partition-
ing, Section 18.2.5, Subpartitioning, Section 18.4, Partition Prun-
ing, Section 18.2.3, HASH Partitioning
datetime_format system variable, Section 5.1.4, Server System Vari-
ables
db option
mysqlaccess, Description
db table
sorting, Section 5.4.5, Access Control, Stage 2: Request Verifica-
tion
debug option
comp_err, Description
make_win_bin_dist, Description
my_print_defaults, Description
myisamchk, Section 4.6.3.1, myisamchk General Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqlaccess, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqldump, Description
mysqldumpslow, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
debug system variable, Section 5.1.4, Server System Variables
debug-check option
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
debug-info option
comp_err, Description
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
debug-sync-timeout option
mysqld, Section 5.1.2, Server Command Options
debug_sync system variable, Section 5.1.4, Server System Variables
debugging
client, Section 22.5.2, Debugging a MySQL Client
server, Section 22.5.1, Debugging a MySQL Server
debugging support, Section 2.10.2, Typical configure Options
decimal point, Chapter 10, Data Types
decode_bits myisamchk variable, Section 4.6.3.1, myisamchk Gener-
al Options
default
privileges, Section 2.11.3, Securing the Initial MySQL Accounts
default host name, Section 4.2.2, Connecting to the MySQL Server
default installation location, Section 2.1.5, Installation Layouts
default options, Section 4.2.3.3, Using Option Files
default values, Section 12.1.17, CREATE TABLE Syntax, Sec-
tion 7.1.1, MySQL Design Limitations and Tradeoffs, Section 12.2.5,
INSERT Syntax, Section 10.1.4, Data Type Default Values
BLOB and TEXT columns, Section 10.4.3, The BLOB and TEXT
Types
explicit, Section 10.1.4, Data Type Default Values
implicit, Section 10.1.4, Data Type Default Values
suppression, Section 1.7.6.2, Constraints on Invalid Data
default-character-set option
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
default-collation option
mysqld, Section 5.1.2, Server Command Options
default-mysqld-path option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
default-storage-engine option
mysqld, Section 5.1.2, Server Command Options
default-table-type option
mysqld, Section 5.1.2, Server Command Options
default-time-zone option
mysqld, Section 5.1.2, Server Command Options
default_week_format system variable, Section 5.1.4, Server System
Variables
defaults
embedded, Section 21.9.3, Options with the Embedded Server
defaults-extra-file option, Section 4.2.3.3.1, Command-Line Options
Standard Index
3243
that Affect Option-File Handling
my_print_defaults, Description
mysqld_multi, Description
mysqld_safe, Description
defaults-file option, Section 4.2.3.3.1, Command-Line Options that Af-
fect Option-File Handling
my_print_defaults, Description
mysqld_multi, Description
mysqld_safe, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
defaults-group-suffix option, Section 4.2.3.3.1, Command-Line Options
that Affect Option-File Handling
my_print_defaults, Description
delay-key-write option
mysqld, Section 5.1.2, Server Command Options, Section 13.5.1,
MyISAM Startup Options
delay_key_write system variable, Section 5.1.4, Server System Vari-
ables
delayed inserts
thread states, Section 7.5.6.3, Delayed-Insert Thread States
delayed-insert option
mysqldump, Description
delayed_insert_limit, Section 12.2.5.2, INSERT DELAYED Syntax
delayed_insert_limit system variable, Section 5.1.4, Server System
Variables
delayed_insert_timeout system variable, Section 5.1.4, Server System
Variables
delayed_queue_size system variable, Section 5.1.4, Server System
Variables
delete option
mysqlimport, Description
delete-master-logs option
mysqldump, Description
deleting
database, Section 12.1.21, DROP DATABASE Syntax
foreign key, Section 13.6.4.4, FOREIGN KEY Constraints, Sec-
tion 12.1.7, ALTER TABLE Syntax
function, Section 12.5.3.2, DROP FUNCTION Syntax
index, Section 12.1.7, ALTER TABLE Syntax, Section 12.1.24,
DROP INDEX Syntax
primary key, Section 12.1.7, ALTER TABLE Syntax
rows, Section B.1.5.6, Deleting Rows from Related Tables
schema, Section 12.1.21, DROP DATABASE Syntax
table, Section 12.1.28, DROP TABLE Syntax
user, Section 5.5.3, Removing User Accounts, Section 12.5.1.2,
DROP USER Syntax
users, Section 5.5.3, Removing User Accounts, Section 12.5.1.2,
DROP USER Syntax
deleting from main table
thread state, Section 7.5.6.2, General Thread States
deleting from reference tables
thread state, Section 7.5.6.2, General Thread States
deletion
mysql.sock, Section B.1.4.5, How to Protect or Change the MySQL
Unix Socket File
delimiter command
mysql, Section 4.5.1.2, mysql Commands
delimiter option
mysql, Section 4.5.1.1, mysql Options
mysqlslap, Description
ndb_select_all, Description
derived tables, Section 12.2.9.8, Subqueries in the FROM clause
des-key-file option
mysqld, Section 5.1.2, Server Command Options
descending option
ndb_select_all, Description
description option
myisamchk, Section 4.6.3.4, Other myisamchk Options
design
issues, Section B.1.8, Known Issues in MySQL
limitations, Section 7.1.1, MySQL Design Limitations and
Tradeoffs
detach option
mysqlslap, Description
development source tree, Section 2.10.3, Installing from the Develop-
ment Source Tree
digits, Chapter 10, Data Types
directory structure
default, Section 2.1.5, Installation Layouts
disable named command
mysql, Section 4.5.1.1, mysql Options
disable-grant-options option
configure, Section 2.10.2, Typical configure Options
disable-keys option
mysqldump, Description
disable-log-bin option
mysqlbinlog, Description
discard_or_import_tablespace
thread state, Section 7.5.6.2, General Thread States
disconnect-slave-event-count option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
disconnecting
from the server, Section 3.1, Connecting to and Disconnecting from
the Server
disk full, Section B.1.4.3, How MySQL Handles a Full Disk
disk issues, Section 7.6, Disk Issues
disk option
ndb_select_all, Description
disks
splitting data across, Section 7.6.1.3, Using Symbolic Links for
Databases on Windows
display size, Chapter 10, Data Types
display triggers, Section 12.5.5.40, SHOW TRIGGERS Syntax
display width, Chapter 10, Data Types
displaying
database information, Section 4.5.6, mysqlshow Display Data-
base, Table, and Column Information
information
Cardinality, Section 12.5.5.23, SHOW INDEX Syntax
Collation, Section 12.5.5.23, SHOW INDEX Syntax
SHOW, Section 12.5.5.39, SHOW TABLES Syntax, Sec-
tion 12.5.5.6, SHOW COLUMNS Syntax, Section 12.5.5, SHOW
Syntax, Section 12.5.5.23, SHOW INDEX Syntax, Sec-
tion 12.5.5.26, SHOW OPEN TABLES Syntax
table status, Section 12.5.5.38, SHOW TABLE STATUS Syntax
div_precision_increment system variable, Section 5.1.4, Server System
Variables
division (/), Section 11.5.1, Arithmetic Operators
double quote (\"), Section 8.1.1, Strings
downgrades
MySQL Cluster, Section 17.5.2, MySQL Cluster 5.1 and MySQL
Cluster NDB 6.x/7.x Upgrade and Downgrade Compatibility, Sec-
tion 17.5.1, Performing a Rolling Restart of a MySQL Cluster, Sec-
tion 17.5, Upgrading and Downgrading MySQL Cluster
downgrading, Section 2.12, Upgrading or Downgrading MySQL, Sec-
tion 2.12.2, Downgrading MySQL
downloading, Section 2.1.3, How to Get MySQL
drbd
FAQ, Section A.14, MySQL 5.1 FAQ MySQL, DRBD, and
Standard Index
3244
Heartbeat
drop-user option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
dropping
user, Section 5.5.3, Removing User Accounts, Section 12.5.1.2,
DROP USER Syntax
dryrun option
mysqlhotcopy, Description
dump option
myisam_ftdump, Description
dump-date option
mysqldump, Description
dumping
databases and tables, Section 4.5.4, mysqldump A Database
Backup Program, Section 4.6.9, mysqlhotcopy A Database
Backup Program
dynamic table characteristics, Section 13.5.3.2, Dynamic Table Charac-
teristics
E
ELT(), Section 11.4, String Functions
ENCODE(), Section 11.11.2, Encryption and Compression Functions
ENCRYPT(), Section 11.11.2, Encryption and Compression Functions
ENGINES
INFORMATION_SCHEMA table, Section 20.18, The INFORMA-
TION_SCHEMA ENGINES Table
ENTER SINGLE USER MODE command (MySQL Cluster), Sec-
tion 17.7.2, Commands in the MySQL Cluster Management Client
ENUM
size, Section 10.5, Data Type Storage Requirements
ENUM data type, Section 10.4.4, The ENUM Type, Section 10.1.3,
Overview of String Types
ERROR Events (MySQL Cluster), Section 17.7.4.2, MySQL Cluster
Log Events
ERROR_FOR_DIVISION_BY_ZERO SQL mode, Section 5.1.8,
Server SQL Modes
EVENTS
INFORMATION_SCHEMA table, Section 20.20, The INFORMA-
TION_SCHEMA EVENTS Table
EXAMPLE storage engine, Chapter 13, Storage Engines, Section 13.10,
The EXAMPLE Storage Engine
EXECUTE, Section 12.7.2, EXECUTE Syntax, Section 12.7, SQL
Syntax for Prepared Statements
EXISTS
with subqueries, Section 12.2.9.6, EXISTS and NOT EXISTS
EXIT SINGLE USER MODE command (MySQL Cluster), Sec-
tion 17.7.2, Commands in the MySQL Cluster Management Client
EXIT command (MySQL Cluster), Section 17.7.2, Commands in the
MySQL Cluster Management Client
EXP(), Section 11.5.2, Mathematical Functions
EXPLAIN, Section 7.2.1, Optimizing Queries with EXPLAIN, Sec-
tion 12.3.2, EXPLAIN Syntax
EXPLAIN PARTITIONS, Section 18.3.4, Obtaining Information About
Partitions
EXPLAIN used with partitioned tables, Section 18.3.4, Obtaining In-
formation About Partitions
EXPORT_SET(), Section 11.4, String Functions
EXTRACT(), Section 11.6, Date and Time Functions
Eiffel Wrapper, Section 21.17, MySQL Eiffel Wrapper
EndPoint(), Section 11.13.5.2.3, LineString Functions
Envelope(), Section 11.13.5.2.1, General Geometry Functions
Equals(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
Errcode, Section 4.8.1, perror Explain Error Codes
Error
thread command, Section 7.5.6.1, Thread Command Values
Event Scheduler
altering events, Section 12.1.2, ALTER EVENT Syntax
and replication, Section 16.3.1.7, Replication of Invoked Features
creating events, Section 12.1.11, CREATE EVENT Syntax
dropping events, Section 12.1.22, DROP EVENT Syntax
obtaining status information, Section 12.5.5.34, SHOW SCHED-
ULER STATUS Syntax
Execute
thread command, Section 7.5.6.1, Thread Command Values
ExecuteOnComputer, Section 17.3.4.7, Defining SQL and Other API
Nodes in a MySQL Cluster, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes, Section 17.3.4.5, Defining a MySQL Cluster
Management Server
Execution of init_command
thread state, Section 7.5.6.2, General Thread States
ExteriorRing(), Section 11.13.5.2.5, Polygon Functions
ExtractValue(), Section 11.10, XML Functions
edit command
mysql, Section 4.5.1.2, mysql Commands
edit-user option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
ego command
mysql, Section 4.5.1.2, mysql Commands
embedded MySQL server library, Section 21.9, libmysqld, the Embed-
ded MySQL Server Library
embedded option
make_win_bin_dist, Description
mysql_config, Description
enable-community-features option
configure, Section 2.10.2, Typical configure Options
enable-debug-sync option
configure, Section 2.10.2, Typical configure Options
enable-dtrace option
configure, Section 2.10.2, Typical configure Options
enable-named-pipe option
mysqld, Section 5.1.2, Server Command Options
enable-profiling option
configure, Section 2.10.2, Typical configure Options
enable-pstack option
mysqld, Section 5.1.2, Server Command Options
enable-thread-safe-client option
configure, Section 2.10.2, Typical configure Options
encryption, Section 5.5.7.1, Basic SSL Concepts
encryption functions, Section 11.11.2, Encryption and Compression
Functions
end
thread state, Section 7.5.6.2, General Thread States
engine option
mysqlslap, Description
engine_condition_pushdown system variable, Section 5.1.4, Server
System Variables
entering
queries, Section 3.2, Entering Queries
environment variable
CC, Section 2.10.4, Dealing with Problems Compiling MySQL,
Section 2.10.2, Typical configure Options, Section 2.14,
Environment Variables
CFLAGS, Section 2.10.4, Dealing with Problems Compiling
MySQL, Section 2.10.2, Typical configure Options, Sec-
tion 2.14, Environment Variables
CXX, Section 2.10.4, Dealing with Problems Compiling MySQL,
Standard Index
3245
Section 2.10.2, Typical configure Options, Section 2.14,
Environment Variables
CXXFLAGS, Section 2.10.4, Dealing with Problems Compiling
MySQL, Section 2.10.2, Typical configure Options, Sec-
tion 2.14, Environment Variables
DBI_TRACE, Section 22.5.1.4, Debugging mysqld under gdb,
Section 2.14, Environment Variables
DBI_USER, Section 2.14, Environment Variables
HOME, Section 4.5.1.1, mysql Options, Section 2.14,
Environment Variables
LD_LIBRARY_PATH, Section 2.15.3, Problems Using the Perl
DBI/DBD Interface
LD_RUN_PATH, Section 2.15.3, Problems Using the Perl
DBI/DBD Interface, Section 2.13.1.3, Linux Source Distribution
Notes, Section 2.13.3, Solaris Notes, Section 2.14, Environment
Variables
MYSQL_DEBUG, Section 22.5.2, Debugging a MySQL Client,
Section 4.1, Overview of MySQL Programs, Section 2.14,
Environment Variables
MYSQL_GROUP_SUFFIX, Section 2.14, Environment Variables
MYSQL_HISTFILE, Section 4.5.1.1, mysql Options, Sec-
tion 2.14, Environment Variables
MYSQL_HOME, Section 2.14, Environment Variables
MYSQL_HOST, Section 4.2.2, Connecting to the MySQL Server,
Section 2.14, Environment Variables
MYSQL_PS1, Section 2.14, Environment Variables
MYSQL_PWD, Section 4.2.2, Connecting to the MySQL Server,
Section 4.1, Overview of MySQL Programs, Section 2.14,
Environment Variables
MYSQL_TCP_PORT, Section 5.6.2, Running Multiple Servers on
Unix, Section 5.6.3, Using Client Programs in a Multiple-Server
Environment, Section 4.1, Overview of MySQL Programs, Sec-
tion 2.14, Environment Variables
MYSQL_UNIX_PORT, Section 5.6.2, Running Multiple Servers on
Unix, Section 5.6.3, Using Client Programs in a Multiple-Server
Environment, Section 4.1, Overview of MySQL Programs, Sec-
tion 2.14, Environment Variables, Section 2.11.2.1, Problems
Running mysql_install_db
PATH, Section 2.9, Installing MySQL from tar.gz Packages on
Other Unix-Like Systems, Section 4.2.1, Invoking MySQL Pro-
grams, Section 2.14, Environment Variables
TMPDIR, Section B.1.4.4, Where MySQL Stores Temporary Files,
Section 4.1, Overview of MySQL Programs, Section 2.14,
Environment Variables, Section 2.11.2.1, Problems Running
mysql_install_db
TZ, Section B.1.4.6, Time Zone Problems, Section 2.14,
Environment Variables
UMASK, Section B.1.3.2, Problems with File Permissions, Sec-
tion 2.14, Environment Variables
UMASK_DIR, Section B.1.3.2, Problems with File Permissions,
Section 2.14, Environment Variables
USER, Section 4.2.2, Connecting to the MySQL Server, Sec-
tion 2.14, Environment Variables
environment variables, Section 5.4.7, Causes of Access-Denied Errors,
Section 4.2.4, Setting Environment Variables, Section 4.1, Overview
of MySQL Programs
CXX, Section 2.10.4, Dealing with Problems Compiling MySQL
list of, Section 2.14, Environment Variables
eq_ref join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
equal (=), Section 11.2.3, Comparison Functions and Operators
errno, Section 4.8.1, perror Explain Error Codes
error logs (MySQL Cluster), Description
error messages
can't find file, Section B.1.3.2, Problems with File Permissions
displaying, Section 4.8.1, perror Explain Error Codes
languages, Section 9.3, Setting the Error Message Language
error_count session variable, Section 5.1.5, Session System Variables
errors
access denied, Section B.1.2.1, Access denied
and replication, Section 16.3.1.20, Slave Errors during Replication
checking tables for, Section 6.4.2, How to Check MyISAM Tables
for Errors
common, Section B.1, Problems and Common Errors
directory checksum, Section 2.13.3, Solaris Notes
handling for UDFs, Section 22.3.2.4, UDF Return Values and Error
Handling
in subqueries, Section 12.2.9.9, Subquery Errors
known, Section B.1.8, Known Issues in MySQL
linking, Section B.1.3.1, Problems Linking to the MySQL Client
Library
list of, Section B.1.2, Common Errors When Using MySQL Pro-
grams
lost connection, Section B.1.2.3, Lost connection to
MySQL server
reporting, Section 1.6, How to Report Bugs or Problems,
Chapter 1, General Information
escape (\\), Section 8.1.1, Strings
escape characters, Section 8.1, Literal Values
estimating
query performance, Section 7.2.2, Estimating Query Performance
event groups, Section 12.6.2.6, SET GLOBAL
SQL_SLAVE_SKIP_COUNTER Syntax
event log format (MySQL Cluster), Section 17.7.4.2, MySQL Cluster
Log Events
event logs (MySQL Cluster), Section 17.7.4.1, MySQL Cluster Log-
ging Management Commands, Section 17.7.4, Event Reports Gener-
ated in MySQL Cluster
event restrictions, Section D.1, Restrictions on Stored Routines, Trig-
gers, and Events
event scheduler, Chapter 19, Stored Programs and Views
thread states, Section 7.5.6.9, Event Scheduler Thread States
event severity levels (MySQL Cluster), Section 17.7.4.1, MySQL
Cluster Logging Management Commands
event types (MySQL Cluster), Section 17.7.4, Event Reports Generated
in MySQL Cluster, Section 17.7.4.2, MySQL Cluster Log Events
event-scheduler option
mysqld, Section 5.1.2, Server Command Options
event_scheduler system variable, Section 5.1.4, Server System Vari-
ables
events, Chapter 19, Stored Programs and Views
altering, Section 12.1.2, ALTER EVENT Syntax
creating, Section 12.1.11, CREATE EVENT Syntax
dropping, Section 12.1.22, DROP EVENT Syntax
events option
mysqldump, Description
example option
mysqld_multi, Description
examples
compressed tables, Description
myisamchk output, Section 6.4.5, Getting Information About a Ta-
ble
queries, Section 3.6, Examples of Common Queries
exe-suffix option
make_win_bin_dist, Description
execute option
mysql, Section 4.5.1.1, mysql Options
executing
thread state, Section 7.5.6.2, General Thread States
executing SQL statements from text files, Section 3.5, Using mysql in
Standard Index
3246
Batch Mode, Section 4.5.1.4, Executing SQL Statements from a Text
File
exit command
mysql, Section 4.5.1.2, mysql Commands
exit-info option
mysqld, Section 5.1.2, Server Command Options
expire_logs_days system variable, Section 5.1.4, Server System Vari-
ables
explicit default values, Section 10.1.4, Data Type Default Values
expression aliases, Section 11.12.3, GROUP BY and HAVING with
Hidden Columns, Section 12.2.8, SELECT Syntax
expressions
extended, Section 3.3.4.7, Pattern Matching
extend-check option
myisamchk, Section 4.6.3.3, myisamchk Repair Options, Sec-
tion 4.6.3.2, myisamchk Check Options
extended option
mysqlcheck, Description
extended-insert option
mysqldump, Description
extensions
to standard SQL, Section 1.7, MySQL Standards Compliance
external locking, Section 5.1.4, Server System Variables, Sec-
tion 5.1.2, Server Command Options, Section 7.5.6.2, General Thread
States, Section 7.3.4, External Locking, Section 6.4.1, Using myis-
amchk for Crash Recovery
external-locking option
mysqld, Section 5.1.2, Server Command Options
extra-file option
my_print_defaults, Description
extra-partition-info option
ndb_desc, Description
extracting
dates, Section 3.3.4.5, Date Calculations
F
FALSE, Section 8.1.4, Boolean Values, Section 8.1.2, Numbers
testing for, Section 11.2.3, Comparison Functions and Operators
FEDERATED storage engine, Chapter 13, Storage Engines, Sec-
tion 13.11, The FEDERATED Storage Engine
FIELD(), Section 11.4, String Functions
FILE, Section 11.4, String Functions
FILES
INFORMATION_SCHEMA table, Section 20.21, The INFORMA-
TION_SCHEMA FILES Table
FIND_IN_SET(), Section 11.4, String Functions
FIXED data type, Section 10.1.1, Overview of Numeric Types
FLOAT data type, Section 10.1.1, Overview of Numeric Types
FLOOR(), Section 11.5.2, Mathematical Functions
FLUSH, Section 12.5.6.3, FLUSH Syntax
and replication, Section 16.3.1.9, Replication and FLUSH
FOR UPDATE, Section 12.2.8, SELECT Syntax
FORCE INDEX, Section 12.2.8.2, Index Hint Syntax, Section B.1.6,
Optimizer-Related Issues
FORCE KEY, Section 12.2.8.2, Index Hint Syntax
FORMAT(), Section 11.4, String Functions
FOUND_ROWS(), Section 11.11.3, Information Functions
FROM, Section 12.2.8, SELECT Syntax
FROM_DAYS(), Section 11.6, Date and Time Functions
FROM_UNIXTIME(), Section 11.6, Date and Time Functions
FULLTEXT, Section 11.8, Full-Text Search Functions
FULLTEXT initialization
thread state, Section 7.5.6.2, General Thread States
Fetch
thread command, Section 7.5.6.1, Thread Command Values
Field List
thread command, Section 7.5.6.1, Thread Command Values
FileSystemPath, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
FileSystemPathDD, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
FileSystemPathDataFiles, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
FileSystemPathUndoFiles, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
Finished reading one binlog; switching to next binlog
thread state, Section 7.5.6.4, Replication Master Thread States
Flushing tables
thread state, Section 7.5.6.2, General Thread States
FragmentLogFileSize, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
FreeBSD troubleshooting, Section 2.10.4, Dealing with Problems Com-
piling MySQL
Functions
user-defined, Section 12.5.3.1, CREATE FUNCTION Syntax, Sec-
tion 12.5.3.2, DROP FUNCTION Syntax
fast option
myisamchk, Section 4.6.3.2, myisamchk Check Options
mysqlcheck, Description
fatal signal 11, Section 2.10.4, Dealing with Problems Compiling
MySQL
field
changing, Section 12.1.7, ALTER TABLE Syntax
fields option
ndb_config, Description
fields-enclosed-by option
mysqldump, Description, Description
fields-escaped-by option
mysqldump, Description, Description
fields-optionally-enclosed-by option
mysqldump, Description, Description
fields-terminated-by option
mysqldump, Description, Description
files
binary log, Section 5.2.4, The Binary Log
config.cache, Section 2.10.4, Dealing with Problems Compiling
MySQL
error messages, Section 9.3, Setting the Error Message Language
general query log, Section 5.2.3, The General Query Log
log, Section 2.10.2, Typical configure Options, Section 5.2.6,
Server Log Maintenance
my.cnf, Section 16.3.1, Replication Features and Issues
not found message, Section B.1.3.2, Problems with File Permis-
sions
permissions, Section B.1.3.2, Problems with File Permissions
repairing, Section 4.6.3.3, myisamchk Repair Options
script, Section 3.5, Using mysql in Batch Mode
size limits, Section B.1.2.12, The table is full
slow query log, Section 5.2.5, The Slow Query Log
text, Section 4.5.5, mysqlimport A Data Import Program,
Section 4.5.1.4, Executing SQL Statements from a Text File
tmp, Section 2.11.2.1, Problems Running mysql_install_db
filesort optimization, Section 7.2.13, ORDER BY Optimization
firewalls (software)
and MySQL Cluster, Section 17.8.1, MySQL Cluster Security and
Networking Issues
first-slave option
mysqldump, Description
fix-db-names option
Standard Index
3247
mysqlcheck, Description
fix-table-names option
mysqlcheck, Description
floating-point number, Section 10.1.1, Overview of Numeric Types
floating-point values
and replication, Section 16.3.1.8, Replication with Floating-Point
Values
floats, Section 8.1.2, Numbers
flush option
mysqld, Section 5.1.2, Server Command Options
flush system variable, Section 5.1.4, Server System Variables
flush tables, Description
flush-logs option
mysqldump, Description
flush-privileges option
mysqldump, Description
flush_time system variable, Section 5.1.4, Server System Variables
flushlog option
mysqlhotcopy, Description
force option
myisamchk, Section 4.6.3.3, myisamchk Repair Options, Sec-
tion 4.6.3.2, myisamchk Check Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlcheck, Description
mysqldump, Description
mysqlimport, Description
force-read option
mysqlbinlog, Description
foreign key
constraint, Section 1.7.6.1, PRIMARY KEY and UNIQUE Index
Constraints
deleting, Section 13.6.4.4, FOREIGN KEY Constraints, Sec-
tion 12.1.7, ALTER TABLE Syntax
foreign keys, Section 3.6.6, Using Foreign Keys, Section 1.7.5.4,
Foreign Keys, Section 12.1.7, ALTER TABLE Syntax
foreign_key_checks session variable, Section 5.1.5, Session System
Variables
freeing items
thread state, Section 7.5.6.2, General Thread States
frequently-asked questions about DRBD, Section A.14, MySQL 5.1
FAQ MySQL, DRBD, and Heartbeat
frequently-asked questions about MySQL Cluster, Section A.10,
MySQL 5.1 FAQ MySQL Cluster
ft_boolean_syntax system variable, Section 5.1.4, Server System Vari-
ables
ft_max_word_len myisamchk variable, Section 4.6.3.1, myisamchk
General Options
ft_max_word_len system variable, Section 5.1.4, Server System Vari-
ables
ft_min_word_len myisamchk variable, Section 4.6.3.1, myisamchk
General Options
ft_min_word_len system variable, Section 5.1.4, Server System Vari-
ables
ft_query_expansion_limit system variable, Section 5.1.4, Server System
Variables
ft_stopword_file myisamchk variable, Section 4.6.3.1, myisamchk
General Options
ft_stopword_file system variable, Section 5.1.4, Server System Vari-
ables
full disk, Section B.1.4.3, How MySQL Handles a Full Disk
full-text search, Section 11.8, Full-Text Search Functions
fulltext
stopword list, Section 11.8.6, Fine-Tuning MySQL Full-Text
Search
fulltext join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
function
creating, Section 12.5.3.1, CREATE FUNCTION Syntax
deleting, Section 12.5.3.2, DROP FUNCTION Syntax
function names
parsing, Section 8.2.4, Function Name Parsing and Resolution
resolving ambiguity, Section 8.2.4, Function Name Parsing and Res-
olution
functions, Chapter 11, Functions and Operators
C API, Section 21.10.2, C API Function Overview
C prepared statement API, Section 21.10.6, C API Prepared State-
ment Function Overview
GROUP BY, Section 11.12.1, GROUP BY (Aggregate) Functions
and replication, Section 16.3.1.10, Replication and System Func-
tions
arithmetic, Section 11.11.1, Bit Functions
bit, Section 11.11.1, Bit Functions
cast, Section 11.9, Cast Functions and Operators
control flow, Section 11.3, Control Flow Functions
date and time, Section 11.6, Date and Time Functions
encryption, Section 11.11.2, Encryption and Compression Func-
tions
grouping, Section 11.2.1, Operator Precedence
information, Section 11.11.3, Information Functions
mathematical, Section 11.5.2, Mathematical Functions
miscellaneous, Section 11.11.4, Miscellaneous Functions
native
adding, Section 22.3.3, Adding a New Native Function
new, Section 22.3, Adding New Functions to MySQL
stored, Section 19.2, Using Stored Routines (Procedures and Func-
tions)
string, Section 11.4, String Functions
string comparison, Section 11.4.1, String Comparison Functions
user-defined, Section 22.3, Adding New Functions to MySQL
adding, Section 22.3.2, Adding a New User-Defined Function
functions for SELECT and WHERE clauses, Chapter 11, Functions and
Operators
G
GCP Stop errors (MySQL Cluster), Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
GEOMETRY data type, Section 11.13.4.1, MySQL Spatial Data
Types
GEOMETRYCOLLECTION data type, Section 11.13.4.1, MySQL
Spatial Data Types
GET_FORMAT(), Section 11.6, Date and Time Functions
GET_LOCK(), Section 11.11.4, Miscellaneous Functions
GIS, Section 11.13, Spatial Extensions, Section 11.13.1, Introduction
to MySQL Spatial Support
GLOBAL_STATUS
INFORMATION_SCHEMA table, Section 20.24, The INFORMA-
TION_SCHEMA GLOBAL_STATUS and SESSION_STATUS
Tables
GLOBAL_VARIABLES
INFORMATION_SCHEMA table, Section 20.25, The INFORMA-
TION_SCHEMA GLOBAL_VARIABLES and SES-
SION_VARIABLES Tables
GLength(), Section 11.13.5.2.4, MultiLineString Functions, Sec-
tion 11.13.5.2.3, LineString Functions
GRANT, Section 12.5.1.3, GRANT Syntax
GRANT statement, Section 5.5.2, Adding User Accounts
GRANTS, Section 12.5.5.22, SHOW GRANTS Syntax
Standard Index
3248
GREATEST(), Section 11.2.3, Comparison Functions and Operators
GROUP BY, Section 7.2.14, GROUP BY Optimization
aliases in, Section 11.12.3, GROUP BY and HAVING with Hidden
Columns
extensions to standard SQL, Section 11.12.3, GROUP BY and HAV-
ING with Hidden Columns, Section 12.2.8, SELECT Syntax
GROUP BY functions, Section 11.12.1, GROUP BY (Aggregate) Func-
tions
GROUP_CONCAT(), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
GeomCollFromText(), Section 11.13.4.2.1, Creating Geometry Values
Using WKT Functions
GeomCollFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
GeomFromText(), Section 11.13.4.2.1, Creating Geometry Values Us-
ing WKT Functions, Section 11.13.5.1, Geometry Format Conversion
Functions
GeomFromWKB(), Section 11.13.4.2.2, Creating Geometry Values Us-
ing WKB Functions, Section 11.13.5.1, Geometry Format Conversion
Functions
GeometryCollection(), Section 11.13.4.2.3, Creating Geometry Values
Using MySQL-Specific Functions
GeometryCollectionFromText(), Section 11.13.4.2.1, Creating Geo-
metry Values Using WKT Functions
GeometryCollectionFromWKB(), Section 11.13.4.2.2, Creating Geo-
metry Values Using WKB Functions
GeometryFromText(), Section 11.13.4.2.1, Creating Geometry Values
Using WKT Functions
GeometryFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
GeometryN(), Section 11.13.5.2.7, GeometryCollection Func-
tions
GeometryType(), Section 11.13.5.2.1, General Geometry Functions
gap lock
InnoDB, Section 13.6.8.4, InnoDB Record, Gap, and Next-Key
Locks, Section 13.6.8, The InnoDB Transaction Model and Lock-
ing, Section 13.6.8.5, Avoiding the Phantom Problem Using Next-
Key Locking, Section 13.6.3, InnoDB Startup Options and System
Variables
gb2312, gbk, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
gcc, Section 2.10.2, Typical configure Options
gci option
ndb_select_all, Description
gdb
using, Section 22.5.1.4, Debugging mysqld under gdb
gdb option
mysqld, Section 5.1.2, Server Command Options
general information, Chapter 1, General Information
general query log, Section 5.2.3, The General Query Log
general-log option
mysqld, Section 5.1.2, Server Command Options
general_log system variable, Section 5.1.4, Server System Variables
general_log_file system variable, Section 5.1.4, Server System Vari-
ables
geographic feature, Section 11.13.1, Introduction to MySQL Spatial
Support
geometry, Section 11.13.1, Introduction to MySQL Spatial Support
geospatial feature, Section 11.13.1, Introduction to MySQL Spatial
Support
getting MySQL, Section 2.1.3, How to Get MySQL
global privileges, Section 12.5.1.5, REVOKE Syntax, Section 12.5.1.3,
GRANT Syntax
go command
mysql, Section 4.5.1.2, mysql Commands
got handler lock
thread state, Section 7.5.6.3, Delayed-Insert Thread States
got old table
thread state, Section 7.5.6.3, Delayed-Insert Thread States
grant tables
re-creating, Section 2.11.2.1, Problems Running
mysql_install_db
sorting, Section 5.4.5, Access Control, Stage 2: Request Verifica-
tion, Section 5.4.4, Access Control, Stage 1: Connection Verifica-
tion
structure, Section 5.4.2, Privilege System Grant Tables
granting
privileges, Section 12.5.1.3, GRANT Syntax
greater than (>), Section 11.2.3, Comparison Functions and Operators
greater than or equal (>=), Section 11.2.3, Comparison Functions and
Operators
group_concat_max_len system variable, Section 5.1.4, Server System
Variables
grouping
expressions, Section 11.2.1, Operator Precedence
H
HANDLER, Section 12.2.4, HANDLER Syntax
HAVING, Section 12.2.8, SELECT Syntax
HEAP storage engine, Chapter 13, Storage Engines, Section 13.9, The
MEMORY (HEAP) Storage Engine
HELP command (MySQL Cluster), Section 17.7.2, Commands in the
MySQL Cluster Management Client
HELP option
myisamchk, Section 4.6.3.1, myisamchk General Options
HELP statement, Section 12.3.3, HELP Syntax
HEX(), Section 11.5.2, Mathematical Functions, Section 11.4, String
Functions
HIGH_NOT_PRECEDENCE SQL mode, Section 5.1.8, Server SQL
Modes
HIGH_PRIORITY, Section 12.2.8, SELECT Syntax
HOME environment variable, Section 4.5.1.1, mysql Options, Sec-
tion 2.14, Environment Variables
HOUR(), Section 11.6, Date and Time Functions
Has read all relay log; waiting for the slave I/O thread to update it
thread state, Section 7.5.6.6, Replication Slave SQL Thread States
Has sent all binlog to slave; waiting for binlog to be updated
thread state, Section 7.5.6.4, Replication Master Thread States
HeartbeatIntervalDbApi, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
HeartbeatIntervalDbDb, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
Host*SciId* parameters, Section 17.3.4.11, SCI Transport Connections
in MySQL Cluster
HostName, Section 17.3.4.7, Defining SQL and Other API Nodes in a
MySQL Cluster, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes, Section 17.3.4.5, Defining a MySQL Cluster Management
Server
HostName (MySQL Cluster), Section 17.8.1, MySQL Cluster Security
and Networking Issues
handling
errors, Section 22.3.2.4, UDF Return Values and Error Handling
hash partitioning, Section 18.2.3, HASH Partitioning
hash partitions
managing, Section 18.3.2, Management of HASH and KEY Parti-
tions
splitting and merging, Section 18.3.2, Management of HASH and
KEY Partitions
have_archive system variable, Section 5.1.4, Server System Variables
Standard Index
3249
have_blackhole_engine system variable, Section 5.1.4, Server System
Variables
have_compress system variable, Section 5.1.4, Server System Vari-
ables
have_crypt system variable, Section 5.1.4, Server System Variables
have_csv system variable, Section 5.1.4, Server System Variables
have_dynamic_loading system variable, Section 5.1.4, Server System
Variables
have_example_engine system variable, Section 5.1.4, Server System
Variables
have_federated_engine system variable, Section 5.1.4, Server System
Variables
have_geometry system variable, Section 5.1.4, Server System Vari-
ables
have_innodb system variable, Section 5.1.4, Server System Variables
have_isam system variable, Section 5.1.4, Server System Variables
have_merge_engine system variable, Section 5.1.4, Server System
Variables
have_openssl system variable, Section 5.1.4, Server System Variables
have_partitioning system variable, Section 5.1.4, Server System Vari-
ables
have_query_cache system variable, Section 5.1.4, Server System Vari-
ables
have_raid system variable, Section 5.1.4, Server System Variables
have_row_based_replication system variable, Section 5.1.4, Server Sys-
tem Variables
have_rtree_keys system variable, Section 5.1.4, Server System Vari-
ables
have_ssl system variable, Section 5.1.4, Server System Variables
have_symlink system variable, Section 5.1.4, Server System Variables
header option
ndb_select_all, Description
header_file option
comp_err, Description
help command
mysql, Section 4.5.1.2, mysql Commands
help option
comp_err, Description
my_print_defaults, Description
myisam_ftdump, Description
myisamchk, Section 4.6.3.1, myisamchk General Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqlaccess, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_multi, Description
mysqld_safe, Description
mysqldump, Description
mysqldumpslow, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
perror, Description
resolve_stack_dump, Description
resolveip, Description
hex-blob option
mysqldump, Description
hexadecimal values, Section 8.1.3, Hexadecimal Values
hexdump option
mysqlbinlog, Description
hints, Section 1.7.4, MySQL Extensions to Standard SQL
index, Section 12.2.8.2, Index Hint Syntax, Section 12.2.8, SE-
LECT Syntax
host name
default, Section 4.2.2, Connecting to the MySQL Server
host name caching, Section 7.5.11, How MySQL Uses DNS
host name resolution, Section 7.5.11, How MySQL Uses DNS
host option, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysqlaccess, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqldump, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
ndb_config, Description
host table, Section 5.4.5, Access Control, Stage 2: Request Verifica-
tion
sorting, Section 5.4.5, Access Control, Stage 2: Request Verifica-
tion
host.frm
problems finding, Section 2.11.2, Unix Post-Installation Procedures
hostname system variable, Section 5.1.4, Server System Variables
howto option
mysqlaccess, Description
html option
mysql, Section 4.5.1.1, mysql Options
I
IBM i5/OS, Section 2.7, Installing MySQL on i5/OS
IBMDB2I storage engine, Chapter 13, Storage Engines
ID
unique, Section 21.10.10.3, How to Get the Unique ID for the Last
Inserted Row
IF(), Section 11.3, Control Flow Functions
IFNULL(), Section 11.3, Control Flow Functions
IGNORE
with partitioned tables, Section 12.2.5, INSERT Syntax
IGNORE INDEX, Section 12.2.8.2, Index Hint Syntax
IGNORE KEY, Section 12.2.8.2, Index Hint Syntax
IGNORE_SPACE SQL mode, Section 5.1.8, Server SQL Modes
IMPORT TABLESPACE, Section 12.1.7, ALTER TABLE Syntax,
Section 13.6.2.1, Using Per-Table Tablespaces
IN, Section 11.2.3, Comparison Functions and Operators, Sec-
tion 12.2.9.3, Subqueries with ANY, IN, and SOME
INDEX DIRECTORY
and replication, Section 16.3.1.5, Replication and DIRECTORY Ta-
ble Options
INET_ATON(), Section 11.11.4, Miscellaneous Functions
INET_NTOA(), Section 11.11.4, Miscellaneous Functions
INFO Events (MySQL Cluster), Section 17.7.4.2, MySQL Cluster Log
Events
INFORMATION_SCHEMA, Chapter 20, INFORMATION_SCHEMA
Tables
and security issues, Section 17.8.2, MySQL Cluster and MySQL
Privileges
INFORMATION_SCHEMA.ENGINES table
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
INFORMATION_SCHEMA.GLOBAL_STATUS table
Standard Index
3250
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
INFORMATION_SCHEMA.GLOBAL_VARIABLES table
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
INNER JOIN, Section 12.2.8.1, JOIN Syntax
INSERT, Section 12.2.5, INSERT Syntax, Section 7.2.21, Speed of
INSERT Statements
INSERT ... SELECT, Section 12.2.5.1, INSERT ... SELECT Syn-
tax
INSERT DELAYED, Section 12.2.5.2, INSERT DELAYED Syntax
INSERT statement
grant privileges, Section 5.5.2, Adding User Accounts
INSERT(), Section 11.4, String Functions
INSTALL PLUGIN, Section 12.5.3.3, INSTALL PLUGIN Syntax
INSTR(), Section 11.4, String Functions
INT data type, Section 10.1.1, Overview of Numeric Types
INTEGER data type, Section 10.1.1, Overview of Numeric Types
INTERVAL(), Section 11.2.3, Comparison Functions and Operators
IS NOT NULL, Section 11.2.3, Comparison Functions and Operators
IS NOT boolean_value, Section 11.2.3, Comparison Functions and Op-
erators
IS NULL, Section 7.2.8, IS NULL Optimization, Section 11.2.3,
Comparison Functions and Operators
and indexes, Section 7.4.4, How MySQL Uses Indexes
IS boolean_value, Section 11.2.3, Comparison Functions and Operat-
ors
ISAM storage engine, Chapter 13, Storage Engines
ISNULL(), Section 11.2.3, Comparison Functions and Operators
ISOLATION LEVEL, Section 12.4.6, SET TRANSACTION Syntax
IS_FREE_LOCK(), Section 11.11.4, Miscellaneous Functions
IS_USED_LOCK(), Section 11.11.4, Miscellaneous Functions
Id, Section 17.3.4.7, Defining SQL and Other API Nodes in a MySQL
Cluster, Section 17.3.4.6, Defining MySQL Cluster Data Nodes, Sec-
tion 17.3.4.5, Defining a MySQL Cluster Management Server
IndexMemory, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes, Section 17.3.6, Configuring MySQL Cluster Parameters for
Local Checkpoints
Init DB
thread command, Section 7.5.6.1, Thread Command Values
InitFragmentLogFiles, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
InitialLogFileGroup, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
InitialNoOfOpenFiles, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
InitialTablespace, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Initialized
thread state, Section 7.5.6.9, Event Scheduler Thread States
InnoDB, Section 13.6, The InnoDB Storage Engine
Monitors, Section 13.6.11.2, File Space Management, Sec-
tion 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions, Section 13.6.13.2, SHOW ENGINE INNODB STATUS and
the InnoDB Monitors, Section 13.6.6, Backing Up and Recovering
an InnoDB Database, Section 13.6.13.3, InnoDB General
Troubleshooting
NFS, Section 13.6.14, Restrictions on InnoDB Tables, Sec-
tion 13.6.2, InnoDB Configuration
Solaris 10 x86_64 issues, Section 2.13.3, Solaris Notes
clustered index, Section 13.6.10.1, Clustered and Secondary In-
dexes
gap lock, Section 13.6.8.4, InnoDB Record, Gap, and Next-Key
Locks, Section 13.6.8, The InnoDB Transaction Model and Lock-
ing, Section 13.6.8.5, Avoiding the Phantom Problem Using Next-
Key Locking, Section 13.6.3, InnoDB Startup Options and System
Variables
index-record lock, Section 13.6.8.4, InnoDB Record, Gap, and
Next-Key Locks, Section 13.6.8, The InnoDB Transaction Model
and Locking, Section 13.6.8.5, Avoiding the Phantom Problem Us-
ing Next-Key Locking, Section 13.6.3, InnoDB Startup Options
and System Variables
next-key lock, Section 13.6.8.4, InnoDB Record, Gap, and Next-
Key Locks, Section 13.6.8, The InnoDB Transaction Model and
Locking, Section 13.6.8.5, Avoiding the Phantom Problem Using
Next-Key Locking, Section 13.6.3, InnoDB Startup Options and
System Variables
record-level locks, Section 13.6.8.4, InnoDB Record, Gap, and
Next-Key Locks, Section 13.6.8, The InnoDB Transaction Model
and Locking, Section 13.6.8.5, Avoiding the Phantom Problem Us-
ing Next-Key Locking, Section 13.6.3, InnoDB Startup Options
and System Variables
secondary index, Section 13.6.10.1, Clustered and Secondary In-
dexes
semi-consistent read, Section 13.6.3, InnoDB Startup Options and
System Variables
transaction isolation levels, Section 13.6.8, The InnoDB Transac-
tion Model and Locking
InnoDB storage engine, Section 13.6, The InnoDB Storage Engine,
Chapter 13, Storage Engines
InnoDB tables, Section 1.7.5.2, Transactions and Atomic Operations
InteriorRingN(), Section 11.13.5.2.5, Polygon Functions
Intersection(), Section 11.13.5.3.2, Spatial Operators
Intersects(), Section 11.13.5.6, Functions That Test Spatial Relation-
ships Between Geometries
IsClosed(), Section 11.13.5.2.4, MultiLineString Functions
IsEmpty(), Section 11.13.5.2.1, General Geometry Functions
IsRing(), Section 11.13.5.2.3, LineString Functions
IsSimple(), Section 11.13.5.2.1, General Geometry Functions
i-am-a-dummy option
mysql, Section 4.5.1.1, mysql Options
i5/OS, Section 2.7, Installing MySQL on i5/OS
icc
and MySQL Cluster support>, Section 22.5, Debugging and Porting
MySQL
id option
ndb_config, Description
identifiers, Section 8.2, Schema Object Names
case sensitivity, Section 8.2.2, Identifier Case Sensitivity
quoting, Section 8.2, Schema Object Names
identity session variable, Section 5.1.5, Session System Variables
ignore option
mysqlimport, Description
ignore-builtin-innodb option
mysqld, Section 13.6.3, InnoDB Startup Options and System Vari-
ables
ignore-lines option
mysqlimport, Description
ignore-spaces option
mysql, Section 4.5.1.1, mysql Options
ignore-table option
mysqldump, Description
implicit default values, Section 10.1.4, Data Type Default Values
importing
data, Section 4.5.5, mysqlimport A Data Import Program,
Section 4.5.1.4, Executing SQL Statements from a Text File
in_file option
comp_err, Description
include option
mysql_config, Description
Standard Index
3251
increasing
performance, Section 16.3.4, Replication FAQ
increasing with replication
speed, Chapter 16, Replication
index
deleting, Section 12.1.7, ALTER TABLE Syntax, Section 12.1.24,
DROP INDEX Syntax
rebuilding, Section 2.12.4, Rebuilding or Repairing Tables or In-
dexes
index hints, Section 12.2.8.2, Index Hint Syntax, Section 12.2.8, SE-
LECT Syntax
index join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
index-record lock
InnoDB, Section 13.6.8.4, InnoDB Record, Gap, and Next-Key
Locks, Section 13.6.8, The InnoDB Transaction Model and Lock-
ing, Section 13.6.8.5, Avoiding the Phantom Problem Using Next-
Key Locking, Section 13.6.3, InnoDB Startup Options and System
Variables
index_merge join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
index_subquery join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
indexes, Section 12.1.13, CREATE INDEX Syntax
and BLOB columns, Section 12.1.17, CREATE TABLE Syntax,
Section 7.4.2, Column Indexes
and IS NULL, Section 7.4.4, How MySQL Uses Indexes
and LIKE, Section 7.4.4, How MySQL Uses Indexes
and NULL values, Section 12.1.17, CREATE TABLE Syntax
and TEXT columns, Section 12.1.17, CREATE TABLE Syntax,
Section 7.4.2, Column Indexes
assigning to key cache, Section 12.5.6.2, CACHE INDEX Syntax
block size, Section 5.1.4, Server System Variables
columns, Section 7.4.2, Column Indexes
leftmost prefix of, Section 7.4.4, How MySQL Uses Indexes
multi-column, Section 7.4.3, Multiple-Column Indexes
multiple-part, Section 12.1.13, CREATE INDEX Syntax
names, Section 8.2, Schema Object Names
use of, Section 7.4.4, How MySQL Uses Indexes
information functions, Section 11.11.3, Information Functions
information option
myisamchk, Section 4.6.3.2, myisamchk Check Options
init
thread state, Section 7.5.6.2, General Thread States
init-file option
mysqld, Section 5.1.2, Server Command Options
init_connect system variable, Section 5.1.4, Server System Variables
init_file system variable, Section 5.1.4, Server System Variables
init_slave system variable, Section 16.1.3.3, Replication Slave Options
and Variables
innochecksum, Section 4.6.1, innochecksum Offline InnoDB
File Checksum Utility, Section 4.1, Overview of MySQL Programs
innodb option
mysqld, Section 13.6.3, InnoDB Startup Options and System Vari-
ables
innodb_status_file option
mysqld, Section 13.6.3, InnoDB Startup Options and System Vari-
ables
insert
thread state, Section 7.5.6.3, Delayed-Insert Thread States
insert-ignore option
mysqldump, Description
insert_id session variable, Section 5.1.5, Session System Variables
insertable views
insertable, Section 19.5.3, Updatable and Insertable Views
inserting
speed of, Section 7.2.21, Speed of INSERT Statements
inserts
concurrent, Section 7.3.1, Internal Locking Methods, Section 7.3.3,
Concurrent Inserts
install option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
installation layouts, Section 2.1.5, Installation Layouts
installation overview, Section 2.10, MySQL Installation Using a Source
Distribution
installing
Linux RPM packages, Section 2.4, Installing MySQL from RPM
Packages on Linux
Mac OS X PKG packages, Section 2.5, Installing MySQL on Mac
OS X
Perl, Section 2.15, Perl Installation Notes
Perl on Windows, Section 2.15.2, Installing ActiveState Perl on
Windows
Solaris PKG packages, Section 2.6, Installing MySQL on Solaris
binary distribution, Section 2.9, Installing MySQL from tar.gz
Packages on Other Unix-Like Systems
overview, Chapter 2, Installing and Upgrading MySQL
source distribution, Section 2.10, MySQL Installation Using a
Source Distribution
user-defined functions, Section 22.3.2.5, Compiling and Installing
User-Defined Functions
installing MySQL Cluster, Section 17.3.2, Installing MySQL Cluster
Software, Section 17.2.2, MySQL Cluster Multi-Computer Installa-
tion, Section 17.2, MySQL Cluster Multi-Computer How-To
installing plugins, Section 12.5.3.3, INSTALL PLUGIN Syntax
integers, Section 8.1.2, Numbers
interactive_timeout system variable, Section 5.1.4, Server System Vari-
ables
internal compiler errors, Section 2.10.4, Dealing with Problems Com-
piling MySQL
internal locking, Section 7.3.1, Internal Locking Methods
internals, Section 22.1, MySQL Internals
internationalization, Chapter 9, Internationalization and Localization
introducer
string literal, Section 8.1.1, Strings, Section 9.1.3.5, Character
String Literal Character Set and Collation
invalid data
constraint, Section 1.7.6.2, Constraints on Invalid Data
isamchk, Section 4.1, Overview of MySQL Programs
isamlog, Section 4.6.4, myisamlog Display MyISAM Log File
Contents, Section 4.1, Overview of MySQL Programs
iterations option
mysqlslap, Description
J
JOIN, Section 12.2.8.1, JOIN Syntax
Japanese character sets
conversion, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
Japanese, Korean, Chinese character sets
frequently asked questions, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
join
nested-loop algorithm, Section 7.2.11, Nested Join Optimization
join algorithm
Block Nested-Loop, Section 7.2.10, Nested-Loop Join Algorithms
Nested-Loop, Section 7.2.10, Nested-Loop Join Algorithms
join option
Standard Index
3252
myisampack, Description
join type
ALL, Section 7.2.1, Optimizing Queries with EXPLAIN
const, Section 7.2.1, Optimizing Queries with EXPLAIN
eq_ref, Section 7.2.1, Optimizing Queries with EXPLAIN
fulltext, Section 7.2.1, Optimizing Queries with EXPLAIN
index, Section 7.2.1, Optimizing Queries with EXPLAIN
index_merge, Section 7.2.1, Optimizing Queries with EXPLAIN
index_subquery, Section 7.2.1, Optimizing Queries with EXPLAIN
range, Section 7.2.1, Optimizing Queries with EXPLAIN
ref, Section 7.2.1, Optimizing Queries with EXPLAIN
ref_or_null, Section 7.2.1, Optimizing Queries with EXPLAIN
system, Section 7.2.1, Optimizing Queries with EXPLAIN
unique_subquery, Section 7.2.1, Optimizing Queries with
EXPLAIN
join_buffer_size system variable, Section 5.1.4, Server System Vari-
ables
join_cache_level system variable, Section 5.1.4, Server System Vari-
ables
K
KEY_COLUMN_USAGE
INFORMATION_SCHEMA table, Section 20.13, The INFORMA-
TION_SCHEMA KEY_COLUMN_USAGE Table
KILL, Section 12.5.6.4, KILL Syntax
Key cache
MyISAM, Section 7.4.5, The MyISAM Key Cache
Kill
thread command, Section 7.5.6.1, Thread Command Values
Killed
thread state, Section 7.5.6.2, General Thread States
Killing slave
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
Korean, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese,
and Korean Character Sets
Korean, Chinese, Japanese character sets
frequently asked questions, Section A.11, MySQL 5.1 FAQ
MySQL Chinese, Japanese, and Korean Character Sets
keep_files_on_create system variable, Section 5.1.4, Server System
Variables
keepold option
mysqlhotcopy, Description
key cache
assigning indexes to, Section 12.5.6.2, CACHE INDEX Syntax
key partitioning, Section 18.2.4, KEY Partitioning
key partitions
managing, Section 18.3.2, Management of HASH and KEY Parti-
tions
splitting and merging, Section 18.3.2, Management of HASH and
KEY Partitions
key space
MyISAM, Section 13.5.2, Space Needed for Keys
key_buffer_size myisamchk variable, Section 4.6.3.1, myisamchk
General Options
key_buffer_size system variable, Section 5.1.4, Server System Vari-
ables
key_cache_age_threshold system variable, Section 5.1.4, Server System
Variables
key_cache_block_size system variable, Section 5.1.4, Server System
Variables
key_cache_division_limit system variable, Section 5.1.4, Server System
Variables
keys, Section 7.4.2, Column Indexes
foreign, Section 3.6.6, Using Foreign Keys, Section 1.7.5.4,
Foreign Keys
multi-column, Section 7.4.3, Multiple-Column Indexes
searching on two, Section 3.6.7, Searching on Two Keys
keys option
mysqlshow, Description
keys-used option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
keywords, Section 8.3, Reserved Words
known errors, Section B.1.8, Known Issues in MySQL
L
LAST_DAY(), Section 11.6, Date and Time Functions
LAST_INSERT_ID(), Section 1.7.5.2, Transactions and Atomic Opera-
tions, Section 12.2.5, INSERT Syntax
and replication, Section 16.3.1.1, Replication and
AUTO_INCREMENT
LAST_INSERT_ID() and stored routines, Section 19.2.4, Stored Pro-
cedures, Functions, Triggers, and LAST_INSERT_ID()
LAST_INSERT_ID() and triggers, Section 19.2.4, Stored Procedures,
Functions, Triggers, and LAST_INSERT_ID()
LAST_INSERT_ID([<replaceable>expr</replaceable>]), Sec-
tion 11.11.3, Information Functions
LCASE(), Section 11.4, String Functions
LD_LIBRARY_PATH environment variable, Section 2.15.3, Problems
Using the Perl DBI/DBD Interface
LD_RUN_PATH environment variable, Section 2.15.3, Problems Us-
ing the Perl DBI/DBD Interface, Section 2.13.1.3, Linux Source Distri-
bution Notes, Section 2.13.3, Solaris Notes, Section 2.14,
Environment Variables
LEAST(), Section 11.2.3, Comparison Functions and Operators
LEFT JOIN, Section 7.2.9, LEFT JOIN and RIGHT JOIN Optimiza-
tion, Section 12.2.8.1, JOIN Syntax
LEFT OUTER JOIN, Section 12.2.8.1, JOIN Syntax
LEFT(), Section 11.4, String Functions
LENGTH(), Section 11.4, String Functions
LIKE, Section 11.4.1, String Comparison Functions
and indexes, Section 7.4.4, How MySQL Uses Indexes
and wildcards, Section 7.4.4, How MySQL Uses Indexes
LIMIT, Section 7.2.17, LIMIT Optimization, Section 12.2.8, SE-
LECT Syntax, Section 11.11.3, Information Functions
and replication, Section 16.3.1.11, Replication and LIMIT
LINESTRING data type, Section 11.13.4.1, MySQL Spatial Data
Types
LN(), Section 11.5.2, Mathematical Functions
LOAD DATA
and replication, Section 16.3.1.12, Replication and LOAD DATA
LOAD DATA FROM MASTER, Section 12.6.2.2, LOAD DATA
FROM MASTER Syntax
LOAD DATA INFILE, Section B.1.5.3, Problems with NULL Values,
Section 12.2.6, LOAD DATA INFILE Syntax
LOAD INDEX INTO CACHE
and partitioning, Section 18.5, Restrictions and Limitations on Parti-
tioning
LOAD TABLE FROM MASTER, Section 12.6.2.3, LOAD TABLE
tbl_name FROM MASTER Syntax
LOAD_FILE(), Section 11.4, String Functions
LOCALTIME, Section 11.6, Date and Time Functions
LOCALTIMESTAMP, Section 11.6, Date and Time Functions
LOCATE(), Section 11.4, String Functions
LOCK IN SHARE MODE, Section 12.2.8, SELECT Syntax
LOCK TABLES, Section 12.4.5, LOCK TABLES and UNLOCK
TABLES Syntax
LOG(), Section 11.5.2, Mathematical Functions
Standard Index
3253
LOG10(), Section 11.5.2, Mathematical Functions
LOG2(), Section 11.5.2, Mathematical Functions
LONG data type, Section 10.4.3, The BLOB and TEXT Types
LONGBLOB data type, Section 10.1.3, Overview of String Types
LONGTEXT data type, Section 10.1.3, Overview of String Types
LOWER(), Section 11.4, String Functions
LPAD(), Section 11.4, String Functions
LTRIM(), Section 11.4, String Functions
LineFromText(), Section 11.13.4.2.1, Creating Geometry Values Using
WKT Functions
LineFromWKB(), Section 11.13.4.2.2, Creating Geometry Values Us-
ing WKB Functions
LineString(), Section 11.13.4.2.3, Creating Geometry Values Using
MySQL-Specific Functions
LineStringFromText(), Section 11.13.4.2.1, Creating Geometry Values
Using WKT Functions
LineStringFromWKB(), Section 11.13.4.2.2, Creating Geometry Val-
ues Using WKB Functions
Linux
binary distribution, Section 2.13.1.2, Linux Binary Distribution
Notes
source distribution, Section 2.13.1.3, Linux Source Distribution
Notes
Lock Monitor
InnoDB, Section 13.6.13.2, SHOW ENGINE INNODB STATUS
and the InnoDB Monitors
LockExecuteThreadToCPU, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
LockMaintThreadsToCPU, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
LockPagesInMainMemory, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
Locked
thread state, Section 7.5.6.2, General Thread States
LogDestination, Section 17.3.4.5, Defining a MySQL Cluster Manage-
ment Server
LogLevelCheckpoint (MySQL Cluster configuration parameter), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
LogLevelCongestion, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
LogLevelConnection (MySQL Cluster configuration parameter), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
LogLevelError, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
LogLevelInfo, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
LogLevelNodeRestart (MySQL Cluster configuration parameter), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
LogLevelShutdown, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
LogLevelStartup, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
LogLevelStatistic (MySQL Cluster configuration parameter), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
Long Data
thread command, Section 7.5.6.1, Thread Command Values
LongMessageBuffer, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
language option
mysqld, Section 5.1.2, Server Command Options
language support
error messages, Section 9.3, Setting the Error Message Language
language system variable, Section 5.1.4, Server System Variables
large page support, Section 7.5.9, Enabling Large Page Support
large-pages option
mysqld, Section 5.1.2, Server Command Options
large_files_support system variable, Section 5.1.4, Server System Vari-
ables
large_page_size system variable, Section 5.1.4, Server System Vari-
ables
large_pages system variable, Section 5.1.4, Server System Variables
last row
unique ID, Section 21.10.10.3, How to Get the Unique ID for the
Last Inserted Row
last_insert_id session variable, Section 5.1.5, Session System Vari-
ables
layout of installation, Section 2.1.5, Installation Layouts
lc_time_names system variable, Section 5.1.4, Server System Vari-
ables
ledir option
mysqld_safe, Description
leftmost prefix of indexes, Section 7.4.4, How MySQL Uses Indexes
legal names, Section 8.2, Schema Object Names
length option
myisam_ftdump, Description
less than (<), Section 11.2.3, Comparison Functions and Operators
less than or equal (<=), Section 11.2.3, Comparison Functions and Op-
erators
libmysqld, Section 21.9, libmysqld, the Embedded MySQL Server Lib-
rary
options, Section 21.9.3, Options with the Embedded Server
libmysqld-libs option
mysql_config, Description
library
mysqlclient, Chapter 21, Connectors and APIs
mysqld, Chapter 21, Connectors and APIs
libs option
mysql_config, Description
libs_r option
mysql_config, Description
license system variable, Section 5.1.4, Server System Variables
limitations
MySQL Limitations, Section D.7, Limits in MySQL
design, Section 7.1.1, MySQL Design Limitations and Tradeoffs
replication, Section 16.3.1, Replication Features and Issues
limitations of MySQL Cluster, Section 17.12, Known Limitations of
MySQL Cluster
limits
MySQL Limits, limits in MySQL, Section D.7, Limits in MySQL
file-size, Section B.1.2.12, The table is full
line-numbers option
mysql, Section 4.5.1.1, mysql Options
linear hash partitioning, Section 18.2.3.1, LINEAR HASH Partitioning
linear key partitioning, Section 18.2.4, KEY Partitioning
linefeed (\n), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
lines-terminated-by option
mysqldump, Description, Description
linking, Section 21.10.16, Building Client Programs
errors, Section B.1.3.1, Problems Linking to the MySQL Client Lib-
rary
problems, Section 21.10.10.4, Problems Linking with the C API
speed, Section 7.5.1, How Compiling and Linking Affects the Speed
of MySQL
links
symbolic, Section 7.6.1, Using Symbolic Links
list partitioning, Section 18.2.2, LIST Partitioning
list partitions
adding and dropping, Section 18.3.1, Management of RANGE and
LIST Partitions
managing, Section 18.3.1, Management of RANGE and LIST Parti-
Standard Index
3254
tions
list-users option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
literals, Section 8.1, Literal Values
load emulation, Section 4.5.7, mysqlslap Load Emulation Client
loading
tables, Section 3.3.3, Loading Data into a Table
local checkpoints (MySQL Cluster), Section 17.3.6, Configuring
MySQL Cluster Parameters for Local Checkpoints
local option
mysqlimport, Description
local-infile option
mysql, Section 4.5.1.1, mysql Options
mysqld, Section 5.3.3, Security-Related mysqld Options
local-load option
mysqlbinlog, Description
local_infile system variable, Section 5.1.4, Server System Variables
localization, Chapter 9, Internationalization and Localization
localstatedir option
configure, Section 2.10.2, Typical configure Options
lock option
ndb_select_all, Description
lock-all-tables option
mysqldump, Description
lock-directory option
mysqlslap, Description
lock-tables option
mysqldump, Description
mysqlimport, Description
locked_in_memory system variable, Section 5.1.4, Server System Vari-
ables
locking, Section 7.5.2, System Factors and Startup Parameter Tuning
external, Section 5.1.4, Server System Variables, Section 5.1.2,
Server Command Options, Section 7.5.6.2, General Thread
States, Section 7.3.4, External Locking, Section 6.4.1, Using
myisamchk for Crash Recovery
internal, Section 7.3.1, Internal Locking Methods
page-level, Section 7.3.1, Internal Locking Methods
row-level, Section 1.7.5.2, Transactions and Atomic Operations,
Section 7.3.1, Internal Locking Methods
table-level, Section 7.3.1, Internal Locking Methods
locking methods, Section 7.3.1, Internal Locking Methods
log
changes, Appendix C, MySQL Change History
log files, Section 2.10.2, Typical configure Options
maintaining, Section 5.2.6, Server Log Maintenance
log files (MySQL Cluster), Description
ndbmtd, Description
log option
mysqld, Section 5.1.2, Server Command Options
mysqld_multi, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
log system variable, Section 5.1.4, Server System Variables
log-backup-output option
mysqld, Section 5.1.2, Server Command Options
log-bin option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
log-bin-index option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
log-bin-trust-function-creators option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
log-bin-trust-routine-creators option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
log-error option
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
mysqldump, Description
log-isam option
mysqld, Section 5.1.2, Server Command Options
log-long-format option
mysqld, Section 5.1.2, Server Command Options
log-output option
mysqld, Section 5.1.2, Server Command Options
log-queries-not-using-indexes option
mysqld, Section 5.1.2, Server Command Options
log-short-format option
mysqld, Section 5.1.2, Server Command Options
log-slave-updates option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
log-slow-admin-statements option
mysqld, Section 5.1.2, Server Command Options
log-slow-queries option
mysqld, Section 5.1.2, Server Command Options
log-slow-slave-statements option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
log-tc option
mysqld, Section 5.1.2, Server Command Options
log-tc-size option
mysqld, Section 5.1.2, Server Command Options
log-warnings option
mysqld, Section 5.1.2, Server Command Options, Section 16.1.3.3,
Replication Slave Options and Variables
log_backup_output system variable, Section 5.1.4, Server System Vari-
ables
log_bin system variable, Section 5.1.4, Server System Variables
log_bin_trust_function_creators system variable, Section 5.1.4, Server
System Variables
log_error system variable, Section 5.1.4, Server System Variables
log_output system variable, Section 5.1.4, Server System Variables
log_queries_not_using_indexes system variable, Section 5.1.4, Server
System Variables
log_slave_updates system variable, Section 5.1.4, Server System Vari-
ables
log_slow_queries system variable, Section 5.1.4, Server System Vari-
ables
log_warnings system variable, Section 5.1.4, Server System Variables
logging commands (MySQL Cluster), Section 17.7.4.1, MySQL Cluster
Logging Management Commands
logging slow query
thread state, Section 7.5.6.2, General Thread States
logical operators, Section 11.2.4, Logical Operators
login
thread state, Section 7.5.6.2, General Thread States
logs
server, Section 5.2, MySQL Server Logs
long_query_time system variable, Section 5.1.4, Server System Vari-
ables
loops option
ndb_show_tables, Description
lost connection errors, Section B.1.2.3, Lost connection to
MySQL server
low-priority option
mysqlimport, Description
low-priority-updates option
mysqld, Section 5.1.2, Server Command Options
low_priority_updates system variable, Section 5.1.4, Server System
Variables
lower_case_file_system system variable, Section 5.1.4, Server System
Standard Index
3255
Variables
lower_case_table_names system variable, Section 5.1.4, Server System
Variables
M
MAKEDATE(), Section 11.6, Date and Time Functions
MAKETIME(), Section 11.6, Date and Time Functions
MAKE_SET(), Section 11.4, String Functions
MASTER_POS_WAIT(), Section 12.6.2.4, MASTER_POS_WAIT()
Syntax, Section 11.11.4, Miscellaneous Functions
MATCH ... AGAINST(), Section 11.8, Full-Text Search Functions
MAX(), Section 11.12.1, GROUP BY (Aggregate) Functions
MAX(DISTINCT), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
MAXDB SQL mode, Section 5.1.8, Server SQL Modes
MAX_CONNECTIONS_PER_HOUR, Section 5.5.4, Limiting Ac-
count Resources
MAX_QUERIES_PER_HOUR, Section 5.5.4, Limiting Account Re-
sources
MAX_UPDATES_PER_HOUR, Section 5.5.4, Limiting Account Re-
sources
MAX_USER_CONNECTIONS, Section 5.5.4, Limiting Account Re-
sources
MBR, Section 11.13.5.5, Relations on Geometry Minimal Bounding
Rectangles (MBRs)
MBRContains(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MBRDisjoint(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MBREqual(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MBRIntersects(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MBROverlaps(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MBRTouches(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MBRWithin(), Section 11.13.5.5, Relations on Geometry Minimal
Bounding Rectangles (MBRs)
MD5(), Section 11.11.2, Encryption and Compression Functions
MEDIUMBLOB data type, Section 10.1.3, Overview of String Types
MEDIUMINT data type, Section 10.1.1, Overview of Numeric Types
MEDIUMTEXT data type, Section 10.1.3, Overview of String Types
MEMORY storage engine, Chapter 13, Storage Engines, Section 13.9,
The MEMORY (HEAP) Storage Engine
and replication, Section 16.3.1.16, Replication with MEMORY
Tables
MERGE storage engine, Section 13.8, The MERGE Storage Engine,
Chapter 13, Storage Engines
MERGE tables
defined, Section 13.8, The MERGE Storage Engine
MICROSECOND(), Section 11.6, Date and Time Functions
MID(), Section 11.4, String Functions
MIN(), Section 11.12.1, GROUP BY (Aggregate) Functions
MIN(DISTINCT), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
MINUTE(), Section 11.6, Date and Time Functions
MIT-pthreads, Section 2.10.5, MIT-pthreads Notes
MLineFromText(), Section 11.13.4.2.1, Creating Geometry Values Us-
ing WKT Functions
MLineFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
MOD (modulo), Section 11.5.2, Mathematical Functions
MOD(), Section 11.5.2, Mathematical Functions
MONTH(), Section 11.6, Date and Time Functions
MONTHNAME(), Section 11.6, Date and Time Functions
MPointFromText(), Section 11.13.4.2.1, Creating Geometry Values Us-
ing WKT Functions
MPointFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
MPolyFromText(), Section 11.13.4.2.1, Creating Geometry Values Us-
ing WKT Functions
MPolyFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
MSSQL SQL mode, Section 5.1.8, Server SQL Modes
MULTILINESTRING data type, Section 11.13.4.1, MySQL Spatial
Data Types
MULTIPOINT data type, Section 11.13.4.1, MySQL Spatial Data
Types
MULTIPOLYGON data type, Section 11.13.4.1, MySQL Spatial Data
Types
MYSQL C type, Section 21.10.1, C API Data Types
MYSQL323 SQL mode, Section 5.1.8, Server SQL Modes
MYSQL40 SQL mode, Section 5.1.8, Server SQL Modes
MYSQL_BIND C type, Section 21.10.5, C API Prepared Statement
Data types
MYSQL_DEBUG environment variable, Section 22.5.2, Debugging a
MySQL Client, Section 4.1, Overview of MySQL Programs, Sec-
tion 2.14, Environment Variables
MYSQL_FIELD C type, Section 21.10.1, C API Data Types
MYSQL_FIELD_OFFSET C type, Section 21.10.1, C API Data Types
MYSQL_GROUP_SUFFIX environment variable, Section 2.14,
Environment Variables
MYSQL_HISTFILE environment variable, Section 4.5.1.1, mysql
Options, Section 2.14, Environment Variables
MYSQL_HOME environment variable, Section 2.14, Environment
Variables
MYSQL_HOST environment variable, Section 4.2.2, Connecting to the
MySQL Server, Section 2.14, Environment Variables
MYSQL_PS1 environment variable, Section 2.14, Environment Vari-
ables
MYSQL_PWD environment variable, Section 4.2.2, Connecting to the
MySQL Server, Section 4.1, Overview of MySQL Programs, Sec-
tion 2.14, Environment Variables
MYSQL_RES C type, Section 21.10.1, C API Data Types
MYSQL_ROW C type, Section 21.10.1, C API Data Types
MYSQL_STMT C type, Section 21.10.5, C API Prepared Statement
Data types
MYSQL_TCP_PORT environment variable, Section 5.6.2, Running
Multiple Servers on Unix, Section 5.6.3, Using Client Programs in a
Multiple-Server Environment, Section 4.1, Overview of MySQL Pro-
grams, Section 2.14, Environment Variables
MYSQL_TIME C type, Section 21.10.5, C API Prepared Statement
Data types
MYSQL_UNIX_PORT environment variable, Section 5.6.2, Running
Multiple Servers on Unix, Section 5.6.3, Using Client Programs in a
Multiple-Server Environment, Section 4.1, Overview of MySQL Pro-
grams, Section 2.14, Environment Variables, Section 2.11.2.1,
Problems Running mysql_install_db
Mac OS X, Section 21.1, MySQL Connector/ODBC
installation, Section 2.5, Installing MySQL on Mac OS X
Making temp file
thread state, Section 7.5.6.6, Replication Slave SQL Thread States
MaxBufferedEpochs, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxLCPStartDelay, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxNoOfAttributes, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Standard Index
3256
MaxNoOfConcurrentIndexOperations, Section 17.3.4.6, Defining
MySQL Cluster Data Nodes
MaxNoOfConcurrentOperations, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
MaxNoOfConcurrentScans, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
MaxNoOfConcurrentTransactions, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
MaxNoOfExecutionThreads
ndbmtd, Description
MaxNoOfFiredTriggers, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
MaxNoOfIndexes, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxNoOfLocalOperations, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
MaxNoOfLocalScans, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxNoOfOpenFiles, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxNoOfOrderedIndexes, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
MaxNoOfSavedMessages, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
MaxNoOfTables, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxNoOfTriggers, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
MaxNoOfUniqueHashIndexes, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
MaxScanBatchSize, Section 17.3.4.7, Defining SQL and Other API
Nodes in a MySQL Cluster
MemReportFrequency, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
Minimum Bounding Rectangle, Section 11.13.5.5, Relations on Geo-
metry Minimal Bounding Rectangles (MBRs)
Monitors
InnoDB, Section 13.6.11.2, File Space Management, Sec-
tion 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions, Section 13.6.13.2, SHOW ENGINE INNODB STATUS and
the InnoDB Monitors, Section 13.6.6, Backing Up and Recovering
an InnoDB Database, Section 13.6.13.3, InnoDB General
Troubleshooting
MultiLineString(), Section 11.13.4.2.3, Creating Geometry Values Us-
ing MySQL-Specific Functions
MultiLineStringFromText(), Section 11.13.4.2.1, Creating Geometry
Values Using WKT Functions
MultiLineStringFromWKB(), Section 11.13.4.2.2, Creating Geometry
Values Using WKB Functions
MultiPoint(), Section 11.13.4.2.3, Creating Geometry Values Using
MySQL-Specific Functions
MultiPointFromText(), Section 11.13.4.2.1, Creating Geometry Values
Using WKT Functions
MultiPointFromWKB(), Section 11.13.4.2.2, Creating Geometry Val-
ues Using WKB Functions
MultiPolygon(), Section 11.13.4.2.3, Creating Geometry Values Using
MySQL-Specific Functions
MultiPolygonFromText(), Section 11.13.4.2.1, Creating Geometry Val-
ues Using WKT Functions
MultiPolygonFromWKB(), Section 11.13.4.2.2, Creating Geometry
Values Using WKB Functions
MyISAM
compressed tables, Section 4.6.5, myisampack Generate Com-
pressed, Read-Only MyISAM Tables, Section 13.5.3.3,
Compressed Table Characteristics
MyISAM key cache, Section 7.4.5, The MyISAM Key Cache
MyISAM storage engine, Section 13.5, The MyISAM Storage Engine,
Chapter 13, Storage Engines
MyODBC, Section 21.1, MySQL Connector/ODBC
MySQL Cluster, Chapter 17, MySQL Cluster NDB 6.X/7.X
"quick" configuration, Section 17.3.3, Quick Test Setup of MySQL
Cluster
<errortext>Table is full</errortext> error, Section A.10, MySQL 5.1
FAQ MySQL Cluster
<foreignphrase>vs</foreignphrase> replication, Section A.10,
MySQL 5.1 FAQ MySQL Cluster
API node, Section 17.3.4.7, Defining SQL and Other API Nodes in
a MySQL Cluster, Section 17.1.1, MySQL Cluster Core Concepts
CHECKPOINT Events, Section 17.7.4.2, MySQL Cluster Log
Events
CLUSTERLOG STATISTICS command, Section 17.7.4.3, Using
CLUSTERLOG STATISTICS in the MySQL Cluster Management
Client
CLUSTERLOG commands, Section 17.7.4.1, MySQL Cluster Log-
ging Management Commands
CONNECTION Events, Section 17.7.4.2, MySQL Cluster Log
Events
CREATE NODEGROUP command, Section 17.7.2, Commands in
the MySQL Cluster Management Client
DROP NODEGROUP command, Section 17.7.2, Commands in the
MySQL Cluster Management Client
ENTER SINGLE USER MODE command, Section 17.7.2,
Commands in the MySQL Cluster Management Client
ERROR Events, Section 17.7.4.2, MySQL Cluster Log Events
EXIT SINGLE USER MODE command, Section 17.7.2,
Commands in the MySQL Cluster Management Client
EXIT command, Section 17.7.2, Commands in the MySQL Cluster
Management Client
FAQ, Section A.10, MySQL 5.1 FAQ MySQL Cluster
GCP Stop errors, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
HELP command, Section 17.7.2, Commands in the MySQL Cluster
Management Client
HostName parameter
and security, Section 17.8.1, MySQL Cluster Security and Net-
working Issues
INFO Events, Section 17.7.4.2, MySQL Cluster Log Events
NODERESTART Events, Section 17.7.4.2, MySQL Cluster Log
Events
QUIT command, Section 17.7.2, Commands in the MySQL Cluster
Management Client
REPORT command, Section 17.7.2, Commands in the MySQL
Cluster Management Client
RESTART command, Section 17.7.2, Commands in the MySQL
Cluster Management Client
SCI (Scalable Coherent Interface), Section 17.11.1, Configuring
MySQL Cluster to use SCI Sockets, Section 17.3.4.11, SCI Trans-
port Connections in MySQL Cluster
SHOW command, Section 17.7.2, Commands in the MySQL
Cluster Management Client
SHUTDOWN command, Section 17.7.2, Commands in the MySQL
Cluster Management Client
SQL node, Section 17.3.4.7, Defining SQL and Other API Nodes in
a MySQL Cluster, Section 17.1.1, MySQL Cluster Core Concepts
SQL nodes, Section 17.6.1, MySQL Server Usage for MySQL
Cluster
SQL statements, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
SQL statements for monitoring, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
Standard Index
3257
START command, Section 17.7.2, Commands in the MySQL
Cluster Management Client
STARTUP Events, Section 17.7.4.2, MySQL Cluster Log Events
STATISTICS Events, Section 17.7.4.2, MySQL Cluster Log
Events
STATUS command, Section 17.7.2, Commands in the MySQL
Cluster Management Client
STOP command, Section 17.7.2, Commands in the MySQL Cluster
Management Client
administration, Section 17.6.24.4, Program Options for ndb_mgm,
Section 17.6.24.5, Program Options for nd-
bd_redo_log_reader, Section 17.6.24.2, Program Options for
ndbd and ndbmtd, Description, Section 17.6.24.3, Program Op-
tions for ndb_mgmd, Description, Section 17.7.2, Commands in
the MySQL Cluster Management Client, Section 17.7.4.3, Using
CLUSTERLOG STATISTICS in the MySQL Cluster Management
Client, Description, Section 17.6.23, Options Common to MySQL
Cluster Programs, Section 17.6.5, ndb_mgm The MySQL
Cluster Management Client, Section 17.4.2, mysqld Command
Options for MySQL Cluster
and DNS, Section 17.2, MySQL Cluster Multi-Computer How-To
and INFORMATION_SCHEMA, Section 17.8.2, MySQL Cluster
and MySQL Privileges
and IP addressing, Section 17.2, MySQL Cluster Multi-Computer
How-To
and MySQL privileges, Section 17.8.2, MySQL Cluster and MySQL
Privileges
and MySQL root user, Section 17.8.2, MySQL Cluster and MySQL
Privileges, Section 17.8.3, MySQL Cluster and MySQL Security
Procedures
and networking, Section 17.2.1, MySQL Cluster Hardware, Soft-
ware, and Networking Requirements
and transactions, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
arbitrator, Section A.10, MySQL 5.1 FAQ MySQL Cluster
available platforms, Chapter 17, MySQL Cluster NDB 6.X/7.X
backups, Section 17.7.3.1, MySQL Cluster Backup Concepts, Sec-
tion 17.6.17, ndb_restore Restore a MySQL Cluster
Backup, Section 17.7.3.4, MySQL Cluster Backup Troubleshoot-
ing, Section 17.7.3, Online Backup of MySQL Cluster, Sec-
tion 17.7.3.3, Configuration for MySQL Cluster Backups, Sec-
tion 17.7.3.2, Using The MySQL Cluster Management Client to
Create a Backup
benchmarks, Section 17.11.2, MySQL Cluster Interconnects and
Performance
cluster logs, Section 17.7.4.1, MySQL Cluster Logging Manage-
ment Commands, Section 17.7.4, Event Reports Generated in
MySQL Cluster
commands, Section 17.6.24.4, Program Options for ndb_mgm,
Section 17.6.24.2, Program Options for ndbd and ndbmtd, De-
scription, Section 17.6.24.3, Program Options for ndb_mgmd, De-
scription, Section 17.7.2, Commands in the MySQL Cluster Man-
agement Client, Description, Section 17.4.2, mysqld Command
Options for MySQL Cluster
compiling from source, Section 17.3.1, Building MySQL Cluster
from Source Code
compiling with icc, Section 22.5, Debugging and Porting MySQL
concepts, Section 17.1.1, MySQL Cluster Core Concepts
configuration, Section 17.3.4.7, Defining SQL and Other API Nodes
in a MySQL Cluster, Section 17.3.4.5, Defining a MySQL Cluster
Management Server, Section 17.3.6, Configuring MySQL Cluster
Parameters for Local Checkpoints, Section 17.6.1, MySQL Server
Usage for MySQL Cluster, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes, Section 17.3.4.4, Defining Computers in a
MySQL Cluster, Description, Section 17.2, MySQL Cluster Multi-
Computer How-To, Section 17.3.3, Quick Test Setup of MySQL
Cluster, Section 17.3, MySQL Cluster Configuration
configuration (example), Section 17.3.4.1, MySQL Cluster Config-
uration Basic Example
configuration changes, Section 17.5.1, Performing a Rolling Restart
of a MySQL Cluster
configuration files, Section 17.2.3, MySQL Cluster Multi-Computer
Configuration, Section 17.3.4, MySQL Cluster Configuration
Files
configuration parameters, Section 17.3.5.1, MySQL Cluster Data
Node Configuration Parameters, Section 17.3.5, Overview of
MySQL Cluster Configuration Parameters, Section 17.3.5.2,
MySQL Cluster Management Node Configuration Parameters,
Section 17.3.5.3, MySQL Cluster SQL Node and API Node Config-
uration Parameters
configuring, Section 17.7.3.3, Configuration for MySQL Cluster
Backups
connectstring, Section 17.3.4.3, The MySQL Cluster Connectstring
data node, Section 17.3.4.6, Defining MySQL Cluster Data Nodes,
Section 17.1.1, MySQL Cluster Core Concepts
data nodes, Section 17.6.2, ndbd The MySQL Cluster Data
Node Daemon, Section 17.6.3, ndbmtd The MySQL Cluster
Data Node Daemon (Multi-Threaded)
data types supported, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
defining node hosts, Section 17.3.4.4, Defining Computers in a
MySQL Cluster
direct connections between nodes, Section 17.3.4.9, MySQL Cluster
TCP/IP Connections Using Direct Connections
error logs, Description
error messages, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
event log format, Section 17.7.4.2, MySQL Cluster Log Events
event logging thresholds, Section 17.7.4.1, MySQL Cluster Logging
Management Commands
event logs, Section 17.7.4.1, MySQL Cluster Logging Management
Commands, Section 17.7.4, Event Reports Generated in MySQL
Cluster
event severity levels, Section 17.7.4.1, MySQL Cluster Logging
Management Commands
event types, Section 17.7.4, Event Reports Generated in MySQL
Cluster, Section 17.7.4.2, MySQL Cluster Log Events
general description, Section 17.1, MySQL Cluster Overview
hardware requirements, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
how to obtain, Section A.10, MySQL 5.1 FAQ MySQL Cluster
importing existing tables, Section A.10, MySQL 5.1 FAQ
MySQL Cluster
information sources, Chapter 17, MySQL Cluster NDB 6.X/7.X
insecurity of communication protocols, Section 17.8.1, MySQL
Cluster Security and Networking Issues
installation, Section 17.3.2, Installing MySQL Cluster Software,
Section 17.2.2, MySQL Cluster Multi-Computer Installation, Sec-
tion 17.2, MySQL Cluster Multi-Computer How-To
interconnects, Section 17.11, Using High-Speed Interconnects with
MySQL Cluster
log files, Description, Description
logging commands, Section 17.7.4.1, MySQL Cluster Logging
Management Commands
management client (ndb_mgm), Section 17.6.5, ndb_mgm The
MySQL Cluster Management Client
management commands, Section 17.7.4.3, Using CLUSTERLOG
STATISTICS in the MySQL Cluster Management Client
management node, Section 17.3.4.5, Defining a MySQL Cluster
Management Server, Section 17.1.1, MySQL Cluster Core Con-
Standard Index
3258
cepts
management nodes, Section 17.6.4, ndb_mgmd The MySQL
Cluster Management Server Daemon
managing, Section 17.7, Management of MySQL Cluster
master node, Section A.10, MySQL 5.1 FAQ MySQL Cluster
memory requirements, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
memory usage and recovery, Section 17.5.1, Performing a Rolling
Restart of a MySQL Cluster, Section 17.12.2, Limits and Differ-
ences of MySQL Cluster from Standard MySQL Limits
mgm, Section 17.6.23, Options Common to MySQL Cluster Pro-
grams
mgm client, Section 17.7.2, Commands in the MySQL Cluster Man-
agement Client
mgm management client, Section 17.7.4.3, Using CLUSTERLOG
STATISTICS in the MySQL Cluster Management Client
mgm process, Description, Section 17.6.24.4, Program Options for
ndb_mgm
mgmd, Section 17.6.23, Options Common to MySQL Cluster Pro-
grams
mgmd process, Description, Section 17.6.24.3, Program Options for
ndb_mgmd
mysqld process, Section 17.6.1, MySQL Server Usage for MySQL
Cluster, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndb_config, Section 17.6.24.6, Program Options for ndb_config
ndb_error_reporter, Section 17.6.24.7, Program Options for
ndb_error_reporter
ndb_mgm, Section 17.6.5, ndb_mgm The MySQL Cluster Man-
agement Client, Section 17.2.4, Initial Startup of MySQL Cluster
ndb_mgmd process, Section 17.6.4, ndb_mgmd The MySQL
Cluster Management Server Daemon
ndb_restore, Section 17.6.24.8, Program Options for
ndb_restore
ndb_show_tables, Section 17.6.24.9, Program Options for
ndb_show_tables
ndb_size.pl, Section 17.6.24.10, Program Options for
ndb_size.pl
ndb_size.pl (utility), Section A.10, MySQL 5.1 FAQ MySQL
Cluster
ndbd, Section 17.6.2, ndbd The MySQL Cluster Data Node
Daemon, Section 17.6.23, Options Common to MySQL Cluster
Programs
ndbd process, Section 17.7.4.3, Using CLUSTERLOG STATIST-
ICS in the MySQL Cluster Management Client, Section 17.6.24.2,
Program Options for ndbd and ndbmtd, Description
ndbd_redo_log_reader, Section 17.6.24.5, Program Options for nd-
bd_redo_log_reader
ndbmtd, Section 17.6.3, ndbmtd The MySQL Cluster Data
Node Daemon (Multi-Threaded)
network configuration
and security, Section 17.8.1, MySQL Cluster Security and Net-
working Issues
network transporters, Section 17.11.1, Configuring MySQL Cluster
to use SCI Sockets, Section 17.11, Using High-Speed Interconnects
with MySQL Cluster
networking, Section 17.3.4.10, MySQL Cluster Shared-Memory
Connections, Section 17.3.4.9, MySQL Cluster TCP/IP Connec-
tions Using Direct Connections, Section 17.3.4.11, SCI Transport
Connections in MySQL Cluster
networking requirements, Section A.10, MySQL 5.1 FAQ
MySQL Cluster
node failure (single user mode), Section 17.7.6, MySQL Cluster
Single User Mode
node identifiers, Section 17.3.4.10, MySQL Cluster Shared-Memory
Connections, Section 17.3.4.11, SCI Transport Connections in
MySQL Cluster
node logs, Section 17.7.4, Event Reports Generated in MySQL
Cluster
node types, Section A.10, MySQL 5.1 FAQ MySQL Cluster
nodes and node groups, Section 17.1.2, MySQL Cluster Nodes,
Node Groups, Replicas, and Partitions
nodes and types, Section 17.1.1, MySQL Cluster Core Concepts
number of computers required, Section A.10, MySQL 5.1 FAQ
MySQL Cluster
obtaining, Section 17.2.2, MySQL Cluster Multi-Computer Installa-
tion
partitioning support, Section 17.12.1, Noncompliance with SQL
Syntax in MySQL Cluster
partitions, Section 17.1.2, MySQL Cluster Nodes, Node Groups,
Replicas, and Partitions
performance, Section 17.11.2, MySQL Cluster Interconnects and
Performance
performing queries, Section 17.2.5, Loading Sample Data into
MySQL Cluster and Performing Queries
platforms supported, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
process management, Section 17.6, MySQL Cluster Programs
programs, Section 17.6.24.9, Program Options for
ndb_show_tables, Section 17.6.24.8, Program Options for
ndb_restore, Section 17.6.24.6, Program Options for
ndb_config, Section 17.6.24.7, Program Options for
ndb_error_reporter, Section 17.6.24.5, Program Options for
ndbd_redo_log_reader, Section 17.6.24.10, Program Op-
tions for ndb_size.pl
replicas, Section 17.1.2, MySQL Cluster Nodes, Node Groups, Rep-
licas, and Partitions
requirements, Section 17.2.1, MySQL Cluster Hardware, Software,
and Networking Requirements
resetting, Section 17.5.1, Performing a Rolling Restart of a MySQL
Cluster
restarting, Section 17.2.6, Safe Shutdown and Restart of MySQL
Cluster
restoring backups, Section 17.6.17, ndb_restore Restore a
MySQL Cluster Backup
roles of computers, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
runtime statistics, Section 17.7.4.3, Using CLUSTERLOG STAT-
ISTICS in the MySQL Cluster Management Client
security, Section A.10, MySQL 5.1 FAQ MySQL Cluster, Sec-
tion 17.8, MySQL Cluster Security Issues
and HostName parameter, Section 17.8.1, MySQL Cluster Se-
curity and Networking Issues
and firewalls, Section 17.8.1, MySQL Cluster Security and Net-
working Issues
and network configuration, Section 17.8.1, MySQL Cluster Se-
curity and Networking Issues
and network ports, Section 17.8.1, MySQL Cluster Security and
Networking Issues
and remote administration, Section 17.8.1, MySQL Cluster Se-
curity and Networking Issues
networking, Section 17.8.1, MySQL Cluster Security and Net-
working Issues
security procedures, Section 17.8.3, MySQL Cluster and MySQL
Security Procedures
shared memory transport, Section 17.3.4.10, MySQL Cluster
Shared-Memory Connections
shutting down, Section 17.2.6, Safe Shutdown and Restart of
MySQL Cluster
single user mode, Section 17.7.6, MySQL Cluster Single User
Standard Index
3259
Mode, Section 17.7.2, Commands in the MySQL Cluster Manage-
ment Client
start phases (summary), Section 17.7.1, Summary of MySQL
Cluster Start Phases
starting, Section 17.3.3, Quick Test Setup of MySQL Cluster
starting and stopping, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
starting nodes, Section 17.2.4, Initial Startup of MySQL Cluster
starting or restarting, Section 17.7.1, Summary of MySQL Cluster
Start Phases
storage requirements, Section 10.5, Data Type Storage Require-
ments
terminology, Section 17.14, MySQL Cluster Glossary
thread states, Section 7.5.6.8, MySQL Cluster Thread States
trace files, Description
transaction handling, Section 17.12.3, Limits Relating to Transac-
tion Handling in MySQL Cluster
transactions, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
transporters
Scalable Coherent Interface (SCI), Section 17.3.4.11, SCI Trans-
port Connections in MySQL Cluster
TCP/IP, Section 17.3.4.9, MySQL Cluster TCP/IP Connections
Using Direct Connections
shared memory (SHM), Section 17.3.4.10, MySQL Cluster
Shared-Memory Connections
troubleshooting backups, Section 17.7.3.4, MySQL Cluster Backup
Troubleshooting
upgrades and downgrades, Section 17.5.2, MySQL Cluster 5.1 and
MySQL Cluster NDB 6.x/7.x Upgrade and Downgrade Compatibil-
ity, Section 17.5.1, Performing a Rolling Restart of a MySQL
Cluster, Section 17.5, Upgrading and Downgrading MySQL
Cluster
using in a virtual machine, Section A.10, MySQL 5.1 FAQ
MySQL Cluster
using tables and data, Section 17.2.5, Loading Sample Data into
MySQL Cluster and Performing Queries
MySQL Cluster Glossary, Section 17.14, MySQL Cluster Glossary
MySQL Cluster How-To, Section 17.2, MySQL Cluster Multi-
Computer How-To
MySQL Cluster limitations, Section 17.12, Known Limitations of
MySQL Cluster
CREATE TABLE statements, Section 17.12.11, Previous MySQL
Cluster Issues Resolved in MySQL 5.1 and MySQL Cluster NDB
6.x
Disk Data storage, Section 17.12.9, Limitations Relating to MySQL
Cluster Disk Data Storage
INSERT IGNORE, UPDATE IGNORE, and REPLACE statements,
Section 17.12.11, Previous MySQL Cluster Issues Resolved in
MySQL 5.1 and MySQL Cluster NDB 6.x
and differences from standard MySQL limits, Section 17.12.2,
Limits and Differences of MySQL Cluster from Standard MySQL
Limits
autodiscovery, Section 17.12.11, Previous MySQL Cluster Issues
Resolved in MySQL 5.1 and MySQL Cluster NDB 6.x
binary logging, Section 17.12.8, Issues Exclusive to MySQL
Cluster
character sets, Section 17.12.11, Previous MySQL Cluster Issues
Resolved in MySQL 5.1 and MySQL Cluster NDB 6.x
database objects, Section 17.12.5, Limits Associated with Database
Objects in MySQL Cluster
error handling and reporting, Section 17.12.4, MySQL Cluster Error
Handling
geometry data types, Section 17.12.1, Noncompliance with SQL
Syntax in MySQL Cluster
implementation, Section 17.12.8, Issues Exclusive to MySQL
Cluster
imposed by configuration, Section 17.12.2, Limits and Differences
of MySQL Cluster from Standard MySQL Limits
memory usage and transaction handling, Section 17.12.3, Limits Re-
lating to Transaction Handling in MySQL Cluster
multiple MySQL servers, Section 17.12.10, Limitations Relating to
Multiple MySQL Cluster Nodes
multiple data nodes, Section 17.12.11, Previous MySQL Cluster Is-
sues Resolved in MySQL 5.1 and MySQL Cluster NDB 6.x
multiple management servers, Section 17.12.11, Previous MySQL
Cluster Issues Resolved in MySQL 5.1 and MySQL Cluster NDB
6.x, Section 17.12.10, Limitations Relating to Multiple MySQL
Cluster Nodes
partitioning, Section 17.12.1, Noncompliance with SQL Syntax in
MySQL Cluster
performance, Section 17.12.7, Limitations Relating to Performance
in MySQL Cluster
replication, Section 17.12.1, Noncompliance with SQL Syntax in
MySQL Cluster, Section 17.12.11, Previous MySQL Cluster Issues
Resolved in MySQL 5.1 and MySQL Cluster NDB 6.x
resolved in current version from previous versions, Section 17.12.11,
Previous MySQL Cluster Issues Resolved in MySQL 5.1 and
MySQL Cluster NDB 6.x
syntax, Section 17.12.1, Noncompliance with SQL Syntax in
MySQL Cluster
transactions, Section 17.12.3, Limits Relating to Transaction Hand-
ling in MySQL Cluster
unsupported features, Section 17.12.6, Unsupported or Missing Fea-
tures in MySQL Cluster
MySQL Cluster processes, Section 17.6, MySQL Cluster Programs
MySQL Cluster programs, Section 17.6, MySQL Cluster Programs
MySQL Instance Manager, Section 4.6.10, mysqlmanager The
MySQL Instance Manager
MySQL binary distribution, Section 2.1.2, Choosing Which MySQL
Distribution to Install
MySQL privileges
and MySQL Cluster, Section 17.8.2, MySQL Cluster and MySQL
Privileges
MySQL server
mysqld, Section 5.1, The MySQL Server, Section 4.3.1, mysqld
The MySQL Server
MySQL source distribution, Section 2.1.2, Choosing Which MySQL
Distribution to Install
MySQL storage engines, Chapter 13, Storage Engines
MySQL system tables
and MySQL Cluster, Section 17.8.2, MySQL Cluster and MySQL
Privileges
and replication, Section 16.3.1.17, Replication of the System
mysql Database
MySQL version, Section 2.1.3, How to Get MySQL
MySQL++, Section 21.13, MySQL C++ API
mSQL compatibility, Section 11.4.2, Regular Expressions
mailing list address, Chapter 1, General Information
maintaining
log files, Section 5.2.6, Server Log Maintenance
tables, Section 6.4.6, Setting Up a Table Maintenance Schedule
maintenance
tables, Section 4.5.3, mysqlcheck A Table Maintenance Pro-
gram
make_binary_distribution, Section 4.1, Overview of MySQL Pro-
grams
make_win_bin_dist, Section 4.4.2, make_win_bin_dist Pack-
age MySQL Distribution as ZIP Archive, Section 4.1, Overview of
MySQL Programs
Standard Index
3260
debug option, Description
embedded option, Description
exe-suffix option, Description
no-debug option, Description
no-embedded option, Description
only-debug option, Description
make_win_src_distribution, Section 4.1, Overview of MySQL Pro-
grams
malicious SQL statements
and MySQL Cluster, Section 17.8.2, MySQL Cluster and MySQL
Privileges
management client (MySQL Cluster), Section 17.6.5, ndb_mgm
The MySQL Cluster Management Client
management node (MySQL Cluster)
defined, Section 17.1.1, MySQL Cluster Core Concepts
management nodes (MySQL Cluster), Section 17.6.4, ndb_mgmd
The MySQL Cluster Management Server Daemon
managing MySQL Cluster, Section 17.7, Management of MySQL
Cluster
managing MySQL Cluster processes, Section 17.6, MySQL Cluster
Programs
manual
available formats, Section 1.1, About This Manual
online location, Section 1.1, About This Manual
syntax conventions, Section 1.2, Typographical and Syntax Conven-
tions
typographical conventions, Section 1.2, Typographical and Syntax
Conventions
master-connect-retry option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-data option
mysqldump, Description
master-host option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-info-file option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-password option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-port option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-retry-count option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-ssl option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-ssl-ca option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-ssl-capath option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-ssl-cert option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-ssl-cipher option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-ssl-key option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
master-user option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
matching
patterns, Section 3.3.4.7, Pattern Matching
mathematical functions, Section 11.5.2, Mathematical Functions
max-binlog-dump-events option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
max-record-length option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
max-relay-log-size option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
max_allowed_packet system variable, Section 5.1.4, Server System
Variables
max_allowed_packet variable, Section 4.5.1.1, mysql Options
max_binlog_cache_size system variable, Section 16.1.3.4, Binary Log
Options and Variables
max_binlog_size system variable, Section 16.1.3.4, Binary Log Options
and Variables
max_connect_errors system variable, Section 5.1.4, Server System
Variables
max_connections system variable, Section 5.1.4, Server System Vari-
ables
max_delayed_threads system variable, Section 5.1.4, Server System
Variables
max_error_count system variable, Section 5.1.4, Server System Vari-
ables
max_heap_table_size system variable, Section 5.1.4, Server System
Variables
max_insert_delayed_threads system variable, Section 5.1.4, Server Sys-
tem Variables
max_join_size system variable, Section 5.1.4, Server System Vari-
ables
max_join_size variable, Section 4.5.1.1, mysql Options
max_length_for_sort_data system variable, Section 5.1.4, Server Sys-
tem Variables
max_prepared_stmt_count system variable, Section 5.1.4, Server Sys-
tem Variables
max_relay_log_size system variable, Section 5.1.4, Server System
Variables
max_seeks_for_key system variable, Section 5.1.4, Server System
Variables
max_sort_length system variable, Section 5.1.4, Server System Vari-
ables
max_sp_recursion_depth system variable, Section 5.1.4, Server System
Variables
max_tmp_tables system variable, Section 5.1.4, Server System Vari-
ables
max_user_connections system variable, Section 5.1.4, Server System
Variables
max_write_lock_count system variable, Section 5.1.4, Server System
Variables
maximum memory used, Description
maximums
maximum columns per table, Section D.7.2, The Maximum Number
of Columns Per Table
maximum tables per join, Section D.7.1, Limits of Joins
medium-check option
myisamchk, Section 4.6.3.2, myisamchk Check Options
mysqlcheck, Description
memlock option
mysqld, Section 5.1.2, Server Command Options
memory usage
myisamchk, Section 4.6.3.5, myisamchk Memory Usage
memory use, Section 7.5.8, How MySQL Uses Memory, Description
in MySQL Cluster, Section 17.12.2, Limits and Differences of
MySQL Cluster from Standard MySQL Limits
metadata
database, Chapter 20, INFORMATION_SCHEMA Tables
stored routines, Section 19.2.3, Stored Routine Metadata
triggers, Section 19.3.2, Trigger Metadata
views, Section 19.5.4, View Metadata
method option
mysqlhotcopy, Description
methods
locking, Section 7.3.1, Internal Locking Methods
mgmd (MySQL Cluster)
Standard Index
3261
defined, Section 17.1.1, MySQL Cluster Core Concepts
min-examined-row-limit option
mysqld, Section 5.1.2, Server Command Options
min_examined_row_limit system variable, Section 5.1.4, Server Sys-
tem Variables
minus
unary (-), Section 11.5.1, Arithmetic Operators
mirror sites, Section 2.1.3, How to Get MySQL
miscellaneous functions, Section 11.11.4, Miscellaneous Functions
modes
batch, Section 3.5, Using mysql in Batch Mode
modulo (%), Section 11.5.2, Mathematical Functions
modulo (MOD), Section 11.5.2, Mathematical Functions
monitor
terminal, Chapter 3, Tutorial
monitoring-interval option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
msql2mysql, Section 4.7.1, msql2mysql Convert mSQL Programs
for Use with MySQL
multi mysqld, Section 4.3.4, mysqld_multi Manage Multiple
MySQL Servers
multi-byte character sets, Section B.1.2.17, Can't initialize
character set
multi-byte characters, Section 9.4.3, Multi-Byte Character Support
multi-column indexes, Section 7.4.3, Multiple-Column Indexes
multi_range_count system variable, Section 5.1.4, Server System Vari-
ables
multiple servers, Section 5.6, Running Multiple MySQL Servers on the
Same Machine
multiple-part index, Section 12.1.13, CREATE INDEX Syntax
multiplication (*), Section 11.5.1, Arithmetic Operators
my.cnf
and MySQL Cluster, Section 17.2.3, MySQL Cluster Multi-
Computer Configuration, Section 17.3.4.1, MySQL Cluster Con-
figuration Basic Example, Section 17.3.4, MySQL Cluster Con-
figuration Files
in MySQL Cluster, Section 17.6.1, MySQL Server Usage for
MySQL Cluster
my.cnf file, Section 16.3.1, Replication Features and Issues
my_bool C type, Section 21.10.1, C API Data Types
my_bool values
printing, Section 21.10.1, C API Data Types
my_init(), Section 21.10.8.1, my_init()
my_print_defaults, Section 4.7.3, my_print_defaults Display
Options from Option Files, Section 4.1, Overview of MySQL Pro-
grams
config-file option, Description
debug option, Description
defaults-extra-file option, Description
defaults-file option, Description
defaults-group-suffix option, Description
extra-file option, Description
help option, Description
no-defaults option, Description
verbose option, Description
version option, Description
my_ulonglong C type, Section 21.10.1, C API Data Types
my_ulonglong values
printing, Section 21.10.1, C API Data Types
myisam-block-size option
mysqld, Section 5.1.2, Server Command Options
myisam-recover option
mysqld, Section 5.1.2, Server Command Options, Section 13.5.1,
MyISAM Startup Options
myisam_block_size myisamchk variable, Section 4.6.3.1, myisamchk
General Options
myisam_data_pointer_size system variable, Section 5.1.4, Server Sys-
tem Variables
myisam_ftdump, Section 4.6.2, myisam_ftdump Display Full-
Text Index information, Section 4.1, Overview of MySQL Programs
count option, Description
dump option, Description
help option, Description
length option, Description
stats option, Description
verbose option, Description
myisam_max_sort_file_size system variable, Section 5.1.4, Server Sys-
tem Variables
myisam_recover_options system variable, Section 5.1.4, Server System
Variables
myisam_repair_threads system variable, Section 5.1.4, Server System
Variables
myisam_sort_buffer_size system variable, Section 5.1.4, Server System
Variables
myisam_stats_method system variable, Section 5.1.4, Server System
Variables
myisam_use_mmap system variable, Section 5.1.4, Server System
Variables
myisamchk, Section 4.6.3, myisamchk MyISAM Table-
Maintenance Utility, Section 2.10.2, Typical configure Options,
Section 4.1, Overview of MySQL Programs
HELP option, Section 4.6.3.1, myisamchk General Options
analyze option, Section 4.6.3.4, Other myisamchk Options
backup option, Section 4.6.3.3, myisamchk Repair Options
block-search option, Section 4.6.3.4, Other myisamchk Options
character-sets-dir option, Section 4.6.3.3, myisamchk Repair Op-
tions
check option, Section 4.6.3.2, myisamchk Check Options
check-only-changed option, Section 4.6.3.2, myisamchk Check
Options
correct-checksum option, Section 4.6.3.3, myisamchk Repair Op-
tions
data-file-length option, Section 4.6.3.3, myisamchk Repair Op-
tions
debug option, Section 4.6.3.1, myisamchk General Options
description option, Section 4.6.3.4, Other myisamchk Options
example output, Section 6.4.5, Getting Information About a Table
extend-check option, Section 4.6.3.3, myisamchk Repair
Options, Section 4.6.3.2, myisamchk Check Options
fast option, Section 4.6.3.2, myisamchk Check Options
force option, Section 4.6.3.3, myisamchk Repair Options, Sec-
tion 4.6.3.2, myisamchk Check Options
help option, Section 4.6.3.1, myisamchk General Options
information option, Section 4.6.3.2, myisamchk Check Options
keys-used option, Section 4.6.3.3, myisamchk Repair Options
max-record-length option, Section 4.6.3.3, myisamchk Repair Op-
tions
medium-check option, Section 4.6.3.2, myisamchk Check Op-
tions
no-symlinks option, Section 4.6.3.3, myisamchk Repair Options
options, Section 4.6.3.1, myisamchk General Options
parallel-recover option, Section 4.6.3.3, myisamchk Repair Op-
tions
quick option, Section 4.6.3.3, myisamchk Repair Options
read-only option, Section 4.6.3.2, myisamchk Check Options
recover option, Section 4.6.3.3, myisamchk Repair Options
safe-recover option, Section 4.6.3.3, myisamchk Repair Options
set-auto-increment[ option, Section 4.6.3.4, Other myisamchk Op-
tions
Standard Index
3262
set-character-set option, Section 4.6.3.3, myisamchk Repair Op-
tions
set-collation option, Section 4.6.3.3, myisamchk Repair Options
silent option, Section 4.6.3.1, myisamchk General Options
sort-index option, Section 4.6.3.4, Other myisamchk Options
sort-records option, Section 4.6.3.4, Other myisamchk Options
sort-recover option, Section 4.6.3.3, myisamchk Repair Options
tmpdir option, Section 4.6.3.3, myisamchk Repair Options
unpack option, Section 4.6.3.3, myisamchk Repair Options
update-state option, Section 4.6.3.2, myisamchk Check Options
verbose option, Section 4.6.3.1, myisamchk General Options
version option, Section 4.6.3.1, myisamchk General Options
wait option, Section 4.6.3.1, myisamchk General Options
myisamlog, Section 4.6.4, myisamlog Display MyISAM Log File
Contents, Section 4.1, Overview of MySQL Programs
myisampack, Section 4.6.5, myisampack Generate Compressed,
Read-Only MyISAM Tables, Section 13.5.3.3, Compressed Table
Characteristics, Section 12.1.17.1, Silent Column Specification
Changes, Section 4.1, Overview of MySQL Programs
backup option, Description
character-sets-dir option, Description
debug option, Description
force option, Description
help option, Description
join option, Description
silent option, Description
test option, Description
tmpdir option, Description
verbose option, Description
version option, Description
wait option, Description
mysql, Section 4.5.1, mysql The MySQL Command-Line Tool,
Section 4.1, Overview of MySQL Programs
SSL options, Section 4.5.1.1, mysql Options
auto-rehash option, Section 4.5.1.1, mysql Options
batch option, Section 4.5.1.1, mysql Options
character-sets-dir option, Section 4.5.1.1, mysql Options
charset command, Section 4.5.1.2, mysql Commands
clear command, Section 4.5.1.2, mysql Commands
column-names option, Section 4.5.1.1, mysql Options
column-type-info option, Section 4.5.1.1, mysql Options
comments option, Section 4.5.1.1, mysql Options
compress option, Section 4.5.1.1, mysql Options
connect command, Section 4.5.1.2, mysql Commands
database option, Section 4.5.1.1, mysql Options
debug option, Section 4.5.1.1, mysql Options
debug-check option, Section 4.5.1.1, mysql Options
debug-info option, Section 4.5.1.1, mysql Options
default-character-set option, Section 4.5.1.1, mysql Options
delimiter command, Section 4.5.1.2, mysql Commands
delimiter option, Section 4.5.1.1, mysql Options
disable named commands, Section 4.5.1.1, mysql Options
edit command, Section 4.5.1.2, mysql Commands
ego command, Section 4.5.1.2, mysql Commands
execute option, Section 4.5.1.1, mysql Options
exit command, Section 4.5.1.2, mysql Commands
force option, Section 4.5.1.1, mysql Options
go command, Section 4.5.1.2, mysql Commands
help command, Section 4.5.1.2, mysql Commands
help option, Section 4.5.1.1, mysql Options
host option, Section 4.5.1.1, mysql Options
html option, Section 4.5.1.1, mysql Options
i-am-a-dummy option, Section 4.5.1.1, mysql Options
ignore-spaces option, Section 4.5.1.1, mysql Options
line-numbers option, Section 4.5.1.1, mysql Options
local-infile option, Section 4.5.1.1, mysql Options
named-commands option, Section 4.5.1.1, mysql Options
no-auto-rehash option, Section 4.5.1.1, mysql Options
no-beep option, Section 4.5.1.1, mysql Options
no-named-commands option, Section 4.5.1.1, mysql Options
no-pager option, Section 4.5.1.1, mysql Options
no-tee option, Section 4.5.1.1, mysql Options
nopager command, Section 4.5.1.2, mysql Commands
notee command, Section 4.5.1.2, mysql Commands
nowarning command, Section 4.5.1.2, mysql Commands
one-database option, Section 4.5.1.1, mysql Options
pager command, Section 4.5.1.2, mysql Commands
pager option, Section 4.5.1.1, mysql Options
password option, Section 4.5.1.1, mysql Options
pipe option, Section 4.5.1.1, mysql Options
port option, Section 4.5.1.1, mysql Options
print command, Section 4.5.1.2, mysql Commands
prompt command, Section 4.5.1.2, mysql Commands
prompt option, Section 4.5.1.1, mysql Options
protocol option, Section 4.5.1.1, mysql Options
quick option, Section 4.5.1.1, mysql Options
quit command, Section 4.5.1.2, mysql Commands
raw option, Section 4.5.1.1, mysql Options
reconnect option, Section 4.5.1.1, mysql Options
rehash command, Section 4.5.1.2, mysql Commands
safe-updates option, Section 4.5.1.1, mysql Options
secure-auth option, Section 4.5.1.1, mysql Options
show-warnings option, Section 4.5.1.1, mysql Options
sigint-ignore option, Section 4.5.1.1, mysql Options
silent option, Section 4.5.1.1, mysql Options
skip-column-names option, Section 4.5.1.1, mysql Options
skip-line-numbers option, Section 4.5.1.1, mysql Options
socket option, Section 4.5.1.1, mysql Options
source command, Section 4.5.1.2, mysql Commands
status command, Section 4.5.1.2, mysql Commands
system command, Section 4.5.1.2, mysql Commands
table option, Section 4.5.1.1, mysql Options
tee command, Section 4.5.1.2, mysql Commands
tee option, Section 4.5.1.1, mysql Options
unbuffered option, Section 4.5.1.1, mysql Options
use command, Section 4.5.1.2, mysql Commands
user option, Section 4.5.1.1, mysql Options
verbose option, Section 4.5.1.1, mysql Options
version option, Section 4.5.1.1, mysql Options
vertical option, Section 4.5.1.1, mysql Options
wait option, Section 4.5.1.1, mysql Options
warnings command, Section 4.5.1.2, mysql Commands
xml option, Section 4.5.1.1, mysql Options
mysql \. (command for reading from text files), Section 3.5, Using
mysql in Batch Mode, Section 4.5.1.4, Executing SQL Statements
from a Text File
mysql command options, Section 4.5.1.1, mysql Options
mysql commands
list of, Section 4.5.1.2, mysql Commands
mysql history file, Section 4.5.1.1, mysql Options
mysql prompt command, Section 4.5.1.2, mysql Commands
mysql source (command for reading from text files), Section 3.5, Using
mysql in Batch Mode, Section 4.5.1.4, Executing SQL Statements
from a Text File
mysql.server, Section 4.3.3, mysql.server MySQL Server Star-
tup Script, Section 4.1, Overview of MySQL Programs
basedir option, Description
datadir option, Description
pid-file option, Description
service-startup-timeout option, Description
Standard Index
3263
use-manager option, Description
use-mysqld_safe option, Description
user option, Description
mysql.sock
changing location of, Section 2.10.2, Typical configure Options
protection, Section B.1.4.5, How to Protect or Change the MySQL
Unix Socket File
mysql_affected_rows(), Section 21.10.3.1,
mysql_affected_rows()
mysql_autocommit(), Section 21.10.3.2, mysql_autocommit()
mysql_change_user(), Section 21.10.3.3, mysql_change_user()
mysql_character_set_name(), Section 21.10.3.4,
mysql_character_set_name()
mysql_close(), Section 21.10.3.5, mysql_close()
mysql_commit(), Section 21.10.3.6, mysql_commit()
mysql_config, Section 4.7.2, mysql_config Get Compile Op-
tions for Compiling Clients
cflags option, Description
embedded option, Description
include option, Description
libmysqld-libs option, Description
libs option, Description
libs_r option, Description
plugindir option, Description
port option, Description
socket option, Description
version option, Description
mysql_connect(), Section 21.10.3.7, mysql_connect()
mysql_convert_table_format, Section 4.1, Overview of MySQL Pro-
grams
mysql_create_db(), Section 21.10.3.8, mysql_create_db()
mysql_create_system_tables, Section 4.1, Overview of MySQL Pro-
grams
mysql_data_seek(), Section 21.10.3.9, mysql_data_seek()
mysql_debug(), Section 21.10.3.10, mysql_debug()
mysql_drop_db(), Section 21.10.3.11, mysql_drop_db()
mysql_dump_debug_info(), Section 21.10.3.12,
mysql_dump_debug_info()
mysql_eof(), Section 21.10.3.13, mysql_eof()
mysql_errno(), Section 21.10.3.14, mysql_errno()
mysql_error(), Section 21.10.3.15, mysql_error()
mysql_escape_string(), Section 21.10.3.16,
mysql_escape_string()
mysql_explain_log, Section 4.1, Overview of MySQL Programs
mysql_fetch_field(), Section 21.10.3.17, mysql_fetch_field()
mysql_fetch_field_direct(), Section 21.10.3.18,
mysql_fetch_field_direct()
mysql_fetch_fields(), Section 21.10.3.19,
mysql_fetch_fields()
mysql_fetch_lengths(), Section 21.10.3.20,
mysql_fetch_lengths()
mysql_fetch_row(), Section 21.10.3.21, mysql_fetch_row()
mysql_field_count(), Section 21.10.3.22, mysql_field_count(),
Section 21.10.3.47, mysql_num_fields()
mysql_field_seek(), Section 21.10.3.23, mysql_field_seek()
mysql_field_tell(), Section 21.10.3.24, mysql_field_tell()
mysql_find_rows, Section 4.1, Overview of MySQL Programs
mysql_fix_extensions, Section 4.1, Overview of MySQL Programs
mysql_fix_privilege_tables, Section 4.1, Overview of MySQL Pro-
grams
mysql_free_result(), Section 21.10.3.25, mysql_free_result()
mysql_get_character_set_info(), Section 21.10.3.26,
mysql_get_character_set_info()
mysql_get_client_info(), Section 21.10.3.27,
mysql_get_client_info()
mysql_get_client_version(), Section 21.10.3.28,
mysql_get_client_version()
mysql_get_host_info(), Section 21.10.3.29,
mysql_get_host_info()
mysql_get_proto_info(), Section 21.10.3.30,
mysql_get_proto_info()
mysql_get_server_info(), Section 21.10.3.31,
mysql_get_server_info()
mysql_get_server_version(), Section 21.10.3.32,
mysql_get_server_version()
mysql_get_ssl_cipher(), Section 21.10.3.33,
mysql_get_ssl_cipher()
mysql_hex_string(), Section 21.10.3.34, mysql_hex_string()
mysql_info(), Section 21.10.3.35, mysql_info(), Section 12.2.5,
INSERT Syntax, Section 12.1.7, ALTER TABLE Syntax, Sec-
tion 12.2.11, UPDATE Syntax, Section 12.2.6, LOAD DATA IN-
FILE Syntax
mysql_init(), Section 21.10.3.36, mysql_init()
mysql_insert_id(), Section 1.7.5.2, Transactions and Atomic Opera-
tions, Section 21.10.3.37, mysql_insert_id(), Section 12.2.5,
INSERT Syntax
mysql_install_db, Section 4.1, Overview of MySQL Programs, Sec-
tion 2.11.2.1, Problems Running mysql_install_db
mysql_kill(), Section 21.10.3.38, mysql_kill()
mysql_library_end(), Section 21.10.3.39, mysql_library_end()
mysql_library_init(), Section 21.10.3.40,
mysql_library_init()
mysql_list_dbs(), Section 21.10.3.41, mysql_list_dbs()
mysql_list_fields(), Section 21.10.3.42, mysql_list_fields()
mysql_list_processes(), Section 21.10.3.43,
mysql_list_processes()
mysql_list_tables(), Section 21.10.3.44, mysql_list_tables()
mysql_more_results(), Section 21.10.3.45,
mysql_more_results()
mysql_next_result(), Section 21.10.3.46, mysql_next_result()
mysql_num_fields(), Section 21.10.3.47, mysql_num_fields()
mysql_num_rows(), Section 21.10.3.48, mysql_num_rows()
mysql_options(), Section 21.10.3.49, mysql_options()
mysql_ping(), Section 21.10.3.50, mysql_ping()
mysql_query(), Section 21.10.10, Common Questions and Problems
When Using the C API, Section 21.10.3.51, mysql_query()
mysql_real_connect(), Section 21.10.3.52,
mysql_real_connect()
mysql_real_escape_string(), Section 21.10.3.53,
mysql_real_escape_string(), Section 8.1.1, Strings
mysql_real_query(), Section 21.10.3.54, mysql_real_query()
mysql_refresh(), Section 21.10.3.55, mysql_refresh()
mysql_reload(), Section 21.10.3.56, mysql_reload()
mysql_rollback(), Section 21.10.3.57, mysql_rollback()
mysql_row_seek(), Section 21.10.3.58, mysql_row_seek()
mysql_row_tell(), Section 21.10.3.59, mysql_row_tell()
mysql_secure_installation, Section 4.1, Overview of MySQL Pro-
grams
mysql_select_db(), Section 21.10.3.60, mysql_select_db()
mysql_server_end(), Section 21.10.9.2, mysql_server_end()
mysql_server_init(), Section 21.10.9.1, mysql_server_init()
mysql_set_character_set(), Section 21.10.3.61,
mysql_set_character_set()
mysql_set_local_infile_default(), Section 21.10.3.62,
mysql_set_local_infile_default()
mysql_set_server_option(), Section 21.10.3.64,
mysql_set_server_option()
mysql_setpermission, Section 4.1, Overview of MySQL Programs
mysql_shutdown(), Section 21.10.3.65, mysql_shutdown()
mysql_sqlstate(), Section 21.10.3.66, mysql_sqlstate()
Standard Index
3264
mysql_ssl_set(), Section 21.10.3.67, mysql_ssl_set()
mysql_stat(), Section 21.10.3.68, mysql_stat()
mysql_stmt_affected_rows(), Section 21.10.7.1,
mysql_stmt_affected_rows()
mysql_stmt_attr_get(), Section 21.10.7.2,
mysql_stmt_attr_get()
mysql_stmt_attr_set(), Section 21.10.7.3,
mysql_stmt_attr_set()
mysql_stmt_bind_param(), Section 21.10.7.4,
mysql_stmt_bind_param()
mysql_stmt_bind_result(), Section 21.10.7.5,
mysql_stmt_bind_result()
mysql_stmt_close(), Section 21.10.7.6, mysql_stmt_close()
mysql_stmt_data_seek(), Section 21.10.7.7,
mysql_stmt_data_seek()
mysql_stmt_errno(), Section 21.10.7.8, mysql_stmt_errno()
mysql_stmt_error(), Section 21.10.7.9, mysql_stmt_error()
mysql_stmt_execute(), Section 21.10.7.10,
mysql_stmt_execute()
mysql_stmt_fetch(), Section 21.10.7.11, mysql_stmt_fetch()
mysql_stmt_fetch_column(), Section 21.10.7.12,
mysql_stmt_fetch_column()
mysql_stmt_field_count(), Section 21.10.7.13,
mysql_stmt_field_count()
mysql_stmt_free_result(), Section 21.10.7.14,
mysql_stmt_free_result()
mysql_stmt_init(), Section 21.10.7.15, mysql_stmt_init()
mysql_stmt_insert_id(), Section 21.10.7.16,
mysql_stmt_insert_id()
mysql_stmt_num_rows(), Section 21.10.7.17,
mysql_stmt_num_rows()
mysql_stmt_param_count(), Section 21.10.7.18,
mysql_stmt_param_count()
mysql_stmt_param_metadata(), Section 21.10.7.19,
mysql_stmt_param_metadata()
mysql_stmt_prepare(), Section 21.10.7.20,
mysql_stmt_prepare()
mysql_stmt_reset(), Section 21.10.7.21, mysql_stmt_reset()
mysql_stmt_result_metadata, Section 21.10.7.22,
mysql_stmt_result_metadata()
mysql_stmt_row_seek(), Section 21.10.7.23,
mysql_stmt_row_seek()
mysql_stmt_row_tell(), Section 21.10.7.24,
mysql_stmt_row_tell()
mysql_stmt_send_long_data(), Section 21.10.7.25,
mysql_stmt_send_long_data()
mysql_stmt_sqlstate(), Section 21.10.7.26,
mysql_stmt_sqlstate()
mysql_stmt_store_result(), Section 21.10.7.27,
mysql_stmt_store_result()
mysql_store_result(), Section 21.10.3.69,
mysql_store_result(), Section 21.10.10, Common Questions
and Problems When Using the C API
mysql_tableinfo, Section 4.1, Overview of MySQL Programs
mysql_thread_end(), Section 21.10.8.2, mysql_thread_end()
mysql_thread_id(), Section 21.10.3.70, mysql_thread_id()
mysql_thread_init(), Section 21.10.8.3, mysql_thread_init()
mysql_thread_safe(), Section 21.10.8.4, mysql_thread_safe()
mysql_tzinfo_to_sql, Section 4.1, Overview of MySQL Programs
mysql_upgrade, Section 5.4.7, Causes of Access-Denied Errors, Sec-
tion 4.1, Overview of MySQL Programs
mysql_use_result(), Section 21.10.3.71, mysql_use_result()
mysql_waitpid, Section 4.1, Overview of MySQL Programs
mysql_warning_count(), Section 21.10.3.72,
mysql_warning_count()
mysql_zap, Section 4.1, Overview of MySQL Programs
mysqlaccess, Section 4.6.6, mysqlaccess Client for Checking
Access Privileges, Section 4.1, Overview of MySQL Programs
brief option, Description
commit option, Description
copy option, Description
db option, Description
debug option, Description
help option, Description
host option, Description
howto option, Description
old_server option, Description
password option, Description
plan option, Description
preview option, Description
relnotes option, Description
rhost option, Description
rollback option, Description
spassword option, Description
superuser option, Description
table option, Description
user option, Description
version option, Description
mysqladmin, Section 12.5.5.41, SHOW VARIABLES Syntax, Sec-
tion 12.5.6.4, KILL Syntax, Section 4.1, Overview of MySQL Pro-
grams, Section 12.1.21, DROP DATABASE Syntax, Section 12.5.6.3,
FLUSH Syntax, Section 12.5.5.37, SHOW STATUS Syntax, Sec-
tion 12.1.10, CREATE DATABASE Syntax, Section 4.5.2, mysql-
admin Client for Administering a MySQL Server
SSL options, Description
character-sets-dir option, Description
compress option, Description
count option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
default-character-set option, Description
force option, Description
help option, Description
host option, Description
no-beep option, Description
password option, Description
pipe option, Description
port option, Description
protocol option, Description
relative option, Description
silent option, Description
sleep option, Description
socket option, Description
user option, Description
verbose option, Description
version option, Description
vertical option, Description
wait option, Description
mysqladmin command options, Description
mysqladmin option
mysqld_multi, Description
mysqlbinlog, Section 4.6.7, mysqlbinlog Utility for Processing
Binary Log Files, Section 4.1, Overview of MySQL Programs
base64-output option, Description
character-sets-dir option, Description
database option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
Standard Index
3265
disable-log-bin option, Description
force-read option, Description
help option, Description
hexdump option, Description
host option, Description
local-load option, Description
offset option, Description
password option, Description
port option, Description
position option, Description
protocol option, Description
read-from-remote-server option, Description
result-file option, Description
server-id option, Description
set-charset option, Description
short-form option, Description
socket option, Description
start-datetime option, Description
start-position option, Description
stop-datetime option, Description
stop-position option, Description
to-last-log option, Description
user option, Description
verbose option, Description
version option, Description
write-binlog option, Description
mysqlbug script, Section 1.6, How to Report Bugs or Problems
mysqlcheck, Section 4.5.3, mysqlcheck A Table Maintenance
Program, Section 4.1, Overview of MySQL Programs
SSL options, Description
all-databases option, Description
all-in-1 option, Description
analyze option, Description
auto-repair option, Description
character-sets-dir option, Description
check option, Description
check-only-changed option, Description
check-upgrade option, Description
compress option, Description
databases option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
default-character-set option, Description
extended option, Description
fast option, Description
fix-db-names option, Description
fix-table-names option, Description
force option, Description
help option, Description
host option, Description
medium-check option, Description
optimize option, Description
password option, Description
pipe option, Description
port option, Description
protocol option, Description
quick option, Description
repair option, Description
silent option, Description
socket option, Description
tables option, Description
use-frm option, Description
user option, Description
verbose option, Description
version option, Description
mysqlclient library, Chapter 21, Connectors and APIs
mysqld, Section 4.1, Overview of MySQL Programs
MySQL server, Section 5.1, The MySQL Server, Section 4.3.1,
mysqld The MySQL Server
SSL options, Section 5.1.2, Server Command Options, Sec-
tion 5.3.3, Security-Related mysqld Options
abort-slave-event-count option, Section 16.1.3.3, Replication Slave
Options and Variables
allow-suspicious-udfs option, Section 5.1.2, Server Command Op-
tions, Section 5.3.3, Security-Related mysqld Options
ansi option, Section 5.1.2, Server Command Options
as MySQL Cluster process, Section 17.6.1, MySQL Server Usage
for MySQL Cluster, Section 17.4.2, mysqld Command Options
for MySQL Cluster
basedir option, Section 5.1.2, Server Command Options
big-tables option, Section 5.1.2, Server Command Options
bind-address option, Section 5.1.2, Server Command Options
binlog-do-db option, Section 16.1.3.4, Binary Log Options and
Variables
binlog-format option, Section 5.1.2, Server Command Options
binlog-ignore-db option, Section 16.1.3.4, Binary Log Options and
Variables
binlog-row-event-max-size option, Section 16.1.3.4, Binary Log
Options and Variables
bootstrap option, Section 5.1.2, Server Command Options
character-set-client-handshake option, Section 5.1.2, Server Com-
mand Options
character-set-filesystem option, Section 5.1.2, Server Command Op-
tions
character-set-server option, Section 5.1.2, Server Command Op-
tions
character-sets-dir option, Section 5.1.2, Server Command Options
chroot option, Section 5.1.2, Server Command Options
collation-server option, Section 5.1.2, Server Command Options
command options, Section 5.1.2, Server Command Options
console option, Section 5.1.2, Server Command Options
core-file option, Section 5.1.2, Server Command Options
datadir option, Section 5.1.2, Server Command Options
debug option, Section 5.1.2, Server Command Options
debug-sync-timeout option, Section 5.1.2, Server Command Op-
tions
default-character-set option, Section 5.1.2, Server Command Op-
tions
default-collation option, Section 5.1.2, Server Command Options
default-storage-engine option, Section 5.1.2, Server Command Op-
tions
default-table-type option, Section 5.1.2, Server Command Options
default-time-zone option, Section 5.1.2, Server Command Options
delay-key-write option, Section 5.1.2, Server Command Options,
Section 13.5.1, MyISAM Startup Options
des-key-file option, Section 5.1.2, Server Command Options
disconnect-slave-event-count option, Section 16.1.3.3, Replication
Slave Options and Variables
enable-named-pipe option, Section 5.1.2, Server Command Op-
tions
enable-pstack option, Section 5.1.2, Server Command Options
event-scheduler option, Section 5.1.2, Server Command Options
exit-info option, Section 5.1.2, Server Command Options
external-locking option, Section 5.1.2, Server Command Options
flush option, Section 5.1.2, Server Command Options
gdb option, Section 5.1.2, Server Command Options
general-log option, Section 5.1.2, Server Command Options
help option, Section 5.1.2, Server Command Options
ignore-builtin-innodb option, Section 13.6.3, InnoDB Startup Op-
Standard Index
3266
tions and System Variables
init-file option, Section 5.1.2, Server Command Options
innodb option, Section 13.6.3, InnoDB Startup Options and System
Variables
innodb_status_file option, Section 13.6.3, InnoDB Startup Options
and System Variables
language option, Section 5.1.2, Server Command Options
large-pages option, Section 5.1.2, Server Command Options
local-infile option, Section 5.3.3, Security-Related mysqld Op-
tions
log option, Section 5.1.2, Server Command Options
log-backup-output option, Section 5.1.2, Server Command Options
log-bin option, Section 16.1.3.4, Binary Log Options and Variables
log-bin-index option, Section 16.1.3.4, Binary Log Options and
Variables
log-bin-trust-function-creators option, Section 16.1.3.4, Binary Log
Options and Variables
log-bin-trust-routine-creators option, Section 16.1.3.4, Binary Log
Options and Variables
log-error option, Section 5.1.2, Server Command Options
log-isam option, Section 5.1.2, Server Command Options
log-long-format option, Section 5.1.2, Server Command Options
log-output option, Section 5.1.2, Server Command Options
log-queries-not-using-indexes option, Section 5.1.2, Server Com-
mand Options
log-short-format option, Section 5.1.2, Server Command Options
log-slave-updates option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
log-slow-admin-statements option, Section 5.1.2, Server Command
Options
log-slow-queries option, Section 5.1.2, Server Command Options
log-slow-slave-statements option, Section 16.1.3.3, Replication
Slave Options and Variables
log-tc option, Section 5.1.2, Server Command Options
log-tc-size option, Section 5.1.2, Server Command Options
log-warnings option, Section 5.1.2, Server Command Options, Sec-
tion 16.1.3.3, Replication Slave Options and Variables
low-priority-updates option, Section 5.1.2, Server Command Op-
tions
master-connect-retry option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
master-host option, Section 16.1.3.3, Replication Slave Options and
Variables
master-info-file option, Section 16.1.3.3, Replication Slave Options
and Variables
master-password option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
master-port option, Section 16.1.3.3, Replication Slave Options and
Variables
master-retry-count option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
master-ssl option, Section 16.1.3.3, Replication Slave Options and
Variables
master-ssl-ca option, Section 16.1.3.3, Replication Slave Options
and Variables
master-ssl-capath option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
master-ssl-cert option, Section 16.1.3.3, Replication Slave Options
and Variables
master-ssl-cipher option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
master-ssl-key option, Section 16.1.3.3, Replication Slave Options
and Variables
master-user option, Section 16.1.3.3, Replication Slave Options and
Variables
max-binlog-dump-events option, Section 16.1.3.4, Binary Log Op-
tions and Variables
max-relay-log-size option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
memlock option, Section 5.1.2, Server Command Options
min-examined-row-limit option, Section 5.1.2, Server Command
Options
myisam-block-size option, Section 5.1.2, Server Command Options
myisam-recover option, Section 5.1.2, Server Command Options,
Section 13.5.1, MyISAM Startup Options
ndb-batch-size option, Section 17.4.2, mysqld Command Options
for MySQL Cluster
ndb-cluster-connection-pool option, Section 17.4.2, mysqld Com-
mand Options for MySQL Cluster
ndb-connectstring option, Section 17.4.2, mysqld Command Op-
tions for MySQL Cluster
ndb-nodeid, Section 17.4.2, mysqld Command Options for
MySQL Cluster
ndbcluster option, Section 17.4.2, mysqld Command Options for
MySQL Cluster
old-passwords option, Section 5.1.2, Server Command Options,
Section 5.3.3, Security-Related mysqld Options
old-style-user-limits option, Section 5.1.2, Server Command Op-
tions
one-thread option, Section 5.1.2, Server Command Options
open-files-limit option, Section 5.1.2, Server Command Options
pid-file option, Section 5.1.2, Server Command Options
plugin-load option, Section 5.1.2, Server Command Options
port option, Section 5.1.2, Server Command Options
port-open-timeout option, Section 5.1.2, Server Command Options
read-only option, Section 16.1.3.3, Replication Slave Options and
Variables
relay-log option, Section 16.1.3.3, Replication Slave Options and
Variables
relay-log-index option, Section 16.1.3.3, Replication Slave Options
and Variables
relay-log-info-file option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
relay-log-purge option, Section 16.1.3.3, Replication Slave Options
and Variables
relay-log-recovery option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
relay-log-space-limit option, Section 16.1.3.3, Replication Slave
Options and Variables
replicate-do-db option, Section 16.1.3.3, Replication Slave Options
and Variables
replicate-do-table option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
replicate-ignore-db option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
replicate-ignore-table option, Section 16.1.3.3, Replication Slave
Options and Variables
replicate-rewrite-db option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
replicate-same-server-id option, Section 16.1.3.3, Replication Slave
Options and Variables
replicate-wild-do-table option, Section 16.1.3.3, Replication Slave
Options and Variables
replicate-wild-ignore-table option, Section 16.1.3.3, Replication
Slave Options and Variables
report-host option, Section 16.1.3.3, Replication Slave Options and
Variables
report-password option, Section 16.1.3.3, Replication Slave Options
and Variables
report-port option, Section 16.1.3.3, Replication Slave Options and
Standard Index
3267
Variables
report-user option, Section 16.1.3.3, Replication Slave Options and
Variables
role in MySQL Cluster, Section 17.1.1, MySQL Cluster Core Con-
cepts
safe-mode option, Section 5.1.2, Server Command Options
safe-show-database option, Section 5.1.2, Server Command Op-
tions, Section 5.3.3, Security-Related mysqld Options
safe-user-create option, Section 5.1.2, Server Command Options,
Section 5.3.3, Security-Related mysqld Options
secure-auth option, Section 5.1.2, Server Command Options, Sec-
tion 5.3.3, Security-Related mysqld Options
secure-backup-file-priv option, Section 5.1.2, Server Command Op-
tions
secure-file-priv option, Section 5.1.2, Server Command Options,
Section 5.3.3, Security-Related mysqld Options
server-id option, Section 16.1.3, Replication and Binary Logging
Options and Variables
shared-memory option, Section 5.1.2, Server Command Options
shared-memory-base-name option, Section 5.1.2, Server Command
Options
show-slave-auth-info option, Section 16.1.3.3, Replication Slave
Options and Variables
skip-concurrent-insert option, Section 5.1.2, Server Command Op-
tions
skip-external-locking option, Section 5.1.2, Server Command Op-
tions
skip-grant-tables option, Section 5.1.2, Server Command Options,
Section 5.3.3, Security-Related mysqld Options
skip-host-cache option, Section 5.1.2, Server Command Options
skip-innodb option, Section 5.1.2, Server Command Options
skip-merge option, Section 5.3.3, Security-Related mysqld Op-
tions
skip-name-resolve option, Section 5.1.2, Server Command
Options, Section 5.3.3, Security-Related mysqld Options
skip-ndbcluster option, Section 17.4.2, mysqld Command Options
for MySQL Cluster
skip-networking option, Section 5.1.2, Server Command Options,
Section 5.3.3, Security-Related mysqld Options
skip-safemalloc option, Section 5.1.2, Server Command Options
skip-show-database option, Section 5.1.2, Server Command Op-
tions, Section 5.3.3, Security-Related mysqld Options
skip-slave-start option, Section 16.1.3.3, Replication Slave Options
and Variables
skip-stack-trace option, Section 5.1.2, Server Command Options
skip-symbolic-links option, Section 5.1.2, Server Command Op-
tions
skip-thread-priority option, Section 5.1.2, Server Command Op-
tions
slave-load-tmpdir option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
slave-net-timeout option, Section 16.1.3.3, Replication Slave Op-
tions and Variables
slave-skip-errors option, Section 16.1.3.3, Replication Slave Options
and Variables
slave_compressed_protocol option, Section 16.1.3.3, Replication
Slave Options and Variables
slow-query-log option, Section 5.1.2, Server Command Options
socket option, Section 5.1.2, Server Command Options
sporadic-binlog-dump-fail option, Section 16.1.3.4, Binary Log Op-
tions and Variables
sql-mode option, Section 5.1.2, Server Command Options
standalone option, Section 5.1.2, Server Command Options
starting, Section 5.3.5, How to Run MySQL as a Normal User
super-large-pages option, Section 5.1.2, Server Command Options
symbolic-links option, Section 5.1.2, Server Command Options
sysdate-is-now option, Section 5.1.2, Server Command Options
tc-heuristic-recover option, Section 5.1.2, Server Command Op-
tions
temp-pool option, Section 5.1.2, Server Command Options
tmpdir option, Section 5.1.2, Server Command Options
transaction-isolation option, Section 5.1.2, Server Command Op-
tions
user option, Section 5.1.2, Server Command Options
verbose option, Section 5.1.2, Server Command Options
version option, Section 5.1.2, Server Command Options
mysqld (MySQL Cluster), Section 17.6, MySQL Cluster Programs
mysqld library, Chapter 21, Connectors and APIs
mysqld option
mysqld_multi, Description
mysqld_safe, Description
mysqld options, Section 7.5.3, Tuning Server Parameters
mysqld server
buffer sizes, Section 7.5.3, Tuning Server Parameters
mysqld-max, Section 4.1, Overview of MySQL Programs
mysqld-safe-compatible option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqld-version option
mysqld_safe, Description
mysqld_multi, Section 4.3.4, mysqld_multi Manage Multiple
MySQL Servers, Section 4.1, Overview of MySQL Programs
config-file option, Description
defaults-extra-file option, Description
defaults-file option, Description
example option, Description
help option, Description
log option, Description
mysqladmin option, Description
mysqld option, Description
no-defaults option, Description
no-log option, Description
password option, Description
silent option, Description
tcp-ip option, Description
user option, Description
verbose option, Description
version option, Description
mysqld_safe, Section 4.3.2, mysqld_safe MySQL Server Startup
Script, Section 4.1, Overview of MySQL Programs
autoclose option, Description
basedir option, Description
core-file-size option, Description
datadir option, Description
defaults-extra-file option, Description
defaults-file option, Description
help option, Description
ledir option, Description
log-error option, Description
mysqld option, Description
mysqld-version option, Description
nice option, Description
no-defaults option, Description
open-files-limit option, Description
pid-file option, Description
port option, Description
skip-kill-mysqld option, Description
skip-syslog option, Description
socket option, Description
syslog option, Description
Standard Index
3268
syslog-tag option, Description
timezone option, Description
user option, Description
mysqldump, Section 4.5.4, mysqldump A Database Backup Pro-
gram, Section 2.12.5, Copying MySQL Databases to Another Ma-
chine, Section 4.1, Overview of MySQL Programs
SSL options, Description
add-drop-database option, Description
add-drop-table option, Description
add-locks option, Description
all-databases option, Description
all-tablespaces option, Description
allow-keywords option, Description
character-sets-dir option, Description
comments option, Description
compact option, Description
compatible option, Description
complete-insert option, Description
compress option, Description
create-options option, Description
databases option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
default-character-set option, Description
delayed-insert option, Description
delete-master-logs option, Description
disable-keys option, Description
dump-date option, Description
events option, Description
extended-insert option, Description
fields-enclosed-by option, Description, Description
fields-escaped-by option, Description, Description
fields-optionally-enclosed-by option, Description, Description
fields-terminated-by option, Description, Description
first-slave option, Description
flush-logs option, Description
flush-privileges option, Description
force option, Description
help option, Description
hex-blob option, Description
host option, Description
ignore-table option, Description
insert-ignore option, Description
lines-terminated-by option, Description, Description
lock-all-tables option, Description
lock-tables option, Description
log-error option, Description
master-data option, Description
no-autocommit option, Description
no-create-db option, Description
no-create-info option, Description
no-data option, Description
no-set-names option, Description
opt option, Description
order-by-primary option, Description
password option, Description
pipe option, Description
port option, Description
problems, Section D.4, Restrictions on Views, Description
protocol option, Description
quick option, Description
quote-names option, Description
replace option, Description
result-file option, Description
routines option, Description
set-charset option, Description
single-transaction option, Description
skip-comments option, Description
skip-opt option, Description
socket option, Description
tab option, Description
tables option, Description
triggers option, Description
tz-utc option, Description
user option, Description
verbose option, Description
version option, Description
views, Section D.4, Restrictions on Views, Description
where option, Description
workarounds, Section D.4, Restrictions on Views, Description
xml option, Description
mysqldumpslow, Section 4.6.8, mysqldumpslow Summarize
Slow Query Log Files, Section 4.1, Overview of MySQL Programs
debug option, Description
help option, Description
verbose option, Description
mysqlhotcopy, Section 4.6.9, mysqlhotcopy A Database Backup
Program, Section 4.1, Overview of MySQL Programs
addtodest option, Description
allowold option, Description
checkpoint option, Description
chroot option, Description
debug option, Description
dryrun option, Description
flushlog option, Description
help option, Description
host option, Description
keepold option, Description
method option, Description
noindices option, Description
password option, Description
port option, Description
quiet option, Description
record_log_pos option, Description
regexp option, Description
resetmaster option, Description
resetslave option, Description
socket option, Description
suffix option, Description
tmpdir option, Description
user option, Description
mysqlimport, Section 4.5.5, mysqlimport A Data Import Pro-
gram, Section 2.12.5, Copying MySQL Databases to Another Ma-
chine, Section 12.2.6, LOAD DATA INFILE Syntax, Section 4.1,
Overview of MySQL Programs
SSL options, Description
character-sets-dir option, Description
columns option, Description
compress option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
default-character-set option, Description
delete option, Description
force option, Description
help option, Description
host option, Description
ignore option, Description
ignore-lines option, Description
Standard Index
3269
local option, Description
lock-tables option, Description
low-priority option, Description
password option, Description
pipe option, Description
port option, Description
protocol option, Description
replace option, Description
silent option, Description
socket option, Description
use-threads option, Description
user option, Description
verbose option, Description
version option, Description
mysqlmanager, Section 4.6.10, mysqlmanager The MySQL In-
stance Manager, Section 4.1, Overview of MySQL Programs
add-user option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
angel-pid-file option, Section 4.6.10.1, MySQL Instance Manager
Command Options
bind-address option, Section 4.6.10.1, MySQL Instance Manager
Command Options
check-password-file option, Section 4.6.10.1, MySQL Instance
Manager Command Options
clean-password-file option, Section 4.6.10.1, MySQL Instance Man-
ager Command Options
debug option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
default-mysqld-path option, Section 4.6.10.1, MySQL Instance
Manager Command Options
defaults-file option, Section 4.6.10.1, MySQL Instance Manager
Command Options
drop-user option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
edit-user option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
help option, Section 4.6.10.1, MySQL Instance Manager Command
Options
install option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
list-users option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
log option, Section 4.6.10.1, MySQL Instance Manager Command
Options
monitoring-interval option, Section 4.6.10.1, MySQL Instance Man-
ager Command Options
mysqld-safe-compatible option, Section 4.6.10.1, MySQL Instance
Manager Command Options
password option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
password-file option, Section 4.6.10.1, MySQL Instance Manager
Command Options
pid-file option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
port option, Section 4.6.10.1, MySQL Instance Manager Command
Options
print-defaults option, Section 4.6.10.1, MySQL Instance Manager
Command Options
print-password-line option, Section 4.6.10.1, MySQL Instance Man-
ager Command Options
remove option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
run-as-service option, Section 4.6.10.1, MySQL Instance Manager
Command Options
socket option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
standalone option, Section 4.6.10.1, MySQL Instance Manager
Command Options
user option, Section 4.6.10.1, MySQL Instance Manager Command
Options
username option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
version option, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
wait-timeout option, Section 4.6.10.1, MySQL Instance Manager
Command Options
mysqlshow, Section 4.5.6, mysqlshow Display Database, Table,
and Column Information, Section 4.1, Overview of MySQL Pro-
grams
SSL options, Description
character-sets-dir option, Description
compress option, Description
count option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
default-character-set option, Description
help option, Description
host option, Description
keys option, Description
password option, Description
pipe option, Description
port option, Description
protocol option, Description
show-table-type option, Description
socket option, Description
status option, Description
user option, Description
verbose option, Description
version option, Description
mysqlslap, Section 4.5.7, mysqlslap Load Emulation Client,
Section 4.1, Overview of MySQL Programs
SSL options, Description
auto-generate-sql option, Description
auto-generate-sql-add-autoincrement option, Description
auto-generate-sql-execute-number option, Description
auto-generate-sql-guid-primary option, Description
auto-generate-sql-load-type option, Description
auto-generate-sql-secondary-indexes option, Description
auto-generate-sql-unique-query-number option, Description
auto-generate-sql-unique-write-number option, Description
auto-generate-sql-write-number option, Description
commit option, Description
compress option, Description
concurrency option, Description
create option, Description
create-schema option, Description
csv option, Description
debug option, Description
debug-check option, Description
debug-info option, Description
delimiter option, Description
detach option, Description
engine option, Description
help option, Description
host option, Description
iterations option, Description
lock-directory option, Description
number-char-cols option, Description
number-int-cols option, Description
Standard Index
3270
number-of-queries option, Description
only-print option, Description
password option, Description
pipe option, Description
port option, Description
post-query option, Description
post-system option, Description
pre-query option, Description
pre-system option, Description
preserve-schema option, Description
protocol option, Description
query option, Description
shared-memory-base-name option, Description
silent option, Description
slave option, Description
socket option, Description
use-threads option, Description
user option, Description
verbose option, Description
version option, Description
mysqltest
MySQL Test Suite, Section 22.1.2, MySQL Test Suite
N
NAME_CONST(), Section 11.11.4, Miscellaneous Functions, Sec-
tion 19.6, Binary Logging of Stored Programs
NATIONAL CHAR data type, Section 10.1.3, Overview of String
Types
NATIONAL VARCHAR data type, Section 10.1.3, Overview of String
Types
NATURAL LEFT JOIN, Section 12.2.8.1, JOIN Syntax
NATURAL LEFT OUTER JOIN, Section 12.2.8.1, JOIN Syntax
NATURAL RIGHT JOIN, Section 12.2.8.1, JOIN Syntax
NATURAL RIGHT OUTER JOIN, Section 12.2.8.1, JOIN Syntax
NCHAR data type, Section 10.1.3, Overview of String Types
NDB, Section A.10, MySQL 5.1 FAQ MySQL Cluster
NDB storage engine, Chapter 17, MySQL Cluster NDB 6.X/7.X
FAQ, Section A.10, MySQL 5.1 FAQ MySQL Cluster
NDB tables
and MySQL root user, Section 17.8.2, MySQL Cluster and MySQL
Privileges
NDB utilities
security issues, Section 17.8.3, MySQL Cluster and MySQL Secur-
ity Procedures
NDBCLUSTER, Section A.10, MySQL 5.1 FAQ MySQL Cluster
NDBCLUSTER storage engine, Chapter 17, MySQL Cluster NDB
6.X/7.X
NFS
InnoDB, Section 13.6.14, Restrictions on InnoDB Tables, Sec-
tion 13.6.2, InnoDB Configuration
NODERESTART Events (MySQL Cluster), Section 17.7.4.2, MySQL
Cluster Log Events
NOT
logical, Section 11.2.4, Logical Operators
NOT BETWEEN, Section 11.2.3, Comparison Functions and Operat-
ors
NOT EXISTS
with subqueries, Section 12.2.9.6, EXISTS and NOT EXISTS
NOT IN, Section 11.2.3, Comparison Functions and Operators
NOT LIKE, Section 11.4.1, String Comparison Functions
NOT NULL
constraint, Section 1.7.6.2, Constraints on Invalid Data
NOT REGEXP, Section 11.4.2, Regular Expressions
NOW(), Section 11.6, Date and Time Functions
NOWAIT (START BACKUP command), Section 17.7.3.2, Using The
MySQL Cluster Management Client to Create a Backup
NO_AUTO_CREATE_USER SQL mode, Section 5.1.8, Server SQL
Modes
NO_AUTO_VALUE_ON_ZERO SQL mode, Section 5.1.8, Server
SQL Modes
NO_BACKSLASH_ESCAPES SQL mode, Section 5.1.8, Server SQL
Modes
NO_DIR_IN_CREATE SQL mode, Section 5.1.8, Server SQL Modes
NO_ENGINE_SUBSTITUTION SQL mode, Section 5.1.8, Server
SQL Modes
NO_FIELD_OPTIONS SQL mode, Section 5.1.8, Server SQL Modes
NO_KEY_OPTIONS SQL mode, Section 5.1.8, Server SQL Modes
NO_TABLE_OPTIONS SQL mode, Section 5.1.8, Server SQL
Modes
NO_UNSIGNED_SUBTRACTION SQL mode, Section 5.1.8, Server
SQL Modes
NO_ZERO_DATE SQL mode, Section 5.1.8, Server SQL Modes
NO_ZERO_IN_DATE SQL mode, Section 5.1.8, Server SQL Modes
NUL, Section 8.1.1, Strings, Section 12.2.6, LOAD DATA INFILE
Syntax
NULL, Section B.1.5.3, Problems with NULL Values, Section 3.3.4.6,
Working with NULL Values
ORDER BY, Section 7.2.13, ORDER BY Optimization, Sec-
tion 12.2.8, SELECT Syntax
testing for null, Section 11.3, Control Flow Functions, Sec-
tion 11.2.3, Comparison Functions and Operators
thread state, Section 7.5.6.2, General Thread States
NULL value, Section 8.1.6, NULL Values, Section 3.3.4.6, Working
with NULL Values
NULL values
and AUTO_INCREMENT columns, Section B.1.5.3, Problems with
NULL Values
and TIMESTAMP columns, Section B.1.5.3, Problems with NULL
Values
and indexes, Section 12.1.17, CREATE TABLE Syntax
vs. empty values, Section B.1.5.3, Problems with NULL Values
NULLIF(), Section 11.3, Control Flow Functions
NUMERIC data type, Section 10.1.1, Overview of Numeric Types
NVARCHAR data type, Section 10.1.3, Overview of String Types
Nested-Loop join algorithm, Section 7.2.10, Nested-Loop Join Al-
gorithms
NetWare, Section 2.8, Installing MySQL on NetWare
NoOfDiskPagesToDiskAfterRestartACC
calculating, Section 17.3.6, Configuring MySQL Cluster Parameters
for Local Checkpoints
NoOfDiskPagesToDiskAfterRestartACC (DEPRECATED), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
NoOfDiskPagesToDiskAfterRestartTUP
calculating, Section 17.3.6, Configuring MySQL Cluster Parameters
for Local Checkpoints
NoOfDiskPagesToDiskAfterRestartTUP (DEPRECATED), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
NoOfDiskPagesToDiskDuringRestartACC (DEPRECATED), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
NoOfDiskPagesToDiskDuringRestartTUP (DEPRECATED), Sec-
tion 17.3.4.6, Defining MySQL Cluster Data Nodes
NoOfFragmentLogFiles, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
calculating, Section 17.3.6, Configuring MySQL Cluster Parameters
for Local Checkpoints
NoOfReplicas, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
NodeGroup, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Nontransactional tables, Section B.1.5.5, Rollback Failure for Non-
transactional Tables
Standard Index
3271
Novell NetWare, Section 2.8, Installing MySQL on NetWare
NumGeometries(), Section 11.13.5.2.7, GeometryCollection
Functions
NumInteriorRings(), Section 11.13.5.2.5, Polygon Functions
NumPoints(), Section 11.13.5.2.3, LineString Functions
name_file option
comp_err, Description
named pipes, Section 2.3.8, Selecting a MySQL Server Type, Sec-
tion 2.3.12, Testing The MySQL Installation
named-commands option
mysql, Section 4.5.1.1, mysql Options
named_pipe system variable, Section 5.1.4, Server System Variables
names, Section 8.2, Schema Object Names
case sensitivity, Section 8.2.2, Identifier Case Sensitivity
variables, Section 8.4, User-Defined Variables
naming
releases of MySQL, Section 2.1.2.1, Choosing Which Version of
MySQL to Install
native backup and restore
backup identifiers, Section 17.7.3.2, Using The MySQL Cluster
Management Client to Create a Backup
native functions
adding, Section 22.3.3, Adding a New Native Function
native thread support, Section 2.1.1, Operating Systems Supported by
MySQL Community Server
ndb option
perror, Description
ndb-batch-size option
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndb-cluster-connection-pool option
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndb-connectstring option
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndb_config, Description
ndb-nodeid option
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndb_config, Section 17.6.24.6, Program Options for ndb_config,
Section 17.6.6, ndb_config Extract MySQL Cluster Configura-
tion Information, Section 17.6, MySQL Cluster Programs
config-file option, Description
configinfo option, Description
fields option, Description
host option, Description
id option, Description
ndb-connectstring option, Description
nodeid option, Description
nodes option, Description
query option, Description
rows option, Description
type option, Description
usage option, Description
version option, Description
xml option, Description
ndb_cpcd, Section 17.6.7, ndb_cpcd Automate Testing for NDB
Development, Section 17.6, MySQL Cluster Programs
ndb_delete_all, Section 17.6.8, ndb_delete_all Delete All
Rows from an NDB Table, Section 17.6, MySQL Cluster Programs
transactional option, Description
ndb_desc, Section 17.6.9, ndb_desc Describe NDB Tables, Sec-
tion 17.6, MySQL Cluster Programs
extra-partition-info option, Description
ndb_drop_index, Section 17.6, MySQL Cluster Programs, Sec-
tion 17.6.10, ndb_drop_index Drop Index from an NDB Table
ndb_drop_table, Section 17.6, MySQL Cluster Programs, Sec-
tion 17.6.11, ndb_drop_table Drop an NDB Table
ndb_error_reporter, Section 17.6.12, ndb_error_reporter
NDB Error-Reporting Utility, Section 17.6, MySQL Cluster Pro-
grams, Section 17.6.24.7, Program Options for
ndb_error_reporter
ndb_mgm, Section 17.6, MySQL Cluster Programs, Section 17.6.5,
ndb_mgm The MySQL Cluster Management Client
ndb_mgm (MySQL Cluster management node client), Section 17.2.4,
Initial Startup of MySQL Cluster
ndb_mgmd, Section 17.6.4, ndb_mgmd The MySQL Cluster Man-
agement Server Daemon, Section 17.6, MySQL Cluster Programs
ndb_mgmd (MySQL Cluster process), Section 17.6.4, ndb_mgmd
The MySQL Cluster Management Server Daemon
ndb_mgmd (MySQL Cluster)
defined, Section 17.1.1, MySQL Cluster Core Concepts
ndb_print_backup_file, Section 17.6, MySQL Cluster Programs, Sec-
tion 17.6.13, ndb_print_backup_file Print NDB Backup File
Contents
ndb_print_schema_file, Section 17.6.14,
ndb_print_schema_file Print NDB Schema File Contents,
Section 17.6, MySQL Cluster Programs
ndb_print_sys_file, Section 17.6, MySQL Cluster Programs, Sec-
tion 17.6.15, ndb_print_sys_file Print NDB System File
Contents
ndb_restore, Section 17.6.24.8, Program Options for ndb_restore,
Section 17.6.17, ndb_restore Restore a MySQL Cluster
Backup
attribute promotion, Description
errors, Description
ndb_select_all, Section 17.6, MySQL Cluster Programs, Sec-
tion 17.6.18, ndb_select_all Print Rows from an NDB Table
delimiter option, Description
descending option, Description
disk option, Description
gci option, Description
header option, Description
lock option, Description
nodata option, Description
order option, Description
rowid option, Description
tupscan option, Description
useHexFormat option, Description
ndb_select_count, Section 17.6.19, ndb_select_count Print
Row Counts for NDB Tables, Section 17.6, MySQL Cluster Pro-
grams
ndb_show_tables, Section 17.6.24.9, Program Options for
ndb_show_tables, Section 17.6.20, ndb_show_tables
Display List of NDB Tables, Section 17.6, MySQL Cluster Programs
loops option, Description
parsable option, Description
type option, Description
unqualified option, Description
ndb_size.pl, Section 17.6.21, ndb_size.pl NDBCLUSTER Size
Requirement Estimator, Section 17.6, MySQL Cluster Programs,
Section 17.6.24.10, Program Options for ndb_size.pl
ndb_size.pl (utility), Section A.10, MySQL 5.1 FAQ MySQL
Cluster
ndb_waiter, Section 17.6, MySQL Cluster Programs, Section 17.6.22,
ndb_waiter Wait for MySQL Cluster to Reach a Given Status
no-contact option, Description
not-started option, Description
timeout option, Description
Standard Index
3272
ndbcluster option
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
ndbd, Section 17.6.2, ndbd The MySQL Cluster Data Node Dae-
mon, Section 17.6, MySQL Cluster Programs
ndbd (MySQL Cluster)
defined, Section 17.1.1, MySQL Cluster Core Concepts
ndbd_redo_log_reader, Section 17.6.16, ndbd_redo_log_reader
Check and Print Content of Cluster Redo Log, Section 17.6.24.5,
Program Options for ndbd_redo_log_reader
ndbmtd, Section 17.6, MySQL Cluster Programs, Section 17.6.3,
ndbmtd The MySQL Cluster Data Node Daemon
(Multi-Threaded)
MaxNoOfExecutionThreads, Description
trace files, Description
negative values, Section 8.1.2, Numbers
nested queries, Section 12.2.9, Subquery Syntax
nested-loop join algorithm, Section 7.2.11, Nested Join Optimization
net_buffer_length system variable, Section 5.1.4, Server System Vari-
ables
net_buffer_length variable, Section 4.5.1.1, mysql Options
net_read_timeout system variable, Section 5.1.4, Server System Vari-
ables
net_retry_count system variable, Section 5.1.4, Server System Vari-
ables
net_write_timeout system variable, Section 5.1.4, Server System Vari-
ables
netmask notation
in account names, Section 5.4.3, Specifying Account Names
network ports
and MySQL Cluster, Section 17.8.1, MySQL Cluster Security and
Networking Issues
new procedures
adding, Section 22.4, Adding New Procedures to MySQL
new system variable, Section 5.1.4, Server System Variables
new users
adding, Section 2.10.1, Source Installation Overview, Section 2.9,
Installing MySQL from tar.gz Packages on Other Unix-Like Sys-
tems
newline (\n), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA
INFILE Syntax
next-key lock
InnoDB, Section 13.6.8.4, InnoDB Record, Gap, and Next-Key
Locks, Section 13.6.8, The InnoDB Transaction Model and Lock-
ing, Section 13.6.8.5, Avoiding the Phantom Problem Using Next-
Key Locking, Section 13.6.3, InnoDB Startup Options and System
Variables
nice option
mysqld_safe, Description
no matching rows, Section B.1.5.7, Solving Problems with No Match-
ing Rows
no-auto-rehash option
mysql, Section 4.5.1.1, mysql Options
no-autocommit option
mysqldump, Description
no-beep option
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
no-contact option
ndb_waiter, Description
no-create-db option
mysqldump, Description
no-create-info option
mysqldump, Description
no-data option
mysqldump, Description
no-debug option
make_win_bin_dist, Description
no-defaults option, Section 4.2.3.3.1, Command-Line Options that Af-
fect Option-File Handling
my_print_defaults, Description
mysqld_multi, Description
mysqld_safe, Description
no-embedded option
make_win_bin_dist, Description
no-log option
mysqld_multi, Description
no-named-commands option
mysql, Section 4.5.1.1, mysql Options
no-pager option
mysql, Section 4.5.1.1, mysql Options
no-set-names option
mysqldump, Description
no-symlinks option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
no-tee option
mysql, Section 4.5.1.1, mysql Options
nodata option
ndb_select_all, Description
node groups (MySQL Cluster), Section 17.1.2, MySQL Cluster Nodes,
Node Groups, Replicas, and Partitions
node identifiers (MySQL Cluster), Section 17.3.4.10, MySQL Cluster
Shared-Memory Connections, Section 17.3.4.11, SCI Transport Con-
nections in MySQL Cluster
node logs (MySQL Cluster), Section 17.7.4, Event Reports Generated
in MySQL Cluster
nodeid option
ndb_config, Description
nodes option
ndb_config, Description
noindices option
mysqlhotcopy, Description
nondelimited strings, Section 10.3.1, The DATETIME, DATE, and
TIMESTAMP Types
nopager command
mysql, Section 4.5.1.2, mysql Commands
not equal (!=), Section 11.2.3, Comparison Functions and Operators
not equal (<>), Section 11.2.3, Comparison Functions and Operators
not-started option
ndb_waiter, Description
notee command
mysql, Section 4.5.1.2, mysql Commands
nowarning command
mysql, Section 4.5.1.2, mysql Commands
number-char-cols option
mysqlslap, Description
number-int-cols option
mysqlslap, Description
number-of-queries option
mysqlslap, Description
numbers, Section 8.1.2, Numbers
numeric types, Section 10.5, Data Type Storage Requirements
numeric-dump-file option
resolve_stack_dump, Description
O
OCT(), Section 11.5.2, Mathematical Functions
OCTET_LENGTH(), Section 11.4, String Functions
ODBC, Section 21.1, MySQL Connector/ODBC
Standard Index
3273
ODBC compatibility, Section 12.1.17, CREATE TABLE Syntax, Sec-
tion 8.2.1, Identifier Qualifiers, Section 10.1.1, Overview of Numeric
Types, Section 11.2.3, Comparison Functions and Operators, Sec-
tion 11.2.2, Type Conversion in Expression Evaluation, Sec-
tion 12.2.8.1, JOIN Syntax
ODirect, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
OLAP, Section 11.12.2, GROUP BY Modifiers
OLD_PASSWORD(), Section 11.11.2, Encryption and Compression
Functions
ON DUPLICATE KEY UPDATE, Section 12.2.5, INSERT Syntax
ONLY_FULL_GROUP_BY
SQL mode, Section 11.12.3, GROUP BY and HAVING with Hidden
Columns
ONLY_FULL_GROUP_BY SQL mode, Section 5.1.8, Server SQL
Modes
OPTIMIZE TABLE, Section 12.5.2.5, OPTIMIZE TABLE Syntax
and partitioning, Section 18.3.3, Maintenance of Partitions
OR, Section 7.2.6, Index Merge Optimization, Section 3.6.7,
Searching on Two Keys
bitwise, Section 11.11.1, Bit Functions
logical, Section 11.2.4, Logical Operators
OR Index Merge optimization, Section 7.2.6, Index Merge Optimiza-
tion
ORACLE SQL mode, Section 5.1.8, Server SQL Modes
ORD(), Section 11.4, String Functions
ORDER BY, Section 12.1.7, ALTER TABLE Syntax, Section 3.3.4.4,
Sorting Rows, Section 12.2.8, SELECT Syntax
NULL, Section 7.2.13, ORDER BY Optimization, Section 12.2.8,
SELECT Syntax
OUTFILE, Section 12.2.8, SELECT Syntax
Obtaining MySQL Cluster, Section 17.2.2, MySQL Cluster Multi-
Computer Installation
OpenGIS, Section 11.13.1, Introduction to MySQL Spatial Support
OpenSSL, Section 5.5.7.2, Using SSL Connections, Section 5.5.7,
Using SSL for Secure Connections
Opening master dump table
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
Opening mysql.ndb_apply_status
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Opening table
thread state, Section 7.5.6.2, General Thread States
Opening tables
thread state, Section 7.5.6.2, General Thread States
Oracle compatibility, Section 11.12.1, GROUP BY (Aggregate) Func-
tions, Section 12.3.1, DESCRIBE Syntax, Section 1.7.4, MySQL
Extensions to Standard SQL
Overlaps(), Section 11.13.5.6, Functions That Test Spatial Relation-
ships Between Geometries
OverloadLimit, Section 17.3.4.8, MySQL Cluster TCP/IP Connections
obtaining information about partitions, Section 18.3.4, Obtaining In-
formation About Partitions
offset option
mysqlbinlog, Description
old system variable, Section 5.1.4, Server System Variables
old-passwords option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
old-style-user-limits option
mysqld, Section 5.1.2, Server Command Options
old_passwords system variable, Section 5.1.4, Server System Vari-
ables
old_server option
mysqlaccess, Description
one-database option
mysql, Section 4.5.1.1, mysql Options
one-thread option
mysqld, Section 5.1.2, Server Command Options
one_shot system variable, Section 5.1.4, Server System Variables
online location of manual, Section 1.1, About This Manual
only-debug option
make_win_bin_dist, Description
only-print option
mysqlslap, Description
open tables, Description, Section 7.4.7, How MySQL Opens and Closes
Tables
open-files-limit option
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
open_files_limit system variable, Section 5.1.4, Server System Vari-
ables
open_files_limit variable, Description
opening
tables, Section 7.4.7, How MySQL Opens and Closes Tables
opens, Description
operating systems
Windows versus Unix, Section 2.3.15, MySQL on Windows Com-
pared to MySQL on Unix
file-size limits, Section B.1.2.12, The table is full
supported, Section 2.1.1, Operating Systems Supported by MySQL
Community Server
operations
arithmetic, Section 11.5.1, Arithmetic Operators
operators, Chapter 11, Functions and Operators
assignment, Section 8.4, User-Defined Variables
cast, Section 11.9, Cast Functions and Operators, Section 11.5.1,
Arithmetic Operators
logical, Section 11.2.4, Logical Operators
precedence, Section 11.2.1, Operator Precedence
opt option
mysqldump, Description
optimization
subquery, Section 7.2.16, Optimizing IN/=ANY Subqueries
tips, Section 7.2.24, Other Optimization Tips
optimizations, Section 7.2.4, WHERE Clause Optimization, Sec-
tion 7.2.6, Index Merge Optimization
optimize option
mysqlcheck, Description
optimizer
and replication, Section 16.3.1.18, Replication and the Query Op-
timizer
controlling, Section 7.5.4, Controlling Query Optimizer Perform-
ance
optimizer_prune_level system variable, Section 5.1.4, Server System
Variables
optimizer_search_depth system variable, Section 5.1.4, Server System
Variables
optimizer_switch system variable, Section 5.1.4, Server System Vari-
ables, Section 7.2.18, Using optimizer_switch to Control the
Optimizer
optimizer_use_mrr system variable, Section 5.1.4, Server System Vari-
ables
optimizing
DISTINCT, Section 7.2.15, DISTINCT Optimization
GROUP BY, Section 7.2.14, GROUP BY Optimization
LEFT JOIN, Section 7.2.9, LEFT JOIN and RIGHT JOIN Optim-
ization
LIMIT, Section 7.2.17, LIMIT Optimization
filesort, Section 7.2.13, ORDER BY Optimization
tables, Section 6.4.4, Table Optimization
Standard Index
3274
option files, Section 5.4.7, Causes of Access-Denied Errors, Sec-
tion 4.2.3.3, Using Option Files
option modifiers, Section 4.2.3.2, Program Option Modifiers
options
boolean, Section 4.2.3.2, Program Option Modifiers
command-line
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
configure, Section 2.10.2, Typical configure Options
embedded server, Section 21.9.3, Options with the Embedded Serv-
er
libmysqld, Section 21.9.3, Options with the Embedded Server
myisamchk, Section 4.6.3.1, myisamchk General Options
provided by MySQL, Chapter 3, Tutorial
replication, Section 16.3.1, Replication Features and Issues
order option
ndb_select_all, Description
order-by-primary option
mysqldump, Description
out_dir option
comp_err, Description
out_file option
comp_err, Description
overview, Chapter 1, General Information
P
PAD_CHAR_TO_FULL_LENGTH SQL mode, Section 5.1.8, Server
SQL Modes
PARTITION, Chapter 18, Partitioning
PARTITIONS
INFORMATION_SCHEMA table, Section 20.19, The INFORMA-
TION_SCHEMA PARTITIONS Table
PASSWORD(), Section B.1.2.15, Ignoring user, Section 5.5.5,
Assigning Account Passwords, Section 5.4.4, Access Control, Stage
1: Connection Verification, Section 11.11.2, Encryption and Compres-
sion Functions
PATH environment variable, Section 2.9, Installing MySQL from
tar.gz Packages on Other Unix-Like Systems, Section 4.2.1,
Invoking MySQL Programs, Section 2.14, Environment Variables
PERIOD_ADD(), Section 11.6, Date and Time Functions
PERIOD_DIFF(), Section 11.6, Date and Time Functions
PHP API, Section 21.11, MySQL PHP API
PI(), Section 11.5.2, Mathematical Functions
PIPES_AS_CONCAT SQL mode, Section 5.1.8, Server SQL Modes
PLUGINS
INFORMATION_SCHEMA table, Section 20.17, The INFORMA-
TION_SCHEMA PLUGINS Table
POINT data type, Section 11.13.4.1, MySQL Spatial Data Types
POLYGON data type, Section 11.13.4.1, MySQL Spatial Data Types
POSITION(), Section 11.4, String Functions
POSTGRESQL SQL mode, Section 5.1.8, Server SQL Modes
POW(), Section 11.5.2, Mathematical Functions
POWER(), Section 11.5.2, Mathematical Functions
PREPARE, Section 12.7, SQL Syntax for Prepared Statements, Sec-
tion 12.7.1, PREPARE Syntax
XA transactions, Section 12.4.7.1, XA Transaction SQL Syntax
PRIMARY KEY, Section 12.1.17, CREATE TABLE Syntax, Sec-
tion 12.1.7, ALTER TABLE Syntax
PROCEDURE, Section 12.2.8, SELECT Syntax
PROCESSLIST, Section 12.5.5.31, SHOW PROCESSLIST Syntax
INFORMATION_SCHEMA table, Section 20.22, The INFORMA-
TION_SCHEMA PROCESSLIST Table
PROFILING
INFORMATION_SCHEMA table, Section 20.26, The INFORMA-
TION_SCHEMA PROFILING Table
PURGE BINARY LOGS, Section 12.6.1.1, PURGE BINARY LOGS
Syntax
PURGE MASTER LOGS, Section 12.6.1.1, PURGE BINARY LOGS
Syntax
PURGE STALE SESSIONS, Section 17.7.1, Summary of MySQL
Cluster Start Phases
Partitioning
maximum number of partitions, Section 18.5, Restrictions and Lim-
itations on Partitioning
Perl
installing, Section 2.15, Perl Installation Notes
installing on Windows, Section 2.15.2, Installing ActiveState Perl
on Windows
Perl API, Section 21.12, MySQL Perl API
Perl DBI/DBD
installation problems, Section 2.15.3, Problems Using the Perl
DBI/DBD Interface
Ping
thread command, Section 7.5.6.1, Thread Command Values
Point(), Section 11.13.4.2.3, Creating Geometry Values Using MySQL-
Specific Functions
PointFromText(), Section 11.13.4.2.1, Creating Geometry Values Using
WKT Functions
PointFromWKB(), Section 11.13.4.2.2, Creating Geometry Values Us-
ing WKB Functions
PointN(), Section 11.13.5.2.3, LineString Functions
PointOnSurface(), Section 11.13.5.2.6, MultiPolygon Functions
PolyFromText(), Section 11.13.4.2.1, Creating Geometry Values Using
WKT Functions
PolyFromWKB(), Section 11.13.4.2.2, Creating Geometry Values Us-
ing WKB Functions
Polygon(), Section 11.13.4.2.3, Creating Geometry Values Using
MySQL-Specific Functions
PolygonFromText(), Section 11.13.4.2.1, Creating Geometry Values
Using WKT Functions
PolygonFromWKB(), Section 11.13.4.2.2, Creating Geometry Values
Using WKB Functions
PortNumber, Section 17.3.4.5, Defining a MySQL Cluster Management
Server, Section 17.3.4.8, MySQL Cluster TCP/IP Connections
PostgreSQL compatibility, Section 1.7.4, MySQL Extensions to Stand-
ard SQL
Prepare
thread command, Section 7.5.6.1, Thread Command Values
Processing events
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Processing events from schema table
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Processlist
thread command, Section 7.5.6.1, Thread Command Values
Purging old relay logs
thread state, Section 7.5.6.2, General Thread States
Python API, Section 21.14, MySQL Python API
pack_isam, Section 4.1, Overview of MySQL Programs
page-level locking, Section 7.3.1, Internal Locking Methods
pager command
mysql, Section 4.5.1.2, mysql Commands
pager option
mysql, Section 4.5.1.1, mysql Options
parallel-recover option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
parameters
server, Section 7.5.3, Tuning Server Parameters
parentheses ( and ), Section 11.2.1, Operator Precedence
parsable option
Standard Index
3275
ndb_show_tables, Description
partition management, Section 18.3, Partition Management
partition pruning, Section 18.4, Partition Pruning
partitioning, Chapter 18, Partitioning
advantages, Section 18.1, Overview of Partitioning in MySQL
and FULLTEXT indexes, Section 18.5, Restrictions and Limitations
on Partitioning
and dates, Section 18.2, Partition Types
and foreign keys, Section 18.5, Restrictions and Limitations on Par-
titioning
and key cache, Section 18.5, Restrictions and Limitations on Parti-
tioning
and server SQL mode, Section 18.5, Restrictions and Limitations on
Partitioning
and subqueries, Section 18.5, Restrictions and Limitations on Parti-
tioning
and temporary tables, Section 18.5.1, Partitioning Keys, Primary
Keys, and Unique Keys, Section 18.5, Restrictions and Limitations
on Partitioning
by hash, Section 18.2.3, HASH Partitioning
by key, Section 18.2.4, KEY Partitioning
by linear hash, Section 18.2.3.1, LINEAR HASH Partitioning
by linear key, Section 18.2.4, KEY Partitioning
by list, Section 18.2.2, LIST Partitioning
by range, Section 18.2.1, RANGE Partitioning
concepts, Section 18.1, Overview of Partitioning in MySQL
data type of partitioning key, Section 18.5, Restrictions and Limita-
tions on Partitioning
enabling, Chapter 18, Partitioning
functions supported in partitioning expressions, Section 18.5.3,
Partitioning Limitations Relating to Functions
limitations, Section 18.5, Restrictions and Limitations on Partition-
ing
operators disallowed in partitioning expressions, Section 18.5,
Restrictions and Limitations on Partitioning
operators supported in partitioning expressions, Section 18.5,
Restrictions and Limitations on Partitioning
optimization, Section 18.3.4, Obtaining Information About Parti-
tions, Section 18.4, Partition Pruning
resources, Chapter 18, Partitioning
storage engines (limitations), Section 18.5.2, Partitioning Limita-
tions Relating to Storage Engines
subpartitioning, Section 18.5, Restrictions and Limitations on Parti-
tioning
support, Chapter 18, Partitioning
support in MySQL Cluster, Section 17.12.1, Noncompliance with
SQL Syntax in MySQL Cluster
types, Section 18.2, Partition Types
partitioning information statements, Section 18.3.4, Obtaining Informa-
tion About Partitions
partitioning keys and primary keys, Section 18.5.1, Partitioning Keys,
Primary Keys, and Unique Keys
partitioning keys and unique keys, Section 18.5.1, Partitioning Keys,
Primary Keys, and Unique Keys
partitions
adding and dropping, Section 18.3, Partition Management
analyzing, Section 18.3.3, Maintenance of Partitions
checking, Section 18.3.3, Maintenance of Partitions
managing, Section 18.3, Partition Management
modifying, Section 18.3, Partition Management
optimizing, Section 18.3.3, Maintenance of Partitions
repairing, Section 18.3.3, Maintenance of Partitions
splitting and merging, Section 18.3, Partition Management
partitions (MySQL Cluster), Section 17.1.2, MySQL Cluster Nodes,
Node Groups, Replicas, and Partitions
password
root user, Section 2.11.3, Securing the Initial MySQL Accounts
password encryption
reversibility of, Section 11.11.2, Encryption and Compression Func-
tions
password option, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysqlaccess, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld_multi, Description
mysqldump, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
password-file option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
passwords
administrator guidelines, Section 5.5.6.1, Administrator Guidelines
for Password Security
for users, Section 5.5.1, User Names and Passwords
forgotten, Section B.1.4.1, How to Reset the Root Password
hashing, Section 5.5.6.3, Password Hashing in MySQL
lost, Section B.1.4.1, How to Reset the Root Password
resetting, Section B.1.4.1, How to Reset the Root Password
security, Section 5.4, The MySQL Access Privilege System, Sec-
tion 5.5.6, Password Security in MySQL
setting, Section 5.5.5, Assigning Account Passwords, Sec-
tion 12.5.1.6, SET PASSWORD Syntax, Section 12.5.1.3, GRANT
Syntax
user guidelines, Section 5.5.6.2, End-User Guidelines for Password
Security
pattern matching, Section 3.3.4.7, Pattern Matching, Section 11.4.2,
Regular Expressions
performance
benchmarks, Section 7.1.5, Using Your Own Benchmarks
disk issues, Section 7.6, Disk Issues
estimating, Section 7.2.2, Estimating Query Performance
improving, Section 16.3.4, Replication FAQ, Section 7.4.1, Make
Your Data as Small as Possible
permission checks
effect on speed, Section 7.2, Optimizing SELECT and Other State-
ments
perror, Section 4.8.1, perror Explain Error Codes, Section 4.1,
Overview of MySQL Programs
--ndb option, Section A.10, MySQL 5.1 FAQ MySQL Cluster
help option, Description
ndb option, Description
silent option, Description
verbose option, Description
version option, Description
phantom rows, Section 13.6.8.5, Avoiding the Phantom Problem Using
Next-Key Locking
pid-file option
mysql.server, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
pid_file system variable, Section 5.1.4, Server System Variables
Standard Index
3276
pipe option, Section 4.2.2, Connecting to the MySQL Server
mysql, Description, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
plan option
mysqlaccess, Description
plugin API, Section 22.2, The MySQL Plugin Interface
plugin-load option
mysqld, Section 5.1.2, Server Command Options
plugin_dir system variable, Section 5.1.4, Server System Variables
plugindir option
mysql_config, Description
plugins
adding, Section 22.2, The MySQL Plugin Interface
installing, Section 12.5.3.3, INSTALL PLUGIN Syntax
uninstalling, Section 12.5.3.4, UNINSTALL PLUGIN Syntax
point in time recovery, Section 6.3, Point-in-Time Recovery
port option, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysql_config, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
mysqldump, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
port system variable, Section 5.1.4, Server System Variables
port-open-timeout option
mysqld, Section 5.1.2, Server Command Options
portability, Section 7.1.2, Designing Applications for Portability
types, Section 10.7, Using Data Types from Other Database En-
gines
porting
to other systems, Section 22.5, Debugging and Porting MySQL
position option
mysqlbinlog, Description
post-install
multiple servers, Section 5.6, Running Multiple MySQL Servers on
the Same Machine
post-installation
setup and testing, Section 2.11, Post-Installation Setup and Testing
post-query option
mysqlslap, Description
post-system option
mysqlslap, Description
pre-query option
mysqlslap, Description
pre-system option
mysqlslap, Description
precedence
operator, Section 11.2.1, Operator Precedence
prefix option
configure, Section 2.10.2, Typical configure Options
preload_buffer_size system variable, Section 5.1.4, Server System
Variables
prepared statements, Section 12.7.2, EXECUTE Syntax, Sec-
tion 21.10.4, C API Prepared Statements, Section 12.7, SQL Syntax
for Prepared Statements, Section 12.7.3, DEALLOCATE PREPARE
Syntax, Section 12.7.1, PREPARE Syntax
repreparation, Section 12.7.4, Automatic Prepared Statement Repre-
paration
prepared_stmt_count system variable, Section 5.1.4, Server System
Variables
preparing
thread state, Section 7.5.6.2, General Thread States
preserve-schema option
mysqlslap, Description
preview option
mysqlaccess, Description
primary key
constraint, Section 1.7.6.1, PRIMARY KEY and UNIQUE Index
Constraints
deleting, Section 12.1.7, ALTER TABLE Syntax
primary keys
and partitioning keys, Section 18.5.1, Partitioning Keys, Primary
Keys, and Unique Keys
print command
mysql, Section 4.5.1.2, mysql Commands
print-defaults option, Section 4.2.3.3.1, Command-Line Options that
Affect Option-File Handling
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
print-password-line option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
privilege
changes, Section 5.4.6, When Privilege Changes Take Effect
privilege information
location, Section 5.4.2, Privilege System Grant Tables
privilege system, Section 5.4, The MySQL Access Privilege System
privileges
access, Section 5.4, The MySQL Access Privilege System
adding, Section 5.5.2, Adding User Accounts
and replication, Section 16.3.1.17, Replication of the System
mysql Database
default, Section 2.11.3, Securing the Initial MySQL Accounts
deleting, Section 5.5.3, Removing User Accounts, Section 12.5.1.2,
DROP USER Syntax
display, Section 12.5.5.22, SHOW GRANTS Syntax
dropping, Section 5.5.3, Removing User Accounts, Sec-
tion 12.5.1.2, DROP USER Syntax
granting, Section 12.5.1.3, GRANT Syntax
revoking, Section 12.5.1.5, REVOKE Syntax
problems
DATE columns, Section B.1.5.2, Problems Using DATE Columns
access denied errors, Section B.1.2.1, Access denied
common errors, Section B.1, Problems and Common Errors
compiling, Section 2.10.4, Dealing with Problems Compiling
MySQL
date values, Section 10.3.1, The DATETIME, DATE, and
TIMESTAMP Types
installing Perl, Section 2.15.3, Problems Using the Perl DBI/DBD
Interface
installing on IBM-AIX, Section 2.13.5.3, IBM-AIX notes
installing on Solaris, Section 2.13.3, Solaris Notes
linking, Section B.1.3.1, Problems Linking to the MySQL Client
Library
lost connection errors, Section B.1.2.3, Lost connection to
MySQL server
reporting, Section 1.6, How to Report Bugs or Problems
starting the server, Section 2.11.2.3, Starting and Troubleshooting
Standard Index
3277
the MySQL Server
table locking, Section 7.3.2, Table Locking Issues
time zone, Section B.1.4.6, Time Zone Problems
procedures
adding, Section 22.4, Adding New Procedures to MySQL
stored, Section 19.2, Using Stored Routines (Procedures and Func-
tions), Section 1.7.5.3, Stored Routines and Triggers
process management (MySQL Cluster), Section 17.6, MySQL Cluster
Programs
process support, Section 2.1.1, Operating Systems Supported by
MySQL Community Server
processes
display, Section 12.5.5.31, SHOW PROCESSLIST Syntax
processing
arguments, Section 22.3.2.3, UDF Argument Processing
profiling session variable, Section 5.1.5, Session System Variables
profiling_history_size session variable, Section 5.1.5, Session System
Variables
program options (MySQL Cluster), Section 17.6.23, Options Common
to MySQL Cluster Programs
ndb_config, Section 17.6.24.6, Program Options for ndb_config
ndb_error_reporter, Section 17.6.24.7, Program Options for
ndb_error_reporter
ndb_restore, Section 17.6.24.8, Program Options for
ndb_restore
ndb_show_tables, Section 17.6.24.9, Program Options for
ndb_show_tables
ndb_size.pl, Section 17.6.24.10, Program Options for
ndb_size.pl
ndbd_redo_log_reader, Section 17.6.24.5, Program Options for nd-
bd_redo_log_reader
program variables
setting, Section 4.2.3.4, Using Options to Set Program Variables
program-development utilities, Section 4.1, Overview of MySQL Pro-
grams
programs
administrative, Section 4.1, Overview of MySQL Programs
client, Section 21.10.16, Building Client Programs, Section 4.1,
Overview of MySQL Programs
crash-me, Section 7.1.2, Designing Applications for Portability
stored, Chapter 19, Stored Programs and Views
utility, Section 4.1, Overview of MySQL Programs
prompt command
mysql, Section 4.5.1.2, mysql Commands
prompt option
mysql, Section 4.5.1.1, mysql Options
prompts
meanings, Section 3.2, Entering Queries
protocol option, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
protocol_version system variable, Section 5.1.4, Server System Vari-
ables
pseudo_thread_id system variable, Section 5.1.4, Server System Vari-
ables
Q
QUARTER(), Section 11.6, Date and Time Functions
QUIT command (MySQL Cluster), Section 17.7.2, Commands in the
MySQL Cluster Management Client
QUOTE(), Section 11.4, String Functions
Query
thread command, Section 7.5.6.1, Thread Command Values
Query Cache, Section 7.5.5, The MySQL Query Cache
Queueing master event to the relay log
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Quit
thread command, Section 7.5.6.1, Thread Command Values
queries
Twin Studies project, Section 3.7, Queries from the Twin Project
entering, Section 3.2, Entering Queries
estimating performance, Section 7.2.2, Estimating Query Perform-
ance
examples, Section 3.6, Examples of Common Queries
speed of, Section 7.2, Optimizing SELECT and Other Statements
query end
thread state, Section 7.5.6.2, General Thread States
query option
mysqlslap, Description
ndb_config, Description
query_alloc_block_size system variable, Section 5.1.4, Server System
Variables
query_cache_limit system variable, Section 5.1.4, Server System Vari-
ables
query_cache_min_res_unit system variable, Section 5.1.4, Server Sys-
tem Variables
query_cache_size system variable, Section 5.1.4, Server System Vari-
ables
query_cache_type system variable, Section 5.1.4, Server System Vari-
ables
query_cache_wlock_invalidate system variable, Section 5.1.4, Server
System Variables
query_prealloc_size system variable, Section 5.1.4, Server System
Variables
questions, Description
quick option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
mysql, Section 4.5.1.1, mysql Options
mysqlcheck, Description
mysqldump, Description
quiet option
mysqlhotcopy, Description
quit command
mysql, Section 4.5.1.2, mysql Commands
quote-names option
mysqldump, Description
quotes
in strings, Section 8.1.1, Strings
quoting, Section 8.1.1, Strings
quoting binary data, Section 8.1.1, Strings
quoting of identifiers, Section 8.2, Schema Object Names
R
RADIANS(), Section 11.5.2, Mathematical Functions
RAID
compile errors, Section 2.10.4, Dealing with Problems Compiling
MySQL
RAND(), Section 11.5.2, Mathematical Functions
READ COMMITTED
transaction isolation level, Section 12.4.6, SET TRANSACTION
Syntax
READ UNCOMMITTED
Standard Index
3278
transaction isolation level, Section 12.4.6, SET TRANSACTION
Syntax
REAL data type, Section 10.1.1, Overview of Numeric Types
REAL_AS_FLOAT SQL mode, Section 5.1.8, Server SQL Modes
RECOVER
XA transactions, Section 12.4.7.1, XA Transaction SQL Syntax
REFERENTIAL_CONSTRAINTS
INFORMATION_SCHEMA table, Section 20.23, The INFORMA-
TION_SCHEMA REFERENTIAL_CONSTRAINTS Table
REGEXP, Section 11.4.2, Regular Expressions
REGEXP operator, Section 11.4.2, Regular Expressions
RELEASE SAVEPOINT, Section 12.4.4, SAVEPOINT and ROLL-
BACK TO SAVEPOINT Syntax
RELEASE_LOCK(), Section 11.11.4, Miscellaneous Functions
RENAME DATABASE, Section 12.1.32, RENAME DATABASE Syn-
tax
RENAME TABLE, Section 12.1.33, RENAME TABLE Syntax
RENAME USER, Section 12.5.1.4, RENAME USER Syntax
REPAIR TABLE, Section 12.5.2.6, REPAIR TABLE Syntax
and partitioning, Section 18.3.3, Maintenance of Partitions
REPEAT(), Section 11.4, String Functions
REPEATABLE READ
transaction isolation level, Section 12.4.6, SET TRANSACTION
Syntax
REPLACE, Section 12.2.7, REPLACE Syntax
REPLACE(), Section 11.4, String Functions
REPORT command (MySQL Cluster), Section 17.7.2, Commands in
the MySQL Cluster Management Client
REQUIRE GRANT option, Section 12.5.1.3, GRANT Syntax
RESET MASTER, Section 12.6.1.2, RESET MASTER Syntax
RESET SLAVE, Section 12.6.2.5, RESET SLAVE Syntax
RESTART command (MySQL Cluster), Section 17.7.2, Commands in
the MySQL Cluster Management Client
RESTORE TABLE, Section 12.5.2.7, RESTORE TABLE Syntax
REVERSE(), Section 11.4, String Functions
REVOKE, Section 12.5.1.5, REVOKE Syntax
RIGHT JOIN, Section 12.2.8.1, JOIN Syntax
RIGHT OUTER JOIN, Section 12.2.8.1, JOIN Syntax
RIGHT(), Section 11.4, String Functions
RLIKE, Section 11.4.2, Regular Expressions
ROLLBACK, Section 12.4.1, START TRANSACTION, COMMIT, and
ROLLBACK Syntax, Section 1.7.5.2, Transactions and Atomic Opera-
tions
XA transactions, Section 12.4.7.1, XA Transaction SQL Syntax
ROLLBACK TO SAVEPOINT, Section 12.4.4, SAVEPOINT and
ROLLBACK TO SAVEPOINT Syntax
ROLLUP, Section 11.12.2, GROUP BY Modifiers
ROUND(), Section 11.5.2, Mathematical Functions
ROUTINES
INFORMATION_SCHEMA table, Section 20.14, The INFORMA-
TION_SCHEMA ROUTINES Table
ROW, Section 12.2.9.5, Row Subqueries
ROW_COUNT(), Section 11.11.3, Information Functions
RPAD(), Section 11.4, String Functions
RPM Package Manager, Section 2.4, Installing MySQL from RPM
Packages on Linux
RPM file, Section 2.4, Installing MySQL from RPM Packages on
Linux
RTRIM(), Section 11.4, String Functions
RTS-threads, Section 22.5.4, Comments about RTS Threads
Reading event from the relay log
thread state, Section 7.5.6.6, Replication Slave SQL Thread States
Reading from net
thread state, Section 7.5.6.2, General Thread States
Reading master dump table data
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
RealtimeScheduler, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Rebuilding the index on master dump table
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
ReceiveBufferMemory, Section 17.3.4.8, MySQL Cluster TCP/IP Con-
nections
Reconnecting after a failed binlog dump request
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Reconnecting after a failed master event read
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
RedoBuffer, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Refresh
thread command, Section 7.5.6.1, Thread Command Values
Register Slave
thread command, Section 7.5.6.1, Thread Command Values
Registering slave on master
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Related(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
Removing duplicates
thread state, Section 7.5.6.2, General Thread States
Reopen tables
thread state, Section 7.5.6.2, General Thread States
Repair by sorting
thread state, Section 7.5.6.2, General Thread States
Repair done
thread state, Section 7.5.6.2, General Thread States
Repair with keycache
thread state, Section 7.5.6.2, General Thread States
Requesting binlog dump
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
ReservedSendBufferMemory, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
Reset stmt
thread command, Section 7.5.6.1, Thread Command Values
RestartOnErrorInsert, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Rolling back
thread state, Section 7.5.6.2, General Thread States
Rpl_semi_sync_master_clients status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_net_avg_wait_time status variable, Sec-
tion 5.1.7, Server Status Variables
Rpl_semi_sync_master_net_wait_time status variable, Section 5.1.7,
Server Status Variables
Rpl_semi_sync_master_net_waits status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_no_times status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_no_tx status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_status status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_timefunc_failures status variable, Section 5.1.7,
Server Status Variables
Rpl_semi_sync_master_tx_avg_wait_time status variable, Section 5.1.7,
Server Status Variables
Rpl_semi_sync_master_tx_wait_time status variable, Section 5.1.7,
Server Status Variables
Rpl_semi_sync_master_tx_waits status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_wait_pos_backtraverse status variable, Sec-
Standard Index
3279
tion 5.1.7, Server Status Variables
Rpl_semi_sync_master_wait_sessions status variable, Section 5.1.7,
Server Status Variables
Rpl_semi_sync_master_yes_tx status variable, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_slave_status status variable, Section 5.1.7, Server
Status Variables
Ruby API, Section 21.15, MySQL Ruby APIs
rand_seed1 session variable, Section 5.1.5, Session System Variables
rand_seed2 session variable, Section 5.1.5, Session System Variables
range join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
range partitioning, Section 18.2.1, RANGE Partitioning
range partitions
adding and dropping, Section 18.3.1, Management of RANGE and
LIST Partitions
managing, Section 18.3.1, Management of RANGE and LIST Parti-
tions
range_alloc_block_size system variable, Section 5.1.4, Server System
Variables
raw option
mysql, Section 4.5.1.1, mysql Options
re-creating
grant tables, Section 2.11.2.1, Problems Running
mysql_install_db
read-from-remote-server option
mysqlbinlog, Description
read-only option
myisamchk, Section 4.6.3.2, myisamchk Check Options
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
read_buffer_size myisamchk variable, Section 4.6.3.1, myisamchk
General Options
read_buffer_size system variable, Section 5.1.4, Server System Vari-
ables
read_only system variable, Section 5.1.4, Server System Variables
read_rnd_buffer_size system variable, Section 5.1.4, Server System
Variables
reconfiguring, Section 2.10.4, Dealing with Problems Compiling
MySQL
reconnect option
mysql, Section 4.5.1.1, mysql Options
record-level locks
InnoDB, Section 13.6.8.4, InnoDB Record, Gap, and Next-Key
Locks, Section 13.6.8, The InnoDB Transaction Model and Lock-
ing, Section 13.6.8.5, Avoiding the Phantom Problem Using Next-
Key Locking, Section 13.6.3, InnoDB Startup Options and System
Variables
record_log_pos option
mysqlhotcopy, Description
recover option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
recovery
from crash, Section 6.4.1, Using myisamchk for Crash Recovery
point in time, Section 6.3, Point-in-Time Recovery
reducing
data size, Section 7.4.1, Make Your Data as Small as Possible
ref join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
ref_or_null, Section 7.2.8, IS NULL Optimization
ref_or_null join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
references, Section 12.1.7, ALTER TABLE Syntax
regexp option
mysqlhotcopy, Description
regular expression syntax, Section 11.4.2, Regular Expressions
rehash command
mysql, Section 4.5.1.2, mysql Commands
relative option
mysqladmin, Description
relay-log option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
relay-log-index option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
relay-log-info-file option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
relay-log-purge option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
relay-log-recovery option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
relay-log-space-limit option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
relay_log_purge system variable, Section 5.1.4, Server System Vari-
ables
relay_log_recovery system variable, Section 16.1.3.3, Replication Slave
Options and Variables
relay_log_space_limit system variable, Section 5.1.4, Server System
Variables
release numbers, Section 2.1.2, Choosing Which MySQL Distribution
to Install
releases
naming scheme, Section 2.1.2.1, Choosing Which Version of
MySQL to Install
testing, Section 2.1.2.1, Choosing Which Version of MySQL to In-
stall
updating, Section 2.1.2.3, How and When Updates Are Released
relnotes option
mysqlaccess, Description
remote administration (MySQL Cluster)
and security issues, Section 17.8.1, MySQL Cluster Security and
Networking Issues
remove option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
removing tmp table
thread state, Section 7.5.6.2, General Thread States
rename
thread state, Section 7.5.6.2, General Thread States
rename result table
thread state, Section 7.5.6.2, General Thread States
renaming user accounts, Section 12.5.1.4, RENAME USER Syntax
reordering
columns, Section B.1.7.2, How to Change the Order of Columns in a
Table
repair
tables, Section 4.5.3, mysqlcheck A Table Maintenance Pro-
gram
repair option
mysqlcheck, Description
repair options
myisamchk, Section 4.6.3.3, myisamchk Repair Options
repairing
tables, Section 6.4.3, How to Repair Tables
replace, Section 4.1, Overview of MySQL Programs
replace option
mysqldump, Description
mysqlimport, Description
replace utility, Section 4.8.2, replace A String-Replacement Util-
ity
replicas (MySQL Cluster), Section 17.1.2, MySQL Cluster Nodes,
Node Groups, Replicas, and Partitions
Standard Index
3280
replicate-do-db option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-do-table option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-ignore-db option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-ignore-table option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-rewrite-db option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-same-server-id option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-wild-do-table option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replicate-wild-ignore-table option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
replication, Chapter 16, Replication
and AUTO_INCREMENT, Section 16.3.1.1, Replication and
AUTO_INCREMENT
and CREATE TABLE ... SELECT, Section 16.3.1.3, Replication of
CREATE TABLE ... SELECT Statements
and DATA DIRECTORY, Section 16.3.1.5, Replication and DIR-
ECTORY Table Options
and DROP ... IF EXISTS, Section 16.3.1.6, Replication of DROP
... IF EXISTS Statements
and FLUSH, Section 16.3.1.9, Replication and FLUSH
and INDEX DIRECTORY, Section 16.3.1.5, Replication and DIR-
ECTORY Table Options
and LAST_INSERT_ID(), Section 16.3.1.1, Replication and
AUTO_INCREMENT
and LIMIT, Section 16.3.1.11, Replication and LIMIT
and LOAD DATA, Section 16.3.1.12, Replication and LOAD
DATA
and MEMORY tables, Section 16.3.1.16, Replication with MEMORY
Tables
and TIMESTAMP, Section 16.3.1.1, Replication and
AUTO_INCREMENT
and TRUNCATE, Section 16.3.1.27, Replication and TRUNCATE
and character sets, Section 16.3.1.2, Replication and Character Sets
and errors on slave, Section 16.3.1.20, Slave Errors during Replica-
tion
and floating-point values, Section 16.3.1.8, Replication with Float-
ing-Point Values
and functions, Section 16.3.1.10, Replication and System Functions
and invoked features, Section 16.3.1.7, Replication of Invoked Fea-
tures
and mysql (system) database, Section 16.3.1.17, Replication of the
System mysql Database
and partial updates, Section 16.3.1.25, Replication and Transac-
tions
and privileges, Section 16.3.1.17, Replication of the System mysql
Database
and query optimizer, Section 16.3.1.18, Replication and the Query
Optimizer
and reserved words, Section 16.3.1.19, Replication and Reserved
Words
and scheduled events, Section 16.3.1.7, Replication of Invoked Fea-
tures
and slow query log, Section 16.3.1.13, Replication and the Slow
Query Log
and stored routines, Section 16.3.1.7, Replication of Invoked Fea-
tures
and temporary tables, Section 16.3.1.22, Replication and Temporary
Tables
and time zones, Section 16.3.1.24, Replication and Time Zones
and transactions, Section 16.3.1.25, Replication and Transactions,
Section 16.3.1.23, Replication Retries and Timeouts
and triggers, Section 16.3.1.26, Replication and Triggers, Sec-
tion 16.3.1.7, Replication of Invoked Features
and variables, Section 16.3.1.28, Replication and Variables
and views, Section 16.3.1.29, Replication and Views
attribute promotion, Section 16.3.1.4.2, Replication of Columns
Having Different Data Types
crashes, Section 16.3.1.14, Replication During a Master Crash
shutdown and restart, Section 16.3.1.21, Replication during a Slave
Shutdown, Section 16.3.1.15, Replication During a Master Shut-
down, Section 16.3.1.22, Replication and Temporary Tables
timeouts, Section 16.3.1.23, Replication Retries and Timeouts
with differing tables on master and slave, Section 16.3.1.4,
Replication with Differing Tables on Master and Slave
replication implementation, Section 16.4, Replication Implementation
replication limitations, Section 16.3.1, Replication Features and Issues
replication master
thread states, Section 7.5.6.4, Replication Master Thread States
replication masters, Section 16.3.1.14, Replication During a Master
Crash
statements, Section 12.6.1, SQL Statements for Controlling Master
Servers
replication options, Section 16.3.1, Replication Features and Issues
replication slave
thread states, Section 7.5.6.7, Replication Slave Connection Thread
States, Section 7.5.6.6, Replication Slave SQL Thread States, Sec-
tion 7.5.6.5, Replication Slave I/O Thread States
replication slaves
statements, Section 12.6.2, SQL Statements for Controlling Slave
Servers
report-host option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
report-password option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
report-port option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
report-user option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
report_host system variable, Section 5.1.4, Server System Variables
report_password system variable, Section 5.1.4, Server System Vari-
ables
report_port system variable, Section 5.1.4, Server System Variables
report_user system variable, Section 5.1.4, Server System Variables
reporting
bugs, Section 1.6, How to Report Bugs or Problems
errors, Section 1.6, How to Report Bugs or Problems, Chapter 1,
General Information
reschedule
thread state, Section 7.5.6.3, Delayed-Insert Thread States
reserved words, Section 8.3, Reserved Words
and replication, Section 16.3.1.19, Replication and Reserved
Words
resetmaster option
mysqlhotcopy, Description
resetslave option
mysqlhotcopy, Description
resolve_stack_dump, Section 4.7.4, resolve_stack_dump Re-
solve Numeric Stack Trace Dump to Symbols, Section 4.1, Overview
of MySQL Programs
help option, Description
numeric-dump-file option, Description
symbols-file option, Description
version option, Description
resolveip, Section 4.8.3, resolveip Resolve Host name to IP Ad-
Standard Index
3281
dress or Vice Versa, Section 4.1, Overview of MySQL Programs
help option, Description
silent option, Description
version option, Description
restarting
the server, Section 2.11.2, Unix Post-Installation Procedures
restoring backups
in MySQL Cluster, Section 17.6.17, ndb_restore Restore a
MySQL Cluster Backup
restrictions
events, Section D.1, Restrictions on Stored Routines, Triggers, and
Events
server-side cursors, Section D.2, Restrictions on Server-Side Curs-
ors
stored routines, Section D.1, Restrictions on Stored Routines, Trig-
gers, and Events
subqueries, Section D.3, Restrictions on Subqueries
triggers, Section D.1, Restrictions on Stored Routines, Triggers, and
Events
views, Section D.4, Restrictions on Views
result-file option
mysqlbinlog, Description
mysqldump, Description
retrieving
data from tables, Section 3.3.4, Retrieving Information from a Ta-
ble
return (\r), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA IN-
FILE Syntax
return values
UDFs, Section 22.3.2.4, UDF Return Values and Error Handling
revoking
privileges, Section 12.5.1.5, REVOKE Syntax
rhost option
mysqlaccess, Description
rollback option
mysqlaccess, Description
rolling restart (MySQL Cluster), Section 17.5.1, Performing a Rolling
Restart of a MySQL Cluster
rolling upgrades and downgrades (MySQL Cluster), Section 17.5.1,
Performing a Rolling Restart of a MySQL Cluster
root password, Section 2.11.3, Securing the Initial MySQL Accounts
root user
password resetting, Section B.1.4.1, How to Reset the Root Pass-
word
rounding errors, Section 10.1.1, Overview of Numeric Types
routines option
mysqldump, Description
row subqueries, Section 12.2.9.5, Row Subqueries
row-level locking, Section 7.3.1, Internal Locking Methods
rowid option
ndb_select_all, Description
rows
counting, Section 3.3.4.8, Counting Rows
deleting, Section B.1.5.6, Deleting Rows from Related Tables
locking, Section 1.7.5.2, Transactions and Atomic Operations
matching problems, Section B.1.5.7, Solving Problems with No
Matching Rows
selecting, Section 3.3.4.2, Selecting Particular Rows
sorting, Section 3.3.4.4, Sorting Rows
rows option
ndb_config, Description
rpl_semi_sync_master_enabled system variable, Section 5.1.4, Server
System Variables
rpl_semi_sync_master_reply_log_file_pos system variable, Sec-
tion 5.1.4, Server System Variables
rpl_semi_sync_master_timeout system variable, Section 5.1.4, Server
System Variables
rpl_semi_sync_master_trace_level system variable, Section 5.1.4,
Server System Variables
rpl_semi_sync_slave_enabled status variable, Section 5.1.7, Server
Status Variables
rpl_semi_sync_slave_enabled system variable, Section 5.1.4, Server
System Variables
rpl_semi_sync_slave_trace_level system variable, Section 5.1.4, Server
System Variables
run-as-service option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
running
ANSI mode, Section 1.7.3, Running MySQL in ANSI Mode
batch mode, Section 3.5, Using mysql in Batch Mode
multiple servers, Section 5.6, Running Multiple MySQL Servers on
the Same Machine
queries, Section 3.2, Entering Queries
running configure after prior invocation, Section 2.10.4, Dealing with
Problems Compiling MySQL
S
SAVEPOINT, Section 12.4.4, SAVEPOINT and ROLLBACK TO
SAVEPOINT Syntax
SCHEMA(), Section 11.11.3, Information Functions
SCHEMATA
INFORMATION_SCHEMA table, Section 20.1, The INFORMA-
TION_SCHEMA SCHEMATA Table
SCHEMA_PRIVILEGES
INFORMATION_SCHEMA table, Section 20.6, The INFORMA-
TION_SCHEMA SCHEMA_PRIVILEGES Table
SCI (Scalable Coherent Interface), Section 17.11.1, Configuring
MySQL Cluster to use SCI Sockets, Section 17.3.4.11, SCI Transport
Connections in MySQL Cluster
SECOND(), Section 11.6, Date and Time Functions
SEC_TO_TIME(), Section 11.6, Date and Time Functions
SELECT
LIMIT, Section 12.2.8, SELECT Syntax
Query Cache, Section 7.5.5, The MySQL Query Cache
optimizing, Section 7.2.1, Optimizing Queries with EXPLAIN,
Section 12.3.2, EXPLAIN Syntax
SELECT INTO TABLE, Section 1.7.5.1, SELECT INTO TABLE
SELECT speed, Section 7.2.3, Speed of SELECT Queries
SEQUENCE, Section 3.6.9, Using AUTO_INCREMENT
SERIAL, Section 10.1.1, Overview of Numeric Types
SERIAL DEFAULT VALUE, Section 10.1.4, Data Type Default Val-
ues
SERIALIZABLE
transaction isolation level, Section 12.4.6, SET TRANSACTION
Syntax
SESSION_STATUS
INFORMATION_SCHEMA table, Section 20.24, The INFORMA-
TION_SCHEMA GLOBAL_STATUS and SESSION_STATUS
Tables
SESSION_USER(), Section 11.11.3, Information Functions
SESSION_VARIABLES
INFORMATION_SCHEMA table, Section 20.25, The INFORMA-
TION_SCHEMA GLOBAL_VARIABLES and SES-
SION_VARIABLES Tables
SET, Section 12.5.4, SET Syntax
CHARACTER SET, Section 9.1.4, Connection Character Sets and
Collations, Section 12.5.4, SET Syntax
NAMES, Section 9.1.4, Connection Character Sets and Collations,
Standard Index
3282
Section 9.1.5, Configuring the Character Set and Collation for Ap-
plications, Section 12.5.4, SET Syntax
ONE_SHOT, Section 12.5.4, SET Syntax
size, Section 10.5, Data Type Storage Requirements
SET GLOBAL SQL_SLAVE_SKIP_COUNTER, Section 12.6.2.6,
SET GLOBAL SQL_SLAVE_SKIP_COUNTER Syntax
SET OPTION, Section 12.5.4, SET Syntax
SET PASSWORD, Section 12.5.1.6, SET PASSWORD Syntax
SET PASSWORD statement, Section 5.5.5, Assigning Account Pass-
words
SET TRANSACTION, Section 12.4.6, SET TRANSACTION Syntax
SET data type, Section 10.1.3, Overview of String Types, Sec-
tion 10.4.5, The SET Type
SET sql_log_bin, Section 12.6.1.3, SET sql_log_bin Syntax
SHA(), Section 11.11.2, Encryption and Compression Functions
SHA1(), Section 11.11.2, Encryption and Compression Functions
SHOW
in MySQL Cluster management client, Section 17.3.3, Quick Test
Setup of MySQL Cluster
SHOW AUTHORS, Section 12.5.5, SHOW Syntax, Section 12.5.5.1,
SHOW AUTHORS Syntax
SHOW BINARY LOGS, Section 12.5.5.2, SHOW BINARY LOGS
Syntax
SHOW BINLOG EVENTS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.3, SHOW BINLOG EVENTS Syntax
SHOW CHARACTER SET, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.4, SHOW CHARACTER SET Syntax
SHOW COLLATION, Section 12.5.5, SHOW Syntax, Section 12.5.5.5,
SHOW COLLATION Syntax
SHOW COLUMNS, Section 12.5.5.6, SHOW COLUMNS Syntax, Sec-
tion 12.5.5, SHOW Syntax
SHOW CONTRIBUTORS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.7, SHOW CONTRIBUTORS Syntax
SHOW CREATE DATABASE, Section 12.5.5.8, SHOW CREATE
DATABASE Syntax, Section 12.5.5, SHOW Syntax
SHOW CREATE EVENT, Section 12.5.5, SHOW Syntax
SHOW CREATE FUNCTION, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.10, SHOW CREATE FUNCTION Syntax
SHOW CREATE PROCEDURE, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.11, SHOW CREATE PROCEDURE Syntax
SHOW CREATE SCHEMA, Section 12.5.5.8, SHOW CREATE
DATABASE Syntax, Section 12.5.5, SHOW Syntax
SHOW CREATE TABLE, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.12, SHOW CREATE TABLE Syntax
SHOW CREATE TRIGGER, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.13, SHOW CREATE TRIGGER Syntax
SHOW CREATE VIEW, Section 12.5.5.14, SHOW CREATE VIEW
Syntax, Section 12.5.5, SHOW Syntax
SHOW DATABASES, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.15, SHOW DATABASES Syntax
SHOW ENGINE, Section 12.5.5, SHOW Syntax, Section 12.5.5.16,
SHOW ENGINE Syntax
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
SHOW ENGINE INNODB STATUS, Section 12.5.5.16, SHOW EN-
GINE Syntax
SHOW ENGINE NDB STATUS, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements, Section 12.5.5.16, SHOW ENGINE
Syntax
SHOW ENGINE NDBCLUSTER STATUS, Section 17.7.7, Quick
Reference: MySQL Cluster SQL Statements, Section 12.5.5.16, SHOW
ENGINE Syntax
SHOW ENGINES, Section 12.5.5.17, SHOW ENGINES Syntax, Sec-
tion 12.5.5, SHOW Syntax
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
SHOW ERRORS, Section 12.5.5, SHOW Syntax, Section 12.5.5.18,
SHOW ERRORS Syntax
and MySQL Cluster, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
SHOW EVENTS, Section 12.5.5, SHOW Syntax, Section 12.5.5.19,
SHOW EVENTS Syntax
SHOW FIELDS, Section 12.5.5.6, SHOW COLUMNS Syntax, Sec-
tion 12.5.5, SHOW Syntax
SHOW FUNCTION CODE, Section 12.5.5.20, SHOW FUNCTION
CODE Syntax, Section 12.5.5, SHOW Syntax
SHOW FUNCTION STATUS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.21, SHOW FUNCTION STATUS Syntax
SHOW GRANTS, Section 12.5.5, SHOW Syntax, Section 12.5.5.22,
SHOW GRANTS Syntax
SHOW INDEX, Section 12.5.5, SHOW Syntax, Section 12.5.5.23,
SHOW INDEX Syntax
SHOW INNODB STATUS, Section 12.5.5, SHOW Syntax
SHOW KEYS, Section 12.5.5, SHOW Syntax, Section 12.5.5.23,
SHOW INDEX Syntax
SHOW MASTER LOGS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.2, SHOW BINARY LOGS Syntax
SHOW MASTER STATUS, Section 12.5.5.25, SHOW MASTER
STATUS Syntax, Section 12.5.5, SHOW Syntax
SHOW OPEN TABLES, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.26, SHOW OPEN TABLES Syntax
SHOW PLUGINS, Section 12.5.5, SHOW Syntax, Section 12.5.5.27,
SHOW PLUGINS Syntax
SHOW PRIVILEGES, Section 12.5.5.28, SHOW PRIVILEGES Syn-
tax, Section 12.5.5, SHOW Syntax
SHOW PROCEDURE CODE, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.29, SHOW PROCEDURE CODE Syntax
SHOW PROCEDURE STATUS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.30, SHOW PROCEDURE STATUS Syntax
SHOW PROCESSLIST, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.31, SHOW PROCESSLIST Syntax
SHOW PROFILE, Section 12.5.5, SHOW Syntax, Section 12.5.5.32,
SHOW PROFILE Syntax, Section 12.5.5.33, SHOW PROFILES
Syntax
SHOW PROFILES, Section 12.5.5, SHOW Syntax, Section 12.5.5.33,
SHOW PROFILES Syntax
SHOW SCHEDULER STATUS, Section 12.5.5, SHOW Syntax
SHOW SCHEMAS, Section 12.5.5, SHOW Syntax, Section 12.5.5.15,
SHOW DATABASES Syntax
SHOW SLAVE HOSTS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.35, SHOW SLAVE HOSTS Syntax
SHOW SLAVE STATUS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.36, SHOW SLAVE STATUS Syntax
SHOW STATUS, Section 12.5.5, SHOW Syntax
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
SHOW STORAGE ENGINES, Section 12.5.5.17, SHOW ENGINES
Syntax
SHOW TABLE STATUS, Section 12.5.5, SHOW Syntax
SHOW TABLE TYPES, Section 12.5.5.17, SHOW ENGINES Syntax,
Section 12.5.5, SHOW Syntax
SHOW TABLES, Section 12.5.5.39, SHOW TABLES Syntax, Sec-
tion 12.5.5, SHOW Syntax
SHOW TRIGGERS, Section 12.5.5, SHOW Syntax, Section 12.5.5.40,
SHOW TRIGGERS Syntax
SHOW VARIABLES, Section 12.5.5, SHOW Syntax
used with MySQL Cluster, Section 17.7.7, Quick Reference:
MySQL Cluster SQL Statements
SHOW WARNINGS, Section 12.5.5, SHOW Syntax, Sec-
tion 12.5.5.42, SHOW WARNINGS Syntax
Standard Index
3283
and MySQL Cluster, Section A.10, MySQL 5.1 FAQ MySQL
Cluster
SHOW command (MySQL Cluster), Section 17.7.2, Commands in the
MySQL Cluster Management Client
SHOW extensions, Section 20.28, Extensions to SHOW Statements
SHOW with WHERE, Section 20.28, Extensions to SHOW Statements,
Chapter 20, INFORMATION_SCHEMA Tables
SHUTDOWN command (MySQL Cluster), Section 17.7.2, Commands
in the MySQL Cluster Management Client
SIGN(), Section 11.5.2, Mathematical Functions
SIN(), Section 11.5.2, Mathematical Functions
SLEEP(), Section 11.11.4, Miscellaneous Functions
SMALLINT data type, Section 10.1.1, Overview of Numeric Types
SNAPSHOTEND (START BACKUP command), Section 17.7.3.2,
Using The MySQL Cluster Management Client to Create a Backup
SNAPSHOTSTART (START BACKUP command), Section 17.7.3.2,
Using The MySQL Cluster Management Client to Create a Backup
SOME, Section 12.2.9.3, Subqueries with ANY, IN, and SOME
SOUNDEX(), Section 11.4, String Functions
SOUNDS LIKE, Section 11.4, String Functions
SPACE(), Section 11.4, String Functions
SQL mode, Section 5.1.8, Server SQL Modes
ALLOW_INVALID_DATES, Section 5.1.8, Server SQL Modes
ANSI, Section 5.1.8, Server SQL Modes
ANSI_QUOTES, Section 5.1.8, Server SQL Modes
DB2, Section 5.1.8, Server SQL Modes
ERROR_FOR_DIVISION_BY_ZERO, Section 5.1.8, Server SQL
Modes
HIGH_NOT_PRECEDENCE, Section 5.1.8, Server SQL Modes
IGNORE_SPACE, Section 5.1.8, Server SQL Modes
MAXDB, Section 5.1.8, Server SQL Modes
MSSQL, Section 5.1.8, Server SQL Modes
MYSQL323, Section 5.1.8, Server SQL Modes
MYSQL40, Section 5.1.8, Server SQL Modes
NO_AUTO_CREATE_USER, Section 5.1.8, Server SQL Modes
NO_AUTO_VALUE_ON_ZERO, Section 5.1.8, Server SQL
Modes
NO_BACKSLASH_ESCAPES, Section 5.1.8, Server SQL Modes
NO_DIR_IN_CREATE, Section 5.1.8, Server SQL Modes
NO_ENGINE_SUBSTITUTION, Section 5.1.8, Server SQL
Modes
NO_FIELD_OPTIONS, Section 5.1.8, Server SQL Modes
NO_KEY_OPTIONS, Section 5.1.8, Server SQL Modes
NO_TABLE_OPTIONS, Section 5.1.8, Server SQL Modes
NO_UNSIGNED_SUBTRACTION, Section 5.1.8, Server SQL
Modes
NO_ZERO_DATE, Section 5.1.8, Server SQL Modes
NO_ZERO_IN_DATE, Section 5.1.8, Server SQL Modes
ONLY_FULL_GROUP_BY, Section 5.1.8, Server SQL Modes,
Section 11.12.3, GROUP BY and HAVING with Hidden Columns
ORACLE, Section 5.1.8, Server SQL Modes
PAD_CHAR_TO_FULL_LENGTH, Section 5.1.8, Server SQL
Modes
PIPES_AS_CONCAT, Section 5.1.8, Server SQL Modes
POSTGRESQL, Section 5.1.8, Server SQL Modes
REAL_AS_FLOAT, Section 5.1.8, Server SQL Modes
STRICT_ALL_TABLES, Section 5.1.8, Server SQL Modes
STRICT_TRANS_TABLES, Section 5.1.8, Server SQL Modes
TRADITIONAL, Section 5.1.8, Server SQL Modes
strict, Section 5.1.8, Server SQL Modes
SQL node (MySQL Cluster)
defined, Section 17.1.1, MySQL Cluster Core Concepts
SQL nodes (MySQL Cluster), Section 17.6.1, MySQL Server Usage for
MySQL Cluster
SQL scripts, Section 4.5.1, mysql The MySQL Command-Line
Tool
SQL statements
replication masters, Section 12.6.1, SQL Statements for Controlling
Master Servers
replication slaves, Section 12.6.2, SQL Statements for Controlling
Slave Servers
SQL statements relating to MySQL Cluster, Section 17.7.7, Quick Ref-
erence: MySQL Cluster SQL Statements
SQL-92
extensions to, Section 1.7, MySQL Standards Compliance
SQL_BIG_RESULT, Section 12.2.8, SELECT Syntax
SQL_BUFFER_RESULT, Section 12.2.8, SELECT Syntax
SQL_CACHE, Section 7.5.5.2, Query Cache SELECT Options, Sec-
tion 12.2.8, SELECT Syntax
SQL_CALC_FOUND_ROWS, Section 12.2.8, SELECT Syntax
SQL_NO_CACHE, Section 7.5.5.2, Query Cache SELECT Options,
Section 12.2.8, SELECT Syntax
SQL_SLAVE_SKIP_COUNTER, Section 12.6.2.6, SET GLOBAL
SQL_SLAVE_SKIP_COUNTER Syntax
SQL_SMALL_RESULT, Section 12.2.8, SELECT Syntax
SQRT(), Section 11.5.2, Mathematical Functions
SRID(), Section 11.13.5.2.1, General Geometry Functions
SSH, Section 5.5.8, Connecting to MySQL Remotely from Windows
with SSH
SSL, Section 5.5.7.2, Using SSL Connections
SSL and X509 Basics, Section 5.5.7, Using SSL for Secure Connec-
tions
SSL command options, Section 5.5.7.3, SSL Command Options
SSL options, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
mysqldump, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
SSL related options, Section 12.5.1.3, GRANT Syntax
START
XA transactions, Section 12.4.7.1, XA Transaction SQL Syntax
START BACKUP
NOWAIT, Section 17.7.3.2, Using The MySQL Cluster Manage-
ment Client to Create a Backup
SNAPSHOTEND, Section 17.7.3.2, Using The MySQL Cluster
Management Client to Create a Backup
SNAPSHOTSTART, Section 17.7.3.2, Using The MySQL Cluster
Management Client to Create a Backup
WAIT COMPLETED, Section 17.7.3.2, Using The MySQL Cluster
Management Client to Create a Backup
WAIT STARTED, Section 17.7.3.2, Using The MySQL Cluster
Management Client to Create a Backup
syntax, Section 17.7.3.2, Using The MySQL Cluster Management
Client to Create a Backup
START SLAVE, Section 12.6.2.7, START SLAVE Syntax
START TRANSACTION, Section 12.4.1, START TRANSACTION,
COMMIT, and ROLLBACK Syntax
START command (MySQL Cluster), Section 17.7.2, Commands in the
MySQL Cluster Management Client
STARTUP Events (MySQL Cluster), Section 17.7.4.2, MySQL Cluster
Log Events
STATISTICS
INFORMATION_SCHEMA table, Section 20.4, The INFORMA-
TION_SCHEMA STATISTICS Table
STATISTICS Events (MySQL Cluster), Section 17.7.4.2, MySQL
Standard Index
3284
Cluster Log Events
STATUS command (MySQL Cluster), Section 17.7.2, Commands in
the MySQL Cluster Management Client
STD(), Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV(), Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV_POP(), Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV_SAMP(), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
STOP SLAVE, Section 12.6.2.8, STOP SLAVE Syntax
STOP command (MySQL Cluster), Section 17.7.2, Commands in the
MySQL Cluster Management Client
STRAIGHT_JOIN, Section 7.2.1, Optimizing Queries with
EXPLAIN, Section 7.2.9, LEFT JOIN and RIGHT JOIN Optimiza-
tion, Section 12.2.8.1, JOIN Syntax, Section 12.2.8, SELECT Syn-
tax
STRCMP(), Section 11.4.1, String Comparison Functions
STRICT_ALL_TABLES SQL mode, Section 5.1.8, Server SQL
Modes
STRICT_TRANS_TABLES SQL mode, Section 5.1.8, Server SQL
Modes
STR_TO_DATE(), Section 11.6, Date and Time Functions
SUBDATE(), Section 11.6, Date and Time Functions
SUBSTR(), Section 11.4, String Functions
SUBSTRING(), Section 11.4, String Functions
SUBSTRING_INDEX(), Section 11.4, String Functions
SUBTIME(), Section 11.6, Date and Time Functions
SUM(), Section 11.12.1, GROUP BY (Aggregate) Functions
SUM(DISTINCT), Section 11.12.1, GROUP BY (Aggregate) Func-
tions
SYSDATE(), Section 11.6, Date and Time Functions
SYSTEM_USER(), Section 11.11.3, Information Functions
Saving state
thread state, Section 7.5.6.2, General Thread States
SchedulerExecutionTimer, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
SchedulerSpinTimer, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Searching rows for update
thread state, Section 7.5.6.2, General Thread States
SendBufferMemory, Section 17.3.4.8, MySQL Cluster TCP/IP Connec-
tions
SendLimit, Section 17.3.4.11, SCI Transport Connections in MySQL
Cluster
SendSignalId, Section 17.3.4.10, MySQL Cluster Shared-Memory Con-
nections, Section 17.3.4.8, MySQL Cluster TCP/IP Connections,
Section 17.3.4.11, SCI Transport Connections in MySQL Cluster
Sending binlog event to slave
thread state, Section 7.5.6.4, Replication Master Thread States
ServerPort, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Set option
thread command, Section 7.5.6.1, Thread Command Values
SharedBufferSize, Section 17.3.4.11, SCI Transport Connections in
MySQL Cluster
SharedGlobalMemory, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
ShmKey, Section 17.3.4.10, MySQL Cluster Shared-Memory Connec-
tions
ShmSize, Section 17.3.4.10, MySQL Cluster Shared-Memory Connec-
tions
Shutdown
thread command, Section 7.5.6.1, Thread Command Values
Shutting down
thread state, Section 7.5.6.8, MySQL Cluster Thread States
SigNum, Section 17.3.4.10, MySQL Cluster Shared-Memory Connec-
tions
Sleep
thread command, Section 7.5.6.1, Thread Command Values
Solaris
installation, Section 2.6, Installing MySQL on Solaris
Solaris installation problems, Section 2.13.3, Solaris Notes
Solaris troubleshooting, Section 2.10.4, Dealing with Problems Compil-
ing MySQL
Solaris x86_64 issues, Section 13.6.13.1, InnoDB Performance Tuning
Tips
Sorting for group
thread state, Section 7.5.6.2, General Thread States
Sorting for order
thread state, Section 7.5.6.2, General Thread States
Sorting index
thread state, Section 7.5.6.2, General Thread States
Sorting result
thread state, Section 7.5.6.2, General Thread States
Spatial Extensions in MySQL, Section 11.13.1, Introduction to MySQL
Spatial Support
Standard Monitor
InnoDB, Section 13.6.13.2, SHOW ENGINE INNODB STATUS
and the InnoDB Monitors
Standard SQL
differences from, Section 1.7.5, MySQL Differences from Standard
SQL, Section 12.5.1.3, GRANT Syntax
extensions to, Section 1.7, MySQL Standards Compliance, Sec-
tion 1.7.4, MySQL Extensions to Standard SQL
StartFailureTimeout, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
StartPartialTimeout, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
StartPartitionedTimeout, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
StartPoint(), Section 11.13.5.2.3, LineString Functions
Starting many servers, Section 5.6, Running Multiple MySQL Servers
on the Same Machine
Statistics
thread command, Section 7.5.6.1, Thread Command Values
StopOnError, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
StringMemory, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Sybase compatibility, Section 12.3.4, USE Syntax
SymDifference(), Section 11.13.5.3.2, Spatial Operators
Syncing ndb table schema operation and binlog
thread state, Section 7.5.6.8, MySQL Cluster Thread States
System lock
thread state, Section 7.5.6.2, General Thread States
safe-mode option
mysqld, Section 5.1.2, Server Command Options
safe-recover option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
safe-show-database option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
safe-updates option, Section 4.5.1.5.2, Using the --safe-updates
Option
mysql, Section 4.5.1.1, mysql Options
safe-user-create option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
schema
altering, Section 12.1.1, ALTER DATABASE Syntax
creating, Section 12.1.10, CREATE DATABASE Syntax
deleting, Section 12.1.21, DROP DATABASE Syntax
script files, Section 3.5, Using mysql in Batch Mode
Standard Index
3285
scripts, Section 4.3.2, mysqld_safe MySQL Server Startup
Script, Section 4.3.4, mysqld_multi Manage Multiple MySQL
Servers
SQL, Section 4.5.1, mysql The MySQL Command-Line Tool
mysql_install_db, Section 2.11.2.1, Problems Running
mysql_install_db
mysqlbug, Section 1.6, How to Report Bugs or Problems
searching
MySQL Web pages, Section 1.6, How to Report Bugs or Problems
and case sensitivity, Section B.1.5.1, Case Sensitivity in String
Searches
full-text, Section 11.8, Full-Text Search Functions
two keys, Section 3.6.7, Searching on Two Keys
secondary index
InnoDB, Section 13.6.10.1, Clustered and Secondary Indexes
secure-auth option
mysql, Section 4.5.1.1, mysql Options
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
secure-backup-file-priv option
mysqld, Section 5.1.2, Server Command Options
secure-file-priv option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
secure_auth system variable, Section 5.1.4, Server System Variables
secure_backup_file_priv system variable, Section 5.1.4, Server System
Variables
secure_file_priv system variable, Section 5.1.4, Server System Vari-
ables
securing a MySQL Cluster, Section 17.8.3, MySQL Cluster and
MySQL Security Procedures
security
against attackers, Section 5.3.2, Making MySQL Secure Against At-
tackers
and NDB utilities, Section 17.8.3, MySQL Cluster and MySQL Se-
curity Procedures
and malicious SQL statements, Section 17.8.2, MySQL Cluster and
MySQL Privileges
security system, Section 5.4, The MySQL Access Privilege System
select_limit variable, Section 4.5.1.1, mysql Options
selecting
databases, Section 3.3.1, Creating and Selecting a Database
semi-consistent read
InnoDB, Section 13.6.3, InnoDB Startup Options and System Vari-
ables
sequence emulation, Section 11.11.3, Information Functions
sequences, Section 3.6.9, Using AUTO_INCREMENT
server
connecting, Section 3.1, Connecting to and Disconnecting from the
Server, Section 4.2.2, Connecting to the MySQL Server
debugging, Section 22.5.1, Debugging a MySQL Server
disconnecting, Section 3.1, Connecting to and Disconnecting from
the Server
logs, Section 5.2, MySQL Server Logs
restart, Section 2.11.2, Unix Post-Installation Procedures
shutdown, Section 2.11.2, Unix Post-Installation Procedures
signal handling, Section 5.1.10, Server Response to Signals
starting, Section 2.11.2, Unix Post-Installation Procedures
starting and stopping, Section 2.11.2.2, Starting and Stopping
MySQL Automatically
starting problems, Section 2.11.2.3, Starting and Troubleshooting
the MySQL Server
server administration, Section 4.5.2, mysqladmin Client for Ad-
ministering a MySQL Server
server variables, Section 5.1.4, Server System Variables, Sec-
tion 12.5.5.41, SHOW VARIABLES Syntax
server-id option
mysqlbinlog, Description
mysqld, Section 16.1.3, Replication and Binary Logging Options
and Variables
server-side cursor restrictions, Section D.2, Restrictions on Server-Side
Cursors
server_id system variable, Section 5.1.4, Server System Variables
servers
multiple, Section 5.6, Running Multiple MySQL Servers on the
Same Machine
service-startup-timeout option
mysql.server, Description
session server variables, Section 5.1.5, Session System Variables
session system variables, Section 5.1.5, Session System Variables
session variable
autocommit, Section 5.1.5, Session System Variables
backup_wait_timeout, Section 5.1.5, Session System Variables
big_tables, Section 5.1.5, Session System Variables
error_count, Section 5.1.5, Session System Variables
foreign_key_checks, Section 5.1.5, Session System Variables
identity, Section 5.1.5, Session System Variables
insert_id, Section 5.1.5, Session System Variables
last_insert_id, Section 5.1.5, Session System Variables
profiling, Section 5.1.5, Session System Variables
profiling_history_size, Section 5.1.5, Session System Variables
rand_seed1, Section 5.1.5, Session System Variables
rand_seed2, Section 5.1.5, Session System Variables
sql_auto_is_null, Section 5.1.5, Session System Variables
sql_big_selects, Section 5.1.5, Session System Variables
sql_buffer_result, Section 5.1.5, Session System Variables
sql_log_bin, Section 5.1.5, Session System Variables
sql_log_off, Section 5.1.5, Session System Variables
sql_log_update, Section 5.1.5, Session System Variables
sql_notes, Section 5.1.5, Session System Variables
sql_quote_show_create, Section 5.1.5, Session System Variables
sql_safe_updates, Section 5.1.5, Session System Variables
sql_warnings, Section 5.1.5, Session System Variables
timestamp, Section 5.1.5, Session System Variables
unique_checks, Section 5.1.5, Session System Variables
warning_count, Section 5.1.5, Session System Variables
session variables
and replication, Section 16.3.1.28, Replication and Variables
server, Section 5.1.5, Session System Variables
system, Section 5.1.5, Session System Variables
set-auto-increment[ option
myisamchk, Section 4.6.3.4, Other myisamchk Options
set-character-set option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
set-charset option
mysqlbinlog, Description
mysqldump, Description
set-collation option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
setting
passwords, Section 5.5.5, Assigning Account Passwords
setting passwords, Section 12.5.1.6, SET PASSWORD Syntax
setting program variables, Section 4.2.3.4, Using Options to Set Pro-
gram Variables
setup
post-installation, Section 2.11, Post-Installation Setup and Testing
thread state, Section 7.5.6.2, General Thread States
shared memory transporter, Section 17.3.4.10, MySQL Cluster Shared-
Memory Connections
shared-memory option
Standard Index
3286
mysqld, Section 5.1.2, Server Command Options
shared-memory-base-name option, Section 4.2.2, Connecting to the
MySQL Server
mysqld, Section 5.1.2, Server Command Options
mysqlslap, Description
shared_memory system variable, Section 5.1.4, Server System Vari-
ables
shared_memory_base_name system variable, Section 5.1.4, Server Sys-
tem Variables
shell syntax, Section 1.2, Typographical and Syntax Conventions
short-form option
mysqlbinlog, Description
show-slave-auth-info option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
show-table-type option
mysqlshow, Description
show-warnings option
mysql, Section 4.5.1.1, mysql Options
showing
database information, Section 4.5.6, mysqlshow Display Data-
base, Table, and Column Information
shutdown_timeout variable, Description
shutting down
the server, Section 2.11.2, Unix Post-Installation Procedures
sigint-ignore option
mysql, Section 4.5.1.1, mysql Options
signals
server response, Section 5.1.10, Server Response to Signals
silent column changes, Section 12.1.17.1, Silent Column Specification
Changes
silent option
myisamchk, Section 4.6.3.1, myisamchk General Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlcheck, Description
mysqld_multi, Description
mysqlimport, Description
mysqlslap, Description
perror, Description
resolveip, Description
single quote (\'), Section 8.1.1, Strings
single user mode (MySQL Cluster), Section 17.7.6, MySQL Cluster
Single User Mode, Section 17.7.2, Commands in the MySQL Cluster
Management Client
and ndb_restore, Description
single-transaction option
mysqldump, Description
size of tables, Section B.1.2.12, The table is full
sizes
display, Chapter 10, Data Types
skip-column-names option
mysql, Section 4.5.1.1, mysql Options
skip-comments option
mysqldump, Description
skip-concurrent-insert option
mysqld, Section 5.1.2, Server Command Options
skip-external-locking option
mysqld, Section 5.1.2, Server Command Options
skip-grant-tables option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
skip-host-cache option
mysqld, Section 5.1.2, Server Command Options
skip-innodb option
mysqld, Section 5.1.2, Server Command Options
skip-kill-mysqld option
mysqld_safe, Description
skip-line-numbers option
mysql, Section 4.5.1.1, mysql Options
skip-merge option
mysqld, Section 5.3.3, Security-Related mysqld Options
skip-name-resolve option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
skip-ndbcluster option
mysqld, Section 17.4.2, mysqld Command Options for MySQL
Cluster
skip-networking option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
skip-opt option
mysqldump, Description
skip-safemalloc option
mysqld, Section 5.1.2, Server Command Options
skip-show-database option
mysqld, Section 5.1.2, Server Command Options, Section 5.3.3,
Security-Related mysqld Options
skip-slave-start option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
skip-stack-trace option
mysqld, Section 5.1.2, Server Command Options
skip-symbolic-links option
mysqld, Section 5.1.2, Server Command Options
skip-syslog option
mysqld_safe, Description
skip-thread-priority option
mysqld, Section 5.1.2, Server Command Options
skip_external_locking system variable, Section 5.1.4, Server System
Variables
skip_networking system variable, Section 5.1.4, Server System Vari-
ables
skip_show_database system variable, Section 5.1.4, Server System
Variables
slave option
mysqlslap, Description
slave-load-tmpdir option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
slave-net-timeout option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
slave-skip-errors option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
slave_compressed_protocol option
mysqld, Section 16.1.3.3, Replication Slave Options and Variables
slave_compressed_protocol system variable, Section 16.1.3.3,
Replication Slave Options and Variables
slave_exec_mode system variable, Section 16.1.3.3, Replication Slave
Options and Variables
slave_load_tmpdir system variable, Section 16.1.3.3, Replication Slave
Options and Variables
slave_net_timeout system variable, Section 16.1.3.3, Replication Slave
Options and Variables
slave_skip_errors system variable, Section 16.1.3.3, Replication Slave
Options and Variables
slave_transaction_retries system variable, Section 16.1.3.3, Replication
Slave Options and Variables
sleep option
mysqladmin, Description
slow queries, Description
slow query log, Section 5.2.5, The Slow Query Log
Standard Index
3287
and replication, Section 16.3.1.13, Replication and the Slow Query
Log
slow-query-log option
mysqld, Section 5.1.2, Server Command Options
slow_launch_time system variable, Section 5.1.4, Server System Vari-
ables
slow_query_log system variable, Section 5.1.4, Server System Vari-
ables
slow_query_log_file system variable, Section 5.1.4, Server System
Variables
socket location
changing, Section 2.10.2, Typical configure Options
socket option, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysql_config, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_safe, Description
mysqldump, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
socket system variable, Section 5.1.4, Server System Variables
sort-index option
myisamchk, Section 4.6.3.4, Other myisamchk Options
sort-records option
myisamchk, Section 4.6.3.4, Other myisamchk Options
sort-recover option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
sort_buffer_size myisamchk variable, Section 4.6.3.1, myisamchk
General Options
sort_buffer_size system variable, Section 5.1.4, Server System Vari-
ables
sort_key_blocks myisamchk variable, Section 4.6.3.1, myisamchk
General Options
sorting
character sets, Section 9.2, The Character Set Used for Data and
Sorting
data, Section 3.3.4.4, Sorting Rows
grant tables, Section 5.4.5, Access Control, Stage 2: Request Veri-
fication, Section 5.4.4, Access Control, Stage 1: Connection Veri-
fication
table rows, Section 3.3.4.4, Sorting Rows
source (mysql client command), Section 3.5, Using mysql in Batch
Mode, Section 4.5.1.4, Executing SQL Statements from a Text File
source command
mysql, Section 4.5.1.2, mysql Commands
source distribution
installing, Section 2.10, MySQL Installation Using a Source Distri-
bution
source distributions
on Linux, Section 2.13.1.3, Linux Source Distribution Notes
spassword option
mysqlaccess, Description
speed
compiling, Section 7.5.1, How Compiling and Linking Affects the
Speed of MySQL
increasing with replication, Chapter 16, Replication
inserting, Section 7.2.21, Speed of INSERT Statements
linking, Section 7.5.1, How Compiling and Linking Affects the
Speed of MySQL
of queries, Section 7.2, Optimizing SELECT and Other Statements,
Section 7.2.3, Speed of SELECT Queries
sporadic-binlog-dump-fail option
mysqld, Section 16.1.3.4, Binary Log Options and Variables
sql-mode option
mysqld, Section 5.1.2, Server Command Options
sql_auto_is_null session variable, Section 5.1.5, Session System Vari-
ables
sql_big_selects session variable, Section 5.1.5, Session System Vari-
ables
sql_buffer_result session variable, Section 5.1.5, Session System Vari-
ables
sql_log_bin session variable, Section 5.1.5, Session System Variables
sql_log_off session variable, Section 5.1.5, Session System Variables
sql_log_update session variable, Section 5.1.5, Session System Vari-
ables
sql_mode system variable, Section 5.1.4, Server System Variables
sql_notes session variable, Section 5.1.5, Session System Variables
sql_quote_show_create session variable, Section 5.1.5, Session System
Variables
sql_safe_updates session variable, Section 5.1.5, Session System Vari-
ables
sql_select_limit system variable, Section 5.1.4, Server System Vari-
ables
sql_slave_skip_counter system variable, Section 16.1.3.3, Replication
Slave Options and Variables
sql_warnings session variable, Section 5.1.5, Session System Vari-
ables
sql_yacc.cc problems, Section 2.10.4, Dealing with Problems Compil-
ing MySQL
square brackets, Chapter 10, Data Types
ssl option, Section 5.5.7.3, SSL Command Options
ssl-ca option, Section 5.5.7.3, SSL Command Options
ssl-capath option, Section 5.5.7.3, SSL Command Options
ssl-cert option, Section 5.5.7.3, SSL Command Options
ssl-cipher option, Section 5.5.7.3, SSL Command Options
ssl-key option, Section 5.5.7.3, SSL Command Options
ssl-verify-server-cert option, Section 5.5.7.3, SSL Command Options
ssl_ca system variable, Section 5.1.4, Server System Variables
ssl_capath system variable, Section 5.1.4, Server System Variables
ssl_cert system variable, Section 5.1.4, Server System Variables
ssl_cipher system variable, Section 5.1.4, Server System Variables
ssl_key system variable, Section 5.1.4, Server System Variables
standalone option
mysqld, Section 5.1.2, Server Command Options
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
standards compatibility, Section 1.7, MySQL Standards Compliance
start-datetime option
mysqlbinlog, Description
start-position option
mysqlbinlog, Description
starting
comments, Section 1.7.5.6, '--' as the Start of a Comment
mysqld, Section 5.3.5, How to Run MySQL as a Normal User
the server, Section 2.11.2, Unix Post-Installation Procedures
the server automatically, Section 2.11.2.2, Starting and Stopping
MySQL Automatically
starting slave
thread state, Section 7.5.6.7, Replication Slave Connection Thread
States
startup options
default, Section 4.2.3.3, Using Option Files
startup parameters, Section 7.5.3, Tuning Server Parameters
Standard Index
3288
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
tuning, Section 7.5.2, System Factors and Startup Parameter Tun-
ing
statefile option
comp_err, Description
statements
GRANT, Section 5.5.2, Adding User Accounts
INSERT, Section 5.5.2, Adding User Accounts
replication masters, Section 12.6.1, SQL Statements for Controlling
Master Servers
replication slaves, Section 12.6.2, SQL Statements for Controlling
Slave Servers
statically
compiling, Section 2.10.2, Typical configure Options
statistics
thread state, Section 7.5.6.2, General Thread States
stats option
myisam_ftdump, Description
stats_method myisamchk variable, Section 4.6.3.1, myisamchk Gen-
eral Options
status
tables, Section 12.5.5.38, SHOW TABLE STATUS Syntax
status command
mysql, Section 4.5.1.2, mysql Commands
results, Description
status option
mysqlshow, Description
status variable
Rpl_semi_sync_master_clients, Section 5.1.7, Server Status Vari-
ables
Rpl_semi_sync_master_net_avg_wait_time, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_net_wait_time, Section 5.1.7, Server Status
Variables
Rpl_semi_sync_master_net_waits, Section 5.1.7, Server Status
Variables
Rpl_semi_sync_master_no_times, Section 5.1.7, Server Status Vari-
ables
Rpl_semi_sync_master_no_tx, Section 5.1.7, Server Status Vari-
ables
Rpl_semi_sync_master_status, Section 5.1.7, Server Status Vari-
ables
Rpl_semi_sync_master_timefunc_failures, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_tx_avg_wait_time, Section 5.1.7, Server
Status Variables
Rpl_semi_sync_master_tx_wait_time, Section 5.1.7, Server Status
Variables
Rpl_semi_sync_master_tx_waits, Section 5.1.7, Server Status Vari-
ables
Rpl_semi_sync_master_wait_pos_backtraverse, Section 5.1.7,
Server Status Variables
Rpl_semi_sync_master_wait_sessions, Section 5.1.7, Server Status
Variables
Rpl_semi_sync_master_yes_tx, Section 5.1.7, Server Status Vari-
ables
Rpl_semi_sync_slave_status, Section 5.1.7, Server Status Vari-
ables
rpl_semi_sync_slave_enabled, Section 5.1.7, Server Status Vari-
ables
status variables, Section 12.5.5.37, SHOW STATUS Syntax, Sec-
tion 5.1.7, Server Status Variables
stop-datetime option
mysqlbinlog, Description
stop-position option
mysqlbinlog, Description
stopping
the server, Section 2.11.2.2, Starting and Stopping MySQL Auto-
matically
stopword list
user-defined, Section 11.8.6, Fine-Tuning MySQL Full-Text
Search
storage engine
ARCHIVE, Section 13.12, The ARCHIVE Storage Engine
storage engines
choosing, Chapter 13, Storage Engines
storage nodes - see data nodes, ndbd, Section 17.6.2, ndbd The
MySQL Cluster Data Node Daemon
storage nodes - see data nodes, ndbd, ndbmtd, Section 17.6.3, ndbmtd
The MySQL Cluster Data Node Daemon (Multi-Threaded)
storage requirements
data type, Section 10.5, Data Type Storage Requirements
storage space
minimizing, Section 7.4.1, Make Your Data as Small as Possible
storage_engine system variable, Section 5.1.4, Server System Vari-
ables
stored functions, Section 19.2, Using Stored Routines (Procedures and
Functions)
and INSERT DELAYED, Section 12.2.5, INSERT Syntax
stored procedures, Section 19.2, Using Stored Routines (Procedures and
Functions)
stored procedures and triggers
defined, Section 1.7.5.3, Stored Routines and Triggers
stored programs, Chapter 19, Stored Programs and Views
stored routine restrictions, Section D.1, Restrictions on Stored Routines,
Triggers, and Events
stored routines
LAST_INSERT_ID(), Section 19.2.4, Stored Procedures, Functions,
Triggers, and LAST_INSERT_ID()
and replication, Section 16.3.1.7, Replication of Invoked Features
metadata, Section 19.2.3, Stored Routine Metadata
storing row into queue
thread state, Section 7.5.6.3, Delayed-Insert Thread States
strict SQL mode, Section 5.1.8, Server SQL Modes
string collating, Section 9.4.2, String Collating Support
string comparison functions, Section 11.4.1, String Comparison Func-
tions
string comparisons
case sensitivity, Section 11.4.1, String Comparison Functions
string concatenation, Section 8.1.1, Strings, Section 11.4, String
Functions
string functions, Section 11.4, String Functions
string literal introducer, Section 8.1.1, Strings, Section 9.1.3.5,
Character String Literal Character Set and Collation
string replacement
replace utility, Section 4.8.2, replace A String-Replacement
Utility
string types, Section 10.4, String Types
strings
defined, Section 8.1, Literal Values
escaping characters, Section 8.1, Literal Values
nondelimited, Section 10.3.1, The DATETIME, DATE, and
TIMESTAMP Types
striping
defined, Section 7.6, Disk Issues
subpartitioning, Section 18.2.5, Subpartitioning
subpartitions, Section 18.2.5, Subpartitioning
subqueries, Section 12.2.9, Subquery Syntax
correlated, Section 12.2.9.7, Correlated Subqueries
Standard Index
3289
errors, Section 12.2.9.9, Subquery Errors
rewriting as joins, Section 12.2.9.11, Rewriting Subqueries as Joins
with ALL, Section 12.2.9.4, Subqueries with ALL
with ANY, IN, SOME, Section 12.2.9.3, Subqueries with ANY, IN,
and SOME
with EXISTS, Section 12.2.9.6, EXISTS and NOT EXISTS
with NOT EXISTS, Section 12.2.9.6, EXISTS and NOT EXISTS
with ROW, Section 12.2.9.5, Row Subqueries
subquery, Section 12.2.9, Subquery Syntax
subquery optimization, Section 7.2.16, Optimizing IN/=ANY Subquer-
ies
subquery restrictions, Section D.3, Restrictions on Subqueries
subselects, Section 12.2.9, Subquery Syntax
subtraction (-), Section 11.5.1, Arithmetic Operators
suffix option
mysqlhotcopy, Description
super-large-pages option
mysqld, Section 5.1.2, Server Command Options
superuser, Section 2.11.3, Securing the Initial MySQL Accounts
superuser option
mysqlaccess, Description
support
for operating systems, Section 2.1.1, Operating Systems Supported
by MySQL Community Server
suppression
default values, Section 1.7.6.2, Constraints on Invalid Data
symbolic links, Section 7.6.1, Using Symbolic Links, Section 7.6.1.3,
Using Symbolic Links for Databases on Windows
symbolic-links option
mysqld, Section 5.1.2, Server Command Options
symbols-file option
resolve_stack_dump, Description
sync_binlog system variable, Section 16.1.3.4, Binary Log Options and
Variables
sync_frm system variable, Section 5.1.4, Server System Variables
sync_master_info system variable, Section 16.1.3.3, Replication Slave
Options and Variables
sync_relay_log system variable, Section 16.1.3.3, Replication Slave
Options and Variables
sync_relay_log_info system variable, Section 16.1.3.3, Replication
Slave Options and Variables
syntax
regular expression, Section 11.4.2, Regular Expressions
syntax conventions, Section 1.2, Typographical and Syntax Conven-
tions
sysdate-is-now option
mysqld, Section 5.1.2, Server Command Options
syslog option
mysqld_safe, Description
syslog-tag option
mysqld_safe, Description
system
privilege, Section 5.4, The MySQL Access Privilege System
security, Section 5.3, General Security Issues
system command
mysql, Section 4.5.1.2, mysql Commands
system optimization, Section 7.5.2, System Factors and Startup Para-
meter Tuning
system table
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN, Sec-
tion 12.2.8, SELECT Syntax
system variable
auto_increment_increment, Section 16.1.3.2, Replication Master
Options and Variables
auto_increment_offset, Section 16.1.3.2, Replication Master Options
and Variables
automatic_sp_privileges, Section 5.1.4, Server System Variables
back_log, Section 5.1.4, Server System Variables
backup_history_log, Section 5.1.4, Server System Variables
backup_history_log_file, Section 5.1.4, Server System Variables
backup_progress_log, Section 5.1.4, Server System Variables
backup_progress_log_file, Section 5.1.4, Server System Variables
backupdir, Section 5.1.4, Server System Variables
basedir, Section 5.1.4, Server System Variables
binlog_cache_size, Section 16.1.3.4, Binary Log Options and Vari-
ables
binlog_format, Section 16.1.3.4, Binary Log Options and Variables
bulk_insert_buffer_size, Section 5.1.4, Server System Variables
character_set_client, Section 5.1.4, Server System Variables
character_set_connection, Section 5.1.4, Server System Variables
character_set_database, Section 5.1.4, Server System Variables
character_set_filesystem, Section 5.1.4, Server System Variables
character_set_results, Section 5.1.4, Server System Variables
character_set_server, Section 5.1.4, Server System Variables
character_set_system, Section 5.1.4, Server System Variables
character_sets_dir, Section 5.1.4, Server System Variables
collation_connection, Section 5.1.4, Server System Variables
collation_database, Section 5.1.4, Server System Variables
collation_server, Section 5.1.4, Server System Variables
completion_type, Section 5.1.4, Server System Variables
concurrent_insert, Section 5.1.4, Server System Variables
connect_timeout, Section 5.1.4, Server System Variables
datadir, Section 5.1.4, Server System Variables
date_format, Section 5.1.4, Server System Variables
datetime_format, Section 5.1.4, Server System Variables
debug, Section 5.1.4, Server System Variables
debug_sync, Section 5.1.4, Server System Variables
default_week_format, Section 5.1.4, Server System Variables
delay_key_write, Section 5.1.4, Server System Variables
delayed_insert_limit, Section 5.1.4, Server System Variables
delayed_insert_timeout, Section 5.1.4, Server System Variables
delayed_queue_size, Section 5.1.4, Server System Variables
div_precision_increment, Section 5.1.4, Server System Variables
engine_condition_pushdown, Section 5.1.4, Server System Vari-
ables
event_scheduler, Section 5.1.4, Server System Variables
expire_logs_days, Section 5.1.4, Server System Variables
flush, Section 5.1.4, Server System Variables
flush_time, Section 5.1.4, Server System Variables
ft_boolean_syntax, Section 5.1.4, Server System Variables
ft_max_word_len, Section 5.1.4, Server System Variables
ft_min_word_len, Section 5.1.4, Server System Variables
ft_query_expansion_limit, Section 5.1.4, Server System Variables
ft_stopword_file, Section 5.1.4, Server System Variables
general_log, Section 5.1.4, Server System Variables
general_log_file, Section 5.1.4, Server System Variables
group_concat_max_len, Section 5.1.4, Server System Variables
have_archive, Section 5.1.4, Server System Variables
have_blackhole_engine, Section 5.1.4, Server System Variables
have_compress, Section 5.1.4, Server System Variables
have_crypt, Section 5.1.4, Server System Variables
have_csv, Section 5.1.4, Server System Variables
have_dynamic_loading, Section 5.1.4, Server System Variables
have_example_engine, Section 5.1.4, Server System Variables
have_federated_engine, Section 5.1.4, Server System Variables
have_geometry, Section 5.1.4, Server System Variables
have_innodb, Section 5.1.4, Server System Variables
have_isam, Section 5.1.4, Server System Variables
have_merge_engine, Section 5.1.4, Server System Variables
have_openssl, Section 5.1.4, Server System Variables
Standard Index
3290
have_partitioning, Section 5.1.4, Server System Variables
have_query_cache, Section 5.1.4, Server System Variables
have_raid, Section 5.1.4, Server System Variables
have_row_based_replication, Section 5.1.4, Server System Vari-
ables
have_rtree_keys, Section 5.1.4, Server System Variables
have_ssl, Section 5.1.4, Server System Variables
have_symlink, Section 5.1.4, Server System Variables
hostname, Section 5.1.4, Server System Variables
init_connect, Section 5.1.4, Server System Variables
init_file, Section 5.1.4, Server System Variables
init_slave, Section 16.1.3.3, Replication Slave Options and Vari-
ables
interactive_timeout, Section 5.1.4, Server System Variables
join_buffer_size, Section 5.1.4, Server System Variables
join_cache_level, Section 5.1.4, Server System Variables
keep_files_on_create, Section 5.1.4, Server System Variables
key_buffer_size, Section 5.1.4, Server System Variables
key_cache_age_threshold, Section 5.1.4, Server System Variables
key_cache_block_size, Section 5.1.4, Server System Variables
key_cache_division_limit, Section 5.1.4, Server System Variables
language, Section 5.1.4, Server System Variables
large_files_support, Section 5.1.4, Server System Variables
large_page_size, Section 5.1.4, Server System Variables
large_pages, Section 5.1.4, Server System Variables
lc_time_names, Section 5.1.4, Server System Variables
license, Section 5.1.4, Server System Variables
local_infile, Section 5.1.4, Server System Variables
locked_in_memory, Section 5.1.4, Server System Variables
log, Section 5.1.4, Server System Variables
log_backup_output, Section 5.1.4, Server System Variables
log_bin, Section 5.1.4, Server System Variables
log_bin_trust_function_creators, Section 5.1.4, Server System Vari-
ables
log_error, Section 5.1.4, Server System Variables
log_output, Section 5.1.4, Server System Variables
log_queries_not_using_indexes, Section 5.1.4, Server System Vari-
ables
log_slave_updates, Section 5.1.4, Server System Variables
log_slow_queries, Section 5.1.4, Server System Variables
log_warnings, Section 5.1.4, Server System Variables
long_query_time, Section 5.1.4, Server System Variables
low_priority_updates, Section 5.1.4, Server System Variables
lower_case_file_system, Section 5.1.4, Server System Variables
lower_case_table_names, Section 5.1.4, Server System Variables
max_allowed_packet, Section 5.1.4, Server System Variables
max_binlog_cache_size, Section 16.1.3.4, Binary Log Options and
Variables
max_binlog_size, Section 16.1.3.4, Binary Log Options and Vari-
ables
max_connect_errors, Section 5.1.4, Server System Variables
max_connections, Section 5.1.4, Server System Variables
max_delayed_threads, Section 5.1.4, Server System Variables
max_error_count, Section 5.1.4, Server System Variables
max_heap_table_size, Section 5.1.4, Server System Variables
max_insert_delayed_threads, Section 5.1.4, Server System Vari-
ables
max_join_size, Section 5.1.4, Server System Variables
max_length_for_sort_data, Section 5.1.4, Server System Variables
max_prepared_stmt_count, Section 5.1.4, Server System Variables
max_relay_log_size, Section 5.1.4, Server System Variables
max_seeks_for_key, Section 5.1.4, Server System Variables
max_sort_length, Section 5.1.4, Server System Variables
max_sp_recursion_depth, Section 5.1.4, Server System Variables
max_tmp_tables, Section 5.1.4, Server System Variables
max_user_connections, Section 5.1.4, Server System Variables
max_write_lock_count, Section 5.1.4, Server System Variables
min_examined_row_limit, Section 5.1.4, Server System Variables
myisam_data_pointer_size, Section 5.1.4, Server System Variables
myisam_max_sort_file_size, Section 5.1.4, Server System Vari-
ables
myisam_recover_options, Section 5.1.4, Server System Variables
myisam_repair_threads, Section 5.1.4, Server System Variables
myisam_sort_buffer_size, Section 5.1.4, Server System Variables
myisam_stats_method, Section 5.1.4, Server System Variables
myisam_use_mmap, Section 5.1.4, Server System Variables
named_pipe, Section 5.1.4, Server System Variables
net_buffer_length, Section 5.1.4, Server System Variables
net_read_timeout, Section 5.1.4, Server System Variables
net_retry_count, Section 5.1.4, Server System Variables
net_write_timeout, Section 5.1.4, Server System Variables
new, Section 5.1.4, Server System Variables
old, Section 5.1.4, Server System Variables
old_passwords, Section 5.1.4, Server System Variables
one_shot, Section 5.1.4, Server System Variables
open_files_limit, Section 5.1.4, Server System Variables
optimizer_prune_level, Section 5.1.4, Server System Variables
optimizer_search_depth, Section 5.1.4, Server System Variables
optimizer_switch, Section 5.1.4, Server System Variables
optimizer_use_mrr, Section 5.1.4, Server System Variables
pid_file, Section 5.1.4, Server System Variables
plugin_dir, Section 5.1.4, Server System Variables
port, Section 5.1.4, Server System Variables
preload_buffer_size, Section 5.1.4, Server System Variables
prepared_stmt_count, Section 5.1.4, Server System Variables
protocol_version, Section 5.1.4, Server System Variables
pseudo_thread_id, Section 5.1.4, Server System Variables
query_alloc_block_size, Section 5.1.4, Server System Variables
query_cache_limit, Section 5.1.4, Server System Variables
query_cache_min_res_unit, Section 5.1.4, Server System Variables
query_cache_size, Section 5.1.4, Server System Variables
query_cache_type, Section 5.1.4, Server System Variables
query_cache_wlock_invalidate, Section 5.1.4, Server System Vari-
ables
query_prealloc_size, Section 5.1.4, Server System Variables
range_alloc_block_size, Section 5.1.4, Server System Variables
read_buffer_size, Section 5.1.4, Server System Variables
read_only, Section 5.1.4, Server System Variables
read_rnd_buffer_size, Section 5.1.4, Server System Variables
relay_log_purge, Section 5.1.4, Server System Variables
relay_log_recovery, Section 16.1.3.3, Replication Slave Options and
Variables
relay_log_space_limit, Section 5.1.4, Server System Variables
report_host, Section 5.1.4, Server System Variables
report_password, Section 5.1.4, Server System Variables
report_port, Section 5.1.4, Server System Variables
report_user, Section 5.1.4, Server System Variables
rpl_semi_sync_master_enabled, Section 5.1.4, Server System Vari-
ables
rpl_semi_sync_master_reply_log_file_pos, Section 5.1.4, Server
System Variables
rpl_semi_sync_master_timeout, Section 5.1.4, Server System Vari-
ables
rpl_semi_sync_master_trace_level, Section 5.1.4, Server System
Variables
rpl_semi_sync_slave_enabled, Section 5.1.4, Server System Vari-
ables
rpl_semi_sync_slave_trace_level, Section 5.1.4, Server System
Variables
secure_auth, Section 5.1.4, Server System Variables
Standard Index
3291
secure_backup_file_priv, Section 5.1.4, Server System Variables
secure_file_priv, Section 5.1.4, Server System Variables
server_id, Section 5.1.4, Server System Variables
shared_memory, Section 5.1.4, Server System Variables
shared_memory_base_name, Section 5.1.4, Server System Vari-
ables
skip_external_locking, Section 5.1.4, Server System Variables
skip_networking, Section 5.1.4, Server System Variables
skip_show_database, Section 5.1.4, Server System Variables
slave_compressed_protocol, Section 16.1.3.3, Replication Slave Op-
tions and Variables
slave_exec_mode, Section 16.1.3.3, Replication Slave Options and
Variables
slave_load_tmpdir, Section 16.1.3.3, Replication Slave Options and
Variables
slave_net_timeout, Section 16.1.3.3, Replication Slave Options and
Variables
slave_skip_errors, Section 16.1.3.3, Replication Slave Options and
Variables
slave_transaction_retries, Section 16.1.3.3, Replication Slave Op-
tions and Variables
slow_launch_time, Section 5.1.4, Server System Variables
slow_query_log, Section 5.1.4, Server System Variables
slow_query_log_file, Section 5.1.4, Server System Variables
socket, Section 5.1.4, Server System Variables
sort_buffer_size, Section 5.1.4, Server System Variables
sql_mode, Section 5.1.4, Server System Variables
sql_select_limit, Section 5.1.4, Server System Variables
sql_slave_skip_counter, Section 16.1.3.3, Replication Slave Options
and Variables
ssl_ca, Section 5.1.4, Server System Variables
ssl_capath, Section 5.1.4, Server System Variables
ssl_cert, Section 5.1.4, Server System Variables
ssl_cipher, Section 5.1.4, Server System Variables
ssl_key, Section 5.1.4, Server System Variables
storage_engine, Section 5.1.4, Server System Variables
sync_binlog, Section 16.1.3.4, Binary Log Options and Variables
sync_frm, Section 5.1.4, Server System Variables
sync_master_info, Section 16.1.3.3, Replication Slave Options and
Variables
sync_relay_log, Section 16.1.3.3, Replication Slave Options and
Variables
sync_relay_log_info, Section 16.1.3.3, Replication Slave Options
and Variables
system_time_zone, Section 5.1.4, Server System Variables
table_cache, Section 5.1.4, Server System Variables
table_definition_cache, Section 5.1.4, Server System Variables
table_lock_wait_timeout, Section 5.1.4, Server System Variables
table_open_cache, Section 5.1.4, Server System Variables
table_type, Section 5.1.4, Server System Variables
thread_cache_size, Section 5.1.4, Server System Variables
thread_concurrency, Section 5.1.4, Server System Variables
thread_handling, Section 5.1.4, Server System Variables
thread_pool_size, Section 5.1.4, Server System Variables
thread_stack, Section 5.1.4, Server System Variables
time_format, Section 5.1.4, Server System Variables
time_zone, Section 5.1.4, Server System Variables
timed_mutexes, Section 5.1.4, Server System Variables
tmp_table_size, Section 5.1.4, Server System Variables
tmpdir, Section 5.1.4, Server System Variables
transaction_alloc_block_size, Section 5.1.4, Server System Vari-
ables
transaction_prealloc_size, Section 5.1.4, Server System Variables
tx_isolation, Section 5.1.4, Server System Variables
updatable_views_with_limit, Section 5.1.4, Server System Vari-
ables
version, Section 5.1.4, Server System Variables
version_comment, Section 5.1.4, Server System Variables
version_compile_machine, Section 5.1.4, Server System Variables
version_compile_os, Section 5.1.4, Server System Variables
wait_timeout, Section 5.1.4, Server System Variables
system variables, Section 5.1.4, Server System Variables, Sec-
tion 5.1.6, Using System Variables, Section 12.5.5.41, SHOW VARI-
ABLES Syntax
and replication, Section 16.3.1.28, Replication and Variables
system_time_zone system variable, Section 5.1.4, Server System Vari-
ables
T
TABLES
INFORMATION_SCHEMA table, Section 20.2, The INFORMA-
TION_SCHEMA TABLES Table
TABLE_PRIVILEGES
INFORMATION_SCHEMA table, Section 20.7, The INFORMA-
TION_SCHEMA TABLE_PRIVILEGES Table
TAN(), Section 11.5.2, Mathematical Functions
TCP/IP, Section 2.3.8, Selecting a MySQL Server Type, Sec-
tion 2.3.12, Testing The MySQL Installation
TEXT
size, Section 10.5, Data Type Storage Requirements
TEXT columns
default values, Section 10.4.3, The BLOB and TEXT Types
indexing, Section 12.1.17, CREATE TABLE Syntax, Section 7.4.2,
Column Indexes
TEXT data type, Section 10.4.3, The BLOB and TEXT Types, Sec-
tion 10.1.3, Overview of String Types
TIME data type, Section 10.1.2, Overview of Date and Time Types,
Section 10.3.2, The TIME Type
TIME(), Section 11.6, Date and Time Functions
TIMEDIFF(), Section 11.6, Date and Time Functions
TIMESTAMP
and NULL values, Section B.1.5.3, Problems with NULL Values
and replication, Section 16.3.1.1, Replication and
AUTO_INCREMENT
TIMESTAMP data type, Section 10.1.2, Overview of Date and Time
Types, Section 10.3.1, The DATETIME, DATE, and TIMESTAMP
Types
TIMESTAMP(), Section 11.6, Date and Time Functions
TIMESTAMPADD(), Section 11.6, Date and Time Functions
TIMESTAMPDIFF(), Section 11.6, Date and Time Functions
TIME_FORMAT(), Section 11.6, Date and Time Functions
TIME_TO_SEC(), Section 11.6, Date and Time Functions
TINYBLOB data type, Section 10.1.3, Overview of String Types
TINYINT data type, Section 10.1.1, Overview of Numeric Types
TINYTEXT data type, Section 10.1.3, Overview of String Types
TMPDIR environment variable, Section B.1.4.4, Where MySQL Stores
Temporary Files, Section 4.1, Overview of MySQL Programs, Sec-
tion 2.14, Environment Variables, Section 2.11.2.1, Problems Run-
ning mysql_install_db
TODO
symlinks, Section 7.6.1.2, Using Symbolic Links for Tables on
Unix
TO_DAYS(), Section 11.6, Date and Time Functions
TRADITIONAL SQL mode, Section 5.1.8, Server SQL Modes
TRIGGERS
INFORMATION_SCHEMA table, Section 20.16, The INFORMA-
TION_SCHEMA TRIGGERS Table
TRIM(), Section 11.4, String Functions
TRUE, Section 8.1.4, Boolean Values, Section 8.1.2, Numbers
Standard Index
3292
testing for, Section 11.2.3, Comparison Functions and Operators
TRUNCATE, Section 12.2.10, TRUNCATE Syntax
and MySQL Cluster, Section 17.12.2, Limits and Differences of
MySQL Cluster from Standard MySQL Limits
and replication, Section 16.3.1.27, Replication and TRUNCATE
TRUNCATE(), Section 11.5.2, Mathematical Functions
TZ environment variable, Section B.1.4.6, Time Zone Problems, Sec-
tion 2.14, Environment Variables
Table Dump
thread command, Section 7.5.6.1, Thread Command Values
Table Monitor
InnoDB, Section 13.6.13.4, Troubleshooting InnoDB Data Diction-
ary Operations, Section 13.6.13.2, SHOW ENGINE INNODB
STATUS and the InnoDB Monitors
Table lock
thread state, Section 7.5.6.2, General Thread States
Tablespace Monitor
InnoDB, Section 13.6.11.2, File Space Management, Sec-
tion 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors, Section 13.6.6, Backing Up and Recovering an
InnoDB Database
Tcl API, Section 21.16, MySQL Tcl API
ThreadPool (OBSOLETE), Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
Time
thread command, Section 7.5.6.1, Thread Command Values
TimeBetweenEpochs, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
TimeBetweenEpochsTimeout, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
TimeBetweenGlobalCheckpoints, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
TimeBetweenInactiveTransactionAbortCheck, Section 17.3.4.6,
Defining MySQL Cluster Data Nodes
TimeBetweenLocalCheckpoints, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
TimeBetweenWatchDogCheck, Section 17.3.4.6, Defining MySQL
Cluster Data Nodes
TimeBetweenWatchDogCheckInitial, Section 17.3.4.6, Defining
MySQL Cluster Data Nodes
TotalSendBufferMemory
API and SQL nodes, Section 17.3.4.7, Defining SQL and Other API
Nodes in a MySQL Cluster
data nodes, Section 17.3.4.6, Defining MySQL Cluster Data Nodes
management nodes, Section 17.3.4.5, Defining a MySQL Cluster
Management Server
Touches(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
TransactionBufferMemory, Section 17.3.4.6, Defining MySQL Cluster
Data Nodes
TransactionDeadlockDetectionTimeout, Section 17.3.4.6, Defining
MySQL Cluster Data Nodes
TransactionInactiveTimeout (MySQL Cluster configuration parameter),
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Twin Studies
queries, Section 3.7, Queries from the Twin Project
tab (\t), Section 8.1.1, Strings, Section 12.2.6, LOAD DATA IN-
FILE Syntax
tab option
mysqldump, Description
table
changing, Section B.1.7.1, Problems with ALTER TABLE, Sec-
tion 12.1.7, ALTER TABLE Syntax
deleting, Section 12.1.28, DROP TABLE Syntax
rebuilding, Section 2.12.4, Rebuilding or Repairing Tables or In-
dexes
repair, Section 2.12.4, Rebuilding or Repairing Tables or Indexes
row size, Section 10.5, Data Type Storage Requirements
table aliases, Section 12.2.8, SELECT Syntax
table cache, Section 7.4.7, How MySQL Opens and Closes Tables
table is full, Section B.1.2.12, The table is full, Section 5.1.5,
Session System Variables
table names
case sensitivity, Section 8.2.2, Identifier Case Sensitivity
case-sensitivity, Section 1.7.4, MySQL Extensions to Standard
SQL
table option
mysql, Section 4.5.1.1, mysql Options
mysqlaccess, Description
table scans
avoiding, Section 7.2.19, How to Avoid Table Scans
table types
choosing, Chapter 13, Storage Engines
table-level locking, Section 7.3.1, Internal Locking Methods
table_cache, Section 7.4.7, How MySQL Opens and Closes Tables
table_cache system variable, Section 5.1.4, Server System Variables
table_definition_cache system variable, Section 5.1.4, Server System
Variables
table_lock_wait_timeout system variable, Section 5.1.4, Server System
Variables
table_open_cache, Section 7.4.7, How MySQL Opens and Closes
Tables
table_open_cache system variable, Section 5.1.4, Server System Vari-
ables
table_type system variable, Section 5.1.4, Server System Variables
tables
BLACKHOLE, Section 13.14, The BLACKHOLE Storage Engine
CSV, Section 13.13, The CSV Storage Engine
EXAMPLE, Section 13.10, The EXAMPLE Storage Engine
FEDERATED, Section 13.11, The FEDERATED Storage Engine
HEAP, Section 13.9, The MEMORY (HEAP) Storage Engine
InnoDB, Section 13.6, The InnoDB Storage Engine
MEMORY, Section 13.9, The MEMORY (HEAP) Storage Engine
MERGE, Section 13.8, The MERGE Storage Engine
MyISAM, Section 13.5, The MyISAM Storage Engine
changing column order, Section B.1.7.2, How to Change the Order
of Columns in a Table
checking, Section 4.6.3.2, myisamchk Check Options
closing, Section 7.4.7, How MySQL Opens and Closes Tables
compressed, Section 4.6.5, myisampack Generate Compressed,
Read-Only MyISAM Tables
compressed format, Section 13.5.3.3, Compressed Table Character-
istics
const, Section 7.2.1, Optimizing Queries with EXPLAIN
constant, Section 7.2.4, WHERE Clause Optimization
copying, Section 12.1.17, CREATE TABLE Syntax
counting rows, Section 3.3.4.8, Counting Rows
creating, Section 3.3.2, Creating a Table
defragment, Section 13.5.3.2, Dynamic Table Characteristics
defragmenting, Section 6.4.6, Setting Up a Table Maintenance
Schedule, Section 12.5.2.5, OPTIMIZE TABLE Syntax
deleting rows, Section B.1.5.6, Deleting Rows from Related Tables
displaying, Section 4.5.6, mysqlshow Display Database, Table,
and Column Information
displaying status, Section 12.5.5.38, SHOW TABLE STATUS Syn-
tax
dumping, Section 4.5.4, mysqldump A Database Backup Pro-
gram, Section 4.6.9, mysqlhotcopy A Database Backup Pro-
gram
dynamic, Section 13.5.3.2, Dynamic Table Characteristics
Standard Index
3293
error checking, Section 6.4.2, How to Check MyISAM Tables for Er-
rors
flush, Description
fragmentation, Section 12.5.2.5, OPTIMIZE TABLE Syntax
host, Section 5.4.5, Access Control, Stage 2: Request Verification
improving performance, Section 7.4.1, Make Your Data as Small as
Possible
information, Section 6.4.5, Getting Information About a Table
information about, Section 3.4, Getting Information About Data-
bases and Tables
loading data, Section 3.3.3, Loading Data into a Table
maintenance, Section 4.5.3, mysqlcheck A Table Maintenance
Program
maintenance schedule, Section 6.4.6, Setting Up a Table Mainten-
ance Schedule
maximum size, Section B.1.2.12, The table is full
merging, Section 13.8, The MERGE Storage Engine
multiple, Section 3.3.4.9, Using More Than one Table
names, Section 8.2, Schema Object Names
open, Section 7.4.7, How MySQL Opens and Closes Tables
opening, Section 7.4.7, How MySQL Opens and Closes Tables
optimizing, Section 6.4.4, Table Optimization
partitioning, Section 13.8, The MERGE Storage Engine
repair, Section 4.5.3, mysqlcheck A Table Maintenance Pro-
gram
repairing, Section 6.4.3, How to Repair Tables
retrieving data, Section 3.3.4, Retrieving Information from a Table
selecting columns, Section 3.3.4.3, Selecting Particular Columns
selecting rows, Section 3.3.4.2, Selecting Particular Rows
sorting rows, Section 3.3.4.4, Sorting Rows
symbolic links, Section 7.6.1.2, Using Symbolic Links for Tables on
Unix
system, Section 7.2.1, Optimizing Queries with EXPLAIN
too many, Section 7.4.8, Disadvantages of Creating Many Tables in
the Same Database
unique ID for last row, Section 21.10.10.3, How to Get the Unique
ID for the Last Inserted Row
updating, Section 1.7.5.2, Transactions and Atomic Operations
tables option
mysqlcheck, Description
mysqldump, Description
tar
problems on Solaris, Section 2.13.3, Solaris Notes, Section 2.6,
Installing MySQL on Solaris
tc-heuristic-recover option
mysqld, Section 5.1.2, Server Command Options
tcp-ip option
mysqld_multi, Description
tee command
mysql, Section 4.5.1.2, mysql Commands
tee option
mysql, Section 4.5.1.1, mysql Options
temp-pool option
mysqld, Section 5.1.2, Server Command Options
temporary file
write access, Section 2.11.2.1, Problems Running
mysql_install_db
temporary files, Section B.1.4.4, Where MySQL Stores Temporary
Files
temporary tables
and replication, Section 16.3.1.22, Replication and Temporary
Tables
internal, Section 7.5.10, How MySQL Uses Internal Temporary
Tables
problems, Section B.1.7.3, TEMPORARY Table Problems
terminal monitor
defined, Chapter 3, Tutorial
test option
myisampack, Description
testing
connection to the server, Section 5.4.4, Access Control, Stage 1:
Connection Verification
installation, Section 2.11.2, Unix Post-Installation Procedures
of MySQL releases, Section 2.1.2.1, Choosing Which Version of
MySQL to Install
post-installation, Section 2.11, Post-Installation Setup and Testing
testing mysqld
mysqltest, Section 22.1.2, MySQL Test Suite
text files
importing, Section 4.5.5, mysqlimport A Data Import Pro-
gram, Section 4.5.1.4, Executing SQL Statements from a Text File
thread cache, Section 7.5.7, How MySQL Uses Threads for Client Con-
nections
thread command
Binlog Dump, Section 7.5.6.1, Thread Command Values
Change user, Section 7.5.6.1, Thread Command Values
Close stmt, Section 7.5.6.1, Thread Command Values
Connect, Section 7.5.6.1, Thread Command Values
Connect Out, Section 7.5.6.1, Thread Command Values
Create DB, Section 7.5.6.1, Thread Command Values
Daemon, Section 7.5.6.1, Thread Command Values
Debug, Section 7.5.6.1, Thread Command Values
Delayed insert, Section 7.5.6.1, Thread Command Values
Drop DB, Section 7.5.6.1, Thread Command Values
Error, Section 7.5.6.1, Thread Command Values
Execute, Section 7.5.6.1, Thread Command Values
Fetch, Section 7.5.6.1, Thread Command Values
Field List, Section 7.5.6.1, Thread Command Values
Init DB, Section 7.5.6.1, Thread Command Values
Kill, Section 7.5.6.1, Thread Command Values
Long Data, Section 7.5.6.1, Thread Command Values
Ping, Section 7.5.6.1, Thread Command Values
Prepare, Section 7.5.6.1, Thread Command Values
Processlist, Section 7.5.6.1, Thread Command Values
Query, Section 7.5.6.1, Thread Command Values
Quit, Section 7.5.6.1, Thread Command Values
Refresh, Section 7.5.6.1, Thread Command Values
Register Slave, Section 7.5.6.1, Thread Command Values
Reset stmt, Section 7.5.6.1, Thread Command Values
Set option, Section 7.5.6.1, Thread Command Values
Shutdown, Section 7.5.6.1, Thread Command Values
Sleep, Section 7.5.6.1, Thread Command Values
Statistics, Section 7.5.6.1, Thread Command Values
Table Dump, Section 7.5.6.1, Thread Command Values
Time, Section 7.5.6.1, Thread Command Values
thread commands, Section 7.5.6.1, Thread Command Values
thread packages
differences between, Section 22.5.5, Differences Between Thread
Packages
thread pooling, Section 7.5.7, How MySQL Uses Threads for Client
Connections
thread state
After create, Section 7.5.6.2, General Thread States
Analyzing, Section 7.5.6.2, General Thread States
Changing master, Section 7.5.6.7, Replication Slave Connection
Thread States
Checking master version, Section 7.5.6.5, Replication Slave I/O
Thread States
Checking table, Section 7.5.6.2, General Thread States
Clearing, Section 7.5.6.9, Event Scheduler Thread States
Standard Index
3294
Committing events to binlog, Section 7.5.6.8, MySQL Cluster
Thread States
Connecting to master, Section 7.5.6.5, Replication Slave I/O Thread
States
Copying to group table, Section 7.5.6.2, General Thread States
Copying to tmp table, Section 7.5.6.2, General Thread States
Copying to tmp table on disk, Section 7.5.6.2, General Thread
States
Creating delayed handler, Section 7.5.6.3, Delayed-Insert Thread
States
Creating index, Section 7.5.6.2, General Thread States
Creating sort index, Section 7.5.6.2, General Thread States
Creating table from master dump, Section 7.5.6.7, Replication Slave
Connection Thread States
Creating tmp table, Section 7.5.6.2, General Thread States
Execution of init_command, Section 7.5.6.2, General Thread States
FULLTEXT initialization, Section 7.5.6.2, General Thread States
Finished reading one binlog; switching to next binlog, Sec-
tion 7.5.6.4, Replication Master Thread States
Flushing tables, Section 7.5.6.2, General Thread States
Has read all relay log; waiting for the slave I/O thread to update it,
Section 7.5.6.6, Replication Slave SQL Thread States
Has sent all binlog to slave; waiting for binlog to be updated, Sec-
tion 7.5.6.4, Replication Master Thread States
Initialized, Section 7.5.6.9, Event Scheduler Thread States
Killed, Section 7.5.6.2, General Thread States
Killing slave, Section 7.5.6.7, Replication Slave Connection Thread
States
Locked, Section 7.5.6.2, General Thread States
Making temp file, Section 7.5.6.6, Replication Slave SQL Thread
States
NULL, Section 7.5.6.2, General Thread States
Opening master dump table, Section 7.5.6.7, Replication Slave Con-
nection Thread States
Opening mysql.ndb_apply_status, Section 7.5.6.8, MySQL Cluster
Thread States
Opening table, Section 7.5.6.2, General Thread States
Opening tables, Section 7.5.6.2, General Thread States
Processing events, Section 7.5.6.8, MySQL Cluster Thread States
Processing events from schema table, Section 7.5.6.8, MySQL
Cluster Thread States
Purging old relay logs, Section 7.5.6.2, General Thread States
Queueing master event to the relay log, Section 7.5.6.5, Replication
Slave I/O Thread States
Reading event from the relay log, Section 7.5.6.6, Replication Slave
SQL Thread States
Reading from net, Section 7.5.6.2, General Thread States
Reading master dump table data, Section 7.5.6.7, Replication Slave
Connection Thread States
Rebuilding the index on master dump table, Section 7.5.6.7,
Replication Slave Connection Thread States
Reconnecting after a failed binlog dump request, Section 7.5.6.5,
Replication Slave I/O Thread States
Reconnecting after a failed master event read, Section 7.5.6.5,
Replication Slave I/O Thread States
Registering slave on master, Section 7.5.6.5, Replication Slave I/O
Thread States
Removing duplicates, Section 7.5.6.2, General Thread States
Reopen tables, Section 7.5.6.2, General Thread States
Repair by sorting, Section 7.5.6.2, General Thread States
Repair done, Section 7.5.6.2, General Thread States
Repair with keycache, Section 7.5.6.2, General Thread States
Requesting binlog dump, Section 7.5.6.5, Replication Slave I/O
Thread States
Rolling back, Section 7.5.6.2, General Thread States
Saving state, Section 7.5.6.2, General Thread States
Searching rows for update, Section 7.5.6.2, General Thread States
Sending binlog event to slave, Section 7.5.6.4, Replication Master
Thread States
Shutting down, Section 7.5.6.8, MySQL Cluster Thread States
Sorting for group, Section 7.5.6.2, General Thread States
Sorting for order, Section 7.5.6.2, General Thread States
Sorting index, Section 7.5.6.2, General Thread States
Sorting result, Section 7.5.6.2, General Thread States
Syncing ndb table schema operation and binlog, Section 7.5.6.8,
MySQL Cluster Thread States
System lock, Section 7.5.6.2, General Thread States
Table lock, Section 7.5.6.2, General Thread States
Updating, Section 7.5.6.2, General Thread States
User lock, Section 7.5.6.2, General Thread States
Waiting for INSERT, Section 7.5.6.3, Delayed-Insert Thread States
Waiting for event from ndbcluster, Section 7.5.6.8, MySQL Cluster
Thread States
Waiting for first event from ndbcluster, Section 7.5.6.8, MySQL
Cluster Thread States
Waiting for master to send event, Section 7.5.6.5, Replication Slave
I/O Thread States
Waiting for master update, Section 7.5.6.5, Replication Slave I/O
Thread States
Waiting for ndbcluster binlog update to reach current position, Sec-
tion 7.5.6.8, MySQL Cluster Thread States
Waiting for ndbcluster to start, Section 7.5.6.8, MySQL Cluster
Thread States
Waiting for next activation, Section 7.5.6.9, Event Scheduler Thread
States
Waiting for scheduler to stop, Section 7.5.6.9, Event Scheduler
Thread States
Waiting for schema epoch, Section 7.5.6.8, MySQL Cluster Thread
States
Waiting for slave mutex on exit, Section 7.5.6.6, Replication Slave
SQL Thread States, Section 7.5.6.5, Replication Slave I/O Thread
States
Waiting for table, Section 7.5.6.2, General Thread States
Waiting for tables, Section 7.5.6.2, General Thread States
Waiting for the next event in relay log, Section 7.5.6.6, Replication
Slave SQL Thread States
Waiting for the slave SQL thread to free enough relay log space, Sec-
tion 7.5.6.5, Replication Slave I/O Thread States
Waiting on cond, Section 7.5.6.2, General Thread States
Waiting on empty queue, Section 7.5.6.9, Event Scheduler Thread
States
Waiting to finalize termination, Section 7.5.6.4, Replication Master
Thread States
Waiting to reconnect after a failed binlog dump request, Sec-
tion 7.5.6.5, Replication Slave I/O Thread States
Waiting to reconnect after a failed master event read, Section 7.5.6.5,
Replication Slave I/O Thread States
Writing to net, Section 7.5.6.2, General Thread States
allocating local table, Section 7.5.6.3, Delayed-Insert Thread States
checking permissions, Section 7.5.6.2, General Thread States
cleaning up, Section 7.5.6.2, General Thread States
closing tables, Section 7.5.6.2, General Thread States
converting HEAP to MyISAM, Section 7.5.6.2, General Thread
States
copy to tmp table, Section 7.5.6.2, General Thread States
creating table, Section 7.5.6.2, General Thread States
deleting from main table, Section 7.5.6.2, General Thread States
deleting from reference tables, Section 7.5.6.2, General Thread
States
discard_or_import_tablespace, Section 7.5.6.2, General Thread
Standard Index
3295
States
end, Section 7.5.6.2, General Thread States
executing, Section 7.5.6.2, General Thread States
freeing items, Section 7.5.6.2, General Thread States
got handler lock, Section 7.5.6.3, Delayed-Insert Thread States
got old table, Section 7.5.6.3, Delayed-Insert Thread States
init, Section 7.5.6.2, General Thread States
insert, Section 7.5.6.3, Delayed-Insert Thread States
logging slow query, Section 7.5.6.2, General Thread States
login, Section 7.5.6.2, General Thread States
preparing, Section 7.5.6.2, General Thread States
query end, Section 7.5.6.2, General Thread States
removing tmp table, Section 7.5.6.2, General Thread States
rename, Section 7.5.6.2, General Thread States
rename result table, Section 7.5.6.2, General Thread States
reschedule, Section 7.5.6.3, Delayed-Insert Thread States
setup, Section 7.5.6.2, General Thread States
starting slave, Section 7.5.6.7, Replication Slave Connection Thread
States
statistics, Section 7.5.6.2, General Thread States
storing row into queue, Section 7.5.6.3, Delayed-Insert Thread
States
update, Section 7.5.6.3, Delayed-Insert Thread States
updating main table, Section 7.5.6.2, General Thread States
updating reference tables, Section 7.5.6.2, General Thread States
upgrading lock, Section 7.5.6.3, Delayed-Insert Thread States
waiting for delay_list, Section 7.5.6.3, Delayed-Insert Thread
States
waiting for handler insert, Section 7.5.6.3, Delayed-Insert Thread
States
waiting for handler lock, Section 7.5.6.3, Delayed-Insert Thread
States
waiting for handler open, Section 7.5.6.3, Delayed-Insert Thread
States
thread states
MySQL Cluster, Section 7.5.6.8, MySQL Cluster Thread States
delayed inserts, Section 7.5.6.3, Delayed-Insert Thread States
event scheduler, Section 7.5.6.9, Event Scheduler Thread States
general, Section 7.5.6.2, General Thread States
replication master, Section 7.5.6.4, Replication Master Thread
States
replication slave, Section 7.5.6.7, Replication Slave Connection
Thread States, Section 7.5.6.6, Replication Slave SQL Thread
States, Section 7.5.6.5, Replication Slave I/O Thread States
thread support, Section 2.1.1, Operating Systems Supported by MySQL
Community Server
nonnative, Section 2.10.5, MIT-pthreads Notes
thread_cache_size system variable, Section 5.1.4, Server System Vari-
ables
thread_concurrency system variable, Section 5.1.4, Server System Vari-
ables
thread_handling system variable, Section 5.1.4, Server System Vari-
ables
thread_pool_size system variable, Section 5.1.4, Server System Vari-
ables
thread_stack system variable, Section 5.1.4, Server System Variables
threaded clients, Section 21.10.17, How to Make a Threaded Client
threads, Description, Section 12.5.5.31, SHOW PROCESSLIST Syn-
tax, Section 22.1, MySQL Internals
RTS, Section 22.5.4, Comments about RTS Threads
display, Section 12.5.5.31, SHOW PROCESSLIST Syntax
time types, Section 10.5, Data Type Storage Requirements
time zone problems, Section B.1.4.6, Time Zone Problems
time zones
and replication, Section 16.3.1.24, Replication and Time Zones
leap seconds, Section 9.7.2, Time Zone Leap Second Support
support, Section 9.7, MySQL Server Time Zone Support
upgrading, Section 9.7.1, Staying Current with Time Zone Changes
time_format system variable, Section 5.1.4, Server System Variables
time_zone system variable, Section 5.1.4, Server System Variables
timed_mutexes system variable, Section 5.1.4, Server System Vari-
ables
timeout, Section 5.1.4, Server System Variables, Section 12.2.5.2,
INSERT DELAYED Syntax, Section 11.11.4, Miscellaneous Func-
tions
connect_timeout variable, Description, Section 4.5.1.1, mysql Op-
tions
shutdown_timeout variable, Description
timeout option
ndb_waiter, Description
timeouts (replication), Section 16.3.1.23, Replication Retries and
Timeouts
timestamp session variable, Section 5.1.5, Session System Variables
timezone option
mysqld_safe, Description
tips
optimization, Section 7.2.24, Other Optimization Tips
tmp_table_size system variable, Section 5.1.4, Server System Vari-
ables
tmpdir option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
myisampack, Description
mysqld, Section 5.1.2, Server Command Options
mysqlhotcopy, Description
tmpdir system variable, Section 5.1.4, Server System Variables
to-last-log option
mysqlbinlog, Description
tools
command-line, Section 4.5.1, mysql The MySQL Command-
Line Tool
mysqld_multi, Section 4.3.4, mysqld_multi Manage Multiple
MySQL Servers
mysqld_safe, Section 4.3.2, mysqld_safe MySQL Server
Startup Script
trace DBI method, Section 22.5.1.4, Debugging mysqld under gdb
trace files
ndbmtd, Description
trace files (MySQL Cluster), Description
transaction isolation level, Section 12.4.6, SET TRANSACTION Syn-
tax
READ COMMITTED, Section 12.4.6, SET TRANSACTION Syn-
tax
READ UNCOMMITTED, Section 12.4.6, SET TRANSACTION
Syntax
REPEATABLE READ, Section 12.4.6, SET TRANSACTION Syn-
tax
SERIALIZABLE, Section 12.4.6, SET TRANSACTION Syntax
transaction-isolation option
mysqld, Section 5.1.2, Server Command Options
transaction-safe tables, Section 1.7.5.2, Transactions and Atomic Oper-
ations, Section 13.6, The InnoDB Storage Engine
transaction_alloc_block_size system variable, Section 5.1.4, Server
System Variables
transaction_prealloc_size system variable, Section 5.1.4, Server System
Variables
transactional option
ndb_delete_all, Description
transactions
and replication, Section 16.3.1.25, Replication and Transactions,
Section 16.3.1.23, Replication Retries and Timeouts
Standard Index
3296
support, Section 1.7.5.2, Transactions and Atomic Operations, Sec-
tion 13.6, The InnoDB Storage Engine
trigger restrictions, Section D.1, Restrictions on Stored Routines, Trig-
gers, and Events
trigger, creating, Section 12.1.19, CREATE TRIGGER Syntax
trigger, dropping, Section 12.1.30, DROP TRIGGER Syntax
triggers, Chapter 19, Stored Programs and Views, Section 12.5.5.40,
SHOW TRIGGERS Syntax, Section 19.3, Using Triggers, Sec-
tion 1.7.5.3, Stored Routines and Triggers
LAST_INSERT_ID(), Section 19.2.4, Stored Procedures, Functions,
Triggers, and LAST_INSERT_ID()
and INSERT DELAYED, Section 12.2.5, INSERT Syntax
and replication, Section 16.3.1.26, Replication and Triggers, Sec-
tion 16.3.1.7, Replication of Invoked Features
metadata, Section 19.3.2, Trigger Metadata
triggers option
mysqldump, Description
troubleshooting
FreeBSD, Section 2.10.4, Dealing with Problems Compiling
MySQL
Solaris, Section 2.10.4, Dealing with Problems Compiling MySQL
tupscan option
ndb_select_all, Description
tutorial, Chapter 3, Tutorial
tx_isolation system variable, Section 5.1.4, Server System Variables
type conversions, Section 11.2.3, Comparison Functions and Operat-
ors, Section 11.2.2, Type Conversion in Expression Evaluation
type option
ndb_config, Description
ndb_show_tables, Description
types
Date and Time, Section 10.3, Date and Time Types
column, Chapter 10, Data Types
columns, Section 10.6, Choosing the Right Type for a Column
data, Chapter 10, Data Types
date, Section 10.5, Data Type Storage Requirements
numeric, Section 10.5, Data Type Storage Requirements
of tables, Chapter 13, Storage Engines
portability, Section 10.7, Using Data Types from Other Database
Engines
strings, Section 10.4, String Types
time, Section 10.5, Data Type Storage Requirements
typographical conventions, Section 1.2, Typographical and Syntax Con-
ventions
tz-utc option
mysqldump, Description
U
UCASE(), Section 11.4, String Functions
UCS-2, Section 9.1, Character Set Support
UDFs, Section 12.5.3.1, CREATE FUNCTION Syntax, Sec-
tion 12.5.3.2, DROP FUNCTION Syntax
compiling, Section 22.3.2.5, Compiling and Installing User-Defined
Functions
defined, Section 22.3, Adding New Functions to MySQL
return values, Section 22.3.2.4, UDF Return Values and Error Hand-
ling
UMASK environment variable, Section B.1.3.2, Problems with File
Permissions, Section 2.14, Environment Variables
UMASK_DIR environment variable, Section B.1.3.2, Problems with
File Permissions, Section 2.14, Environment Variables
UNCOMPRESS(), Section 11.11.2, Encryption and Compression Func-
tions
UNCOMPRESSED_LENGTH(), Section 11.11.2, Encryption and
Compression Functions
UNHEX(), Section 11.4, String Functions
UNINSTALL PLUGIN, Section 12.5.3.4, UNINSTALL PLUGIN Syn-
tax
UNION, Section 3.6.7, Searching on Two Keys, Section 12.2.8.3,
UNION Syntax
UNIQUE, Section 12.1.7, ALTER TABLE Syntax
UNIX_TIMESTAMP(), Section 11.6, Date and Time Functions
UNKNOWN
testing for, Section 11.2.3, Comparison Functions and Operators
UNLOCK TABLES, Section 12.4.5, LOCK TABLES and UNLOCK
TABLES Syntax
UNSIGNED, Section 10.2, Numeric Types, Section 10.1.1, Overview
of Numeric Types
UPDATE, Section 12.2.11, UPDATE Syntax
UPPER(), Section 11.4, String Functions
URLs for downloading MySQL, Section 2.1.3, How to Get MySQL
USE, Section 12.3.4, USE Syntax
USE INDEX, Section 12.2.8.2, Index Hint Syntax
USE KEY, Section 12.2.8.2, Index Hint Syntax
USER environment variable, Section 4.2.2, Connecting to the MySQL
Server, Section 2.14, Environment Variables
USER(), Section 11.11.3, Information Functions
USER_PRIVILEGES
INFORMATION_SCHEMA table, Section 20.5, The INFORMA-
TION_SCHEMA USER_PRIVILEGES Table
UTC_DATE(), Section 11.6, Date and Time Functions
UTC_TIME(), Section 11.6, Date and Time Functions
UTC_TIMESTAMP(), Section 11.6, Date and Time Functions
UTF-8, Section 9.1, Character Set Support
UUID(), Section 11.11.4, Miscellaneous Functions
UUID_SHORT(), Section 11.11.4, Miscellaneous Functions
UndoDataBuffer, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
UndoIndexBuffer, Section 17.3.4.6, Defining MySQL Cluster Data
Nodes
Unicode, Section 9.1, Character Set Support
Unicode Collation Algorithm, Section 9.1.12.1, Unicode Character
Sets
Union(), Section 11.13.5.3.2, Spatial Operators
Unix, Section 21.1, MySQL Connector/ODBC
UpdateXML(), Section 11.10, XML Functions
Updating
thread state, Section 7.5.6.2, General Thread States
User lock
thread state, Section 7.5.6.2, General Thread States
User-defined functions, Section 12.5.3.1, CREATE FUNCTION Syn-
tax, Section 12.5.3.2, DROP FUNCTION Syntax
ulimit, Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
unary minus (-), Section 11.5.1, Arithmetic Operators
unbuffered option
mysql, Section 4.5.1.1, mysql Options
uninstalling plugins, Section 12.5.3.4, UNINSTALL PLUGIN Syntax
unique ID, Section 21.10.10.3, How to Get the Unique ID for the Last
Inserted Row
unique key
constraint, Section 1.7.6.1, PRIMARY KEY and UNIQUE Index
Constraints
unique keys
and partitioning keys, Section 18.5.1, Partitioning Keys, Primary
Keys, and Unique Keys
unique_checks session variable, Section 5.1.5, Session System Vari-
ables
unique_subquery join type
optimizer, Section 7.2.1, Optimizing Queries with EXPLAIN
Standard Index
3297
unloading
tables, Section 3.3.4, Retrieving Information from a Table
unnamed views, Section 12.2.9.8, Subqueries in the FROM clause
unpack option
myisamchk, Section 4.6.3.3, myisamchk Repair Options
unqualified option
ndb_show_tables, Description
updatable views, Section 19.5.3, Updatable and Insertable Views
updatable_views_with_limit system variable, Section 5.1.4, Server Sys-
tem Variables
update
thread state, Section 7.5.6.3, Delayed-Insert Thread States
update-state option
myisamchk, Section 4.6.3.2, myisamchk Check Options
updating
releases of MySQL, Section 2.1.2.3, How and When Updates Are
Released
tables, Section 1.7.5.2, Transactions and Atomic Operations
updating main table
thread state, Section 7.5.6.2, General Thread States
updating reference tables
thread state, Section 7.5.6.2, General Thread States
upgrades
MySQL Cluster, Section 17.5.2, MySQL Cluster 5.1 and MySQL
Cluster NDB 6.x/7.x Upgrade and Downgrade Compatibility, Sec-
tion 17.5.1, Performing a Rolling Restart of a MySQL Cluster, Sec-
tion 17.5, Upgrading and Downgrading MySQL Cluster
upgrades and downgrades (MySQL Cluster)
compatibility between versions, Section 17.5.2, MySQL Cluster 5.1
and MySQL Cluster NDB 6.x/7.x Upgrade and Downgrade Compat-
ibility
upgrading, Section 2.12, Upgrading or Downgrading MySQL, Sec-
tion 2.12.1, Upgrading MySQL
4.0 to 4.1, Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
different architecture, Section 2.12.5, Copying MySQL Databases to
Another Machine
to &current-series;, Section 2.12.1.1, Upgrading from MySQL 5.0 to
5.1
upgrading lock
thread state, Section 7.5.6.3, Delayed-Insert Thread States
upgrading tables
ISAM, Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
RAID, Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
uptime, Description
usage option
ndb_config, Description
use command
mysql, Section 4.5.1.2, mysql Commands
use-frm option
mysqlcheck, Description
use-manager option
mysql.server, Description
use-mysqld_safe option
mysql.server, Description
use-threads option
mysqlimport, Description
mysqlslap, Description
useHexFormat option
ndb_select_all, Description
user accounts
creating, Section 12.5.1.1, CREATE USER Syntax
renaming, Section 12.5.1.4, RENAME USER Syntax
user names
and passwords, Section 5.5.1, User Names and Passwords
user option, Section 4.2.2, Connecting to the MySQL Server
mysql, Section 4.5.1.1, mysql Options
mysql.server, Description
mysqlaccess, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_multi, Description
mysqld_safe, Description
mysqldump, Description
mysqlhotcopy, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
user privileges
adding, Section 5.5.2, Adding User Accounts
deleting, Section 5.5.3, Removing User Accounts, Section 12.5.1.2,
DROP USER Syntax
dropping, Section 5.5.3, Removing User Accounts, Sec-
tion 12.5.1.2, DROP USER Syntax
user table
sorting, Section 5.4.4, Access Control, Stage 1: Connection Verific-
ation
user variables, Section 8.4, User-Defined Variables
and replication, Section 16.3.1.28, Replication and Variables
user-defined functions
adding, Section 22.3, Adding New Functions to MySQL, Sec-
tion 22.3.2, Adding a New User-Defined Function
username option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
users
adding, Section 2.10.1, Source Installation Overview, Section 2.9,
Installing MySQL from tar.gz Packages on Other Unix-Like Sys-
tems
deleting, Section 5.5.3, Removing User Accounts, Section 12.5.1.2,
DROP USER Syntax
root, Section 2.11.3, Securing the Initial MySQL Accounts
uses
of MySQL, Section 7.1.3, What We Have Used MySQL For
using MySQL Cluster programs, Section 17.6, MySQL Cluster Pro-
grams
using multiple disks to start data, Section 7.6.1.3, Using Symbolic
Links for Databases on Windows
utilities
program-development, Section 4.1, Overview of MySQL Programs
utility programs, Section 4.1, Overview of MySQL Programs
V
VALUES(), Section 11.11.4, Miscellaneous Functions
VARBINARY data type, Section 10.4.2, The BINARY and VARBIN-
ARY Types, Section 10.1.3, Overview of String Types
VARCHAR
size, Section 10.5, Data Type Storage Requirements
VARCHAR data type, Section 10.4, String Types, Section 10.1.3,
Overview of String Types
VARCHARACTER data type, Section 10.1.3, Overview of String
Types
VARIANCE(), Section 11.12.1, GROUP BY (Aggregate) Functions
VAR_POP(), Section 11.12.1, GROUP BY (Aggregate) Functions
VAR_SAMP(), Section 11.12.1, GROUP BY (Aggregate) Functions
VERSION(), Section 11.11.3, Information Functions
Standard Index
3298
VIEWS
INFORMATION_SCHEMA table, Section 20.15, The INFORMA-
TION_SCHEMA VIEWS Table
Vietnamese, Section A.11, MySQL 5.1 FAQ MySQL Chinese, Ja-
panese, and Korean Character Sets
Views
limitations, Section D.4, Restrictions on Views
privileges, Section D.4, Restrictions on Views
problems, Section D.4, Restrictions on Views
Visual Studio, Section 2.10.6.1, Building MySQL from Source Using
CMake and Visual Studio
valid numbers
examples, Section 8.1.2, Numbers
variables
and replication, Section 16.3.1.28, Replication and Variables
environment, Section 4.1, Overview of MySQL Programs
mysqld, Section 7.5.3, Tuning Server Parameters
server, Section 5.1.4, Server System Variables, Section 12.5.5.41,
SHOW VARIABLES Syntax
status, Section 12.5.5.37, SHOW STATUS Syntax, Section 5.1.7,
Server Status Variables
system, Section 5.1.4, Server System Variables, Section 5.1.6,
Using System Variables, Section 12.5.5.41, SHOW VARIABLES
Syntax
user, Section 8.4, User-Defined Variables
verbose option
my_print_defaults, Description
myisam_ftdump, Description
myisamchk, Section 4.6.3.1, myisamchk General Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_multi, Description
mysqldump, Description
mysqldumpslow, Description
mysqlimport, Description
mysqlshow, Description
mysqlslap, Description
perror, Description
version
choosing, Section 2.1.2, Choosing Which MySQL Distribution to
Install
latest, Section 2.1.3, How to Get MySQL
version option
comp_err, Description
my_print_defaults, Description
myisamchk, Section 4.6.3.1, myisamchk General Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysql_config, Description
mysqlaccess, Description
mysqladmin, Description
mysqlbinlog, Description
mysqlcheck, Description
mysqld, Section 5.1.2, Server Command Options
mysqld_multi, Description
mysqldump, Description
mysqlimport, Description
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
mysqlshow, Description
mysqlslap, Description
ndb_config, Description
perror, Description
resolve_stack_dump, Description
resolveip, Description
version system variable, Section 5.1.4, Server System Variables
version_comment system variable, Section 5.1.4, Server System Vari-
ables
version_compile_machine system variable, Section 5.1.4, Server Sys-
tem Variables
version_compile_os system variable, Section 5.1.4, Server System
Variables
vertical option
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
view restrictions, Section D.4, Restrictions on Views
views, Section 19.5, Using Views, Chapter 19, Stored Programs and
Views, Section 1.7.5.5, Views, Section 12.1.20, CREATE VIEW Syn-
tax
algorithms, Section 19.5.2, View Processing Algorithms
and replication, Section 16.3.1.29, Replication and Views
metadata, Section 19.5.4, View Metadata
updatable, Section 1.7.5.5, Views, Section 19.5.3, Updatable and
Insertable Views, Section 12.1.20, CREATE VIEW Syntax
virtual memory
problems while compiling, Section 2.10.4, Dealing with Problems
Compiling MySQL
W
WAIT COMPLETED (START BACKUP command), Section 17.7.3.2,
Using The MySQL Cluster Management Client to Create a Backup
WAIT STARTED (START BACKUP command), Section 17.7.3.2,
Using The MySQL Cluster Management Client to Create a Backup
WEEK(), Section 11.6, Date and Time Functions
WEEKDAY(), Section 11.6, Date and Time Functions
WEEKOFYEAR(), Section 11.6, Date and Time Functions
WHERE, Section 7.2.4, WHERE Clause Optimization
with SHOW, Section 20.28, Extensions to SHOW Statements,
Chapter 20, INFORMATION_SCHEMA Tables
WKB format, Section 11.13.3.2, Well-Known Binary (WKB) Format
WKT format, Section 11.13.3.1, Well-Known Text (WKT) Format
Waiting for INSERT
thread state, Section 7.5.6.3, Delayed-Insert Thread States
Waiting for event from ndbcluster
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Waiting for first event from ndbcluster
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Waiting for master to send event
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Waiting for master update
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Waiting for ndbcluster binlog update to reach current position
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Waiting for ndbcluster to start
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Waiting for next activation
thread state, Section 7.5.6.9, Event Scheduler Thread States
Waiting for scheduler to stop
thread state, Section 7.5.6.9, Event Scheduler Thread States
Waiting for schema epoch
thread state, Section 7.5.6.8, MySQL Cluster Thread States
Waiting for slave mutex on exit
thread state, Section 7.5.6.6, Replication Slave SQL Thread States,
Section 7.5.6.5, Replication Slave I/O Thread States
Waiting for table
Standard Index
3299
thread state, Section 7.5.6.2, General Thread States
Waiting for tables
thread state, Section 7.5.6.2, General Thread States
Waiting for the next event in relay log
thread state, Section 7.5.6.6, Replication Slave SQL Thread States
Waiting for the slave SQL thread to free enough relay log space
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Waiting on cond
thread state, Section 7.5.6.2, General Thread States
Waiting on empty queue
thread state, Section 7.5.6.9, Event Scheduler Thread States
Waiting to finalize termination
thread state, Section 7.5.6.4, Replication Master Thread States
Waiting to reconnect after a failed binlog dump request
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Waiting to reconnect after a failed master event read
thread state, Section 7.5.6.5, Replication Slave I/O Thread States
Well-Known Binary format, Section 11.13.3.2, Well-Known Binary
(WKB) Format
Well-Known Text format, Section 11.13.3.1, Well-Known Text (WKT)
Format
Wildcard character (%), Section 8.1.1, Strings
Wildcard character (_), Section 8.1.1, Strings
Windows, Section 21.1, MySQL Connector/ODBC
compiling on, Section 2.10.7, Compiling MySQL Clients on Win-
dows
open issues, Section 2.3.15, MySQL on Windows Compared to
MySQL on Unix
upgrading, Section 2.3.14, Upgrading MySQL on Windows
versus Unix, Section 2.3.15, MySQL on Windows Compared to
MySQL on Unix
Within(), Section 11.13.5.6, Functions That Test Spatial Relationships
Between Geometries
Writing to net
thread state, Section 7.5.6.2, General Thread States
wait option
myisamchk, Section 4.6.3.1, myisamchk General Options
myisampack, Description
mysql, Section 4.5.1.1, mysql Options
mysqladmin, Description
wait-timeout option
mysqlmanager, Section 4.6.10.1, MySQL Instance Manager Com-
mand Options
wait_timeout system variable, Section 5.1.4, Server System Variables
waiting for delay_list
thread state, Section 7.5.6.3, Delayed-Insert Thread States
waiting for handler insert
thread state, Section 7.5.6.3, Delayed-Insert Thread States
waiting for handler lock
thread state, Section 7.5.6.3, Delayed-Insert Thread States
waiting for handler open
thread state, Section 7.5.6.3, Delayed-Insert Thread States
warning_count session variable, Section 5.1.5, Session System Vari-
ables
warnings command
mysql, Section 4.5.1.2, mysql Commands
where option
mysqldump, Description
widths
display, Chapter 10, Data Types
wildcards
and LIKE, Section 7.4.4, How MySQL Uses Indexes
in account names, Section 5.4.3, Specifying Account Names
in mysql.columns_priv table, Section 5.4.5, Access Control, Stage 2:
Request Verification
in mysql.db table, Section 5.4.5, Access Control, Stage 2: Request
Verification
in mysql.host table, Section 5.4.5, Access Control, Stage 2: Request
Verification
in mysql.procs_priv table, Section 5.4.5, Access Control, Stage 2:
Request Verification
in mysql.tables_priv table, Section 5.4.5, Access Control, Stage 2:
Request Verification
with-big-tables option, Section 2.10.2, Typical configure Options
configure, Section 2.10.2, Typical configure Options
with-client-ldflags option
configure, Section 2.10.2, Typical configure Options
with-debug option
configure, Section 2.10.2, Typical configure Options
with-embedded-server option
configure, Section 2.10.2, Typical configure Options
with-extra-charsets option
configure, Section 2.10.2, Typical configure Options
with-libevent option
configure, Section 2.10.2, Typical configure Options
with-unix-socket-path option
configure, Section 2.10.2, Typical configure Options
with-zlib-dir option
configure, Section 2.10.2, Typical configure Options
without-server option, Section 2.10.2, Typical configure Options
configure, Section 2.10.2, Typical configure Options
wrappers
Eiffel, Section 21.17, MySQL Eiffel Wrapper
write access
tmp, Section 2.11.2.1, Problems Running mysql_install_db
write-binlog option
mysqlbinlog, Description
write_buffer_size myisamchk variable, Section 4.6.3.1, myisamchk
General Options
X
X(), Section 11.13.5.2.2, Point Functions
X509/Certificate, Section 5.5.7.1, Basic SSL Concepts
XA BEGIN, Section 12.4.7.1, XA Transaction SQL Syntax
XA COMMIT, Section 12.4.7.1, XA Transaction SQL Syntax
XA PREPARE, Section 12.4.7.1, XA Transaction SQL Syntax
XA RECOVER, Section 12.4.7.1, XA Transaction SQL Syntax
XA ROLLBACK, Section 12.4.7.1, XA Transaction SQL Syntax
XA START, Section 12.4.7.1, XA Transaction SQL Syntax
XA transactions, Section 12.4.7, XA Transactions
transaction identifiers, Section 12.4.7.1, XA Transaction SQL Syn-
tax
XOR
bitwise, Section 11.11.1, Bit Functions
logical, Section 11.2.4, Logical Operators
xid
XA transaction identifier, Section 12.4.7.1, XA Transaction SQL
Syntax
xml option
mysql, Section 4.5.1.1, mysql Options
mysqldump, Description
ndb_config, Description
Y
Y(), Section 11.13.5.2.2, Point Functions
YEAR data type, Section 10.1.2, Overview of Date and Time Types,
Section 10.3.3, The YEAR Type
YEAR(), Section 11.6, Date and Time Functions
YEARWEEK(), Section 11.6, Date and Time Functions
Standard Index
3300
Year 2000 compliance, Section 10.3.4, Year 2000 Issues and Date
Types
Year 2000 issues, Section 10.3.4, Year 2000 Issues and Date Types
Yen sign (Japanese), Section A.11, MySQL 5.1 FAQ MySQL
Chinese, Japanese, and Korean Character Sets
yaSSL, Section 5.5.7.2, Using SSL Connections, Section 5.5.7, Using
SSL for Secure Connections
Z
ZEROFILL, Section 10.2, Numeric Types, Section 10.1.1, Overview
of Numeric Types, Section 21.10.13, C API Prepared Statement Prob-
lems
Standard Index
3301
C Function Index
my_init()
Section 21.10.8.1, my_init()
Section 21.10.8.3, mysql_thread_init()
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
mysql_affected_rows()
Section 12.2.1, CALL Syntax
Section 12.2.5, INSERT Syntax
Section 12.2.7, REPLACE Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 11.11.3, Information Functions
Section 21.10.10.2, What Results You Can Get from a Query
mysql_autocommit()
Section 21.10.3.2, mysql_autocommit()
Section 21.10.2, C API Function Overview
mysql_change_user()
Section 21.10.3.3, mysql_change_user()
Section 21.10.2, C API Function Overview
mysql_character_set_name()
Section 21.10.3.4, mysql_character_set_name()
Section 21.10.2, C API Function Overview
mysql_close()
Section 21.10.3.5, mysql_close()
Section 21.10.3.6, mysql_commit()
Section 21.10.3.7, mysql_connect()
Section 21.10.3.36, mysql_init()
Section 21.10.3.57, mysql_rollback()
Section 21.10.2, C API Function Overview
Section B.1.2.11, Communication Errors and Aborted Connections
mysql_commit()
Section 21.10.3.6, mysql_commit()
Section 21.10.2, C API Function Overview
mysql_connect()
Section 21.10.8.1, my_init()
Section 21.10.3.5, mysql_close()
Section 21.10.3.7, mysql_connect()
Section 21.10.3.49, mysql_options()
Section 21.10.8.3, mysql_thread_init()
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
mysql_create_db()
Section 21.10.3.8, mysql_create_db()
Section 21.10.2, C API Function Overview
mysql_data_seek()
Section 21.10.3.9, mysql_data_seek()
Section 21.10.3.58, mysql_row_seek()
Section 21.10.3.71, mysql_use_result()
Section 21.10.2, C API Function Overview
mysql_debug()
Section 21.10.3.10, mysql_debug()
Section 21.10.2, C API Function Overview
mysql_drop_db()
Section 21.10.3.11, mysql_drop_db()
Section 21.10.2, C API Function Overview
mysql_dump_debug_info()
Section 21.10.3.12, mysql_dump_debug_info()
Section 21.10.2, C API Function Overview
mysql_eof()
Section 21.10.3.13, mysql_eof()
Section 21.10.2, C API Function Overview
mysql_errno(&mysql)
Section 21.10.3.22, mysql_field_count()
Section 21.10.3.47, mysql_num_fields()
mysql_errno()
Section 21.10.3.7, mysql_connect()
Section 21.10.3.13, mysql_eof()
Section 21.10.3.14, mysql_errno()
Section 21.10.3.66, mysql_sqlstate()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.3, C API Function Descriptions
Section 21.10.2, C API Function Overview
Section B.2, Types of Error Values
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
mysql_error()
Section 21.10.3.7, mysql_connect()
Section 21.10.3.13, mysql_eof()
Section 21.10.3.15, mysql_error()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.3, C API Function Descriptions
Section 21.10.2, C API Function Overview
Section B.2, Types of Error Values
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
mysql_escape_string()
Section 21.10.3.16, mysql_escape_string()
Section 21.10.2, C API Function Overview
Section 9.2, The Character Set Used for Data and Sorting
mysql_fetch_field()
Section 21.10.3.17, mysql_fetch_field()
3302
Section 21.10.3.23, mysql_field_seek()
Section 21.10.3.24, mysql_field_tell()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
mysql_fetch_field_direct()
Section 21.10.3.18, mysql_fetch_field_direct()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.2, C API Function Overview
mysql_fetch_fields()
Section 21.10.3.19, mysql_fetch_fields()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.2, C API Function Overview
mysql_fetch_lengths()
Section 21.10.3.20, mysql_fetch_lengths()
Section 21.10.3.21, mysql_fetch_row()
Section 21.10.2, C API Function Overview
mysql_fetch_row()
Section 21.10.3.13, mysql_eof()
Section 21.10.3.14, mysql_errno()
Section 21.10.3.20, mysql_fetch_lengths()
Section 21.10.3.21, mysql_fetch_row()
Section 21.10.3.59, mysql_row_tell()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 13.11.1, FEDERATED Storage Engine Overview
Section 21.10.10.2, What Results You Can Get from a Query
mysql_field_count(&mysql)
Section 21.10.3.22, mysql_field_count()
Section 21.10.3.47, mysql_num_fields()
mysql_field_count()
Section 21.10.3.22, mysql_field_count()
Section 21.10.3.47, mysql_num_fields()
Section 21.10.3.51, mysql_query()
Section 21.10.3.54, mysql_real_query()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.3.69, mysql_store_result()
Section 21.10.2, C API Function Overview
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
mysql_field_seek()
Section 21.10.3.17, mysql_fetch_field()
Section 21.10.3.23, mysql_field_seek()
Section 21.10.3.24, mysql_field_tell()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
mysql_field_tell()
Section 21.10.3.24, mysql_field_tell()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.2, C API Function Overview
mysql_free_result()
Section B.1.2.14, Commands out of sync
Section 21.10.3.25, mysql_free_result()
Section 21.10.3.41, mysql_list_dbs()
Section 21.10.3.42, mysql_list_fields()
Section 21.10.3.43, mysql_list_processes()
Section 21.10.3.44, mysql_list_tables()
Section 21.10.3.46, mysql_next_result()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.2, C API Function Overview
Section 21.10.6, C API Prepared Statement Function Overview
mysql_get_character_set_info()
Section 21.10.3.26, mysql_get_character_set_info()
Section 21.10.2, C API Function Overview
Section 9.5.2, Choosing a Collation ID
mysql_get_client_info()
Section 21.10.3.7, mysql_connect()
Section 21.10.3.27, mysql_get_client_info()
Section 21.10.2, C API Function Overview
mysql_get_client_version()
Section 21.10.3.28, mysql_get_client_version()
Section 21.10.2, C API Function Overview
mysql_get_host_info()
Section 21.10.3.29, mysql_get_host_info()
Section 21.10.2, C API Function Overview
mysql_get_proto_info()
Section 21.10.3.30, mysql_get_proto_info()
Section 21.10.2, C API Function Overview
mysql_get_server_info()
Section 21.10.3.31, mysql_get_server_info()
Section 21.10.2, C API Function Overview
mysql_get_server_version()
Section 21.10.3.32, mysql_get_server_version()
Section 21.10.2, C API Function Overview
mysql_get_ssl_cipher()
Section 21.10.3.33, mysql_get_ssl_cipher()
Section 21.10.2, C API Function Overview
Section 5.5.7.2, Using SSL Connections
mysql_hex_string()
Section 21.10.3.34, mysql_hex_string()
Section 21.10.2, C API Function Overview
mysql_info()
Section 12.1.7, ALTER TABLE Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
C Function Index
3303
Section 1.7.6.1, PRIMARY KEY and UNIQUE Index Constraints
Section 12.2.11, UPDATE Syntax
Section 21.10.3.35, mysql_info()
Section 21.10.3.49, mysql_options()
Section 21.10.2, C API Function Overview
Section 21.10.10.2, What Results You Can Get from a Query
mysql_init()
Section 21.10.8.1, my_init()
Section 21.10.3.5, mysql_close()
Section 21.10.3.33, mysql_get_ssl_cipher()
Section 21.10.3.36, mysql_init()
Section 21.10.3.40, mysql_library_init()
Section 21.10.3.49, mysql_options()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.67, mysql_ssl_set()
Section 21.10.8.3, mysql_thread_init()
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
mysql_insert_id()
Section 12.1.17, CREATE TABLE Syntax
Section 12.2.5, INSERT Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.37, mysql_insert_id()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 21.10.10.3, How to Get the Unique ID for the Last Inserted
Row
Section 11.11.3, Information Functions
Section 5.1.5, Session System Variables
Section 1.7.5.2, Transactions and Atomic Operations
Section 3.6.9, Using AUTO_INCREMENT
Section 21.10.10.2, What Results You Can Get from a Query
mysql_kill()
Section 21.10.3.38, mysql_kill()
Section 21.10.3.70, mysql_thread_id()
Section 21.10.2, C API Function Overview
Section 21.10.11, Controlling Automatic Reconnection Behavior
mysql_library_end()
Section 21.10.3.39, mysql_library_end()
Section 21.10.3.40, mysql_library_init()
Section 21.10.9.2, mysql_server_end()
Section 21.10.9, C API Embedded Server Function Descriptions
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
Section 21.9, libmysqld, the Embedded MySQL Server Library
mysql_library_init()
Section 21.10.8.1, my_init()
Section 21.10.3.40, mysql_library_init()
Section 21.10.9.1, mysql_server_init()
Section 21.10.8.3, mysql_thread_init()
Section 21.10.9, C API Embedded Server Function Descriptions
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
Section 21.9.3, Options with the Embedded Server
Section 21.9, libmysqld, the Embedded MySQL Server Library
mysql_library_init(0, NULL,
NULL)
Section 21.10.3.40, mysql_library_init()
mysql_list_dbs()
Section 21.10.3.25, mysql_free_result()
Section 21.10.3.41, mysql_list_dbs()
Section 21.10.2, C API Function Overview
mysql_list_fields()
Section 21.10.3.42, mysql_list_fields()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
mysql_list_processes()
Section 21.10.3.43, mysql_list_processes()
Section 21.10.2, C API Function Overview
mysql_list_tables()
Section 21.10.3.44, mysql_list_tables()
Section 21.10.2, C API Function Overview
mysql_more_results()
Section 21.10.3.45, mysql_more_results()
Section 21.10.3.46, mysql_next_result()
Section 21.10.2, C API Function Overview
Section 21.10.12, C API Support for Multiple Statement Execution
mysql_next_result()
Section 12.2.1, CALL Syntax
Section 21.10.3.45, mysql_more_results()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.64, mysql_set_server_option()
Section 21.10.3.69, mysql_store_result()
Section 21.10.2, C API Function Overview
Section 21.10.12, C API Support for Multiple Statement Execution
mysql_num_fields()
Section 21.10.3.47, mysql_num_fields()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.2, C API Function Overview
mysql_num_fields(result)
Section 21.10.3.21, mysql_fetch_row()
mysql_num_fields(result)-1
Section 21.10.3.18, mysql_fetch_field_direct()
mysql_num_rows()
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 21.10.10.2, What Results You Can Get from a Query
C Function Index
3304
mysql_num_rows(result)-1
Section 21.10.3.9, mysql_data_seek()
mysql_options()
Section 21.10.3.49, mysql_options()
Section 21.10.3.50, mysql_ping()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.2, C API Function Overview
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.11, Controlling Automatic Reconnection Behavior
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
mysql_options(...
MYSQL_OPT_LOCAL_INFILE, 0)
Section 5.3.4, Security Issues with LOAD DATA LOCAL
mysql_options(...,
MYSQL_OPT_READ_TIMEOUT,...)
Section B.1.2.9, MySQL server has gone away
mysql_options(...,
MYSQL_OPT_WRITE_TIMEOUT,...)
Section B.1.2.9, MySQL server has gone away
mysql_options(mysql,
MYSQL_SET_CHARSET_NAME, "char-
set_name")
Section 21.10.3.52, mysql_real_connect()
mysql_ping()
Section B.1.2.9, MySQL server has gone away
Section 21.10.3.50, mysql_ping()
Section 21.10.3.70, mysql_thread_id()
Section 21.10.2, C API Function Overview
Section 21.10.11, Controlling Automatic Reconnection Behavior
mysql_query()
Section 12.2.1, CALL Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.8, mysql_create_db()
Section 21.10.3.11, mysql_drop_db()
Section 21.10.3.17, mysql_fetch_field()
Section 21.10.3.38, mysql_kill()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.51, mysql_query()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.54, mysql_real_query()
Section 21.10.3.56, mysql_reload()
Section 21.10.3.63, mysql_set_local_infile_handler()
Section 21.10.3.64, mysql_set_server_option()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.2, C API Function Overview
Section 21.10.12, C API Support for Multiple Statement Execution
Section 21.10.10.3, How to Get the Unique ID for the Last Inserted
Row
Section 21.10.17, How to Make a Threaded Client
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
mysql_real_connect()
Section 12.2.1, CALL Syntax
Section 21.10.3.3, mysql_change_user()
Section 21.10.3.7, mysql_connect()
Section 21.10.3.36, mysql_init()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.49, mysql_options()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.64, mysql_set_server_option()
Section 21.10.3.66, mysql_sqlstate()
Section 21.10.3.67, mysql_ssl_set()
Section 21.10.2, C API Function Overview
Section 21.10.12, C API Support for Multiple Statement Execution
Chapter 11, Functions and Operators
Section 21.10.17, How to Make a Threaded Client
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.4, Server System Variables
Section 19.2.1, Stored Routine Syntax
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
Section 5.5.7.2, Using SSL Connections
mysql_real_escape_string()
Section 21.10.3.16, mysql_escape_string()
Section 21.10.3.53, mysql_real_escape_string()
Section 21.10.3.61, mysql_set_character_set()
Section 21.10.2, C API Function Overview
Section 5.3.1, General Security Guidelines
Section 11.13.4.4, Populating Spatial Columns
Section 8.1.1, Strings
Section 9.2, The Character Set Used for Data and Sorting
mysql_real_query()
Section 12.2.1, CALL Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.51, mysql_query()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.54, mysql_real_query()
Section 21.10.3.64, mysql_set_server_option()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.2, C API Function Overview
Section 21.10.12, C API Support for Multiple Statement Execution
Section 13.11.1, FEDERATED Storage Engine Overview
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_refresh()
Section 21.10.3.55, mysql_refresh()
Section 21.10.2, C API Function Overview
mysql_reload()
Section 21.10.3.56, mysql_reload()
Section 21.10.2, C API Function Overview
C Function Index
3305
mysql_rollback()
Section 21.10.3.57, mysql_rollback()
Section 21.10.2, C API Function Overview
mysql_row_seek()
Section 21.10.3.58, mysql_row_seek()
Section 21.10.3.59, mysql_row_tell()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.2, C API Function Overview
mysql_row_tell()
Section 21.10.3.58, mysql_row_seek()
Section 21.10.3.59, mysql_row_tell()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.2, C API Function Overview
mysql_select_db()
Section 21.10.3.60, mysql_select_db()
Section 21.10.2, C API Function Overview
mysql_server_end()
Section 21.10.9.2, mysql_server_end()
Section 21.10.2, C API Function Overview
mysql_server_init()
Section 21.10.8.1, my_init()
Section 21.10.9.1, mysql_server_init()
Section 21.10.8.3, mysql_thread_init()
Section 21.10.2, C API Function Overview
mysql_set_character_set()
Section 21.10.3.26, mysql_get_character_set_info()
Section 21.10.3.53, mysql_real_escape_string()
Section 21.10.3.61, mysql_set_character_set()
Section 21.10.2, C API Function Overview
mysql_set_local_infile_default
()
Section 21.10.3.62, mysql_set_local_infile_default()
Section 21.10.2, C API Function Overview
mysql_set_local_infile_handler
()
Section 21.10.3.62, mysql_set_local_infile_default()
Section 21.10.3.63, mysql_set_local_infile_handler()
Section 21.10.2, C API Function Overview
mysql_set_server_option()
Section 21.10.3.64, mysql_set_server_option()
Section 21.10.2, C API Function Overview
Section 21.10.12, C API Support for Multiple Statement Execution
mysql_shutdown()
Section 21.10.3.65, mysql_shutdown()
Section 21.10.2, C API Function Overview
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_sqlstate()
Section 21.10.3.14, mysql_errno()
Section 21.10.3.66, mysql_sqlstate()
Section 21.10.2, C API Function Overview
Section B.2, Types of Error Values
mysql_ssl_set()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.67, mysql_ssl_set()
Section 21.10.2, C API Function Overview
Section 5.5.7.2, Using SSL Connections
mysql_stat()
Section 21.10.3.68, mysql_stat()
Section 21.10.2, C API Function Overview
mysql_stmt_affected_rows()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_attr_get()
Section 21.10.7.2, mysql_stmt_attr_get()
Section 21.10.6, C API Prepared Statement Function Overview
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_stmt_attr_set()
Section 21.10.7.3, mysql_stmt_attr_set()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.1, C API Data Types
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.6, C API Prepared Statement Function Overview
Section D.2, Restrictions on Server-Side Cursors
mysql_stmt_attr_set(MYSQL_STMT
, STMT_ATTR_UPDATE_MAX_LENGTH,
&flag)
Section 21.10.7.27, mysql_stmt_store_result()
mysql_stmt_bind_param()
Section 21.10.7.4, mysql_stmt_bind_param()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.20, mysql_stmt_prepare()
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.14, C API Prepared Statement Handling of Date and
Time Values
mysql_stmt_bind_result()
Section 21.10.7.5, mysql_stmt_bind_result()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.12, mysql_stmt_fetch_column()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.5, C API Prepared Statement Data types
C Function Index
3306
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.14, C API Prepared Statement Handling of Date and
Time Values
mysql_stmt_close()
Section 21.10.7.6, mysql_stmt_close()
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_close(MYSQL_STMT *)
Section 21.10.7.15, mysql_stmt_init()
mysql_stmt_data_seek()
Section 21.10.7.7, mysql_stmt_data_seek()
Section 21.10.7.23, mysql_stmt_row_seek()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_errno()
Section 21.10.7.8, mysql_stmt_errno()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.6, C API Prepared Statement Function Overview
Section B.2, Types of Error Values
mysql_stmt_error()
Section 21.10.7.9, mysql_stmt_error()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.20, mysql_stmt_prepare()
Section 21.10.6, C API Prepared Statement Function Overview
Section B.2, Types of Error Values
mysql_stmt_execute()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.3, mysql_stmt_attr_set()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.14, C API Prepared Statement Handling of Date and
Time Values
Section 7.5.5.1, How the Query Cache Operates
mysql_stmt_fetch()
Section 21.10.7.5, mysql_stmt_bind_result()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.7.24, mysql_stmt_row_tell()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_fetch_column()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.12, mysql_stmt_fetch_column()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_field_count()
Section 21.10.7.13, mysql_stmt_field_count()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_free_result()
Section 21.10.7.3, mysql_stmt_attr_set()
Section 21.10.7.14, mysql_stmt_free_result()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_init()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.15, mysql_stmt_init()
Section 21.10.7.20, mysql_stmt_prepare()
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.7, C API Prepared Statement Function Descriptions
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.4, C API Prepared Statements
mysql_stmt_insert_id()
Section 21.10.7.16, mysql_stmt_insert_id()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_num_rows()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_num_rows(stmt)-1
Section 21.10.7.7, mysql_stmt_data_seek()
mysql_stmt_param_count()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.18, mysql_stmt_param_count()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_param_metadata()
Section 21.10.7.19, mysql_stmt_param_metadata()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_prepare()
Section 21.10.7.4, mysql_stmt_bind_param()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.13, mysql_stmt_field_count()
Section 21.10.7.20, mysql_stmt_prepare()
Section 21.10.7.21, mysql_stmt_reset()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.14, C API Prepared Statement Handling of Date and
Time Values
Section 7.5.5.1, How the Query Cache Operates
Section 12.7, SQL Syntax for Prepared Statements
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_stmt_reset()
Section 21.10.7.3, mysql_stmt_attr_set()
Section 21.10.7.21, mysql_stmt_reset()
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_result_metadata()
Section 21.10.7.11, mysql_stmt_fetch()
C Function Index
3307
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.5, C API Prepared Statement Data types
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_row_seek()
Section 21.10.7.23, mysql_stmt_row_seek()
Section 21.10.7.24, mysql_stmt_row_tell()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_row_tell()
Section 21.10.7.23, mysql_stmt_row_seek()
Section 21.10.7.24, mysql_stmt_row_tell()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_send_long_data()
Section 21.10.7.21, mysql_stmt_reset()
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 21.10.6, C API Prepared Statement Function Overview
mysql_stmt_sqlstate()
Section 21.10.7.26, mysql_stmt_sqlstate()
Section 21.10.6, C API Prepared Statement Function Overview
Section B.2, Types of Error Values
mysql_stmt_store_result()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.3, mysql_stmt_attr_set()
Section 21.10.7.7, mysql_stmt_data_seek()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 21.10.7.23, mysql_stmt_row_seek()
Section 21.10.7.24, mysql_stmt_row_tell()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.1, C API Data Types
Section 21.10.6, C API Prepared Statement Function Overview
mysql_store_result()
Section B.1.2.14, Commands out of sync
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.9, mysql_data_seek()
Section 21.10.3.13, mysql_eof()
Section 21.10.3.17, mysql_fetch_field()
Section 21.10.3.21, mysql_fetch_row()
Section 21.10.3.22, mysql_field_count()
Section 21.10.3.25, mysql_free_result()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.47, mysql_num_fields()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.3.58, mysql_row_seek()
Section 21.10.3.59, mysql_row_tell()
Section 21.10.7.22, mysql_stmt_result_metadata()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Description
Section 13.11.1, FEDERATED Storage Engine Overview
Section 21.10.17, How to Make a Threaded Client
Section 21.10.10.2, What Results You Can Get from a Query
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
mysql_thread_end()
Section 21.10.8.2, mysql_thread_end()
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
Section 21.9, libmysqld, the Embedded MySQL Server Library
mysql_thread_id()
Section 21.10.3.50, mysql_ping()
Section 21.10.3.70, mysql_thread_id()
Section 21.10.2, C API Function Overview
Section 21.10.11, Controlling Automatic Reconnection Behavior
mysql_thread_init()
Section 21.10.8.1, my_init()
Section 21.10.8.2, mysql_thread_end()
Section 21.10.8.3, mysql_thread_init()
Section 21.10.2, C API Function Overview
Section 21.10.17, How to Make a Threaded Client
Section 21.9, libmysqld, the Embedded MySQL Server Library
mysql_thread_safe()
Section 21.10.8.4, mysql_thread_safe()
Section 21.10.2, C API Function Overview
mysql_use_result()
Section B.1.2.14, Commands out of sync
Section B.1.2.8, Out of memory
Section 21.10.3.9, mysql_data_seek()
Section 21.10.3.13, mysql_eof()
Section 21.10.3.21, mysql_fetch_row()
Section 21.10.3.25, mysql_free_result()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.47, mysql_num_fields()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.3.58, mysql_row_seek()
Section 21.10.3.59, mysql_row_tell()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Description
Section 21.10.17, How to Make a Threaded Client
Section 21.10.10.2, What Results You Can Get from a Query
mysql_warning_count()
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.72, mysql_warning_count()
Section 21.10.2, C API Function Overview
C Function Index
3308
Command Index
--ndb-cluster
Section A.10, MySQL 5.1 FAQ MySQL Cluster
--old-passwords
Section 21.11, MySQL PHP API
--run-as-service
Section 4.6.10.1, MySQL Instance Manager Command Options
../dist/configure
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
./configure
Section 2.10.3, Installing from the Development Source Tree
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.10.2, Typical configure Options
./configure --help
Section 2.10.1, Source Installation Overview
./configure --without-server
Section 22.5, Debugging and Porting MySQL
./configure --help
Section 2.10.2, Typical configure Options
./configure; make; make in-
stall
Section 2.13.1.3, Linux Source Distribution Notes
./mysql-test-run.pl
Section 22.1.2, MySQL Test Suite
./mysql-test-run.pl test_name
Section 22.1.2, MySQL Test Suite
/etc/init.d/mysql
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
/etc/init.d/mysql stop
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
/usr/local/mysql/bin/mysql
Section 4.2.1, Invoking MySQL Programs
? [arg]
Section 4.5.1.2, mysql Commands
ALL STATUS
Section 17.7.6, MySQL Cluster Single User Mode
APF
Section 17.8.1, MySQL Cluster Security and Networking Issues
Access
Section 12.2.2, DELETE Syntax
BUILD/autorun.sh
Section 2.10.3, Installing from the Development Source Tree
BUILD/compile-pentium-max
Section 17.3.1, Building MySQL Cluster from Source Code
BUILD/com-
pile-platform_name-max
Section 17.2.2, MySQL Cluster Multi-Computer Installation
CC
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
CRTUSRPRF
Section 2.7, Installing MySQL on i5/OS
EXIT SINGLE USER MODE
Section 17.7.6, MySQL Cluster Single User Mode
GnuPG
Section 2.1.4.2, Signature Checking Using GnuPG
Help View
Section 2.5, Installing MySQL on Mac OS X
Hot Backup
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
InnoDB Hot Backup
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Section 13.6, The InnoDB Storage Engine
InnoDB Hot Backup
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
InnoDB Hot Backup
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 13.6, The InnoDB Storage Engine
Section 13.6.2.1, Using Per-Table Tablespaces
Metrowerks CodeWarrior for
NetWare
Section 2.8, Installing MySQL on NetWare
NET
Section 2.3.11, Starting MySQL as a Windows Service
3309
NET START MySQL
Section 2.3.11, Starting MySQL as a Windows Service
NET STOP MySQL
Section 2.3.11, Starting MySQL as a Windows Service
NET START
Section 5.6.1.2, Starting Multiple Windows Servers as Services
NET START MySQL
Section 2.3.14, Upgrading MySQL on Windows
NET START MySQL
Section 2.3.13, Troubleshooting a MySQL Installation Under Win-
dows
NET STOP
Section 5.6.1.2, Starting Multiple Windows Servers as Services
NET STOP MySQL
Section 2.3.11, Starting MySQL as a Windows Service
Notepad
Section 2.3.7, Creating an Option File
Section 2.3.13, Troubleshooting a MySQL Installation Under Win-
dows
PGP
Section 2.1.4.2, Signature Checking Using GnuPG
Registry Editor
Section 2.3.11, Starting MySQL as a Windows Service
SELECT
Section 17.2.5, Loading Sample Data into MySQL Cluster and Per-
forming Queries
SHOW
Description
Section 17.3.3, Quick Test Setup of MySQL Cluster
SHOW WARNINGS
Section A.10, MySQL 5.1 FAQ MySQL Cluster
SHOW ERRORS
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Service Control Manager
Section 2.3, Installing MySQL on Windows
Section 2.3.11, Starting MySQL as a Windows Service
Services
Section 2.3.11, Starting MySQL as a Windows Service
Start>Run>cmd.exe
Section 5.5.7.4, Setting Up SSL Certificates for MySQL
Text in this style
Section 1.2, Typographical and Syntax Conventions
WinDbg
Section 22.5.1.3, Using pdb to create a Windows crashdump
WinZip
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
WordPad
Section 12.2.6, LOAD DATA INFILE Syntax
\! command
Section 4.5.1.2, mysql Commands
\#
Section 4.5.1.2, mysql Commands
\. file_name
Section 4.5.1.2, mysql Commands
\? [arg]
Section 4.5.1.2, mysql Commands
\C charset_name
Section 4.5.1.2, mysql Commands
\G
Section 4.5.1.2, mysql Commands
\P [command]
Section 4.5.1.2, mysql Commands
\R [str]
Section 4.5.1.2, mysql Commands
\T [file_name]
Section 4.5.1.2, mysql Commands
\W
Section 4.5.1.2, mysql Commands
\c
Section 4.5.1.2, mysql Commands
\d str
Section 4.5.1.2, mysql Commands
\e
Section 4.5.1.2, mysql Commands
\g
Command Index
3310
Section 4.5.1.2, mysql Commands
\h [arg]
Section 4.5.1.2, mysql Commands
\n
Section 4.5.1.2, mysql Commands
\p
Section 4.5.1.2, mysql Commands
\q
Section 4.5.1.2, mysql Commands
\r [db_name host_name]]
Section 4.5.1.2, mysql Commands
\s
Section 4.5.1.2, mysql Commands
\t
Section 4.5.1.2, mysql Commands
\u db_name
Section 4.5.1.2, mysql Commands
\w
Section 4.5.1.2, mysql Commands
aCC
Section 22.5, Debugging and Porting MySQL
addgroup
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.10.1, Source Installation Overview
adduser
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.10.1, Source Installation Overview
autoconf
Section 2.10.3, Installing from the Development Source Tree
automake
Section 2.10.3, Installing from the Development Source Tree
bash
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 5.5.6.2, End-User Guidelines for Password Security
Section 2.5, Installing MySQL on Mac OS X
Section 4.2.1, Invoking MySQL Programs
Section 16.1.3.3, Replication Slave Options and Variables
Section 4.2.4, Setting Environment Variables
Section 1.2, Typographical and Syntax Conventions
bin/mysql_setpermission
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.10.1, Source Installation Overview
bin/mysqld_safe
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 2.10.1, Source Installation Overview
Section 2.11.2, Unix Post-Installation Procedures
bin/safe_mysqld
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.10.1, Source Installation Overview
Section 2.11.2, Unix Post-Installation Procedures
bison
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 2.10.6, Installing MySQL from Source on Windows
Section 2.10.3, Installing from the Development Source Tree
bzr
Section 2.10.3, Installing from the Development Source Tree
c++
Section 2.10.4, Dealing with Problems Compiling MySQL
c++filt
Section 22.5.1.5, Using a Stack Trace
cat [> filename]
Section 4.5.1.1, mysql Options
cc
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 2.13.5.2, HP-UX Version 11.x Notes
Section 22.5, Debugging and Porting MySQL
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
cd
Section 2.11.2.2, Starting and Stopping MySQL Automatically
charset charset_name
Section 4.5.1.2, mysql Commands
chkconfig
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.11.2.2, Starting and Stopping MySQL Automatically
chroot
Description
Command Index
3311
clear
Section 4.5.1.2, mysql Commands
cmake
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
cmake --help
Section 22.3.2.5, Compiling and Installing User-Defined Functions
cmd.exe
Section 4.2.1, Invoking MySQL Programs
Section 1.2, Typographical and Syntax Conventions
command.com
Section 4.2.1, Invoking MySQL Programs
Section 1.2, Typographical and Syntax Conventions
comp_err
Section 4.4.1, comp_err Compile MySQL Error Message File
Description
Section 4.1, Overview of MySQL Programs
comp_err [options]
Section 4.4.1, comp_err Compile MySQL Error Message File
compile-amd64-max-sci
Section 17.11.1, Configuring MySQL Cluster to use SCI Sockets
compile-pentium-max
Section 17.3.1, Building MySQL Cluster from Source Code
compile-pentium64-max-sci
Section 17.11.1, Configuring MySQL Cluster to use SCI Sockets
configure
Section B.1.2.17, Can't initialize character set
Section 9.4, Adding a New Character Set
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.6, BSD/OS Version 4.x Notes
Section 17.3.1, Building MySQL Cluster from Source Code
Section 22.5.1.1, Compiling MySQL for Debugging
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 22.2.3.3, Creating a Plugin Library
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 2.14, Environment Variables
Section 2.13.4.1, FreeBSD Notes
Section 2.13.5.1, HP-UX Version 10.20 Notes
Section 2.13.5.2, HP-UX Version 11.x Notes
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section B.1.4.5, How to Protect or Change the MySQL Unix Socket
File
Section 1.6, How to Report Bugs or Problems
Section 2.13.5.3, IBM-AIX notes
Section 2.10.3, Installing from the Development Source Tree
Section 2.13.1.7, Linux Alpha Notes
Section 2.13.1.10, Linux IA-64 Notes
Section 2.13.1.3, Linux Source Distribution Notes
Section 2.13.1.5, Linux x86 Notes
Section 2.10.5, MIT-pthreads Notes
Section 2.13.2.1, Mac OS X 10.x (Darwin)
Section 2.1.2.4, MySQL Binaries Compiled by Sun Microsystems,
Inc.
Section 2.10, MySQL Installation Using a Source Distribution
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 5.6.2, Running Multiple Servers on Unix
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
Section 2.13.5.7, SGI Irix Notes
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Section 9.1.3.1, Server Character Set and Collation
Section 5.1.4, Server System Variables
Section 2.13.3.1, Solaris 2.7/2.8 Notes
Section 2.13.3, Solaris Notes
Section 2.13.3.2, Solaris x86 Notes
Section 2.10.1, Source Installation Overview
Section 2.13.5.4, SunOS 4 Notes
Section 13.12, The ARCHIVE Storage Engine
Section 13.14, The BLACKHOLE Storage Engine
Section 13.13, The CSV Storage Engine
Section 13.10, The EXAMPLE Storage Engine
Section 13.11, The FEDERATED Storage Engine
Section 13.5, The MyISAM Storage Engine
Section 9.2, The Character Set Used for Data and Sorting
Section 7.5.5, The MySQL Query Cache
Section 2.10.2, Typical configure Options
Section 1.2, Typographical and Syntax Conventions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 4.2.3.3, Using Option Files
Section 5.5.7.2, Using SSL Connections
Section B.1.4.2, What to Do If MySQL Keeps Crashing
Section 21.9, libmysqld, the Embedded MySQL Server Library
configure --help
Section 2.10.2, Typical configure Options
configure.js
Section 17.3.1, Building MySQL Cluster from Source Code
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.10.2, Typical configure Options
connect [db_name host_name]]
Section 4.5.1.2, mysql Commands
copy
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
coreadm
Section 5.1.2, Server Command Options
cp
Chapter 6, Backup and Recovery
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
Command Index
3312
crash-me
Section 7.1.2, Designing Applications for Portability
Section 7.1.4, The MySQL Benchmark Suite
cron
Section 12.5.2.3, CHECK TABLE Syntax
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 13.5.1, MyISAM Startup Options
Section 5.2.6, Server Log Maintenance
Section 6.4.6, Setting Up a Table Maintenance Schedule
Section 3.5, Using mysql in Batch Mode
csh
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 4.2.1, Invoking MySQL Programs
Section 4.2.4, Setting Environment Variables
Section 1.2, Typographical and Syntax Conventions
cxx
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 22.5, Debugging and Porting MySQL
delimiter str
Section 4.5.1.2, mysql Commands
df
Section B.1.1, How to Determine What Is Causing a Problem
drwtsn32.exe
Section 22.5.1.3, Using pdb to create a Windows crashdump
dump
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
ecc/icc
Section 22.5, Debugging and Porting MySQL
edit
Section 4.5.1.2, mysql Commands
egcs
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
ego
Section 4.5.1.2, mysql Commands
exit
Section 4.5.1.2, mysql Commands
fcc/FCC
Section 2.13.1.3, Linux Source Distribution Notes
fsadm
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
g++
Section 2.10.4, Dealing with Problems Compiling MySQL
gcc
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 22.5.1.1, Compiling MySQL for Debugging
Section 21.9.1, Compiling Programs with libmysqld
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 2.13.4.1, FreeBSD Notes
Section 2.13.5.1, HP-UX Version 10.20 Notes
Section 2.13.5.2, HP-UX Version 11.x Notes
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 2.13.5.3, IBM-AIX notes
Section 2.13.1.7, Linux Alpha Notes
Section 2.13.1.10, Linux IA-64 Notes
Section 2.13.1.9, Linux MIPS Notes
Section 2.13.1.3, Linux Source Distribution Notes
Section 2.13.1.5, Linux x86 Notes
Section 2.10, MySQL Installation Using a Source Distribution
Section 22.5, Debugging and Porting MySQL
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
Section 2.13.5.7, SGI Irix Notes
Section 2.13.3.1, Solaris 2.7/2.8 Notes
Section 2.13.3, Solaris Notes
Section 2.13.3.2, Solaris x86 Notes
Section 2.10.2, Typical configure Options
gcc-c++
Section 2.10.4, Dealing with Problems Compiling MySQL
gdb
Section 22.5.1.1, Compiling MySQL for Debugging
Section 22.5.1.4, Debugging mysqld under gdb
Section 2.13.1.7, Linux Alpha Notes
Section 2.13.3.2, Solaris x86 Notes
Section B.1.4.2, What to Do If MySQL Keeps Crashing
gmake
Section 2.13.4.1, FreeBSD Notes
Section 2.13.5.3, IBM-AIX notes
Section 2.10.3, Installing from the Development Source Tree
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
gnutar
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.13.2, Mac OS X Notes
Section 2.10, MySQL Installation Using a Source Distribution
go
Section 4.5.1.2, mysql Commands
Command Index
3313
gpg
Section 2.1.4.2, Signature Checking Using GnuPG
gpg --import
Section 2.1.4.2, Signature Checking Using GnuPG
grep
Description
Section 3.3.4.7, Pattern Matching
groupadd
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.4, Installing MySQL from RPM Packages on Linux
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.10.1, Source Installation Overview
gtar
Section 2.13.5.1, HP-UX Version 10.20 Notes
Section 2.13.5.2, HP-UX Version 11.x Notes
Section 2.6, Installing MySQL on Solaris
Section 2.13.3, Solaris Notes
gunzip
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.10.1, Source Installation Overview
gzip
Section 1.6, How to Report Bugs or Problems
gzip --fast
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
hdparm
Section 13.6.3, InnoDB Startup Options and System Variables
help [arg]
Section 4.5.1.2, mysql Commands
help contents
Section 4.5.1.3, mysql Server-Side Help
hostname
Section B.1.2.2, Can't connect to [local] MySQL
server
ibback
Chapter 6, Backup and Recovery
ibbackup
Chapter 6, Backup and Recovery
icc
Section 22.5, Debugging and Porting MySQL
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
idtune
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
idtune name parameter
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
innochecksum
Section 4.6.1, innochecksum Offline InnoDB File Checksum
Utility
Description
Section 4.1, Overview of MySQL Programs
innochecksum [options]
file_name
Section 4.6.1, innochecksum Offline InnoDB File Checksum
Utility
iptables
Section 17.8.1, MySQL Cluster Security and Networking Issues
isamchk
Section 13.5.3.3, Compressed Table Characteristics
Section 4.1, Overview of MySQL Programs
isamlog
Description
Section 4.1, Overview of MySQL Programs
kill
Section B.1.2.2, Can't connect to [local] MySQL
server
Description
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
kill -9
Section D.5, Restrictions on XA Transactions
kswapd
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
ld
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
ldconfig
Section 22.3.2.5, Compiling and Installing User-Defined Functions
less
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
libtool
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Command Index
3314
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 22.2.3.3, Creating a Plugin Library
Section 2.10.3, Installing from the Development Source Tree
Section 2.10, MySQL Installation Using a Source Distribution
Section 2.13.5.4, SunOS 4 Notes
ln
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
logger
Description
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
m4
Section 2.10.3, Installing from the Development Source Tree
make
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 2.13.4.6, BSD/OS Version 4.x Notes
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 22.2.3.3, Creating a Plugin Library
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 2.13.4.1, FreeBSD Notes
Section 2.13.5.3, IBM-AIX notes
Section 2.10.3, Installing from the Development Source Tree
Section 2.10, MySQL Installation Using a Source Distribution
Section 2.13.4.2, NetBSD Notes
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.13.3.1, Solaris 2.7/2.8 Notes
Section 2.13.5.4, SunOS 4 Notes
Section 2.10.2, Typical configure Options
make install
Section 22.2.3.3, Creating a Plugin Library
Section 17.2.2, MySQL Cluster Multi-Computer Installation
make perl
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
make realclean
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
make test
Section 2.10.3, Installing from the Development Source Tree
make -f Makefile.aperl
inst_perl MAP_TARGET=perl
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
make -k
Section 2.10.2, Typical configure Options
make distclean
Section 2.10.4, Dealing with Problems Compiling MySQL
make install
Section 22.2.3.3, Creating a Plugin Library
Section 2.13.4.1, FreeBSD Notes
Section 2.10.3, Installing from the Development Source Tree
Section 2.13.1.5, Linux x86 Notes
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.10.1, Source Installation Overview
make perl
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
make test
Section 2.15.1, Installing Perl on Unix
Section 22.1.2, MySQL Test Suite
make_binary_distribution
Section 4.1, Overview of MySQL Programs
make_win_bin_dist
Section 4.4.2, make_win_bin_dist Package MySQL Distribu-
tion as ZIP Archive
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Description
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 4.1, Overview of MySQL Programs
make_win_bin_dist [options]
package_basename [copy_def
...]
Section 4.4.2, make_win_bin_dist Package MySQL Distribu-
tion as ZIP Archive
make_win_src_distribution
Section 4.1, Overview of MySQL Programs
md5
Section 2.1.4.1, Verifying the MD5 Checksum
md5sum
Section 2.1.4.1, Verifying the MD5 Checksum
memcached
Chapter 14, High Availability and Scalability
Section 14.5, Using MySQL with memcached
mkdev mysql
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
mkdev aio
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
mkdev mysql
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Command Index
3315
mkdir
Section 12.1.10, CREATE DATABASE Syntax
mod_perl
Section 7.1.3, What We Have Used MySQL For
more
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
msql2mysql
Section 4.7.1, msql2mysql Convert mSQL Programs for Use with
MySQL
Description
Description
Section 4.1, Overview of MySQL Programs
msql2mysqlC-source-file ...
Section 4.7.1, msql2mysql Convert mSQL Programs for Use with
MySQL
my_print_defaults
Section 4.7.3, my_print_defaults Display Options from Op-
tion Files
Description
Section 4.7, MySQL Program Development Utilities
Section 4.1, Overview of MySQL Programs
my_print_defaults [options]
option_group ...
Section 4.7.3, my_print_defaults Display Options from Op-
tion Files
myisam_ftdump
Section 4.6.2, myisam_ftdump Display Full-Text Index informa-
tion
Description
Section 4.1, Overview of MySQL Programs
myisam_ftdump [options]
tbl_name index_num
Section 4.6.2, myisam_ftdump Display Full-Text Index informa-
tion
myisamchk
Section 4.6.3, myisamchk MyISAM Table-Maintenance Utility
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.5, myisamchk Memory Usage
Section 4.6.3.3, myisamchk Repair Options
Section 12.2.2, DELETE Syntax
Section 13.5.1, MyISAM Startup Options
Section 12.5.2.6, REPAIR TABLE Syntax
Section 2.3.3.2, Choosing an Install Type
Section 13.5.3.3, Compressed Table Characteristics
Section 13.5.4.1, Corrupted MyISAM Tables
Section 6.1, Database Backups
Section 22.5.1, Debugging a MySQL Server
Description
Description
Description
Section 7.3.4, External Locking
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 6.4.5, Getting Information About a Table
Section 6.4.2, How to Check MyISAM Tables for Errors
Section 6.4.3, How to Repair Tables
Section 1.6, How to Report Bugs or Problems
Section 2.8, Installing MySQL on NetWare
Section 4.6.3.4, Other myisamchk Options
Section 7.2.24, Other Optimization Tips
Section 4.1, Overview of MySQL Programs
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.2, Server Command Options
Section 6.4.6, Setting Up a Table Maintenance Schedule
Section 7.2.21, Speed of INSERT Statements
Section 13.5.3.1, Static (Fixed-Length) Table Characteristics
Section 7.5.2, System Factors and Startup Parameter Tuning
Section 6.4, Table Maintenance and Crash Recovery
Section 6.4.4, Table Optimization
Section 13.5, The MyISAM Storage Engine
Section 6.4.1, Using myisamchk for Crash Recovery
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section B.1.4.2, What to Do If MySQL Keeps Crashing
myisamchk --analyze
Section 12.5.2.1, ANALYZE TABLE Syntax
Section 7.2.1, Optimizing Queries with EXPLAIN
myisamchk --description -
-verbose
Section 7.2.3, Speed of SELECT Queries
myisamchk --help
Section 4.6.3.1, myisamchk General Options
myisamchk --medium-check
tbl_name
Section 12.5.2.3, CHECK TABLE Syntax
myisamchk --recover
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
myisamchk --safe-recover
Section 12.5.2.6, REPAIR TABLE Syntax
myisamchk --safe-recover
tbl_name
Section 6.4.3, How to Repair Tables
myisamchk -
-stats_method=method_name -
Command Index
3316
-analyze
Section 7.4.6, MyISAM Index Statistics Collection
myisamchk --unpack
Section 13.5.3, MyISAM Table Storage Formats
myisamchk --update-state
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
myisamchk -dvv
Description
myisamchk -r
Section 6.1, Database Backups
myisamchk -rq
Description
myisamchk *.MYI
Section 6.4.3, How to Repair Tables
myisamchk --analyze
Section 7.2.3, Speed of SELECT Queries
Section 13.5, The MyISAM Storage Engine
myisamchk --description -
-verbose tbl_name
Section 4.6.3.4, Other myisamchk Options
myisamchk --fast
Section 13.5, The MyISAM Storage Engine
myisamchk --help
Description
myisamchk --keys-used=0 -rq /
path/to/db/tbl_name.
Section 7.2.21, Speed of INSERT Statements
myisamchk --medium-check
Section 4.6.3.2, myisamchk Check Options
myisamchk --recover tbl_name
Section 12.5.2.6, REPAIR TABLE Syntax
myisamchk --recover --quick
Section 12.5.2.6, REPAIR TABLE Syntax
myisamchk --safe-recover
Section 12.5.2.6, REPAIR TABLE Syntax
myisamchk --silent --force
*/*.MYI
Section B.1.4.2, What to Do If MySQL Keeps Crashing
myisamchk --sort-index -
-sort-records=1
Section 7.2.3, Speed of SELECT Queries
myisamchk -a
Section 12.5.5.23, SHOW INDEX Syntax
Section 6.4.5, Getting Information About a Table
myisamchk -d
Section 6.4.5, Getting Information About a Table
myisamchk -d tbl_name
Section 6.4.5, Getting Information About a Table
myisamchk -d -v
Section 6.4.5, Getting Information About a Table
myisamchk -d -v tbl_name
Section 6.4.5, Getting Information About a Table
myisamchk -dv
Section 12.5.6.5, LOAD INDEX INTO CACHE Syntax
myisamchk -dv /
path/to/table-index-file
Section B.1.2.12, The table is full
myisamchk -dv tbl_name
Section 4.6.3.5, myisamchk Memory Usage
myisamchk -dvv tbl_name
Section 9.6, Problems With Character Sets
myisamchk -e *.MYI
Section 6.4.3, How to Repair Tables
myisamchk -ed
Section 13.5.3.2, Dynamic Table Characteristics
myisamchk -ei
Section 13.5.3.2, Dynamic Table Characteristics
myisamchk -eis
Section 6.4.5, Getting Information About a Table
myisamchk -eis tbl_name
Section 6.4.5, Getting Information About a Table
myisamchk -eiv
Section 6.4.5, Getting Information About a Table
myisamchk -eiv tbl_name
Command Index
3317
Section 6.4.5, Getting Information About a Table
myisamchk -r
Section 4.6.3.3, myisamchk Repair Options
Section 13.5.3.2, Dynamic Table Characteristics
Section 6.4.3, How to Repair Tables
Section 13.5.3.1, Static (Fixed-Length) Table Characteristics
myisamchk -r database/ta-
ble.MYI
Section 22.5.1.7, Making a Test Case If You Experience Table Corrup-
tion
myisamchk -r tbl_name
Section 6.4.3, How to Repair Tables
myisamchk -r -q
Section 6.4.3, How to Repair Tables
myisamchk -r -q -
-
set-character-set=charset_name
Section 2.12.1, Upgrading MySQL
myisamchk -r -q -
-set-collation=collation_name
Section 9.2, The Character Set Used for Data and Sorting
Section 2.10.2, Typical configure Options
myisamchk -r -q tbl_name
Section 6.4.3, How to Repair Tables
myisamchk -rq
Description
myisamchk -rq /
path/to/db/tbl_name
Section 7.2.21, Speed of INSERT Statements
myisamchk -s
Section 6.4.6, Setting Up a Table Maintenance Schedule
myisamchk -s database/*.MYI
Section 22.5.1.7, Making a Test Case If You Experience Table Corrup-
tion
myisamchk [options] tbl_name
...
Section 4.6.3, myisamchk MyISAM Table-Maintenance Utility
myisamlog
Section 4.6.4, myisamlog Display MyISAM Log File Contents
Description
Section 4.1, Overview of MySQL Programs
myisamlog [options] [log_file
[tbl_name] ...]
Section 4.6.4, myisamlog Display MyISAM Log File Contents
myisampack
Section 4.6.3.3, myisamchk Repair Options
Section 4.6.5, myisampack Generate Compressed, Read-Only
MyISAM Tables
Section 12.1.17, CREATE TABLE Syntax
Section 13.5.3, MyISAM Table Storage Formats
Section B.1.2.12, The table is full
Section 13.5.3.3, Compressed Table Characteristics
Description
Section 7.3.4, External Locking
Section 6.4.5, Getting Information About a Table
Section 4.1, Overview of MySQL Programs
Section 12.1.17.1, Silent Column Specification Changes
Section 7.2.21, Speed of INSERT Statements
Section 13.8, The MERGE Storage Engine
Section 13.5, The MyISAM Storage Engine
myisampack [options] file_name
...
Section 4.6.5, myisampack Generate Compressed, Read-Only
MyISAM Tables
mysql
Section 1.7.5.6, '--' as the Start of a Comment
Section 4.5.1, mysql The MySQL Command-Line Tool
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
Section 4.5.1.3, mysql Server-Side Help
Section 4.5.1.5, mysql Tips
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.3.3, HELP Syntax
Section B.1.2.15, Ignoring user
Section 7.2.17, LIMIT Optimization
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Section B.1.2.8, Out of memory
Section B.1.2.10, Packet too large
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 21.10.3.14, mysql_errno()
Section 21.10.3.66, mysql_sqlstate()
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 17.7.8.1, Adding MySQL Cluster Data Nodes Online: General
Issues
Section 5.5.2, Adding User Accounts
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 11.13.5, Analyzing Spatial Information
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Chapter 6, Backup and Recovery
Command Index
3318
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 5.4.7, Causes of Access-Denied Errors
Section 2.3.3.5, Changes Made by MySQL Installation Wizard
Section 2.3.3.2, Choosing an Install Type
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Section 17.7.2, Commands in the MySQL Cluster Management Client
Section 8.5, Comment Syntax
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 4.6.10.6, Connecting to MySQL Instance Manager
Section 3.1, Connecting to and Disconnecting from the Server
Section 4.2.2, Connecting to the MySQL Server
Section 9.1.4, Connection Character Sets and Collations
Section 21.10.11, Controlling Automatic Reconnection Behavior
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 3.3.1, Creating and Selecting a Database
Section 13.6.2.3, Creating the InnoDB Tablespace
Section 22.5.2, Debugging a MySQL Client
Section 19.1, Defining Stored Programs
Description
Description
Description
Description
Description
Description
Section 4.5.1.5.3, Disabling mysql Auto-Reconnect
Section 2.12.2, Downgrading MySQL
Section 5.5.6.2, End-User Guidelines for Password Security
Section 3.2, Entering Queries
Section 2.14, Environment Variables
Section 6.2, Example Backup and Recovery Strategy
Section 3.6, Examples of Common Queries
Section 4.5.1.4, Executing SQL Statements from a Text File
Chapter 11, Functions and Operators
Section B.1.1, How to Determine What Is Causing a Problem
Section 1.6, How to Report Bugs or Problems
Section 5.3.5, How to Run MySQL as a Normal User
Section 11.11.3, Information Functions
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.5, Installing MySQL on Mac OS X
Section 4.2.1, Invoking MySQL Programs
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 17.2.5, Loading Sample Data into MySQL Cluster and Per-
forming Queries
Section 5.3.2, Making MySQL Secure Against Attackers
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Chapter 17, MySQL Cluster NDB 6.X/7.X
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 9.7, MySQL Server Time Zone Support
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 7.2, Optimizing SELECT and Other Statements
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 4.1, Overview of MySQL Programs
Section 5.5.6.3, Password Hashing in MySQL
Section 6.3, Point-in-Time Recovery
Section 2.11.2.1, Problems Running mysql_install_db
Section 4.2.3.2, Program Option Modifiers
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section 12.7, SQL Syntax for Prepared Statements
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Section 5.3.3, Security-Related mysqld Options
Section B.3, Server Error Codes and Messages
Section 5.1.4, Server System Variables
Section 5.1.9, Server-Side Help
Section 4.2.3, Specifying Program Options
Section 2.3.11, Starting MySQL as a Windows Service
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.3.12, Testing The MySQL Installation
Section 10.4.3, The BLOB and TEXT Types
Section 19.3.1, Trigger Syntax
Section 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions
Chapter 3, Tutorial
Section 2.10.2, Typical configure Options
Section 1.2, Typographical and Syntax Conventions
Section 2.12.1, Upgrading MySQL
Section 3.5, Using mysql in Batch Mode
Section 6.2.2, Using Backups for Recovery
Section 4.2.3.3, Using Option Files
Section 4.2.3.1, Using Options on the Command Line
Section 4.2.3.4, Using Options to Set Program Variables
Section 5.5.7.2, Using SSL Connections
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
Section 4.5.1.5.2, Using the --safe-updates Option
Section 2.11.1, Windows Post-Installation Procedures
Section 11.10, XML Functions
mysql --help
Section 4.1, Overview of MySQL Programs
mysql -u root mysql
Section 2.11.2.1, Problems Running mysql_install_db
mysql ... --debug
Section 22.5.1.1, Compiling MySQL for Debugging
mysql [options] db_name
Section 4.5.1, mysql The MySQL Command-Line Tool
mysql {start|stop}
Section 4.3.3, mysql.server MySQL Server Startup Script
mysql-server
Section 2.13.4.1, FreeBSD Notes
mysql-test-run.pl
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 22.1.2, MySQL Test Suite
mysql.exe
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
mysql.server
Section 4.3.3, mysql.server MySQL Server Startup Script
Command Index
3319
Description
Description
Section 2.13.1.4, Linux Post-Installation Notes
Section 5.3.2, Making MySQL Secure Against Attackers
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 4.1, Overview of MySQL Programs
Section 5.1.2, Server Command Options
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
Section B.1.4.6, Time Zone Problems
mysql.server stop
Section 2.11.2.2, Starting and Stopping MySQL Automatically
mysql_config
Section 4.7.2, mysql_config Get Compile Options for Compil-
ing Clients
Section 21.10.16, Building Client Programs
Section 21.9.1, Compiling Programs with libmysqld
Description
Section 4.1, Overview of MySQL Programs
Section B.1.3.1, Problems Linking to the MySQL Client Library
mysql_config --libmysqld-libs
Section 21.9.1, Compiling Programs with libmysqld
mysql_config options
Section 4.7.2, mysql_config Get Compile Options for Compil-
ing Clients
mysql_convert_table_format
Section 4.1, Overview of MySQL Programs
mysql_create_system_tables
Section 4.1, Overview of MySQL Programs
mysql_explain_log
Section 4.1, Overview of MySQL Programs
mysql_find_rows
Section 22.5.1.7, Making a Test Case If You Experience Table Corrup-
tion
Section 4.1, Overview of MySQL Programs
mysql_fix_extensions
Section 4.1, Overview of MySQL Programs
mysql_fix_privilege_tables
Section 4.1, Overview of MySQL Programs
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_install_db
Section 5.5.2, Adding User Accounts
Section 5.4.7, Causes of Access-Denied Errors
Section 2.1.5, Installation Layouts
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.5, Installing MySQL on Mac OS X
Section 2.8, Installing MySQL on NetWare
Section 2.13.1.2, Linux Binary Distribution Notes
Section 4.1, Overview of MySQL Programs
Section 2.11.2.1, Problems Running mysql_install_db
Section 13.6.14, Restrictions on InnoDB Tables
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.1.2, Server Command Options
Section 5.1.9, Server-Side Help
Section 2.10.1, Source Installation Overview
Section 2.11.2, Unix Post-Installation Procedures
Section 2.11.1, Windows Post-Installation Procedures
mysql_install_db --force
Section 2.13.1.2, Linux Binary Distribution Notes
mysql_secure_installation
Section 4.1, Overview of MySQL Programs
mysql_setpermission
Section 4.1, Overview of MySQL Programs
mysql_stmt_execute()
Section 5.1.7, Server Status Variables
mysql_stmt_prepare()
Section 5.1.7, Server Status Variables
mysql_tableinfo
Section 4.1, Overview of MySQL Programs
mysql_tzinfo_to_sql
Section 9.7, MySQL Server Time Zone Support
Section 4.1, Overview of MySQL Programs
mysql_upgrade
Section 12.1.1, ALTER DATABASE Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 5.4.7, Causes of Access-Denied Errors
Section 22.2.1, Characteristics of the Plugin Interface
Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt
Description
Section 1.4.1, What Is New in MySQL 5.1
Section 4.1, Overview of MySQL Programs
Section 5.5.6.3, Password Hashing in MySQL
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 22.2, The MySQL Plugin Interface
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_waitpid
Section 4.1, Overview of MySQL Programs
mysql_zap
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 4.1, Overview of MySQL Programs
Command Index
3320
mysqlaccess
Section 4.6.6, mysqlaccess Client for Checking Access Priv-
ileges
Section 5.4.7, Causes of Access-Denied Errors
Description
Section 1.6, How to Report Bugs or Problems
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 4.1, Overview of MySQL Programs
mysqlaccess [host_name
[user_name [db_name]]]
[options]
Section 4.6.6, mysqlaccess Client for Checking Access Priv-
ileges
mysqladmin
Section 4.5.2, mysqladmin Client for Administering a MySQL
Server
Section 12.1.10, CREATE DATABASE Syntax
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 12.1.21, DROP DATABASE Syntax
Section 12.5.6.3, FLUSH Syntax
Section 5.5.5, Assigning Account Passwords
Section 2.13.4.6, BSD/OS Version 4.x Notes
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Section 6.4.3, How to Repair Tables
Section 1.6, How to Report Bugs or Problems
Section 2.5, Installing MySQL on Mac OS X
Section 2.8, Installing MySQL on NetWare
Section 2.7, Installing MySQL on i5/OS
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 4.1, Overview of MySQL Programs
Section 5.4.1, Privileges Provided by MySQL
Section 5.6.2, Running Multiple Servers on Unix
Section 2.11.3, Securing the Initial MySQL Accounts
Section 2.3.11, Starting MySQL as a Windows Service
Section 2.3.10, Starting MySQL from the Windows Command Line
Section 5.1.11, The Shutdown Process
Section 7.5.3, Tuning Server Parameters
Section 2.11.2, Unix Post-Installation Procedures
Section 2.3.14, Upgrading MySQL on Windows
Section 4.2.3.3, Using Option Files
mysqladmin create
Section 2.13.5.7, SGI Irix Notes
mysqladmin debug
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
mysqladmin flush-hosts
Section 7.5.11, How MySQL Uses DNS
mysqladmin flush-logs
Section 5.2, MySQL Server Logs
Section 5.2.4, The Binary Log
mysqladmin flush-privileges
Section 5.4.7, Causes of Access-Denied Errors
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 5.4.2, Privilege System Grant Tables
Section 2.11.2.1, Problems Running mysql_install_db
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.4.6, When Privilege Changes Take Effect
mysqladmin flush-tables
Description
Section 7.4.7, How MySQL Opens and Closes Tables
Section 7.5.8, How MySQL Uses Memory
Section 7.2.21, Speed of INSERT Statements
mysqladmin flush-xxx
Section 5.5.2, Adding User Accounts
mysqladmin kill
Section B.1.4.3, How MySQL Handles a Full Disk
Section 5.4.1, Privileges Provided by MySQL
mysqladmin processlist
Section 5.3.2, Making MySQL Secure Against Attackers
mysqladmin processlist status
Section 22.5.1, Debugging a MySQL Server
mysqladmin refresh
Section 5.5.2, Adding User Accounts
Section B.1.8.2, Additional Known Issues
Section 7.4.7, How MySQL Opens and Closes Tables
mysqladmin reload
Section 5.5.4, Limiting Account Resources
Section 2.11.2.1, Problems Running mysql_install_db
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
mysqladmin shutdown
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 5.3.5, How to Run MySQL as a Normal User
Section 2.13.5.3, IBM-AIX notes
Section 22.5.1.7, Making a Test Case If You Experience Table Corrup-
tion
Section 16.3.1.22, Replication and Temporary Tables
Section 17.2.6, Safe Shutdown and Restart of MySQL Cluster
Section 2.3.11, Starting MySQL as a Windows Service
mysqladmin variables
Section B.1.2.9, MySQL server has gone away
mysqladmin ver
Section 22.5.1.1, Compiling MySQL for Debugging
Command Index
3321
mysqladmin version
Section B.1.2.2, Can't connect to [local] MySQL
server
mysqladmin --sleep
Section 2.10.5, MIT-pthreads Notes
mysqladmin -h localhost vari-
ables
Section B.1.2.2, Can't connect to [local] MySQL
server
mysqladmin -i 5 -r status
Section B.1.4.2, What to Do If MySQL Keeps Crashing
mysqladmin -i 5 status
Section B.1.4.2, What to Do If MySQL Keeps Crashing
mysqladmin -i10 processlist
status
Section 22.5.1, Debugging a MySQL Server
mysqladmin -u root ping
Section B.1.1, How to Determine What Is Causing a Problem
mysqladmin -u root drop test
Section 2.11.2, Unix Post-Installation Procedures
mysqladmin -u root processlist
Section B.1.1, How to Determine What Is Causing a Problem
Section B.1.4.2, What to Do If MySQL Keeps Crashing
mysqladmin -u root processlist
Section B.1.4.2, What to Do If MySQL Keeps Crashing
mysqladmin [options] command
[command-options] [command
[command-options]] ...
Section 4.5.2, mysqladmin Client for Administering a MySQL
Server
mysqladmin debug
Section 12.5.5.34, SHOW SCHEDULER STATUS Syntax
Section 22.5.1, Debugging a MySQL Server
mysqladmin extended-status
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.5.5.37, SHOW STATUS Syntax
mysqladmin flush-hosts
Section B.1.2.6, Host 'host_name' is blocked
Section 5.4.7, Causes of Access-Denied Errors
mysqladmin flush-logs
Section 6.2.1, Backup Policy
Section 6.2.3, Backup Strategy Summary
Section 5.2.6, Server Log Maintenance
Section 16.4.2.1, The Slave Relay Log
mysqladmin flush-privileges
Description
mysqladmin flush-tables
Section 7.3.4, External Locking
Section 6.4.1, Using myisamchk for Crash Recovery
mysqladmin kill
Section 12.5.6.4, KILL Syntax
Section B.1.2.9, MySQL server has gone away
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 2.13.5.3, IBM-AIX notes
Section 11.11.4, Miscellaneous Functions
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
mysqladmin password
Section 5.5.5, Assigning Account Passwords
Section 5.4.7, Causes of Access-Denied Errors
Description
mysqladmin processlist
Section 12.5.6.4, KILL Syntax
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 21.10.3.43, mysql_list_processes()
Section 5.5.2, Adding User Accounts
Section 7.5.6, Examining Thread Information
Section 22.1.1, MySQL Threads
Section 5.4.1, Privileges Provided by MySQL
mysqladmin refresh
Section B.1.8.2, Additional Known Issues
Section 5.2, MySQL Server Logs
Section 5.2.6, Server Log Maintenance
mysqladmin reload
Section 5.5.2, Adding User Accounts
Description
Section 1.6, How to Report Bugs or Problems
Section 5.4.2, Privilege System Grant Tables
Section 5.4.6, When Privilege Changes Take Effect
mysqladmin reload version
Section 1.6, How to Report Bugs or Problems
mysqladmin shutdown
Section 12.5.1.3, GRANT Syntax
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 22.5.1.2, Creating Trace Files
Section 13.6.2.3, Creating the InnoDB Tablespace
Description
Section 6.4.3, How to Repair Tables
Command Index
3322
Section 2.5, Installing MySQL on Mac OS X
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 5.4.1, Privileges Provided by MySQL
Section 2.3.11, Starting MySQL as a Windows Service
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 5.1.11, The Shutdown Process
Section B.1.4.2, What to Do If MySQL Keeps Crashing
mysqladmin status
Section 21.10.3.68, mysql_stat()
Description
Section 7.4.7, How MySQL Opens and Closes Tables
mysqladmin variables
Section 12.5.5.41, SHOW VARIABLES Syntax
mysqladmin variables extended-
status processlist
Section 1.6, How to Report Bugs or Problems
mysqladmin version
Section B.1.2.9, MySQL server has gone away
Section 1.6, How to Report Bugs or Problems
Section 2.11.2, Unix Post-Installation Procedures
Section B.1.4.2, What to Do If MySQL Keeps Crashing
mysqlanalyze
Description
mysqlbinlog
Section 4.6.7, mysqlbinlog Utility for Processing Binary Log
Files
Section 4.6.7.1, mysqlbinlog Hex Dump Format
Section 4.6.7.2, mysqlbinlog Row Event Display
Section 12.5.6.1, BINLOG Syntax
Section 12.5.4, SET Syntax
Section 12.5.5.3, SHOW BINLOG EVENTS Syntax
Section 12.6.2.7, START SLAVE Syntax
Section B.1.8.2, Additional Known Issues
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Description
Section 16.3.6, How to Report Replication Bugs or Problems
Section 11.11.4, Miscellaneous Functions
Section 4.1, Overview of MySQL Programs
Section 6.3, Point-in-Time Recovery
Section 16.3.1.28, Replication and Variables
Section 6.3.2, Specifying Positions for Recovery
Section 6.3.1, Specifying Times for Recovery
Section 5.2.4, The Binary Log
Section 16.4.2.1, The Slave Relay Log
Section 6.2.2, Using Backups for Recovery
mysqlbinlog binary-log-file |
mysql
Section 22.5.1.7, Making a Test Case If You Experience Table Corrup-
tion
mysqlbinlog [options] log_file
...
Section 4.6.7, mysqlbinlog Utility for Processing Binary Log
Files
mysqlbinlog|mysql
Section B.1.8.2, Additional Known Issues
mysqlbug
Section 1.6, How to Report Bugs or Problems
mysqlc
Section 2.3.12, Testing The MySQL Installation
mysqlcheck
Section 4.5.3, mysqlcheck A Table Maintenance Program
Section 12.1.1, ALTER DATABASE Syntax
Description
Description
Description
Section 8.2.3, Mapping of Identifiers to File Names
Section 4.1, Overview of MySQL Programs
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section 18.5, Restrictions and Limitations on Partitioning
Section 6.4, Table Maintenance and Crash Recovery
Section 13.5, The MyISAM Storage Engine
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysqlcheck --check-upgrade
Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt
mysqlcheck --check-upgrade
Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt
mysqlcheck [options] [db_name
[tbl_name ...]]
Section 4.5.3, mysqlcheck A Table Maintenance Program
mysqld
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.1, myisamchk General Options
Section 4.3.1, mysqld The MySQL Server
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.1.20, CREATE VIEW Syntax
Section B.1.2.2, Can't connect to [local] MySQL
server
Section B.1.2.13, Can't create/write to file
Section B.1.2.17, Can't initialize character set
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 12.5.6.3, FLUSH Syntax
Section B.1.2.6, Host 'host_name' is blocked
Section 12.2.5.2, INSERT DELAYED Syntax
Section B.1.2.15, Ignoring user
Section 13.6.2, InnoDB Configuration
Section 13.6.13.3, InnoDB General Troubleshooting
Section 13.6.3, InnoDB Startup Options and System Variables
Command Index
3323
Section 12.5.6.4, KILL Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 13.5.1, MyISAM Startup Options
Section B.1.2.9, MySQL server has gone away
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section B.1.2.10, Packet too large
Section 12.2.8, SELECT Syntax
Section 12.4.6, SET TRANSACTION Syntax
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 12.5.5.16, SHOW ENGINE Syntax
Section 12.5.5.41, SHOW VARIABLES Syntax
Section B.1.2.7, Too many connections
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.49, mysql_options()
Section 22.3, Adding New Functions to MySQL
Section 22.4, Adding New Procedures to MySQL
Section 22.3.2, Adding a New User-Defined Function
Section 13.6.5, Adding, Removing, or Resizing InnoDB Data and Log
Files
Section B.1.8.2, Additional Known Issues
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 2.13.4.6, BSD/OS Version 4.x Notes
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4.1, Binary Logging Formats
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 5.4.7, Causes of Access-Denied Errors
Section 2.1.2.2, Choosing a Distribution Format
Section 17.7.2, Commands in the MySQL Cluster Management Client
Section 8.5, Comment Syntax
Section B.1.2.11, Communication Errors and Aborted Connections
Section 22.5.1.1, Compiling MySQL for Debugging
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 7.2.7, Condition Pushdown Optimization
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 13.5.4.1, Corrupted MyISAM Tables
Section 22.5.1.2, Creating Trace Files
Section 13.6.2.3, Creating the InnoDB Tablespace
Section 13.6.2.4, Dealing with InnoDB Initialization Problems
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 22.5.1.4, Debugging mysqld under gdb
Section 22.5.1, Debugging a MySQL Server
Section 17.3.4.7, Defining SQL and Other API Nodes in a MySQL
Cluster
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 2.14, Environment Variables
Section 7.3.4, External Locking
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 13.6.6.2, Forcing InnoDB Recovery
Section 2.13.4.1, FreeBSD Notes
Section 7.5.6.2, General Thread States
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 7.4.7, How MySQL Opens and Closes Tables
Section 7.5.11, How MySQL Uses DNS
Section 7.5.8, How MySQL Uses Memory
Section 7.2.19, How to Avoid Table Scans
Section B.1.1, How to Determine What Is Causing a Problem
Section 6.4.3, How to Repair Tables
Section 1.6, How to Report Bugs or Problems
Section 5.3.5, How to Run MySQL as a Normal User
Section 2.13.5.3, IBM-AIX notes
Section 8.2.2, Identifier Case Sensitivity
Section 17.2.4, Initial Startup of MySQL Cluster
Section 2.1.5, Installation Layouts
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.4, Installing MySQL from RPM Packages on Linux
Section 2.5, Installing MySQL on Mac OS X
Section 2.7, Installing MySQL on i5/OS
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 2.13.1.7, Linux Alpha Notes
Section 2.13.1.2, Linux Binary Distribution Notes
Section 2.13.1.1, Linux Operating System Notes
Section 2.13.1.4, Linux Post-Installation Notes
Section 2.13.1.3, Linux Source Distribution Notes
Section 2.13.1.5, Linux x86 Notes
Section 2.10.5, MIT-pthreads Notes
Section 2.13.2.1, Mac OS X 10.x (Darwin)
Section 5.3.2, Making MySQL Secure Against Attackers
Section 22.5.1.7, Making a Test Case If You Experience Table Corrup-
tion
Section 11.11.4, Miscellaneous Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section A.3, MySQL 5.1 FAQ Server SQL Mode
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.2.3, MySQL Cluster Multi-Computer Configuration
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.1.2, MySQL Cluster Nodes, Node Groups, Replicas, and
Partitions
Section 17.6, MySQL Cluster Programs
Section 17.4.1, MySQL Cluster Server Option and Variable Reference
Section 17.4.3, MySQL Cluster System Variables
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 4.6.10.2, MySQL Instance Manager Configuration Files
Chapter 5, MySQL Server Administration
Section 5.2, MySQL Server Logs
Section 9.7, MySQL Server Time Zone Support
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 4.3, MySQL Server and Server-Startup Programs
Section 22.1.2, MySQL Test Suite
Section 22.1.1, MySQL Threads
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section B.1.6, Optimizer-Related Issues
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 21.9.3, Options with the Embedded Server
Command Index
3324
Section 17.3.5, Overview of MySQL Cluster Configuration Paramet-
ers
Section 4.1, Overview of MySQL Programs
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
Section 22.5, Debugging and Porting MySQL
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 5.4.2, Privilege System Grant Tables
Section 2.11.2.1, Problems Running mysql_install_db
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
Section B.1.3.2, Problems with File Permissions
Section 4.2.3.2, Program Option Modifiers
Section 7.5.5.3, Query Cache Configuration
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
Section 16.1.3.2, Replication Master Options and Variables
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.1.3.1, Replication and Binary Logging Option and Variable
Reference
Section 16.1.3, Replication and Binary Logging Options and Variables
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section B.1.5.5, Rollback Failure for Nontransactional Tables
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.6.2, Running Multiple Servers on Unix
Section 1.7.3, Running MySQL in ANSI Mode
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 2.13.5.7, SGI Irix Notes
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Section 5.3.3, Security-Related mysqld Options
Section 1.7.2, Selecting SQL Modes
Section 2.3.8, Selecting a MySQL Server Type
Section 9.1.3.1, Server Character Set and Collation
Section 5.1.2, Server Command Options
Section 5.1.10, Server Response to Signals
Section 5.1.8, Server SQL Modes
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 6.4.6, Setting Up a Table Maintenance Schedule
Section 9.3, Setting the Error Message Language
Section 2.13.3, Solaris Notes
Section 2.13.3.2, Solaris x86 Notes
Section 2.10.1, Source Installation Overview
Section 5.6.1.2, Starting Multiple Windows Servers as Services
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
Section 2.3.11, Starting MySQL as a Windows Service
Section 2.3.10, Starting MySQL from the Windows Command Line
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
Section 9.7.1, Staying Current with Time Zone Changes
Section 2.13.5.4, SunOS 4 Notes
Section 7.3.2, Table Locking Issues
Section B.1.2.19, Table-Corruption Issues
Section 2.3.12, Testing The MySQL Installation
Section 13.14, The BLACKHOLE Storage Engine
Section 10.4.3, The BLOB and TEXT Types
Section 13.5, The MyISAM Storage Engine
Section 5.2.4, The Binary Log
Section 5.2.2, The Error Log
Section 5.2.3, The General Query Log
Section 7.5.5, The MySQL Query Cache
Section 5.1, The MySQL Server
Section 5.2.5, The Slow Query Log
Section B.1.4.6, Time Zone Problems
Section 2.3.13, Troubleshooting a MySQL Installation Under Win-
dows
Section 7.5.3, Tuning Server Parameters
Section 2.10.2, Typical configure Options
Section 1.2, Typographical and Syntax Conventions
Section 2.11.2, Unix Post-Installation Procedures
Section 2.12.1, Upgrading MySQL
Section 2.3.14, Upgrading MySQL on Windows
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 22.3.2.6, User-Defined Function Security Precautions
Section 8.4, User-Defined Variables
Section 6.4.1, Using myisamchk for Crash Recovery
Section 22.5.1.3, Using pdb to create a Windows crashdump
Section 4.2.3.3, Using Option Files
Section 13.6.2.1, Using Per-Table Tablespaces
Section 5.5.7.2, Using SSL Connections
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
Section 7.6.1.3, Using Symbolic Links for Databases on Windows
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 22.5.1.5, Using a Stack Trace
Section B.1.4.2, What to Do If MySQL Keeps Crashing
Section 5.4.6, When Privilege Changes Take Effect
Section B.1.4.4, Where MySQL Stores Temporary Files
Section 22.2.3, Writing Plugins
mysqld --help
Section 7.5.3, Tuning Server Parameters
mysqld --print-defaults
Section 22.5.1, Debugging a MySQL Server
mysqld --remove
Section 5.6.1.2, Starting Multiple Windows Servers as Services
mysqld --console
Section 2.3.10, Starting MySQL from the Windows Command Line
mysqld --help
Section 22.5.1.1, Compiling MySQL for Debugging
Section 5.1.2, Server Command Options
mysqld --no-defaults ...
Section 22.5.1, Debugging a MySQL Server
mysqld --print-defaults
Section 2.12.1, Upgrading MySQL
mysqld --verbose --help
Section 5.1.2, Server Command Options
Section 2.3.10, Starting MySQL from the Windows Command Line
mysqld [options]
Section 4.3.1, mysqld The MySQL Server
mysqld-.13
Section 2.12.1, Upgrading MySQL
Command Index
3325
mysqld-4.0.18
Section 2.12.1, Upgrading MySQL
mysqld-abc.exe
Description
mysqld-debug
Section 2.1.2.2, Choosing a Distribution Format
Section 22.5.1.2, Creating Trace Files
Description
Section 2.3.8, Selecting a MySQL Server Type
Section 5.1.2, Server Command Options
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
mysqld-max
Section 2.1.2.2, Choosing a Distribution Format
Section 4.1, Overview of MySQL Programs
Section 2.3.8, Selecting a MySQL Server Type
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 7.6.1.3, Using Symbolic Links for Databases on Windows
mysqld-max-nt
Section 2.3.8, Selecting a MySQL Server Type
mysqld-nt
Section 2.3.8, Selecting a MySQL Server Type
Section 5.1.2, Server Command Options
Section 5.6.1.2, Starting Multiple Windows Servers as Services
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
mysqld-opt
Section 2.3.8, Selecting a MySQL Server Type
mysqld_multi
Section 4.3.4, mysqld_multi Manage Multiple MySQL Servers
Description
Description
Section 4.1, Overview of MySQL Programs
Section 5.6.2, Running Multiple Servers on Unix
mysqld_multi [options]
{start|stop|report} [GNR[,GNR]
...]
Section 4.3.4, mysqld_multi Manage Multiple MySQL Servers
mysqld_safe
Section 4.3.2, mysqld_safe MySQL Server Startup Script
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 13.6.13.3, InnoDB General Troubleshooting
Section B.1.2.10, Packet too large
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section B.1.8.2, Additional Known Issues
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Section 22.5.1.1, Compiling MySQL for Debugging
Section 13.6.2.3, Creating the InnoDB Tablespace
Description
Description
Description
Section 7.5.9, Enabling Large Page Support
Section 2.13.4.1, FreeBSD Notes
Section B.1.4.5, How to Protect or Change the MySQL Unix Socket
File
Section 2.13.5.3, IBM-AIX notes
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.5, Installing MySQL on Mac OS X
Section 2.8, Installing MySQL on NetWare
Section 2.7, Installing MySQL on i5/OS
Section 2.13.1.4, Linux Post-Installation Notes
Section 5.3.2, Making MySQL Secure Against Attackers
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 9.7, MySQL Server Time Zone Support
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
Section 4.1, Overview of MySQL Programs
Section B.1.3.2, Problems with File Permissions
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.6.2, Running Multiple Servers on Unix
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 2.10.1, Source Installation Overview
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
Section 5.2.2, The Error Log
Section B.1.4.6, Time Zone Problems
Section 7.5.3, Tuning Server Parameters
Section 2.11.2, Unix Post-Installation Procedures
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 4.2.3.3, Using Option Files
mysqld_safe options
Section 4.3.2, mysqld_safe MySQL Server Startup Script
mysqldump
Section 4.5.4, mysqldump A Database Backup Program
Section 12.1.20, CREATE VIEW Syntax
Section 13.6.4.4, FOREIGN KEY Constraints
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Section 12.5.3.4, UNINSTALL PLUGIN Syntax
Section 13.6.5, Adding, Removing, or Resizing InnoDB Data and Log
Files
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Section 6.2.1, Backup Policy
Section 6.2.3, Backup Strategy Summary
Chapter 6, Backup and Recovery
Section 5.4.7, Causes of Access-Denied Errors
Command Index
3326
Section 2.3.3.2, Choosing an Install Type
Section 4.2.2, Connecting to the MySQL Server
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 16.1.1.5, Creating a Data Snapshot Using mysqldump
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 6.1, Database Backups
Section 13.6.11.3, Defragmenting a Table
Description
Description
Section 2.12.2, Downgrading MySQL
Section 2.12.2.1, Downgrading to MySQL 5.0
Section 6.2, Example Backup and Recovery Strategy
Section 1.7.5.4, Foreign Keys
Section 1.6, How to Report Bugs or Problems
Section 16.1.1, How to Set Up Replication
Section 17.2.5, Loading Sample Data into MySQL Cluster and Per-
forming Queries
Section 8.2.3, Mapping of Identifiers to File Names
Section 13.6.7, Moving an InnoDB Database to Another Machine
Section 1.4.1, What Is New in MySQL 5.1
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
Section 4.1, Overview of MySQL Programs
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section D.4, Restrictions on Views
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 16.1.1.8, Setting Up Replication with Existing Data
Section 4.2.3, Specifying Program Options
Section 2.3.11, Starting MySQL as a Windows Service
Section 10.4.3, The BLOB and TEXT Types
Section 9.7.2, Time Zone Leap Second Support
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 11.10, XML Functions
mysqldump --delete-master-logs
Section 6.2.1, Backup Policy
mysqldump --routines
Section 2.12.2.1, Downgrading to MySQL 5.0
mysqldump --xml
Section 4.5.1.1, mysql Options
mysqldump --flush-logs
Section 6.1, Database Backups
mysqldump --help
Section 2.12.5, Copying MySQL Databases to Another Machine
Description
mysqldump --master-data
Section 16.1.1.4, Obtaining the Master Replication Information
mysqldump --quick db_name
tbl_name_1 ... tbl_name_n >
query.sql
Section B.1.5.7, Solving Problems with No Matching Rows
mysqldump --tab
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysqldump -T
Section 12.2.6, LOAD DATA INFILE Syntax
mysqldump [options] [db_name
[tbl_name ...]]
Section 4.5.4, mysqldump A Database Backup Program
mysqldump mysql
Section 5.4.7, Causes of Access-Denied Errors
mysqldumpslow
Section 4.6.8, mysqldumpslow Summarize Slow Query Log
Files
Description
Section 4.1, Overview of MySQL Programs
Section 5.2.5, The Slow Query Log
mysqldumpslow --help
Section 5.2.5, The Slow Query Log
mysqldumpslow [options]
[log_file ...]
Section 4.6.8, mysqldumpslow Summarize Slow Query Log
Files
mysqlhotcopy
Section 4.6.9, mysqlhotcopy A Database Backup Program
Section 12.5.2.2, BACKUP TABLE Syntax
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Chapter 6, Backup and Recovery
Section 6.1, Database Backups
Description
Description
Section 4.1, Overview of MySQL Programs
mysqlhotcopy --flushlog
Section 6.1, Database Backups
mysqlhotcopy arguments
Section 4.6.9, mysqlhotcopy A Database Backup Program
mysqlimport
Section 4.5.5, mysqlimport A Data Import Program
Section 12.2.6, LOAD DATA INFILE Syntax
Chapter 6, Backup and Recovery
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 6.1, Database Backups
Description
Section 2.12.2, Downgrading MySQL
Section 4.1, Overview of MySQL Programs
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Command Index
3327
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysqlimport [options] db_name
textfile1 ...
Section 4.5.5, mysqlimport A Data Import Program
mysqlmanager
Section 4.6.10, mysqlmanager The MySQL Instance Manager
Description
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 4.1, Overview of MySQL Programs
mysqlmanager [options]
Section 4.6.10, mysqlmanager The MySQL Instance Manager
mysqloptimize
Description
mysqlrepair
Description
mysqlshow
Section 4.5.6, mysqlshow Display Database, Table, and Column
Information
Section 12.5.5.15, SHOW DATABASES Syntax
Section 4.2.2, Connecting to the MySQL Server
Description
Section 4.1, Overview of MySQL Programs
Section 2.3.12, Testing The MySQL Installation
Section 2.11.1, Windows Post-Installation Procedures
mysqlshow --status db_name
Section 12.5.5.38, SHOW TABLE STATUS Syntax
mysqlshow -k db_name tbl_name
Section 12.5.5.23, SHOW INDEX Syntax
mysqlshow db_name
Section 12.5.5.39, SHOW TABLES Syntax
mysqlshow db_name tbl_name
Section 12.5.5.6, SHOW COLUMNS Syntax
mysqlshow [options] [db_name
[tbl_name [col_name]]]
Section 4.5.6, mysqlshow Display Database, Table, and Column
Information
mysqlshow db_name
Section 12.5.5.39, SHOW TABLES Syntax
mysqlshow mysql user
Section B.1.2.15, Ignoring user
mysqlslap
Section 4.5.7, mysqlslap Load Emulation Client
Description
Section 1.4.1, What Is New in MySQL 5.1
Section 4.1, Overview of MySQL Programs
Section 7.1.5, Using Your Own Benchmarks
mysqlslap [options]
Section 4.5.7, mysqlslap Load Emulation Client
mysqltest
Section 22.1.2, MySQL Test Suite
ndb_config
Section 17.6.6, ndb_config Extract MySQL Cluster Configura-
tion Information
Description
Section 17.6, MySQL Cluster Programs
Section 17.6.24.6, Program Options for ndb_config
ndb_config options
Section 17.6.6, ndb_config Extract MySQL Cluster Configura-
tion Information
ndb_cpcd
Section 17.6.7, ndb_cpcd Automate Testing for NDB Develop-
ment
Description
ndb_cpcd options
Section 17.6.7, ndb_cpcd Automate Testing for NDB Develop-
ment
ndb_delete_all
Section 17.6.8, ndb_delete_all Delete All Rows from an NDB
Table
Description
ndb_delete_all options
Section 17.6.8, ndb_delete_all Delete All Rows from an NDB
Table
ndb_desc
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.9, ndb_desc Describe NDB Tables
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Description
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
ndb_desc -d db_name table_name
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
ndb_desc options
Section 17.6.9, ndb_desc Describe NDB Tables
ndb_drop_index
Command Index
3328
Section 17.6.10, ndb_drop_index Drop Index from an NDB Ta-
ble
Description
ndb_drop_index options
Section 17.6.10, ndb_drop_index Drop Index from an NDB Ta-
ble
ndb_drop_table
Section 17.6.11, ndb_drop_table Drop an NDB Table
Description
Description
ndb_drop_table options
Section 17.6.11, ndb_drop_table Drop an NDB Table
ndb_error_reporter
Section 17.6.12, ndb_error_reporter NDB Error-Reporting
Utility
Description
Section 17.6.24.7, Program Options for ndb_error_reporter
ndb_error_reporter options
Section 17.6.12, ndb_error_reporter NDB Error-Reporting
Utility
ndb_mgm
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.5, ndb_mgm The MySQL Cluster Management Client
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 17.7.8.1, Adding MySQL Cluster Data Nodes Online: General
Issues
Section 17.7.2, Commands in the MySQL Cluster Management Client
Description
Description
Section 17.7.4, Event Reports Generated in MySQL Cluster
Section 17.2.4, Initial Startup of MySQL Cluster
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Chapter 17, MySQL Cluster NDB 6.X/7.X
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.14, MySQL Cluster Glossary
Section 17.7.4.1, MySQL Cluster Logging Management Commands
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.1.2, MySQL Cluster Nodes, Node Groups, Replicas, and
Partitions
Section 17.6, MySQL Cluster Programs
Section 17.8.1, MySQL Cluster Security and Networking Issues
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
Section 17.6.24.4, Program Options for ndb_mgm
Section 17.2.6, Safe Shutdown and Restart of MySQL Cluster
Section 4.2.3.1, Using Options on the Command Line
Section 17.7.3.2, Using The MySQL Cluster Management Client to
Create a Backup
ndb_mgm -e "START BACKUP"
Section 17.7.3.2, Using The MySQL Cluster Management Client to
Create a Backup
ndb_mgm options
Section 17.6.5, ndb_mgm The MySQL Cluster Management Client
ndb_mgmd
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.4, ndb_mgmd The MySQL Cluster Management Serv-
er Daemon
Section 17.7.2, Commands in the MySQL Cluster Management Client
Section 17.3.4.5, Defining a MySQL Cluster Management Server
Description
Section 17.2.4, Initial Startup of MySQL Cluster
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.14, MySQL Cluster Glossary
Section 17.7.4.1, MySQL Cluster Logging Management Commands
Section 17.3.5.2, MySQL Cluster Management Node Configuration
Parameters
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.1.2, MySQL Cluster Nodes, Node Groups, Replicas, and
Partitions
Section 17.6, MySQL Cluster Programs
Section 17.3.5, Overview of MySQL Cluster Configuration Paramet-
ers
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
Section 17.6.24.3, Program Options for ndb_mgmd
Section 17.3.3, Quick Test Setup of MySQL Cluster
Section 17.2.6, Safe Shutdown and Restart of MySQL Cluster
Section 17.7.1, Summary of MySQL Cluster Start Phases
Section 17.3.4.3, The MySQL Cluster Connectstring
ndb_mgmd options
Section 17.6.4, ndb_mgmd The MySQL Cluster Management Serv-
er Daemon
ndb_print_backup_file
Section 17.6.13, ndb_print_backup_file Print NDB Backup
File Contents
Description
Description
Description
Description
ndb_print_backup_file
file_name
Section 17.6.13, ndb_print_backup_file Print NDB Backup
File Contents
ndb_print_schema_file
Section 17.6.14, ndb_print_schema_file Print NDB Schema
File Contents
Description
Description
Description
Description
ndb_print_schema_file
file_name
Section 17.6.14, ndb_print_schema_file Print NDB Schema
File Contents
ndb_print_sys_file
Command Index
3329
Section 17.6.15, ndb_print_sys_file Print NDB System File
Contents
Description
Description
Description
ndb_print_sys_file file_name
Section 17.6.15, ndb_print_sys_file Print NDB System File
Contents
ndb_restore
Section 17.6.17, ndb_restore Restore a MySQL Cluster
Backup
Chapter 6, Backup and Recovery
Description
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.14, MySQL Cluster Glossary
Section 17.6, MySQL Cluster Programs
Section 17.7.6, MySQL Cluster Single User Mode
Section 17.6.24.8, Program Options for ndb_restore
ndb_restore options
Section 17.6.17, ndb_restore Restore a MySQL Cluster
Backup
ndb_schema_backup_file
Description
ndb_select_all
Section 17.6.18, ndb_select_all Print Rows from an NDB Ta-
ble
Description
Description
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
ndb_select_all -c con-
nect_string tbl_name -d
db_name [> file_name]
Section 17.6.18, ndb_select_all Print Rows from an NDB Ta-
ble
ndb_select_count
Section 17.6.19, ndb_select_count Print Row Counts for NDB
Tables
Description
ndb_select_count [-c con-
nect_string] -ddb_name
tbl_name[, tbl_name2[, ...]]
Section 17.6.19, ndb_select_count Print Row Counts for NDB
Tables
ndb_show_tables
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.20, ndb_show_tables Display List of NDB
Tables
Description
Section 17.6, MySQL Cluster Programs
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section 17.6.24.9, Program Options for ndb_show_tables
ndb_show_tables [options]
Section 17.6.20, ndb_show_tables Display List of NDB
Tables
ndb_size.pl
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.21, ndb_size.pl NDBCLUSTER Size Requirement
Estimator
Description
Section 2.15, Perl Installation Notes
Section 17.6.24.10, Program Options for ndb_size.pl
ndb_size.pl arguments
Section 17.6.21, ndb_size.pl NDBCLUSTER Size Requirement
Estimator
ndb_waiter
Section 17.6.22, ndb_waiter Wait for MySQL Cluster to Reach a
Given Status
Description
Section 17.14, MySQL Cluster Glossary
ndb_waiter options
Section 17.6.22, ndb_waiter Wait for MySQL Cluster to Reach a
Given Status
ndbd
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.2, ndbd The MySQL Cluster Data Node Daemon
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 17.7.2, Commands in the MySQL Cluster Management Client
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Description
Description
Description
Description
Section 17.2.4, Initial Startup of MySQL Cluster
Section 17.7, Management of MySQL Cluster
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.3.5.1, MySQL Cluster Data Node Configuration Paramet-
ers
Section 17.14, MySQL Cluster Glossary
Section 17.11.2, MySQL Cluster Interconnects and Performance
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.1.2, MySQL Cluster Nodes, Node Groups, Replicas, and
Partitions
Section 17.6, MySQL Cluster Programs
Section 17.3.5, Overview of MySQL Cluster Configuration Paramet-
ers
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
Command Index
3330
5.1 and MySQL Cluster NDB 6.x
Section 17.6.24.2, Program Options for ndbd and ndbmtd
Section 17.3.3, Quick Test Setup of MySQL Cluster
Section 17.3.4.11, SCI Transport Connections in MySQL Cluster
Section 17.2.6, Safe Shutdown and Restart of MySQL Cluster
Section 17.7.1, Summary of MySQL Cluster Start Phases
Section 17.7.4.3, Using CLUSTERLOG STATISTICS in the MySQL
Cluster Management Client
Section 17.11, Using High-Speed Interconnects with MySQL Cluster
ndbd --nostart
Section 17.7.2, Commands in the MySQL Cluster Management Client
ndbd --initial
Section 17.7.2, Commands in the MySQL Cluster Management Client
ndbd -n
Section 17.7.2, Commands in the MySQL Cluster Management Client
ndbd options
Section 17.6.2, ndbd The MySQL Cluster Data Node Daemon
ndbd_redo_log_reader
Section 17.6.16, ndbd_redo_log_reader Check and Print
Content of Cluster Redo Log
Description
Section 17.6.24.5, Program Options for ndbd_redo_log_reader
ndbd_redo_log_reader file_name
[options]
Section 17.6.16, ndbd_redo_log_reader Check and Print
Content of Cluster Redo Log
ndbmtd
Section 17.6.3, ndbmtd The MySQL Cluster Data Node Daemon
(Multi-Threaded)
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Description
Description
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
Section 17.3.5.1, MySQL Cluster Data Node Configuration Paramet-
ers
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.6.24.2, Program Options for ndbd and ndbmtd
ndbmtd options
Section 17.6.3, ndbmtd The MySQL Cluster Data Node Daemon
(Multi-Threaded)
ndbmtd.exe
Section 17.2.2, MySQL Cluster Multi-Computer Installation
nm
Section 22.5.1.5, Using a Stack Trace
nm --numeric-sort mysqld
Description
nohup
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
nopager
Section 4.5.1.2, mysql Commands
notee
Section 4.5.1.2, mysql Commands
nowarning
Section 4.5.1.2, mysql Commands
openssl
Section 5.5.7.4, Setting Up SSL Certificates for MySQL
openssl md5 package_name
Section 2.1.4.1, Verifying the MD5 Checksum
pack_isam
Section 13.5.3.3, Compressed Table Characteristics
Section 4.1, Overview of MySQL Programs
Section 13.5, The MyISAM Storage Engine
pager
Section 4.5.1.2, mysql Commands
pager [command]
Section 4.5.1.2, mysql Commands
perror
Section 4.8.1, perror Explain Error Codes
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section B.1.2.13, Can't create/write to file
Description
Section 6.4.3, How to Repair Tables
Section 13.6.12.2, Operating System Error Codes
Section 4.1, Overview of MySQL Programs
perror --ndb error_code
Section A.10, MySQL 5.1 FAQ MySQL Cluster
perror [options] errorcode ...
Section 4.8.1, perror Explain Error Codes
pgcc
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
ping
Section 14.2, Using Linux HA Heartbeat
Command Index
3331
pkgadd
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
ppm
Section 2.15, Perl Installation Notes
print
Section 4.5.1.2, mysql Commands
process
Section 17.14, MySQL Cluster Glossary
prompt
Section 4.5.1.2, mysql Commands
prompt [str]
Section 4.5.1.2, mysql Commands
ps
Section 22.5.5, Differences Between Thread Packages
Section 5.5.6.2, End-User Guidelines for Password Security
Section 7.5.8, How MySQL Uses Memory
Section B.1.1, How to Determine What Is Causing a Problem
Section 2.13.1.4, Linux Post-Installation Notes
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
ps auxw
Section 4.2.2, Connecting to the MySQL Server
ps xa | grep mysqld
Section B.1.2.2, Can't connect to [local] MySQL
server
pthread
Description
pull
Section 2.10.3, Installing from the Development Source Tree
quit
Section 4.5.1.2, mysql Commands
rehash
Section 4.5.1.2, mysql Commands
replace
Section 1.7.5.6, '--' as the Start of a Comment
Section 4.8.2, replace A String-Replacement Utility
Description
Description
Section 4.1, Overview of MySQL Programs
replace arguments
Section 4.8.2, replace A String-Replacement Utility
resolve_stack_dump
Section 4.7.4, resolve_stack_dump Resolve Numeric Stack
Trace Dump to Symbols
Description
Section 4.1, Overview of MySQL Programs
Section 22.5.1.5, Using a Stack Trace
resolve_stack_dump [options]
symbols_file
[numeric_dump_file]
Section 4.7.4, resolve_stack_dump Resolve Numeric Stack
Trace Dump to Symbols
resolveip
Section 4.8.3, resolveip Resolve Host name to IP Address or
Vice Versa
Description
Section 2.13.1.2, Linux Binary Distribution Notes
Section 4.1, Overview of MySQL Programs
resolveip [options]
{host_name|ip-addr} ...
Section 4.8.3, resolveip Resolve Host name to IP Address or
Vice Versa
rpm
Section 2.1.4.2, Signature Checking Using GnuPG
Section 2.10.1, Source Installation Overview
rpm --import
Section 2.1.4.3, Signature Checking Using RPM
rpmbuild
Section 2.10.1, Source Installation Overview
rsync
Chapter 6, Backup and Recovery
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
safe_mysqld
Section 2.5, Installing MySQL on Mac OS X
Section 2.10.1, Source Installation Overview
Section 7.5.3, Tuning Server Parameters
scp
Chapter 6, Backup and Recovery
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
sed
Section 3.3.4.7, Pattern Matching
setenv
Section 4.2.4, Setting Environment Variables
Command Index
3332
sh
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 4.2.1, Invoking MySQL Programs
Section 4.2.4, Setting Environment Variables
Section 1.2, Typographical and Syntax Conventions
source file_name
Section 4.5.1.2, mysql Commands
ssh
Section 17.8.1, MySQL Cluster Security and Networking Issues
status
Section 4.5.1.2, mysql Commands
strings
Section 5.3.1, General Security Guidelines
su root
Section 17.2.2, MySQL Cluster Multi-Computer Installation
sudo
Section 17.2.2, MySQL Cluster Multi-Computer Installation
sysctl
Section 2.13.4.1, FreeBSD Notes
system
Section 4.5.1.2, mysql Commands
system command
Section 4.5.1.2, mysql Commands
tar
Chapter 6, Backup and Recovery
Section 2.1.2.2, Choosing a Distribution Format
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 3.3, Creating and Using a Database
Section 2.13.5.1, HP-UX Version 10.20 Notes
Section 2.13.5.2, HP-UX Version 11.x Notes
Section 1.6, How to Report Bugs or Problems
Section 2.1.5, Installation Layouts
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.5, Installing MySQL on Mac OS X
Section 2.6, Installing MySQL on Solaris
Section 2.15.1, Installing Perl on Unix
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
Section 2.13.2, Mac OS X Notes
Section 2.1.2.4, MySQL Binaries Compiled by Sun Microsystems,
Inc.
Section 2.10, MySQL Installation Using a Source Distribution
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.13.3, Solaris Notes
Section 2.10.1, Source Installation Overview
tcpdump
Section 5.3.1, General Security Guidelines
tcsh
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 2.5, Installing MySQL on Mac OS X
Section 4.2.1, Invoking MySQL Programs
Section 4.2.4, Setting Environment Variables
Section 1.2, Typographical and Syntax Conventions
tee
Section 4.5.1.2, mysql Commands
tee [file_name]
Section 4.5.1.2, mysql Commands
telnet
Section 5.3.1, General Security Guidelines
top
Section B.1.1, How to Determine What Is Causing a Problem
ulimit
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 7.5.9, Enabling Large Page Support
ulimit -n
Description
ulimit -c
Description
ulimit -c unlimited
Section 17.6.23, Options Common to MySQL Cluster Programs
ulimit -c 1000000
Section 2.13.1.4, Linux Post-Installation Notes
ulimit -c unlimited
Section 5.1.2, Server Command Options
ulimit -d 256000
Section B.1.2.10, Packet too large
ulimit -d unlimited
Section 2.13.5.3, IBM-AIX notes
ulimit -n 256
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
ulimit -v 80000
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.13.4.5, BSD/OS Version 3.x Notes
Command Index
3333
update-rc.d
Section 17.2.2, MySQL Cluster Multi-Computer Installation
use db_name
Section 4.5.1.2, mysql Commands
useradd
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.4, Installing MySQL from RPM Packages on Linux
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 2.10.1, Source Installation Overview
usermod
Section 2.4, Installing MySQL from RPM Packages on Linux
vi
Section 4.5.1.2, mysql Commands
Section 17.2.3, MySQL Cluster Multi-Computer Configuration
Section 3.3.4.7, Pattern Matching
warnings
Section 4.5.1.2, mysql Commands
winMd5Sum
Section 2.1.4.1, Verifying the MD5 Checksum
xlC_r
Section 22.5, Debugging and Porting MySQL
yacc
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 8.3, Reserved Words
zip
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 1.6, How to Report Bugs or Problems
zsh
Section 4.2.4, Setting Environment Variables
Command Index
3334
Function Index
%
Section 1.7.4, MySQL Extensions to Standard SQL
ABS()
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 22.3, Adding New Functions to MySQL
Section 8.2.4, Function Name Parsing and Resolution
Section 18.5.3, Partitioning Limitations Relating to Functions
ABS(X)
Section 11.5.2, Mathematical Functions
ACOS(X)
Section 11.5.2, Mathematical Functions
ADDDATE()
Section 11.6, Date and Time Functions
ADDDATE(date,INTERVAL expr
unit)
Section 11.6, Date and Time Functions
ADDDATE(expr,days)
Section 11.6, Date and Time Functions
ADDTIME()
Section 11.6, Date and Time Functions
ADDTIME(expr1,expr2)
Section 11.6, Date and Time Functions
AES_DECRYPT()
Section 11.11.2, Encryption and Compression Functions
AES_DECRYPT(crypt_str,key_str)
Section 11.11.2, Encryption and Compression Functions
AES_ENCRYPT()
Section 11.11.2, Encryption and Compression Functions
AES_ENCRYPT(str,key_str)
Section 11.11.2, Encryption and Compression Functions
ASCII()
Section 12.3.3, HELP Syntax
Section 11.4, String Functions
ASCII(str)
Section 11.4, String Functions
ASIN(X)
Section 11.5.2, Mathematical Functions
ATAN(X)
Section 11.5.2, Mathematical Functions
ATAN(Y,X)
Section 11.5.2, Mathematical Functions
ATAN2(Y,X)
Section 11.5.2, Mathematical Functions
AVG()
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 10.1.2, Overview of Date and Time Types
Section 10.4.4, The ENUM Type
Section 10.4.5, The SET Type
AVG([DISTINCT] expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
Area()
Section 11.13.5.2, Geometry Functions
Area(mpoly)
Section 11.13.5.2.6, MultiPolygon Functions
Area(poly)
Section 11.13.5.2.5, Polygon Functions
AsBinary()
Section 11.13.4.5, Fetching Spatial Data
AsBinary(g)
Section 11.13.5.1, Geometry Format Conversion Functions
AsText()
Section 11.13.4.5, Fetching Spatial Data
AsText(g)
Section 11.13.5.1, Geometry Format Conversion Functions
AsWKB(g)
Section 11.13.5.1, Geometry Format Conversion Functions
AsWKT(g)
Section 11.13.5.1, Geometry Format Conversion Functions
BENCHMARK()
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.3, Information Functions
Section 7.2, Optimizing SELECT and Other Statements
Section 12.2.9.10, Optimizing Subqueries
Section 12.2.9.8, Subqueries in the FROM clause
BENCHMARK(10, (SELECT * FROM
t))
Section 11.11.3, Information Functions
3335
BENCHMARK(count,expr)
Section 11.11.3, Information Functions
BENCH-
MARK(loop_count,expression)
Section 7.2, Optimizing SELECT and Other Statements
BIN()
Section 8.1.5, Bit-Field Values
BIN(N)
Section 11.4, String Functions
BIT_AND()
Section 1.7.4, MySQL Extensions to Standard SQL
BIT_AND(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
BIT_COUNT()
Section 1.7.4, MySQL Extensions to Standard SQL
BIT_COUNT(N)
Section 11.11.1, Bit Functions
BIT_LENGTH(str)
Section 11.4, String Functions
BIT_OR()
Section 1.7.4, MySQL Extensions to Standard SQL
BIT_OR(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
BIT_XOR()
Section 1.7.4, MySQL Extensions to Standard SQL
BIT_XOR(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
BdMPolyFromText(wkt,srid)
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
BdMPolyFromWKB(wkb,srid)
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
BdPolyFromText(wkt,srid)
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
BdPolyFromWKB(wkb,srid)
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
Boundary(g)
Section 11.13.5.2.1, General Geometry Functions
Buffer(g,d)
Section 11.13.5.3.2, Spatial Operators
CAST()
Section 9.1.8.2, CONVERT() and CAST()
Section 8.1.5, Bit-Field Values
Section 11.9, Cast Functions and Operators
Section 11.2.3, Comparison Functions and Operators
Section 11.6, Date and Time Functions
Section 10.3, Date and Time Types
Section 1.7.5, MySQL Differences from Standard SQL
Section 9.1.8.1, Result Strings
Section 11.2.2, Type Conversion in Expression Evaluation
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 8.4, User-Defined Variables
CAST(... AS UNSIGNED)
Section 8.1.3, Hexadecimal Values
CAST(... COLLATE ...)
Section 9.1.8.2, CONVERT() and CAST()
CAST(...) COLLATE ...
Section 9.1.8.2, CONVERT() and CAST()
CAST(expr AS CHAR)
Section 11.9, Cast Functions and Operators
CAST(expr AS type)
Section 11.9, Cast Functions and Operators
CAST(str AS BINARY)
Section 9.1.6.3, BINARY Operator
Section 11.9, Cast Functions and Operators
CEIL()
Section 11.5.2, Mathematical Functions
CEIL(X)
Section 11.5.2, Mathematical Functions
CEILING()
Section 11.5.2, Mathematical Functions
Section 18.5.3, Partitioning Limitations Relating to Functions
CEILING(3.7004397181411)
Section 18.2.3.1, LINEAR HASH Partitioning
CEILING(X)
Section 11.5.2, Mathematical Functions
CHAR()
Section 1.7.4, MySQL Extensions to Standard SQL
Section 11.4, String Functions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Function Index
3336
CHAR(1,0)
Section 11.4, String Functions
CHAR(1,0,0)
Section 11.4, String Functions
CHAR(128 | key_num)
Section 11.11.2, Encryption and Compression Functions
CHAR(256)
Section 11.4, String Functions
CHAR(256*256)
Section 11.4, String Functions
CHAR(N)
Section 11.9, Cast Functions and Operators
CHAR(N,... [USING char-
set_name])
Section 11.4, String Functions
CHARACTER_LENGTH()
Section 11.4, String Functions
CHARACTER_LENGTH(str)
Section 11.4, String Functions
CHARSET()
Section 9.1.8.1, Result Strings
CHARSET(str)
Section 11.11.3, Information Functions
CHAR_LENGTH()
Section 11.4, String Functions
CHAR_LENGTH(str)
Section 11.4, String Functions
COALESCE(a.c1,b.c1)
Section 12.2.8.1, JOIN Syntax
COALESCE(value,...)
Section 11.2.3, Comparison Functions and Operators
COERCIBILITY()
Section 9.1.6.5, Special Cases Where Collation Determination Is
Tricky
COERCIBILITY(str)
Section 11.11.3, Information Functions
COLLATION()
Section B.1.5.1, Case Sensitivity in String Searches
Section 9.1.8.1, Result Strings
COLLATION(str)
Section 11.11.3, Information Functions
COMPRESS()
Section 11.11.2, Encryption and Compression Functions
Section 5.1.4, Server System Variables
Section 2.10.2, Typical configure Options
COMPRESS(string_to_compress)
Section 11.11.2, Encryption and Compression Functions
CONCAT()
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 1.7.4, MySQL Extensions to Standard SQL
Section 9.1.8.1, Result Strings
Section 5.1.8, Server SQL Modes
Section 11.4, String Functions
Section 9.1.7, String Repertoire
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 11.2.2, Type Conversion in Expression Evaluation
Section 11.10, XML Functions
CONCAT(p1.id, p1.tvab) + 0 AS
tvid
Section 3.7.1, Find All Nondistributed Twins
CONCAT(str1,str2,...)
Section 11.4, String Functions
CONCAT_WS()
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 11.4, String Functions
CON-
CAT_WS(separator,str1,str2,...
)
Section 11.4, String Functions
CONNECTION_ID()
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.3, Information Functions
CONV()
Section 11.5.2, Mathematical Functions
Section 9.1.8.1, Result Strings
CONV(N,10,16)
Section 11.4, String Functions
Function Index
3337
CONV(N,10,2)
Section 11.4, String Functions
CONV(N,10,8)
Section 11.5.2, Mathematical Functions
CONV(N,from_base,to_base)
Section 11.5.2, Mathematical Functions
CONVERT()
Section 9.1.8.2, CONVERT() and CAST()
Section 11.9, Cast Functions and Operators
Section 9.1.3.5, Character String Literal Character Set and Collation
Section 11.2.3, Comparison Functions and Operators
Section 11.11.4, Miscellaneous Functions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
CONVERT(... USING ...)
Section 9.1.8.2, CONVERT() and CAST()
Section 11.9, Cast Functions and Operators
CONVERT(expr USING transcod-
ing_name)
Section 11.9, Cast Functions and Operators
CONVERT(expr,type)
Section 11.9, Cast Functions and Operators
CONVERT(ucs2)
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
CONVERT_TZ()
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
Section 12.4.5.3, Other Table-Locking Notes
CON-
VERT_TZ(...,...,@@session.time
_zone)
Section 16.3.1.24, Replication and Time Zones
CONVERT_TZ(dt,from_tz,to_tz)
Section 11.6, Date and Time Functions
COS(X)
Section 11.5.2, Mathematical Functions
COT(X)
Section 11.5.2, Mathematical Functions
COUNT()
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 7.2.4, WHERE Clause Optimization
Section 3.3.4.8, Counting Rows
Section 18.1, Overview of Partitioning in MySQL
Section B.1.5.3, Problems with NULL Values
Section 5.1.8, Server SQL Modes
Section 19.5.3, Updatable and Insertable Views
Section 19.5.2, View Processing Algorithms
COUNT(*)
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 7.2.4, WHERE Clause Optimization
Section 3.3.4.8, Counting Rows
Section 7.2.1, Optimizing Queries with EXPLAIN
Section B.1.5.3, Problems with NULL Values
COUNT(DISTINCT ...)
Section 11.12.1, GROUP BY (Aggregate) Functions
COUNT(DISTINCT expr,[expr...])
Section 11.12.1, GROUP BY (Aggregate) Functions
COUNT(DISTINCT value_list)
Section 1.7.4, MySQL Extensions to Standard SQL
COUNT(DISTINCT)
Section 11.12.1, GROUP BY (Aggregate) Functions
COUNT(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
CRC32(expr)
Section 11.5.2, Mathematical Functions
CURDATE()
Section 3.3.4.5, Date Calculations
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
CURRENT_DATE
Section 12.1.17, CREATE TABLE Syntax
Section 10.1.4, Data Type Default Values
Section 11.6, Date and Time Functions
Section 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
CURRENT_DATE()
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
CURRENT_TIME
Section 11.6, Date and Time Functions
Section 10.3.2, The TIME Type
CURRENT_TIME()
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
CURRENT_TIMESTAMP
Section 12.1.11, CREATE EVENT Syntax
Function Index
3338
Section 12.1.17, CREATE TABLE Syntax
Section 10.3.1.1, TIMESTAMP Properties
Section 10.1.4, Data Type Default Values
Section 11.6, Date and Time Functions
CURRENT_TIMESTAMP()
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
CURRENT_USER
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 11.11.3, Information Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
CURRENT_USER()
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 5.4.4, Access Control, Stage 1: Connection Verification
Section 5.5.9, Auditing MySQL Account Activity
Section 11.11.3, Information Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
Section 9.1.10, UTF-8 for Metadata
CURTIME()
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
Section 9.7, MySQL Server Time Zone Support
Centroid(mpoly)
Section 11.13.5.2.6, MultiPolygon Functions
Contains()
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
Contains(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
ConvexHull(g)
Section 11.13.5.3.2, Spatial Operators
Create_func_abs
Section 22.3.3, Adding a New Native Function
Create_func_arg0
Section 22.3.3, Adding a New Native Function
Create_func_arg1
Section 22.3.3, Adding a New Native Function
Create_func_arg2
Section 22.3.3, Adding a New Native Function
Create_func_arg3
Section 22.3.3, Adding a New Native Function
Create_func_concat
Section 22.3.3, Adding a New Native Function
Create_func_lcase
Section 22.3.3, Adding a New Native Function
Create_func_lpad
Section 22.3.3, Adding a New Native Function
Create_func_pow
Section 22.3.3, Adding a New Native Function
Create_func_uuid
Section 22.3.3, Adding a New Native Function
Create_native_func
Section 22.3.3, Adding a New Native Function
Crosses(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
DATABASE()
Section B.1.8.2, Additional Known Issues
Section 3.4, Getting Information About Databases and Tables
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.3, Information Functions
Section 9.1.10, UTF-8 for Metadata
DATE(expr)
Section 11.6, Date and Time Functions
DATEDIFF()
Section 11.6, Date and Time Functions
Section 18.5.3, Partitioning Limitations Relating to Functions
DATEDIFF(expr1,expr2)
Section 11.6, Date and Time Functions
DATE_ADD()
Section 12.1.11, CREATE EVENT Syntax
Section 3.3.4.5, Date Calculations
Section 11.6, Date and Time Functions
Section 10.3, Date and Time Types
DATE_ADD(date,INTERVAL expr
unit)
Section 11.6, Date and Time Functions
Function Index
3339
DATE_FORMAT()
Section 21.10.13, C API Prepared Statement Problems
Section 11.6, Date and Time Functions
Section 9.8, MySQL Server Locale Support
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
DATE_FORMAT(date,format)
Section 11.6, Date and Time Functions
DATE_SUB()
Section 11.6, Date and Time Functions
Section 10.3, Date and Time Types
DATE_SUB(date,INTERVAL expr
unit)
Section 11.6, Date and Time Functions
DAY()
Section 11.6, Date and Time Functions
Section 18.5.3, Partitioning Limitations Relating to Functions
DAY(date)
Section 11.6, Date and Time Functions
DAYNAME()
Section 9.8, MySQL Server Locale Support
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
DAYNAME(date)
Section 11.6, Date and Time Functions
DAYOFMONTH()
Section 3.3.4.5, Date Calculations
Section 11.6, Date and Time Functions
Section 18.5.3, Partitioning Limitations Relating to Functions
DAYOFMONTH(date)
Section 11.6, Date and Time Functions
DAYOFWEEK()
Section 18.5.3, Partitioning Limitations Relating to Functions
DAYOFWEEK(date)
Section 11.6, Date and Time Functions
DAYOFYEAR()
Section 18.2, Partition Types
Section 18.5.3, Partitioning Limitations Relating to Functions
DAYOFYEAR(date)
Section 11.6, Date and Time Functions
DECODE()
Section 11.11.2, Encryption and Compression Functions
Section 1.7.4, MySQL Extensions to Standard SQL
DECODE(crypt_str,pass_str)
Section 11.11.2, Encryption and Compression Functions
DEFAULT(col_name)
Section 12.2.5, INSERT Syntax
Section 12.2.7, REPLACE Syntax
Section 11.11.4, Miscellaneous Functions
DEFAULT(i)
Section 10.1.4, Data Type Default Values
DEGREES(X)
Section 11.5.2, Mathematical Functions
DES_DECRYPT()
Section 11.11.2, Encryption and Compression Functions
Section 5.1.2, Server Command Options
DES_DECRYPT(crypt_str[,key_str
])
Section 11.11.2, Encryption and Compression Functions
DES_ENCRYPT()
Section 11.11.2, Encryption and Compression Functions
Section 5.1.2, Server Command Options
DES_ENCRYPT(str[,{key_num|key_
str}])
Section 11.11.2, Encryption and Compression Functions
Difference(g1,g2)
Section 11.13.5.3.2, Spatial Operators
Dimension(g)
Section 11.13.5.2.1, General Geometry Functions
Disjoint(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
Distance()
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
Distance(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
ELT()
Section B.1.8.2, Additional Known Issues
Section 1.7.4, MySQL Extensions to Standard SQL
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
Function Index
3340
ELT(N,str1,str2,str3,...)
Section 11.4, String Functions
ENCODE()
Section 11.11.2, Encryption and Compression Functions
Section 1.7.4, MySQL Extensions to Standard SQL
ENCODE(str,pass_str)
Section 11.11.2, Encryption and Compression Functions
ENCRYPT()
Section 11.11.2, Encryption and Compression Functions
Section 7.5.5.1, How the Query Cache Operates
Section 1.7.4, MySQL Extensions to Standard SQL
Section 5.1.4, Server System Variables
Section 5.5.1, User Names and Passwords
ENCRYPT(str[,salt])
Section 11.11.2, Encryption and Compression Functions
EXP()
Section 11.5.2, Mathematical Functions
EXP(X)
Section 11.5.2, Mathematical Functions
EX-
PORT_SET(bits,on,off[,separato
r[,number_of_bits]])
Section 11.4, String Functions
EXTRACT()
Section 11.9, Cast Functions and Operators
Section 11.6, Date and Time Functions
Section 18.5.3, Partitioning Limitations Relating to Functions
EXTRACT(unit FROM date)
Section 11.6, Date and Time Functions
EndPoint()
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.2.4, MultiLineString Functions
EndPoint(ls)
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
Envelope(g)
Section 11.13.5.2.1, General Geometry Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
Equals(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
ExteriorRing(poly)
Section 11.13.5.2.5, Polygon Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
Extract-
Value('<a><b>Sakila</b></a>',
'/a/b')
Section 11.10, XML Functions
Extract-
Value('<a><b>Sakila</b></a>',
'/a/b/text()')
Section 11.10, XML Functions
ExtractValue()
Section 1.4.1, What Is New in MySQL 5.1
Section 11.10, XML Functions
ExtractValue(xml_frag,
xpath_expr)
Section 11.10, XML Functions
FIELD()
Section 11.4, String Functions
FIELD(str,str1,str2,str3,...)
Section 11.4, String Functions
FIND_IN_SET()
Section 11.4, String Functions
Section 10.4.5, The SET Type
FIND_IN_SET(str,strlist)
Section 11.4, String Functions
FLOOR()
Section 11.5.1, Arithmetic Operators
Section 18.5.3, Partitioning Limitations Relating to Functions
FLOOR(X)
Section 11.5.2, Mathematical Functions
FLOOR(i RAND() * (j i))
Section 11.5.2, Mathematical Functions
FORMAT()
Section 1.7.4, MySQL Extensions to Standard SQL
Section 9.1.8.1, Result Strings
FORMAT(X,D)
Section 11.5.2, Mathematical Functions
Function Index
3341
Section 11.11.4, Miscellaneous Functions
Section 11.4, String Functions
FOUND_ROWS()
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.3, Information Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
FROM_DAYS()
Section 11.6, Date and Time Functions
Section 1.7.4, MySQL Extensions to Standard SQL
FROM_DAYS(N)
Section 11.6, Date and Time Functions
FROM_UNIXTIME()
Section 11.6, Date and Time Functions
Section 16.3.1.24, Replication and Time Zones
FROM_UNIXTIME(unix_timestamp)
Section 11.6, Date and Time Functions
FROM_UNIXTIME(unix_timestamp,f
ormat)
Section 11.6, Date and Time Functions
GET_FORMAT()
Section 11.6, Date and Time Functions
Section 9.8, MySQL Server Locale Support
GET_FORMAT(DATE,'EUR')
Section 11.6, Date and Time Functions
GET_FORMAT(DATE,'INTERNAL')
Section 11.6, Date and Time Functions
GET_FORMAT(DATE,'ISO')
Section 11.6, Date and Time Functions
GET_FORMAT(DATE,'JIS')
Section 11.6, Date and Time Functions
GET_FORMAT(DATE,'USA')
Section 11.6, Date and Time Functions
GET_FORMAT(DATETIME,'EUR')
Section 11.6, Date and Time Functions
GET_FORMAT(DATETIME,'INTERNAL'
)
Section 11.6, Date and Time Functions
GET_FORMAT(DATETIME,'ISO')
Section 11.6, Date and Time Functions
GET_FORMAT(DATETIME,'JIS')
Section 11.6, Date and Time Functions
GET_FORMAT(DATETIME,'USA')
Section 11.6, Date and Time Functions
GET_FORMAT(TIME,'EUR')
Section 11.6, Date and Time Functions
GET_FORMAT(TIME,'INTERNAL')
Section 11.6, Date and Time Functions
GET_FORMAT(TIME,'ISO')
Section 11.6, Date and Time Functions
GET_FORMAT(TIME,'JIS')
Section 11.6, Date and Time Functions
GET_FORMAT(TIME,'USA')
Section 11.6, Date and Time Functions
GET_FORMAT({DATE|TIME|DATETIME
},
{'EUR'|'USA'|'JIS'|'ISO'|'INTE
RNAL'})
Section 11.6, Date and Time Functions
GET_LOCK()
Section 12.1.11, CREATE EVENT Syntax
Section 12.5.6.4, KILL Syntax
Section 21.10.3.3, mysql_change_user()
Section 21.10.11, Controlling Automatic Reconnection Behavior
Section 7.5.6.2, General Thread States
Section 7.5.5.1, How the Query Cache Operates
Section 7.3.1, Internal Locking Methods
Section 11.11.4, Miscellaneous Functions
Section 12.4.5.3, Other Table-Locking Notes
Section 16.3.1.10, Replication and System Functions
GET_LOCK(str,timeout)
Section 11.11.4, Miscellaneous Functions
GLength()
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.2.4, MultiLineString Functions
Section 11.13.7, MySQL Conformance and Compatibility
GLength(ls)
Section 11.13.5.2.3, LineString Functions
GLength(mls)
Section 11.13.5.2.4, MultiLineString Functions
GREATEST()
Function Index
3342
Section 11.2.3, Comparison Functions and Operators
Section 9.1.8.1, Result Strings
GREATEST(value1,value2,...)
Section 11.2.3, Comparison Functions and Operators
GREATEST(x,NULL)
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
GROUP_CONCAT()
Section B.1.8.2, Additional Known Issues
Section 1.7.4, MySQL Extensions to Standard SQL
Section 5.1.4, Server System Variables
GROUP_CONCAT(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
GeomCollFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
GeomCollFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
GeomFromText()
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
Section 11.13.4.4, Populating Spatial Columns
GeomFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
Section 11.13.5.1, Geometry Format Conversion Functions
GeomFromWKB()
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
GeomFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
Section 11.13.5.1, Geometry Format Conversion Functions
GeometryCollection(g1,g2,...)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
GeometryCollectionFrom-
Text(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
GeometryCollectionFrom-
WKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
GeometryFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
GeometryFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
GeometryN(gc,N)
Section 11.13.5.2.7, GeometryCollection Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
GeometryType(g)
Section 11.13.5.2.1, General Geometry Functions
HEX()
Section 9.1.3.5, Character String Literal Character Set and Collation
Section 8.1.3, Hexadecimal Values
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 9.1.8.1, Result Strings
HEX(N_or_S)
Section 11.5.2, Mathematical Functions
Section 11.4, String Functions
HEX(str)
Section 11.4, String Functions
HOUR()
Section 18.5.3, Partitioning Limitations Relating to Functions
HOUR(time)
Section 11.6, Date and Time Functions
IF()
Section B.1.8.2, Additional Known Issues
Section 11.3, Control Flow Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 9.1.8.1, Result Strings
IF(expr1,expr2,expr3)
Section 11.3, Control Flow Functions
IFNULL()
Section 11.3, Control Flow Functions
Section B.1.5.3, Problems with NULL Values
IFNULL(expr1,expr2)
Section 11.3, Control Flow Functions
IN()
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 11.2.2, Type Conversion in Expression Evaluation
IN(value_list)
Section D.3, Restrictions on Subqueries
INET_ATON()
Section 11.11.4, Miscellaneous Functions
Function Index
3343
INET_ATON(expr)
Section 11.11.4, Miscellaneous Functions
INET_NTOA(expr)
Section 11.11.4, Miscellaneous Functions
INSERT(str,pos,len,newstr)
Section 11.4, String Functions
INSTR()
Section 9.1.8.1, Result Strings
INSTR(str,substr)
Section 11.4, String Functions
INTERVAL(N,N1,N2,N3,...)
Section 11.2.3, Comparison Functions and Operators
ISNULL()
Section 11.2.3, Comparison Functions and Operators
ISNULL(expr)
Section 11.2.3, Comparison Functions and Operators
IS_FREE_LOCK()
Section 16.3.1.10, Replication and System Functions
IS_FREE_LOCK(str)
Section 11.11.4, Miscellaneous Functions
IS_USED_LOCK()
Section 16.3.1.10, Replication and System Functions
IS_USED_LOCK(str)
Section 11.11.4, Miscellaneous Functions
InteriorRingN(poly,N)
Section 11.13.5.2.5, Polygon Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
Intersection(g1,g2)
Section 11.13.5.3.2, Spatial Operators
Intersects(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
IsClosed(mls)
Section 11.13.5.2.4, MultiLineString Functions
IsEmpty(g)
Section 11.13.5.2.1, General Geometry Functions
IsRing(ls)
Section 11.13.5.2.3, LineString Functions
IsSimple()
Section 11.13.5.2.1, General Geometry Functions
IsSimple(g)
Section 11.13.5.2.1, General Geometry Functions
LAST_DAY(date)
Section 11.6, Date and Time Functions
LAST_INSERT_ID()
Section 4.6.7.1, mysqlbinlog Hex Dump Format
Section 12.1.17, CREATE TABLE Syntax
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 21.10.3.37, mysql_insert_id()
Section 21.10.11, Controlling Automatic Reconnection Behavior
Section 7.5.5.1, How the Query Cache Operates
Section 21.10.10.3, How to Get the Unique ID for the Last Inserted
Row
Section 11.11.3, Information Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 12.4.5.3, Other Table-Locking Notes
Section 16.3.1.1, Replication and AUTO_INCREMENT
Section 5.1.5, Session System Variables
Section 19.2.4, Stored Procedures, Functions, Triggers, and
LAST_INSERT_ID()
Section 1.7.5.2, Transactions and Atomic Operations
Section 16.3.5, Troubleshooting Replication
Section 19.5.3, Updatable and Insertable Views
Section 3.6.9, Using AUTO_INCREMENT
LAST_INSERT_ID(expr)
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 21.10.3.37, mysql_insert_id()
Section 21.10.7.16, mysql_stmt_insert_id()
Section 11.11.3, Information Functions
LCASE()
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
LCASE(str)
Section 11.4, String Functions
LEAST()
Section 11.2.3, Comparison Functions and Operators
Section 9.1.8.1, Result Strings
LEAST(value1,value2,...)
Section 11.2.3, Comparison Functions and Operators
LEAST(x,NULL)
Function Index
3344
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
LEFT()
Section 11.9, Cast Functions and Operators
LEFT(str,len)
Section 11.4, String Functions
LENGTH()
Section 11.4, String Functions
LENGTH(str)
Section 11.4, String Functions
LN()
Section 11.5.2, Mathematical Functions
LN(X)
Section 11.5.2, Mathematical Functions
LOAD_FILE()
Section 7.5.5.1, How the Query Cache Operates
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
LOAD_FILE(file_name)
Section 11.4, String Functions
LOCALTIME
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
LOCALTIME()
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
LOCALTIMESTAMP
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
LOCALTIMESTAMP()
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
LOCATE()
Section 11.4, String Functions
LOCATE(substr,str)
Section 11.4, String Functions
LOCATE(substr,str,pos)
Section 11.4, String Functions
LOG()
Section 11.5.2, Mathematical Functions
LOG(10,X)
Section 11.5.2, Mathematical Functions
LOG(2,13)
Section 18.2.3.1, LINEAR HASH Partitioning
LOG(B,X)
Section 11.5.2, Mathematical Functions
LOG(X)
Section 11.5.2, Mathematical Functions
LOG(X) / LOG(2)
Section 11.5.2, Mathematical Functions
LOG(X) / LOG(B)
Section 11.5.2, Mathematical Functions
LOG10(X)
Section 11.5.2, Mathematical Functions
LOG2()
Section 11.5.2, Mathematical Functions
LOG2(X)
Section 11.5.2, Mathematical Functions
LOWER()
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
LOWER(str)
Section 11.4, String Functions
LPAD(str,len,padstr)
Section 11.4, String Functions
LTRIM()
Section 9.1.8.1, Result Strings
LTRIM(str)
Section 11.4, String Functions
Length()
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.2.4, MultiLineString Functions
Section 11.13.7, MySQL Conformance and Compatibility
LineFromText()
Section 11.13.5.1, Geometry Format Conversion Functions
Function Index
3345
LineFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
LineFromWKB()
Section 11.13.5.1, Geometry Format Conversion Functions
LineFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
LineString(pt1,pt2,...)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
LineStringFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
LineStringFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
MAKEDATE(year,dayofyear)
Section 11.6, Date and Time Functions
MAKETIME(hour,minute,second)
Section 11.6, Date and Time Functions
MAKE_SET(bits,str1,str2,...)
Section 11.4, String Functions
MASTER_POS_WAIT()
Section 12.6.2.4, MASTER_POS_WAIT() Syntax
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.4, Miscellaneous Functions
Section 16.3.4, Replication FAQ
MAS-
TER_POS_WAIT(log_name,log_pos[
,timeout])
Section 11.11.4, Miscellaneous Functions
MATCH (col1,col2,...) AGAINST
(expr [search_modifier])
Section 11.8, Full-Text Search Functions
MATCH()
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 11.8.5, Full-Text Restrictions
Section 11.8, Full-Text Search Functions
Section 11.8.1, Natural Language Full-Text Searches
MATCH() ... AGAINST
Section 11.8, Full-Text Search Functions
MATCH() ... AGAINST()
Section 11.8.2, Boolean Full-Text Searches
MAX()
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 11.12.3, GROUP BY and HAVING with Hidden Columns
Section B.1.8.2, Additional Known Issues
Section 7.4.4, How MySQL Uses Indexes
Section 7.2.14.1, Loose index scan
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.10, Optimizing Subqueries
Section 19.5.3, Updatable and Insertable Views
Section 19.5.2, View Processing Algorithms
Section 10.3.4, Year 2000 Issues and Date Types
MAX([DISTINCT] expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
MAX(auto_increment_column) + 1
WHERE prefix=given-prefix
Section 3.6.9, Using AUTO_INCREMENT
MAX(col_name)
Section 10.1.1, Overview of Numeric Types
MAX(t1.b)
Section 5.1.8, Server SQL Modes
MBRContains()
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
Section 11.13.6.2, Using a Spatial Index
MBRContains(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MBRDisjoint(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MBREqual(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MBRIntersects(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MBROverlaps(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MBRTouches(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MBRWithin()
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
Function Index
3346
angles (MBRs)
Section 11.13.6.2, Using a Spatial Index
MBRWithin(g1,g2)
Section 11.13.5.5, Relations on Geometry Minimal Bounding Rect-
angles (MBRs)
MD5()
Section 18.2.4, KEY Partitioning
Section 8.2, Schema Object Names
Section 11.11.2, Encryption and Compression Functions
Section 5.3.1, General Security Guidelines
Section 5.5.6.4, Implications of Password Hashing Changes in MySQL
4.1 for Application Programs
Section 1.7.4, MySQL Extensions to Standard SQL
MD5(str)
Section 11.11.2, Encryption and Compression Functions
MICROSECOND()
Section 18.5.3, Partitioning Limitations Relating to Functions
MICROSECOND(expr)
Section 11.6, Date and Time Functions
MID()
Section 9.1.8.1, Result Strings
MID(str,pos,len)
Section 11.4, String Functions
MIN()
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 11.12.3, GROUP BY and HAVING with Hidden Columns
Section 7.2.4, WHERE Clause Optimization
Section B.1.8.2, Additional Known Issues
Section 7.4.4, How MySQL Uses Indexes
Section 7.2.14.1, Loose index scan
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.10, Optimizing Subqueries
Section B.1.5.3, Problems with NULL Values
Section 19.5.3, Updatable and Insertable Views
Section 19.5.2, View Processing Algorithms
Section 10.3.4, Year 2000 Issues and Date Types
MIN([DISTINCT] expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
MIN(col_name)
Section 10.1.1, Overview of Numeric Types
MIN(number-with-zerofill)
Section 21.10.13, C API Prepared Statement Problems
MINUTE()
Section 18.5.3, Partitioning Limitations Relating to Functions
MINUTE(time)
Section 11.6, Date and Time Functions
MLineFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
MLineFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
MOD()
Section 11.5.1, Arithmetic Operators
Section 3.3.4.5, Date Calculations
Section 11.5.2, Mathematical Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 18.5.3, Partitioning Limitations Relating to Functions
MOD(N,0)
Section 11.5.2, Mathematical Functions
MOD(N,M)
Section 11.5.2, Mathematical Functions
Section 1.7.4, MySQL Extensions to Standard SQL
MOD(X,0)
Section 5.1.8, Server SQL Modes
MOD(something,12)
Section 3.3.4.5, Date Calculations
MONTH()
Section 3.3.4.5, Date Calculations
Section 18.2, Partition Types
Section 18.5.3, Partitioning Limitations Relating to Functions
MONTH(birth)
Section 3.3.4.5, Date Calculations
MONTH(date)
Section 11.6, Date and Time Functions
MONTHNAME()
Section 9.8, MySQL Server Locale Support
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
MONTHNAME(date)
Section 11.6, Date and Time Functions
MPointFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
MPointFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
MPolyFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
Function Index
3347
MPolyFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
MultiLineString(ls1,ls2,...)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
MultiLineStringFrom-
Text(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
MultiLineStringFrom-
WKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
MultiPoint(pt1,pt2,...)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
MultiPointFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
MultiPointFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
MultiPolygon(poly1,poly2,...)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
MultiPolygonFrom-
Text(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
MultiPolygonFrom-
WKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
NAME_CONST()
Section 19.6, Binary Logging of Stored Programs
Section 11.11.4, Miscellaneous Functions
NAME_CONST(name,value)
Section 11.11.4, Miscellaneous Functions
NOW()
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 10.3.1.1, TIMESTAMP Properties
Section 10.1.4, Data Type Default Values
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
Section A.1, MySQL 5.1 FAQ General
Section 9.7, MySQL Server Time Zone Support
Section 16.3.1.10, Replication and System Functions
Section 16.3.1.24, Replication and Time Zones
Section 5.1.2, Server Command Options
Section 5.1.5, Session System Variables
Section 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
Section 10.3.3, The YEAR Type
Section 9.7.2, Time Zone Leap Second Support
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
NULLIF(expr1,expr2)
Section 11.3, Control Flow Functions
NumGeometries(gc)
Section 11.13.5.2.7, GeometryCollection Functions
NumInteriorRings(poly)
Section 11.13.5.2.5, Polygon Functions
NumPoints(ls)
Section 11.13.5.2.3, LineString Functions
OCT(N)
Section 11.5.2, Mathematical Functions
OCTET_LENGTH()
Section 11.4, String Functions
OCTET_LENGTH(str)
Section 11.4, String Functions
OLD_PASSWORD()
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 12.5.1.6, SET PASSWORD Syntax
Section 11.11.2, Encryption and Compression Functions
Section 5.5.6.4, Implications of Password Hashing Changes in MySQL
4.1 for Application Programs
Section 5.5.6.3, Password Hashing in MySQL
OLD_PASSWORD(str)
Section 11.11.2, Encryption and Compression Functions
ORD()
Section 11.4, String Functions
ORD(str)
Section 11.4, String Functions
Overlaps(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
PASSWORD()
Section 12.5.1.1, CREATE USER Syntax
Section 12.5.1.3, GRANT Syntax
Section B.1.2.15, Ignoring user
Section 18.2.4, KEY Partitioning
Section 12.5.1.6, SET PASSWORD Syntax
Function Index
3348
Section 5.4.4, Access Control, Stage 1: Connection Verification
Section 5.5.2, Adding User Accounts
Section 5.5.5, Assigning Account Passwords
Section 5.4.7, Causes of Access-Denied Errors
Section 11.11.2, Encryption and Compression Functions
Section 5.5.6.4, Implications of Password Hashing Changes in MySQL
4.1 for Application Programs
Section 1.7.4, MySQL Extensions to Standard SQL
Section 5.5.6.3, Password Hashing in MySQL
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.5.1, User Names and Passwords
PASSWORD(str)
Section 11.11.2, Encryption and Compression Functions
PERIOD_ADD()
Section 1.7.4, MySQL Extensions to Standard SQL
PERIOD_ADD(P,N)
Section 11.6, Date and Time Functions
PERIOD_DIFF()
Section 1.7.4, MySQL Extensions to Standard SQL
PERIOD_DIFF(P1,P2)
Section 11.6, Date and Time Functions
PI()
Section 8.2.4, Function Name Parsing and Resolution
Section 11.5.2, Mathematical Functions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
POSITION(substr IN str)
Section 11.4, String Functions
POW()
Section 11.5.2, Mathematical Functions
POW(5-int_col,3) + 6
Section 18.2.3, HASH Partitioning
POW(X,Y)
Section 11.5.2, Mathematical Functions
POWER(2,4)
Section 18.2.3.1, LINEAR HASH Partitioning
POWER(X,Y)
Section 11.5.2, Mathematical Functions
Point()
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
Point(x,y)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
PointFromText()
Section 11.13.5.1, Geometry Format Conversion Functions
PointFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
PointFromWKB()
Section 11.13.5.1, Geometry Format Conversion Functions
PointFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
PointN(ls,N)
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
PolyFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
PolyFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
Polygon(ls1,ls2,...)
Section 11.13.4.2.3, Creating Geometry Values Using MySQL-Specific
Functions
PolygonFromText(wkt[,srid])
Section 11.13.4.2.1, Creating Geometry Values Using WKT Functions
PolygonFromWKB(wkb[,srid])
Section 11.13.4.2.2, Creating Geometry Values Using WKB Functions
QUARTER()
Section 18.5.3, Partitioning Limitations Relating to Functions
QUARTER(date)
Section 11.6, Date and Time Functions
QUOTE(str)
Section 11.4, String Functions
RADIANS(X)
Section 11.5.2, Mathematical Functions
RAND()
Section 4.6.7.1, mysqlbinlog Hex Dump Format
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 7.5.5.1, How the Query Cache Operates
Section 11.5.2, Mathematical Functions
Section 16.3.1.10, Replication and System Functions
Section 5.1.5, Session System Variables
RAND(N)
Function Index
3349
Section 11.5.2, Mathematical Functions
RELEASE_LOCK()
Section 12.2.3, DO Syntax
Section 7.5.5.1, How the Query Cache Operates
Section 7.3.1, Internal Locking Methods
Section 11.11.4, Miscellaneous Functions
Section 12.4.5.3, Other Table-Locking Notes
Section 16.3.1.10, Replication and System Functions
RELEASE_LOCK(str)
Section 11.11.4, Miscellaneous Functions
REPEAT()
Section 9.1.8.1, Result Strings
REPEAT(str,count)
Section 11.4, String Functions
REPLACE()
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
REPLACE(str,from_str,to_str)
Section 11.4, String Functions
REVERSE()
Section 9.1.8.1, Result Strings
REVERSE(str)
Section 11.4, String Functions
RIGHT()
Section 3.3.4.5, Date Calculations
Section 9.1.8.1, Result Strings
RIGHT(str,len)
Section 11.4, String Functions
ROUND()
Section 11.5.2, Mathematical Functions
ROUND(X)
Section 11.5.2, Mathematical Functions
ROUND(X,D)
Section 11.5.2, Mathematical Functions
ROW_COUNT()
Section 12.2.1, CALL Syntax
Section 12.2.2, DELETE Syntax
Section 12.2.5, INSERT Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 11.11.3, Information Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
RPAD()
Section 9.1.8.1, Result Strings
RPAD(str,len,padstr)
Section 11.4, String Functions
RTRIM()
Section 9.1.8.1, Result Strings
RTRIM(str)
Section 11.4, String Functions
Related()
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
SCHEMA()
Section 11.11.3, Information Functions
SECOND()
Section 18.5.3, Partitioning Limitations Relating to Functions
SECOND(time)
Section 11.6, Date and Time Functions
SEC_TO_TIME(seconds)
Section 11.6, Date and Time Functions
SESSION_USER()
Section 11.11.3, Information Functions
Section 9.1.10, UTF-8 for Metadata
SHA()
Section 11.11.2, Encryption and Compression Functions
SHA(str)
Section 11.11.2, Encryption and Compression Functions
SHA1()
Section 11.11.2, Encryption and Compression Functions
Section 5.3.1, General Security Guidelines
Section 5.5.6.4, Implications of Password Hashing Changes in MySQL
4.1 for Application Programs
SHA1(str)
Section 11.11.2, Encryption and Compression Functions
SIGN(X)
Section 11.5.2, Mathematical Functions
SIN(3.14)
Section 22.3.2.3, UDF Argument Processing
SIN(X)
Section 11.5.2, Mathematical Functions
Function Index
3350
SLEEP()
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.4, Miscellaneous Functions
Section 16.3.1, Replication Features and Issues
Section D.7.3, Windows Platform Limitations
SLEEP(duration)
Section 11.11.4, Miscellaneous Functions
SOUNDEX()
Section 22.3, Adding New Functions to MySQL
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
SOUNDEX(expr1) = SOUN-
DEX(expr2)
Section 11.4, String Functions
SOUNDEX(str)
Section 11.4, String Functions
SPACE()
Section 9.1.8.1, Result Strings
SPACE(N)
Section 11.4, String Functions
SQRT(X)
Section 11.5.2, Mathematical Functions
SRID(g)
Section 11.13.5.2.1, General Geometry Functions
STD()
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 1.7.4, MySQL Extensions to Standard SQL
STD(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV()
Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV_POP()
Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV_POP(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV_SAMP()
Section 11.12.1, GROUP BY (Aggregate) Functions
STDDEV_SAMP(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
STRCMP()
Section B.1.5.2, Problems Using DATE Columns
Section 11.4.1, String Comparison Functions
STRCMP(expr1,expr2)
Section 11.4.1, String Comparison Functions
STR_TO_DATE()
Section 11.6, Date and Time Functions
Section 9.8, MySQL Server Locale Support
STR_TO_DATE(str,format)
Section 11.6, Date and Time Functions
SUBDATE()
Section 11.6, Date and Time Functions
SUBDATE(date,INTERVAL expr
unit)
Section 11.6, Date and Time Functions
SUBDATE(expr,days)
Section 11.6, Date and Time Functions
SUBSTR()
Section 11.4, String Functions
SUBSTR(str FROM pos FOR len)
Section 11.4, String Functions
SUBSTR(str FROM pos)
Section 11.4, String Functions
SUBSTR(str,pos)
Section 11.4, String Functions
SUBSTR(str,pos,len)
Section 11.4, String Functions
SUBSTRING()
Section 5.5.9, Auditing MySQL Account Activity
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
Section 10.4.3, The BLOB and TEXT Types
SUBSTRING(str FROM pos FOR
len)
Section 11.4, String Functions
SUBSTRING(str FROM pos)
Section 11.4, String Functions
Function Index
3351
SUBSTRING(str,pos)
Section 11.4, String Functions
SUBSTRING(str,pos,len)
Section 11.4, String Functions
SUBSTRING_INDEX()
Section 11.4, String Functions
SUB-
STRING_INDEX(str,delim,count)
Section 11.4, String Functions
SUBTIME()
Section 11.6, Date and Time Functions
SUBTIME(expr1,expr2)
Section 11.6, Date and Time Functions
SUM()
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 22.3.2, Adding a New User-Defined Function
Section 10.1.2, Overview of Date and Time Types
Section 18.1, Overview of Partitioning in MySQL
Section B.1.5.3, Problems with NULL Values
Section 10.4.4, The ENUM Type
Section 10.4.5, The SET Type
Section 19.5.3, Updatable and Insertable Views
Section 19.5.2, View Processing Algorithms
SUM([DISTINCT] expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
SYSDATE()
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
Section 16.3.1.10, Replication and System Functions
Section 5.1.2, Server Command Options
Section 5.1.5, Session System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
SYSTEM_USER()
Section 11.11.3, Information Functions
Section 9.1.10, UTF-8 for Metadata
StartPoint()
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.2.4, MultiLineString Functions
StartPoint(ls)
Section 11.13.5.2.3, LineString Functions
Section 11.13.5.3.1, Geometry Functions That Produce New Geomet-
ries
SymDifference(g1,g2)
Section 11.13.5.3.2, Spatial Operators
TAN(X)
Section 11.5.2, Mathematical Functions
TIME(expr)
Section 11.6, Date and Time Functions
TIMEDIFF()
Section 11.6, Date and Time Functions
TIMEDIFF(expr1,expr2)
Section 11.6, Date and Time Functions
TIMESTAMP()
Section 11.6, Date and Time Functions
TIMESTAMP(expr)
Section 11.6, Date and Time Functions
TIMESTAMP(expr1,expr2)
Section 11.6, Date and Time Functions
TIMESTAMPADD()
Section 11.6, Date and Time Functions
TIMESTAM-
PADD(unit,interval,datetime_ex
pr)
Section 11.6, Date and Time Functions
TIMESTAMP-
DIFF(unit,datetime_expr1,datet
ime_expr2)
Section 11.6, Date and Time Functions
TIME_FORMAT(time,format)
Section 11.6, Date and Time Functions
TIME_TO_SEC()
Section 18.5.3, Partitioning Limitations Relating to Functions
TIME_TO_SEC(time)
Section 11.6, Date and Time Functions
TO_DAYS()
Section 11.6, Date and Time Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 18.4, Partition Pruning
Section 18.2, Partition Types
Section 18.5.3, Partitioning Limitations Relating to Functions
TO_DAYS(date)
Section 11.6, Date and Time Functions
Function Index
3352
TO_DAYS(date_col)
Section 18.2.3, HASH Partitioning
TRIM()
Section 1.7.4, MySQL Extensions to Standard SQL
Section 9.1.8.1, Result Strings
TRIM([remstr FROM] str)
Section 11.4, String Functions
TRIM([{BOTH | LEADING | TRAIL-
ING} [remstr] FROM] str)
Section 11.4, String Functions
TRUNCATE(X,D)
Section 11.5.2, Mathematical Functions
Touches(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
UCASE()
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
UCASE(str)
Section 11.4, String Functions
UNCOMPRESS()
Section 11.11.2, Encryption and Compression Functions
Section 5.1.4, Server System Variables
Section 2.10.2, Typical configure Options
UNCOM-
PRESS(string_to_uncompress)
Section 11.11.2, Encryption and Compression Functions
UNCOM-
PRESSED_LENGTH(compressed_stri
ng)
Section 11.11.2, Encryption and Compression Functions
UNHEX()
Section 11.4, String Functions
UNHEX(str)
Section 11.4, String Functions
UNIX_TIMESTAMP()
Section 11.6, Date and Time Functions
Section 7.5.5.1, How the Query Cache Operates
Section B.1.4.6, Time Zone Problems
UNIX_TIMESTAMP(date)
Section 11.6, Date and Time Functions
UPPER()
Section 9.1.8.1, Result Strings
Section 11.4, String Functions
UPPER(X)
Section 9.1.8.1, Result Strings
UPPER(_utf8'abc')
Section 9.1.7, String Repertoire
UPPER(str)
Section 11.4, String Functions
USER()
Section 5.5.9, Auditing MySQL Account Activity
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.3, Information Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
Section 9.1.6.5, Special Cases Where Collation Determination Is
Tricky
Section 9.1.10, UTF-8 for Metadata
UTC_DATE
Section 11.6, Date and Time Functions
UTC_DATE()
Section 11.6, Date and Time Functions
UTC_TIME
Section 11.6, Date and Time Functions
UTC_TIME()
Section 11.6, Date and Time Functions
UTC_TIMESTAMP
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
UTC_TIMESTAMP()
Section 11.6, Date and Time Functions
Section 9.7, MySQL Server Time Zone Support
UUID()
Section 16.1.3.4, Binary Log Options and Variables
Section 19.6, Binary Logging of Stored Programs
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.4, Miscellaneous Functions
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.1.10, Replication and System Functions
Section 5.2.4.2, Setting The Binary Log Format
UUID_SHORT()
Function Index
3353
Section 7.5.5.1, How the Query Cache Operates
Section 11.11.4, Miscellaneous Functions
Union(g1,g2)
Section 11.13.5.3.2, Spatial Operators
UpdateXML()
Section 1.4.1, What Is New in MySQL 5.1
Section 11.10, XML Functions
UpdateXML(xml_target,
xpath_expr, new_xml)
Section 11.10, XML Functions
VALUES()
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 11.11.4, Miscellaneous Functions
VALUES(col_name)
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 11.11.4, Miscellaneous Functions
VARIANCE()
Section 11.12.1, GROUP BY (Aggregate) Functions
VARIANCE(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
VAR_POP()
Section 11.12.1, GROUP BY (Aggregate) Functions
VAR_POP(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
VAR_SAMP()
Section 11.12.1, GROUP BY (Aggregate) Functions
VAR_SAMP(expr)
Section 11.12.1, GROUP BY (Aggregate) Functions
VERSION()
Section B.1.5.1, Case Sensitivity in String Searches
Section 11.11.3, Information Functions
Section 16.3.1.10, Replication and System Functions
Section 9.1.6.5, Special Cases Where Collation Determination Is
Tricky
Section 9.1.10, UTF-8 for Metadata
WEEK()
Section 11.6, Date and Time Functions
Section 5.1.4, Server System Variables
WEEK(date,3)
Section 11.6, Date and Time Functions
WEEK(date[,mode])
Section 11.6, Date and Time Functions
WEEKDAY()
Section 1.7.4, MySQL Extensions to Standard SQL
Section 18.2, Partition Types
Section 18.5.3, Partitioning Limitations Relating to Functions
WEEKDAY(date)
Section 11.6, Date and Time Functions
WEEKOFYEAR()
Section 11.6, Date and Time Functions
WEEKOFYEAR(date)
Section 11.6, Date and Time Functions
Within()
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
Within(g1,g2)
Section 11.13.5.6, Functions That Test Spatial Relationships Between
Geometries
X(p)
Section 11.13.5.2.2, Point Functions
Y(p)
Section 11.13.5.2.2, Point Functions
YEAR('1984-06-21')
Section 18.4, Partition Pruning
YEAR('1999-06-21')
Section 18.4, Partition Pruning
YEAR()
Section 3.3.4.5, Date Calculations
Section 18.4, Partition Pruning
Section 18.2, Partition Types
Section 18.5.3, Partitioning Limitations Relating to Functions
YEAR(NULL)
Section 18.2.6, How MySQL Partitioning Handles NULL
YEAR(date)
Section 11.6, Date and Time Functions
YEAR(date_col)
Section 18.2.3, HASH Partitioning
YEAR(dob)
Section 18.3.1, Management of RANGE and LIST Partitions
Function Index
3354
YEAR(separated)
Section 18.2.1, RANGE Partitioning
YEARWEEK()
Section 11.6, Date and Time Functions
Section 18.5.3, Partitioning Limitations Relating to Functions
YEARWEEK(date)
Section 11.6, Date and Time Functions
YEARWEEK(date,mode)
Section 11.6, Date and Time Functions
addslashes()
Section 5.3.1, General Security Guidelines
ascii
Section 9.1.7, String Repertoire
Section 2.10.2, Typical configure Options
Section 9.1.12.2, West European Character Sets
bin
Section 2.11.2, Unix Post-Installation Procedures
binary
Section 12.2.8, SELECT Syntax
Section 9.4, Adding a New Character Set
Section 21.10.1, C API Data Types
Section 21.10.5, C API Prepared Statement Data types
Section B.1.5.1, Case Sensitivity in String Searches
Section 9.1.4, Connection Character Sets and Collations
Description
Section 9.1.8.1, Result Strings
Section 5.1.4, Server System Variables
Section 9.1.6.4, The _bin and binary Collations
Section 2.10.2, Typical configure Options
case
Section 12.1.17, CREATE TABLE Syntax
Section 9.4, Adding a New Character Set
char
Section 21.10.5, C API Prepared Statement Data types
Section 13.9, The MEMORY (HEAP) Storage Engine
charset
Section 4.5.1.2, mysql Commands
Section 9.1.4, Connection Character Sets and Collations
collation
Section 9.4.1, The Character Definition Arrays
compress
Section 21.10.3.49, mysql_options()
Section B.1.3.1, Problems Linking to the MySQL Client Library
count
Section 12.5.5.16, SHOW ENGINE Syntax
Section 8.2.4, Function Name Parsing and Resolution
Section 5.1.8, Server SQL Modes
crypt()
Section 11.11.2, Encryption and Compression Functions
Section 5.1.4, Server System Variables
date
Section 11.6, Date and Time Functions
day
Section 21.10.5, C API Prepared Statement Data types
default
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 5.1.6.1, Structured System Variables
Section 7.2.18, Using optimizer_switch to Control the Optim-
izer
expr IN (value,...)
Section 11.2.3, Comparison Functions and Operators
expr NOT IN (value,...)
Section 11.2.3, Comparison Functions and Operators
gethostbyaddr()
Section 7.5.11, How MySQL Uses DNS
gethostbyaddr_r()
Section 7.5.11, How MySQL Uses DNS
gethostbyname()
Section 7.5.11, How MySQL Uses DNS
gethostbyname_r()
Section 7.5.11, How MySQL Uses DNS
hour
Section 21.10.5, C API Prepared Statement Data types
insert
Section 7.5.6.3, Delayed-Insert Thread States
length
Section 21.10.3.34, mysql_hex_string()
Section 21.10.3.53, mysql_real_escape_string()
Section 21.10.3.54, mysql_real_query()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.20, mysql_stmt_prepare()
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 21.10.5, C API Prepared Statement Data types
Section 22.2.3.3, Creating a Plugin Library
Section 22.2.3.2, Type-Specific Plugin Structures and Functions
Function Index
3355
ln
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
log
Section 2.10.3, Installing from the Development Source Tree
lower
Section 11.4.2, Regular Expressions
Section 9.4.1, The Character Definition Arrays
main()
Section 21.9, libmysqld, the Embedded MySQL Server Library
max
Section 13.6.2, InnoDB Configuration
minute
Section 21.10.5, C API Prepared Statement Data types
month
Section 21.10.5, C API Prepared Statement Data types
my_open()
Section 5.1.7, Server Status Variables
mysql_add_word()
Section 22.2.3.2, Type-Specific Plugin Structures and Functions
mysql_escape_string()
Section 5.3.1, General Security Guidelines
mysql_library_xxx()
Section 21.9, libmysqld, the Embedded MySQL Server Library
mysql_parse()
Section 22.2.3.2, Type-Specific Plugin Structures and Functions
mysql_real_escape_string()
Section 5.3.1, General Security Guidelines
mysql_shutdown(X)
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
mysql_shutdown(X,SHUTDOWN_DEFA
ULT)
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
old-password
Description
or
Section 11.10, XML Functions
password
Description
power
Section 2.13.5.3, IBM-AIX notes
pthread_exit()
Section 21.9, libmysqld, the Embedded MySQL Server Library
quote
Section 5.3.1, General Security Guidelines
Section 8.1.1, Strings
second
Section 21.10.5, C API Prepared Statement Data types
setrlimit()
Section 5.1.2, Server Command Options
space
Section 13.6.13.2.2, InnoDB Tablespace Monitor Output
Section 11.4.2, Regular Expressions
thr_setconcurrency()
Section 5.1.4, Server System Variables
uncompress
Section B.1.3.1, Problems Linking to the MySQL Client Library
upper
Section 11.4.2, Regular Expressions
Section 9.4.1, The Character Definition Arrays
user
Section B.1.2.15, Ignoring user
Section 21.10.3.49, mysql_options()
Section 21.10.3.52, mysql_real_connect()
Section 5.4.4, Access Control, Stage 1: Connection Verification
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section 5.5.5, Assigning Account Passwords
Section 5.5.9, Auditing MySQL Account Activity
Section 5.4.7, Causes of Access-Denied Errors
Section 3.1, Connecting to and Disconnecting from the Server
Section 13.6.4.2, Converting Tables from Other Storage Engines to
InnoDB
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 17.3.4.5, Defining a MySQL Cluster Management Server
Description
Section 11.11.2, Encryption and Compression Functions
Section 5.3.1, General Security Guidelines
Section 5.3.5, How to Run MySQL as a Normal User
Section 5.5.4, Limiting Account Resources
Section 5.3.2, Making MySQL Secure Against Attackers
Section 5.5.6.3, Password Hashing in MySQL
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section D.6, Restrictions on Character Sets
Function Index
3356
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.1.2, Server Command Options
Section 5.4.3, Specifying Account Names
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.11.2, Unix Post-Installation Procedures
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.5.1, User Names and Passwords
Section 5.5.7.2, Using SSL Connections
Section 11.10, XML Functions
version
Description
Section 22.2.3.1, General Plugin Structures and Functions
Section 5.1.4, Server System Variables
year
Section 11.12.2, GROUP BY Modifiers
Section 21.10.5, C API Prepared Statement Data types
Function Index
3357
INFORMATION_SCHEMA Index
CHARACTER_SETS
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 20.9, The INFORMATION_SCHEMA CHARACTER_SETS Ta-
ble
COLLATIONS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 21.10.1, C API Data Types
Section 20.10, The INFORMATION_SCHEMA COLLATIONS Table
COLLA-
TION_CHARACTER_SET_APPLICABILI
TY
Section 20.11, The INFORMATION_SCHEMA COLLA-
TION_CHARACTER_SET_APPLICABILITY Table
COLUMNS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 20.3, The INFORMATION_SCHEMA COLUMNS Table
COLUMN_PRIVILEGES
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
ENGINES
Section 1.4.1, What Is New in MySQL 5.1
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
Section 20.18, The INFORMATION_SCHEMA ENGINES Table
EVENTS
Section 1.4.1, What Is New in MySQL 5.1
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
FILES
Section 1.4.1, What Is New in MySQL 5.1
Section 20.21, The INFORMATION_SCHEMA FILES Table
GLOBAL_STATUS
Section 20.24, The INFORMATION_SCHEMA GLOBAL_STATUS and
SESSION_STATUS Tables
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
GLOBAL_VARIABLES
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
INFORMA-
TION_SCHEMA.CHARACTER_SETS
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
INFORMATION_SCHEMA.COLLATIONS
Section 9.5.2, Choosing a Collation ID
INFORMATION_SCHEMA.COLUMNS
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
INFORMATION_SCHEMA.ENGINES
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
INFORMATION_SCHEMA.EVENTS
Section 12.1.11, CREATE EVENT Syntax
Section 12.5.5.19, SHOW EVENTS Syntax
Section 16.3.1.7, Replication of Invoked Features
Section D.1, Restrictions on Stored Routines, Triggers, and Events
INFORMATION_SCHEMA.FILES
Section 12.1.3, ALTER LOGFILE GROUP Syntax
Section 12.1.8, ALTER TABLESPACE Syntax
Section 12.1.14, CREATE LOGFILE GROUP Syntax
Section 12.1.18, CREATE TABLESPACE Syntax
INFORMATION_SCHEMA.PARAMETERS
Section 1.4.2, What Is Planned for MySQL 6.0
INFORMATION_SCHEMA.PARTITIONS
Section 18.2.4, KEY Partitioning
Section 18.2.6, How MySQL Partitioning Handles NULL
Section 18.3.4, Obtaining Information About Partitions
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
INFORMATION_SCHEMA.PLUGINS
Section 22.2.3.1, General Plugin Structures and Functions
INFORMATION_SCHEMA.PROCESSLIST
Section 20.22, The INFORMATION_SCHEMA PROCESSLIST Table
INFORMATION_SCHEMA.ROUTINES
Chapter 20, INFORMATION_SCHEMA Tables
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
Section 1.4.2, What Is Planned for MySQL 6.0
INFORMATION_SCHEMA.TABLES
Chapter 20, INFORMATION_SCHEMA Tables
Chapter 18, Partitioning
INFORMA-
TION_SCHEMA.TABLE_CONSTRAINTS
Section 20.23, The INFORMATION_SCHEMA REFEREN-
TIAL_CONSTRAINTS Table
INFORMATION_SCHEMA.TRIGGERS
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section A.5, MySQL 5.1 FAQ Triggers
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
3358
INFORMATION_SCHEMA.VIEWS
Section 19.5.3, Updatable and Insertable Views
KEY_COLUMN_USAGE
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 20.13, The INFORMATION_SCHEMA KEY_COLUMN_USAGE
Table
PARTITIONS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 18.2.6, How MySQL Partitioning Handles NULL
Section 1.4.1, What Is New in MySQL 5.1
Section 18.3.4, Obtaining Information About Partitions
Chapter 18, Partitioning
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
PLUGINS
Section 22.2.1, Characteristics of the Plugin Interface
Section 1.4.1, What Is New in MySQL 5.1
Section 20.18, The INFORMATION_SCHEMA ENGINES Table
Section 20.17, The INFORMATION_SCHEMA PLUGINS Table
PROCESSLIST
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 7.5.6, Examining Thread Information
Section 1.4.1, What Is New in MySQL 5.1
Section 20.22, The INFORMATION_SCHEMA PROCESSLIST Table
PROFILING
Section 12.5.5.33, SHOW PROFILES Syntax
Section 20.26, The INFORMATION_SCHEMA PROFILING Table
REFERENTIAL_CONSTRAINTS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 20.23, The INFORMATION_SCHEMA REFEREN-
TIAL_CONSTRAINTS Table
ROUTINES
Section 12.5.5.30, SHOW PROCEDURE STATUS Syntax
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 19.2.3, Stored Routine Metadata
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
SCHEMATA
Section 5.4.2, Privilege System Grant Tables
Section 20.1, The INFORMATION_SCHEMA SCHEMATA Table
SCHEMA_PRIVILEGES
Section 20.6, The INFORMATION_SCHEMA
SCHEMA_PRIVILEGES Table
SESSION_STATUS
Section 20.24, The INFORMATION_SCHEMA GLOBAL_STATUS and
SESSION_STATUS Tables
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
SESSION_VARIABLES
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
STATISTICS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 13.6.3, InnoDB Startup Options and System Variables
Section 20.4, The INFORMATION_SCHEMA STATISTICS Table
TABLES
Section 7.2.20, INFORMATION_SCHEMA Optimization
Chapter 20, INFORMATION_SCHEMA Tables
Section 13.6.3, InnoDB Startup Options and System Variables
Section 20.2, The INFORMATION_SCHEMA TABLES Table
TABLE_CONSTRAINTS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 20.12, The INFORMATION_SCHEMA TA-
BLE_CONSTRAINTS Table
TABLE_PRIVILEGES
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
TRIGGERS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 12.5.5.13, SHOW CREATE TRIGGER Syntax
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 19.3.2, Trigger Metadata
USER_PRIVILEGES
Section 20.5, The INFORMATION_SCHEMA USER_PRIVILEGES
Table
VIEWS
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 19.5.4, View Metadata
INFORMATION_SCHEMA Index
3359
Transaction Isolation Level Index
READ COMMITTED
Section 13.6.8.4, InnoDB Record, Gap, and Next-Key Locks
Section 13.6.3, InnoDB Startup Options and System Variables
Section 12.4.6, SET TRANSACTION Syntax
Section 13.6.8.2, Consistent Nonlocking Reads
Section 13.6.8.9, How to Cope with Deadlocks
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section A.1, MySQL 5.1 FAQ General
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 13.6.8, The InnoDB Transaction Model and Locking
READ UNCOMMITTED
Section 12.4.6, SET TRANSACTION Syntax
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 13.6.8, The InnoDB Transaction Model and Locking
READ-COMMITTED
Section 12.4.6, SET TRANSACTION Syntax
Section 5.1.2, Server Command Options
READ-UNCOMMITTED
Section 12.4.6, SET TRANSACTION Syntax
Section 5.1.2, Server Command Options
REPEATABLE READ
Section 13.6.8.4, InnoDB Record, Gap, and Next-Key Locks
Section 12.4.6, SET TRANSACTION Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 13.6.8.2, Consistent Nonlocking Reads
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 13.6.8, The InnoDB Transaction Model and Locking
Section 12.4.7, XA Transactions
REPEATABLE-READ
Section 12.4.6, SET TRANSACTION Syntax
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
SERIALIZABLE
Section 12.4.6, SET TRANSACTION Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 13.6.8.2, Consistent Nonlocking Reads
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 5.1.2, Server Command Options
Section 13.6.8, The InnoDB Transaction Model and Locking
Section 12.4.7, XA Transactions
3360
JOIN Types Index
ALL
Section 7.2.10, Nested-Loop Join Algorithms
const
Section 7.2.13, ORDER BY Optimization
Section 12.2.8, SELECT Syntax
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
eq_ref
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 13.8, The MERGE Storage Engine
fulltext
Section 7.2.1, Optimizing Queries with EXPLAIN
index
Section 7.2.10, Nested-Loop Join Algorithms
Section 7.2.1, Optimizing Queries with EXPLAIN
index_merge
Section 7.2.6, Index Merge Optimization
Section 7.2.1, Optimizing Queries with EXPLAIN
index_subquery
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.10, Optimizing Subqueries
range
Section 7.2.6, Index Merge Optimization
Section 7.2.14.1, Loose index scan
Section 7.2.10, Nested-Loop Join Algorithms
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5, Range Optimization
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
ref
Section 7.4.6, MyISAM Index Statistics Collection
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 13.8, The MERGE Storage Engine
ref_or_null
Section 7.2.8, IS NULL Optimization
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
system
Section 12.2.8, SELECT Syntax
Section 17.7.5.1, MySQL Cluster Messages in the Cluster Log
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
unique_subquery
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.10, Optimizing Subqueries
3361
Operator Index
!
Section 11.2.4, Logical Operators
Section 11.2.1, Operator Precedence
!=
Section 11.2.3, Comparison Functions and Operators
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
%
Section 11.5.1, Arithmetic Operators
&
Section 12.1.17, CREATE TABLE Syntax
Section 11.11.1, Bit Functions
Section 18.5, Restrictions and Limitations on Partitioning
&&
Section 11.2.4, Logical Operators
Section 1.7.4, MySQL Extensions to Standard SQL
*
Section 11.5.1, Arithmetic Operators
Section 10.1.1, Overview of Numeric Types
Section 18.5, Restrictions and Limitations on Partitioning
+
Section 11.5.1, Arithmetic Operators
Section 11.9, Cast Functions and Operators
Section 11.6, Date and Time Functions
Section 10.1.1, Overview of Numeric Types
-
Section 11.5.1, Arithmetic Operators
Section 11.9, Cast Functions and Operators
Section 11.6, Date and Time Functions
Section 10.1.1, Overview of Numeric Types
/
Section 11.5.1, Arithmetic Operators
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.4, Server System Variables
<
Section 11.2.3, Comparison Functions and Operators
Section 7.4.4, How MySQL Uses Indexes
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
<<
Section 11.11.1, Bit Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 18.5, Restrictions and Limitations on Partitioning
<=
Section 11.2.3, Comparison Functions and Operators
Section 7.4.4, How MySQL Uses Indexes
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
<=>
Section 11.2.3, Comparison Functions and Operators
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 11.2.2, Type Conversion in Expression Evaluation
<>
Section 11.2.3, Comparison Functions and Operators
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
=
Section 11.2.3, Comparison Functions and Operators
Section 7.4.4, How MySQL Uses Indexes
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section D.3, Restrictions on Subqueries
Section 11.4.1, String Comparison Functions
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
>
Section 11.2.3, Comparison Functions and Operators
Section 7.4.4, How MySQL Uses Indexes
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
>=
Section 11.2.3, Comparison Functions and Operators
Section 7.4.4, How MySQL Uses Indexes
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
>>
Section 11.11.1, Bit Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 18.5, Restrictions and Limitations on Partitioning
AND
Section 12.1.17, CREATE TABLE Syntax
Section 7.4.4, How MySQL Uses Indexes
Section 7.2.6, Index Merge Optimization
Section 11.2.4, Logical Operators
Section 1.7.4, MySQL Extensions to Standard SQL
3362
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section D.3, Restrictions on Subqueries
Section 3.6.7, Searching on Two Keys
Section 3.3.4.2, Selecting Particular Rows
Section 11.4.1, String Comparison Functions
Section 7.2.6.1, The Index Merge Intersection Access Algorithm
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 19.5.2, View Processing Algorithms
BETWEEN
Section 11.2.3, Comparison Functions and Operators
Section 7.4.4, How MySQL Uses Indexes
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
BINARY
Section 9.1.6.3, BINARY Operator
Section 11.9, Cast Functions and Operators
Section 11.11.2, Encryption and Compression Functions
Section 3.3.4.7, Pattern Matching
Section 3.3.4.4, Sorting Rows
BINARY str
Section 11.9, Cast Functions and Operators
CASE
Section 11.3, Control Flow Functions
Section 1.7.4, MySQL Extensions to Standard SQL
CASE WHEN [condition] THEN
result [WHEN [condition] THEN
result ...] [ELSE result] END
Section 11.3, Control Flow Functions
CASE WHEN expr1 = expr2 THEN
NULL ELSE expr1 END
Section 11.3, Control Flow Functions
CASE value WHEN
[compare_value] THEN result
[WHEN [compare_value] THEN
result ...] [ELSE result] END
Section 11.3, Control Flow Functions
DIV
Section 11.5.1, Arithmetic Operators
Section 18.5, Restrictions and Limitations on Partitioning
IS NOT NULL
Section 11.2.3, Comparison Functions and Operators
Section B.1.5.3, Problems with NULL Values
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 3.3.4.6, Working with NULL Values
IS NOT boolean_value
Section 11.2.3, Comparison Functions and Operators
IS NULL
Section 7.2.8, IS NULL Optimization
Section 11.2.3, Comparison Functions and Operators
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section B.1.5.3, Problems with NULL Values
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 3.3.4.6, Working with NULL Values
IS boolean_value
Section 11.2.3, Comparison Functions and Operators
LIKE
Section 12.5.5.4, SHOW CHARACTER SET Syntax
Section 12.5.5.5, SHOW COLLATION Syntax
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 12.5.5.15, SHOW DATABASES Syntax
Section 12.5.5.19, SHOW EVENTS Syntax
Section 12.5.5.26, SHOW OPEN TABLES Syntax
Section 12.5.5.30, SHOW PROCEDURE STATUS Syntax
Section 12.5.5.37, SHOW STATUS Syntax
Section 12.5.5.38, SHOW TABLE STATUS Syntax
Section 12.5.5.39, SHOW TABLES Syntax
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section 12.5.5.41, SHOW VARIABLES Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 11.9, Cast Functions and Operators
Section 20.28, Extensions to SHOW Statements
Section 7.4.4, How MySQL Uses Indexes
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 1.7.4, MySQL Extensions to Standard SQL
Section 3.3.4.7, Pattern Matching
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.4.3, Specifying Account Names
Section 11.4.1, String Comparison Functions
Section 8.1.1, Strings
Section 5.1.6.1, Structured System Variables
Section 10.4.5, The SET Type
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 5.1.6, Using System Variables
LIKE '_A%'
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
LIKE 'pattern'
Section 12.5.5, SHOW Syntax
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
LIKE ... ESCAPE
Section B.1.8.2, Additional Known Issues
Operator Index
3363
N % M
Section 11.5.1, Arithmetic Operators
Section 11.5.2, Mathematical Functions
N MOD M
Section 11.5.2, Mathematical Functions
NOT
Section 11.2.4, Logical Operators
Section 11.2.1, Operator Precedence
Section 5.1.8, Server SQL Modes
NOT LIKE
Section 3.3.4.7, Pattern Matching
Section 11.4.1, String Comparison Functions
NOT REGEXP
Section 1.7.4, MySQL Extensions to Standard SQL
Section 3.3.4.7, Pattern Matching
Section 11.4.1, String Comparison Functions
NOT RLIKE
Section 3.3.4.7, Pattern Matching
Section 11.4.1, String Comparison Functions
OR
Section 12.5.1.3, GRANT Syntax
Section 7.2.6, Index Merge Optimization
Section 11.2.4, Logical Operators
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 3.6.7, Searching on Two Keys
Section 3.3.4.2, Selecting Particular Rows
Section 5.1.8, Server SQL Modes
Section 11.4.1, String Comparison Functions
Section 7.2.6.3, The Index Merge Sort-Union Access Algorithm
Section 7.2.6.2, The Index Merge Union Access Algorithm
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
REGEXP
Section 1.7.4, MySQL Extensions to Standard SQL
Section 3.3.4.7, Pattern Matching
Section 11.4.2, Regular Expressions
Section D.6, Restrictions on Character Sets
RLIKE
Section 3.3.4.7, Pattern Matching
Section 11.4.2, Regular Expressions
Section D.6, Restrictions on Character Sets
XOR
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 11.2.4, Logical Operators
^
Section 11.11.1, Bit Functions
Section 11.2.1, Operator Precedence
Section 18.5, Restrictions and Limitations on Partitioning
expr BETWEEN min AND max
Section 11.2.3, Comparison Functions and Operators
expr LIKE pat [ESCAPE 'es-
cape_char']
Section 11.4.1, String Comparison Functions
expr NOT BETWEEN min AND max
Section 11.2.3, Comparison Functions and Operators
expr NOT LIKE pat [ESCAPE 'es-
cape_char']
Section 11.4.1, String Comparison Functions
expr NOT REGEXP pat
Section 11.4.2, Regular Expressions
expr NOT RLIKE pat
Section 11.4.2, Regular Expressions
expr REGEXP pat
Section 11.4.2, Regular Expressions
expr RLIKE pat
Section 11.4.2, Regular Expressions
expr1 SOUNDS LIKE expr2
Section 11.4, String Functions
|
Section 11.11.1, Bit Functions
Section 18.5, Restrictions and Limitations on Partitioning
||
Section 9.1.6.2, COLLATE Clause Precedence
Section 11.2.4, Logical Operators
Section 1.7.4, MySQL Extensions to Standard SQL
Section 11.2.1, Operator Precedence
Section 9.1.8.1, Result Strings
Section 5.1.8, Server SQL Modes
~
Section 11.11.1, Bit Functions
Section 18.5, Restrictions and Limitations on Partitioning
Operator Index
3364
Option Index
-
Section 12.1.1, ALTER DATABASE Syntax
Section 12.5.1.3, GRANT Syntax
Section 11.8.2, Boolean Full-Text Searches
Section 10.6, Choosing the Right Type for a Column
Section 11.6, Date and Time Functions
Section 4.2.1, Invoking MySQL Programs
Section 8.1.2, Numbers
Section 10.1.1, Overview of Numeric Types
Section 11.4.2, Regular Expressions
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.4.3, Specifying Account Names
Section 4.2.3.1, Using Options on the Command Line
-#
Description
Section 22.5.3, The DBUG Package
-# [debug_options]
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
-# [debug_options]
Section 5.1.2, Server Command Options
-#...
Section 22.5.3, The DBUG Package
-#D,20
Section 22.5.3, The DBUG Package
-#debug_options
Description
--
Section 1.7.5.6, '--' as the Start of a Comment
Section 8.5, Comment Syntax
Description
Section 4.2.1, Invoking MySQL Programs
--HELP
Section 4.6.3.1, myisamchk General Options
--abort-slave-event-count
Section 16.1.3.3, Replication Slave Options and Variables
--add-drop-database
Description
--add-drop-table
Description
--add-locks
Description
--add-user
Section 4.6.10.1, MySQL Instance Manager Command Options
--addtodest
Description
--all-databases
Description
Description
Section 2.12.2.1, Downgrading to MySQL 5.0
Section 8.2.3, Mapping of Identifiers to File Names
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
--all-in-1
Description
--all-tablespaces
Description
Section 1.4.1, What Is New in MySQL 5.1
--allow-keywords
Description
--allow-suspicious-udfs
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 22.3.2.6, User-Defined Function Security Precautions
--allowold
Description
--analyze
Section 4.6.3.1, myisamchk General Options
Description
Section 4.6.3.4, Other myisamchk Options
Section 6.4.4, Table Optimization
--angel-pid-file
Section 4.6.10.1, MySQL Instance Manager Command Options
--angel-pid-file=file_name
Section 4.6.10.1, MySQL Instance Manager Command Options
--ansi
Section 1.7.3, Running MySQL in ANSI Mode
Section 5.1.2, Server Command Options
--append
3365
Description
--auto-generate-sql
Description
-
-
auto-gener-
ate-sql-add-autoincrement
Description
-
-
auto-gener-
ate-sql-execute-number=N
Description
-
-
auto-generate-sql-guid-primary
Description
-
-
auto-gener-
ate-sql-load-type=type
Description
-
-
auto-gener-
ate-sql-secondary-indexes=N
Description
-
-
auto-gener-
ate-sql-unique-query-number=N
Description
-
-
auto-gener-
ate-sql-unique-write-number=N
Description
-
-
auto-generate-sql-write-number
Description
-
-
auto-gener-
ate-sql-write-number=N
Description
--auto-rehash
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
--auto-repair
Description
--autoclose
Description
Section 2.8, Installing MySQL on NetWare
--back_log=50
Section 2.13.3, Solaris Notes
--backup
Section 4.6.3.3, myisamchk Repair Options
Description
--backup-id
Description
--backup_history_log
Section 5.1.2, Server Command Options
--backup_id
Description
--backup_path
Description
-
-
backup_path=/path/to/backup/fi
les
Description
--backup_progress_log
Section 5.1.2, Server Command Options
--base64-output
Description
Option Index
3366
--base64-output=DECODE-ROWS
Section 4.6.7.2, mysqlbinlog Row Event Display
--base64-output=NEVER
Section 4.6.7.2, mysqlbinlog Row Event Display
--base64-output[=value]
Description
--basedir
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.4, Server System Variables
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 2.10.2, Typical configure Options
Section 2.11.2, Unix Post-Installation Procedures
--basedir=path
Description
Description
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
--batch
Section 4.5.1.1, mysql Options
--bdb-no-recover
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
--big-tables
Section 7.5.8, How MySQL Uses Memory
Section 5.1.2, Server Command Options
--bind-address
Description
Description
Section 5.6, Running Multiple MySQL Servers on the Same Machine
--bind-address=127.0.0.1
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 5.4.7, Causes of Access-Denied Errors
Section 4.6.10.4, Instance Manager User and Password Management
--bind-address=IP
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.1.2, Server Command Options
--binlog-do-db
Section 16.1.3.4, Binary Log Options and Variables
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.2.4, The Binary Log
--binlog-do-db=db1
Section 16.1.3.4, Binary Log Options and Variables
--binlog-do-db=db_name
Section 16.1.3.4, Binary Log Options and Variables
--binlog-do-db=sales
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4, The Binary Log
--binlog-format
Section 16.1.3.4, Binary Log Options and Variables
--binlog-format=MIXED
Section 5.2.4.1, Binary Logging Formats
--binlog-format=ROW
Section 5.2.4.1, Binary Logging Formats
--binlog-format=STATEMENT
Section 5.2.4.1, Binary Logging Formats
--binlog-format=mixed
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
--binlog-format=type
Section 5.2.4.2, Setting The Binary Log Format
-
-bin-
log-
format={ROW|STATEMENT|MIXED}
Section 5.1.2, Server Command Options
--binlog-ignore-db
Section 16.1.3.4, Binary Log Options and Variables
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.2.4, The Binary Log
--binlog-ignore-db=db_name
Section 16.1.3.4, Binary Log Options and Variables
--binlog-ignore-db=sales
Section 16.1.3.4, Binary Log Options and Variables
--binlog-row-event-max-size
Section 5.2.4.2, Setting The Binary Log Format
--binlog-row-event-max-size=N
Section 16.1.3.4, Binary Log Options and Variables
--block-search=offset
Option Index
3367
Section 4.6.3.4, Other myisamchk Options
--bootstrap
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 5.1.2, Server Command Options
Section 2.10.2, Typical configure Options
--brief
Description
--build=x86_64-pc-solaris2.10
Section 2.10, MySQL Installation Using a Source Distribution
--cflags
Description
-
-charac-
ter-set-client-handshake
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 5.1.2, Server Command Options
Section 9.1.12.7.1, The cp932 Character Set
-
-charac-
ter-
set-filesystem=charset_name
Section 5.1.2, Server Command Options
--character-set-server
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 16.3.1.2, Replication and Character Sets
Section 9.1.3.1, Server Character Set and Collation
Section 5.1.2, Server Command Options
Section 9.2, The Character Set Used for Data and Sorting
Section 8.4, User-Defined Variables
-
-charac-
ter-set-server=charset_name
Section 5.1.2, Server Command Options
--character-set-server=latin1
Section 9.1.3.1, Server Character Set and Collation
Section 9.2.1, Using the German Character Set
--character-set-server=utf8
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
--character-sets-dir
Section B.1.2.17, Can't initialize character set
Description
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 9.6, Problems With Character Sets
Section 9.2, The Character Set Used for Data and Sorting
--character-sets-dir=name
Section 17.6.23, Options Common to MySQL Cluster Programs
--character-sets-dir=path
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Section 5.1.2, Server Command Options
--charset=path, -C path
Description
--check
Section 4.6.3.2, myisamchk Check Options
Description
--check-only-changed
Section 4.6.3.2, myisamchk Check Options
Description
--check-password-file
Section 4.6.10.1, MySQL Instance Manager Command Options
--check-upgrade
Description
--checkpoint
Description
--checkpoint=db_name.tbl_name
Description
--chroot
Description
--chroot=path
Description
Section 5.1.2, Server Command Options
--clean-password-file
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.6.10.1, MySQL Instance Manager Command Options
--collation-server
Section 9.1.5, Configuring the Character Set and Collation for Applica-
Option Index
3368
tions
Section 16.3.1.2, Replication and Character Sets
Section 9.1.3.1, Server Character Set and Collation
Section 5.1.2, Server Command Options
Section 9.2, The Character Set Used for Data and Sorting
-
-colla-
tion-server=collation_name
Section 5.1.2, Server Command Options
-
-colla-
tion-server=latin1_german1_ci
Section 9.2.1, Using the German Character Set
-
-colla-
tion-server=latin1_swedish_ci
Section 9.1.3.1, Server Character Set and Collation
--column-names
Section 4.5.1.1, mysql Options
Section 4.2.3.2, Program Option Modifiers
--column-type-info
Section 4.5.1.1, mysql Options
--columns=column_list
Description
--comments
Section 4.5.1.1, mysql Options
Description
--commit
Description
--commit=N
Description
--comp
Section 4.2.3, Specifying Program Options
--compact
Description
--compatible
Description
--compatible=name
Description
--compatible=oracle
Description
--complete-insert
Description
--compr
Section 4.2.3, Specifying Program Options
--compress
Section 4.5.1.1, mysql Options
Section 12.2.6, LOAD DATA INFILE Syntax
Section 5.5.7.1, Basic SSL Concepts
Description
Description
Description
Description
Description
Description
Section 4.2.3, Specifying Program Options
--concurrency=N
Description
--config-file
Description
Description
Description
Section 17.2.4, Initial Startup of MySQL Cluster
Section A.10, MySQL 5.1 FAQ MySQL Cluster
--config-file=file_name
Description
Description
--config-file=filename
Description
--config-file=path-to-file
Description
--config-file=path_name
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
--configdir
Section 17.3.4, MySQL Cluster Configuration Files
--configdir=directory
Description
--configinfo
Description
--connect
Description
Option Index
3369
--connect-string
Section A.10, MySQL 5.1 FAQ MySQL Cluster
-
-connect-string=connect_string
Section 17.6.23, Options Common to MySQL Cluster Programs
--connectstring
Description
--console
Section 13.6.13.3, InnoDB General Troubleshooting
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 13.6.2.3, Creating the InnoDB Tablespace
Section B.1.4.1.1, Resetting the Root Password on Windows Systems
Section 5.1.2, Server Command Options
Section 2.3.9, Starting the Server for the First Time
Section 5.2.2, The Error Log
--copy
Description
--core-file
Section 22.5.1.4, Debugging mysqld under gdb
Description
Section 2.13.1.4, Linux Post-Installation Notes
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 5.1.2, Server Command Options
--core-file-size
Section 5.1.2, Server Command Options
--core-file-size=1000000
Section 2.13.1.4, Linux Post-Installation Notes
--core-file-size=size
Description
--correct-checksum
Section 4.6.3.3, myisamchk Repair Options
--count
Description
Description
Description
--count=N
Description
--create
Description
--create-options
Description
--create-schema=value
Description
--create=value
Description
--csv[=file_name]
Description
--daemon
Description
Description
--data-file-length=len, -D len
Section 4.6.3.3, myisamchk Repair Options
--database
Description
Description
--database=db_name
Section 4.5.1.1, mysql Options
Description
--databases
Description
Description
--datadir
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 2.3.7, Creating an Option File
Description
Section 5.1.4, Server System Variables
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 2.10.2, Typical configure Options
Section 2.11.2, Unix Post-Installation Procedures
Section 4.2.3.3, Using Option Files
--datadir=path
Description
Description
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.6.2, Running Multiple Servers on Unix
Section 5.1.2, Server Command Options
--db=db_name
Description
--debug
Section 22.5.1.1, Compiling MySQL for Debugging
Description
Description
Description
Description
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 5.1.4, Server System Variables
Option Index
3370
Section 2.3.10, Starting MySQL from the Windows Command Line
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 22.5.3, The DBUG Package
--debug-check
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
--debug-info
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
--debug-sync-timeout=N
Section 5.1.4, Server System Variables
Section 2.10.2, Typical configure Options
--debug-sync-timeout[=N]
Section 5.1.2, Server Command Options
--debug="..."
Section 22.5.3, The DBUG Package
--debug="d,parser_debug"
Section 5.1.2, Server Command Options
Section 2.10.2, Typical configure Options
--debug=+P
Section 5.1.2, Server Command Options
--debug=N
Description
--debug=T
Section 5.1.2, Server Command Options
--debug=d,general,query
Section 5.4.7, Causes of Access-Denied Errors
--debug=debug_options, -# de-
bug_options
Section 4.6.3.1, myisamchk General Options
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
--debug[=debug_options]
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.1.2, Server Command Options
--debug[=options]
Section 17.6.23, Options Common to MySQL Cluster Programs
--default-character-set
Section 12.2.6, LOAD DATA INFILE Syntax
Section 9.1.4, Connection Character Sets and Collations
Description
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
-
-de-
fault-charac-
ter-set=charset_name
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Section 5.1.2, Server Command Options
--default-character-set=utf8
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 4.5.1.4, Executing SQL Statements from a Text File
-
-de-
fault-collation=collation_name
Section 5.1.2, Server Command Options
-
-de-
fault-
mysqld-path=/usr/sbin/mysqld
Section 4.6.10.1, MySQL Instance Manager Command Options
--default-mysqld-path=path
Section 4.6.10.1, MySQL Instance Manager Command Options
--default-storage-engine
Option Index
3371
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 13.3, Setting the Storage Engine
Chapter 13, Storage Engines
--default-storage-engine=type
Section 5.1.2, Server Command Options
--default-table-type
Section 13.3, Setting the Storage Engine
Chapter 13, Storage Engines
--default-table-type=type
Section 5.1.2, Server Command Options
--default-time-zone
Section 16.3.1.24, Replication and Time Zones
Section 5.1.4, Server System Variables
--default-time-zone=timezone
Section 9.7, MySQL Server Time Zone Support
Section 5.1.2, Server Command Options
--default.key_buffer_size=256K
Section 5.1.6.1, Structured System Variables
--defaults-extra-file
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Description
Description
-
-defaults-extra-file=file_name
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Description
Description
--defaults-extra-file=path
Description
Section 4.2.3.3, Using Option Files
--defaults-file
Section 13.6.2, InnoDB Configuration
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 4.6.10.7, MySQL Instance Manager Commands
Section 4.6.10.2, MySQL Instance Manager Configuration Files
Section 21.9.3, Options with the Embedded Server
Section B.1.4.1.1, Resetting the Root Password on Windows Systems
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.6.1.2, Starting Multiple Windows Servers as Services
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
Section 2.3.11, Starting MySQL as a Windows Service
--defaults-file=file_name
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 2.3.11, Starting MySQL as a Windows Service
-
-de-
faults-file=option_file_name
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--defaults-group-suffix
Section 2.14, Environment Variables
--defaults-group-suffix=_other
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
--defaults-group-suffix=str
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
--defaults-group-suffix=suffix
Description
--delay-key-write
Section B.1.4.2, What to Do If MySQL Keeps Crashing
--delay-key-write=ALL
Section 13.5.1, MyISAM Startup Options
Section 7.3.4, External Locking
Section 16.3.4, Replication FAQ
--delay-key-write=OFF
Section 7.3.4, External Locking
-
-
delay-key-write[={OFF|ON|ALL}]
Section 5.1.2, Server Command Options
--delay_key_write=1
Section 5.1.4, Server System Variables
Section 5.1.6, Using System Variables
--delay_key_write=ON
Section 5.1.4, Server System Variables
Section 5.1.6, Using System Variables
--delayed-insert
Description
Option Index
3372
--delete
Description
--delete-master-logs
Description
--delimiter
Description
--delimiter=character
Description
--delimiter=str
Section 4.5.1.1, mysql Options
Description
--demangle
Section 22.5.1.5, Using a Stack Trace
--des-key-file
Section 12.5.6.3, FLUSH Syntax
Section 11.11.2, Encryption and Compression Functions
--des-key-file=file_name
Section 5.1.2, Server Command Options
--descending
Description
--description
Section 4.6.3.4, Other myisamchk Options
--detach=N
Description
--disable
Section 4.2.3.2, Program Option Modifiers
--disable-auto-rehash
Section 4.5.1.1, mysql Options
--disable-community-features
Section 2.10.2, Typical configure Options
--disable-debug-sync
Section 2.10.2, Typical configure Options
--disable-dtrace
Section 2.10.2, Typical configure Options
--disable-grant-options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 2.10.2, Typical configure Options
--disable-keys
Description
--disable-log-bin
Description
--disable-named-commands
Section 4.5.1.1, mysql Options
--disable-plugin_name
Section 5.1.3, Server Options for Loading Plugins
--disable-profiling
Section 2.10.2, Typical configure Options
--disable-shared
Section 2.13.4.6, BSD/OS Version 4.x Notes
Section 2.10.2, Typical configure Options
--disconnect-slave-event-count
Section 16.1.3.3, Replication Slave Options and Variables
--disk
Description
--dont_ignore_systab_0
Description
--drop-user
Section 4.6.10.1, MySQL Instance Manager Command Options
--dryrun
Description
--dump
Description
--dump-date
Description
--edit-user
Section 4.6.10.1, MySQL Instance Manager Command Options
--embedded
Description
Description
--enable-assembler
Section 2.13.3, Solaris Notes
--enable-community-features
Section 2.10.2, Typical configure Options
--enable-debug-sync
Option Index
3373
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 2.10.2, Typical configure Options
--enable-dtrace
Section 2.10.2, Typical configure Options
--enable-local-infile
Section 5.3.4, Security Issues with LOAD DATA LOCAL
--enable-locking
Section 7.3.4, External Locking
Section 5.1.2, Server Command Options
--enable-named-pipe
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 4.2.2, Connecting to the MySQL Server
Section 2.3.8, Selecting a MySQL Server Type
Section 5.1.2, Server Command Options
--enable-plugin_name
Section 5.1.3, Server Options for Loading Plugins
--enable-profiling
Section 2.10.2, Typical configure Options
--enable-pstack
Section 5.1.2, Server Command Options
--enable-thread-safe-client
Section 2.10.2, Typical configure Options
--engine-condition-pushdown
Section 7.2.7, Condition Pushdown Optimization
--engine-condition-pushdown=1
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
--engine=engine_name
Description
--event-scheduler[=value]
Section 5.1.2, Server Command Options
--events
Description
--example
Description
--exclude-databases
Description
--exclude-databases=db_list
Description
--exclude-tables
Description
--exclude-tables=tbl_list
Description
--excludedbs
Description
--excludetables
Description
--exe-suffix=suffix
Description
--execute
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 4.2.3.1, Using Options on the Command Line
Section 17.7.3.2, Using The MySQL Cluster Management Client to
Create a Backup
--execute=command
Section 17.6.23, Options Common to MySQL Cluster Programs
--execute=statement
Section 4.5.1.1, mysql Options
--exit-info[=flags]
Section 5.1.2, Server Command Options
--extend-check
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.3, myisamchk Repair Options
--extended
Description
--extended-insert
Description
--external-locking
Section 13.5.1, MyISAM Startup Options
Section 7.3.4, External Locking
Section 2.10.5, MIT-pthreads Notes
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 7.5.2, System Factors and Startup Parameter Tuning
--extra-file=file_name
Description
--extra-partition-info
Description
Option Index
3374
--fast
Section 4.6.3.2, myisamchk Check Options
Description
--federated
Section 13.11, The FEDERATED Storage Engine
--fields
Description
--fields-enclosed-by
Description
--fields-enclosed-by=...
Description
Description
--fields-escaped-by=...
Description
Description
-
-fields-optionally-enclosed-by
Description
-
-
fields-option-
ally-enclosed-by=...
Description
Description
--fields-terminated-by
Description
--fields-terminated-by=...
Description
Description
--fields-xxx
Description
--fields=delimiter
Description
--first-slave
Description
--fix-db-names
Description
--fix-table-names
Description
--flush
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section B.1.4.2, What to Do If MySQL Keeps Crashing
--flush-logs
Description
--flush-privileges
Description
--flush_time=val
Section 22.1.1, MySQL Threads
--flushlog
Description
--force
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Section 2.13.1.2, Linux Binary Distribution Notes
Section 22.1.2, MySQL Test Suite
Section 3.5, Using mysql in Batch Mode
--force-read
Description
--format
Description
--fs
Description
--gci
Description
--gdb
Section 22.5.1.4, Debugging mysqld under gdb
Section 5.1.2, Server Command Options
--general-log
Section 5.1.2, Server Command Options
--general-log[={0|1}]
Section 5.1.2, Server Command Options
--general_log
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Option Index
3375
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.2.3, The General Query Log
--general_log_file
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
--general_log_file=file_name
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.2.3, The General Query Log
--header=FALSE
Description
--header_file=file_name, -H
file_name
Description
--help
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 4.1, Overview of MySQL Programs
Section 5.1.2, Server Command Options
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 7.5.3, Tuning Server Parameters
Chapter 3, Tutorial
Section 2.11.2, Unix Post-Installation Procedures
Section 4.2.3.3, Using Option Files
Section 4.2.3.1, Using Options on the Command Line
--hex
Description
--hex-blob
Description
--hexdump
Section 4.6.7.1, mysqlbinlog Hex Dump Format
Description
--host
Section 5.4.7, Causes of Access-Denied Errors
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Section 4.2.1, Invoking MySQL Programs
Section 2.10.5, MIT-pthreads Notes
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--host=--user
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
--host=127.0.0.1
Section 5.4.7, Causes of Access-Denied Errors
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--host=host_name
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--host=hostname
Description
--host=localhost
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
Section 4.2.3.3, Using Option Files
Section 4.2.3.1, Using Options on the Command Line
--hostname
Description
--howto
Description
--html
Section 4.5.1.1, mysql Options
Option Index
3376
--i-am-a-dummy
Section 4.5.1.1, mysql Options
Section 4.5.1.5.2, Using the --safe-updates Option
--id
Description
--id=node_id
Description
--ignore
Description
--ignore-builtin-innodb
Section 13.6.3, InnoDB Startup Options and System Variables
--ignore-lines=N
Description
--ignore-spaces
Section 4.5.1.1, mysql Options
-
-ignore-table=db_name.tbl_name
Description
--in_file=file_name, -F
file_name
Description
--include
Description
--include-databases
Description
--include-databases=db_list
Description
--include-tables
Description
--include-tables=tbl_list
Description
--info
Description
Description
--information
Section 4.6.3.2, myisamchk Check Options
--init-file
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section B.1.4.1.1, Resetting the Root Password on Windows Systems
Section 5.1.4, Server System Variables
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 2.10.2, Typical configure Options
--init-file=file_name
Section 5.1.2, Server Command Options
--init_connect="SET NAMES
'utf8'"
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
--initial
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Description
Description
Description
Description
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
Section 17.3.4, MySQL Cluster Configuration Files
Section 17.3.5.1, MySQL Cluster Data Node Configuration Paramet-
ers
Section 17.3.5, Overview of MySQL Cluster Configuration Paramet-
ers
Section 17.7.1, Summary of MySQL Cluster Start Phases
--initial-start
Description
--innodb
Section 13.6.3, InnoDB Startup Options and System Variables
--innodb-autoinc-lock-mode
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
--innodb-xxx
Section 5.1.2, Server Command Options
--innodb[=value]
Section 13.6.3, InnoDB Startup Options and System Variables
--innodb_checksums
Section 13.6.3, InnoDB Startup Options and System Variables
--innodb_file_per_table
Section 13.6.2.1, Using Per-Table Tablespaces
Section 7.6.1.3, Using Symbolic Links for Databases on Windows
-
Option Index
3377
-in-
nodb_locks_unsafe_for_binlog
Section 16.1.3.4, Binary Log Options and Variables
--innodb_rollback_on_timeout
Section 13.6.12, InnoDB Error Handling
Section 13.6.3, InnoDB Startup Options and System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--innodb_status_file
Section 13.6.3, InnoDB Startup Options and System Variables
--innodb_status_file=1
Section 13.6.3, InnoDB Startup Options and System Variables
--innodb_support_xa
Section 5.2.4, The Binary Log
--insert-ignore
Description
--install
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.6.1.2, Starting Multiple Windows Servers as Services
Section 2.3.11, Starting MySQL as a Windows Service
--install-manual
Section 5.6.1.2, Starting Multiple Windows Servers as Services
Section 2.3.11, Starting MySQL as a Windows Service
--iterations=N
Description
--join=big_tbl_name
Description
--keep_files_on_create
Section 12.1.17, CREATE TABLE Syntax
--keepold
Description
--key_buffer_size=32M
Section 5.1.2, Server Command Options
--keys
Description
--keys-used=val
Section 4.6.3.3, myisamchk Repair Options
--language
Section 9.3, Setting the Error Message Language
--language=lang_name, -L
lang_name
Section 5.1.2, Server Command Options
--large-pages
Section 7.5.9, Enabling Large Page Support
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
--ledir
Description
--ledir=path
Description
--length
Description
--libmysqld-libs
Description
--libs
Description
--libs_r
Description
--line-numbers
Section 4.5.1.1, mysql Options
--lines-terminated-by
Description
Description
--lines-terminated-by="\r\n"
Description
--lines-terminated-by=...
Description
Description
--list-users
Section 4.6.10.1, MySQL Instance Manager Command Options
--loadqueries
Description
--local
Section 12.2.6, LOAD DATA INFILE Syntax
Description
Section 5.3.4, Security Issues with LOAD DATA LOCAL
--local-infile
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Option Index
3378
--local-infile=0
Section 4.5.1.1, mysql Options
Section 12.2.6, LOAD DATA INFILE Syntax
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Section 5.3.3, Security-Related mysqld Options
--local-infile=1
Section 4.5.1.1, mysql Options
--local-infile[=1]
Section 5.3.4, Security Issues with LOAD DATA LOCAL
--local-infile[={0|1}]
Section 4.5.1.1, mysql Options
Section 5.3.3, Security-Related mysqld Options
--local-load
Description
--local-load=path
Description
--local-service
Section 2.3.11, Starting MySQL as a Windows Service
--lock-all-tables
Description
--lock-directory
Description
--lock-directory=path
Description
--lock-tables
Description
Description
--lock=lock_type
Description
--log
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.2.3, The General Query Log
-
-log-backup-output[=value,...]
Section 5.1.2, Server Command Options
--log-bin
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 12.6.1.1, PURGE BINARY LOGS Syntax
Section 6.2.1, Backup Policy
Section 6.2.3, Backup Strategy Summary
Section 16.1.3.4, Binary Log Options and Variables
Section 19.6, Binary Logging of Stored Programs
Section 6.1, Database Backups
Section 16.3.6, How to Report Replication Bugs or Problems
Section 6.3, Point-in-Time Recovery
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.2.4, The Binary Log
Section 16.3.5, Troubleshooting Replication
Section 6.2.2, Using Backups for Recovery
--log-bin-index[=file_name]
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4, The Binary Log
-
-
log-
bin-trust-function-creators
Section 16.1.3.4, Binary Log Options and Variables
-
-
log-
bin-trust-function-creators=1
Section 16.1.3.4, Binary Log Options and Variables
Section 19.6, Binary Logging of Stored Programs
-
-
log-
bin-
trust-func-
tion-creators[={0|1}]
Section 16.1.3.4, Binary Log Options and Variables
-
-
log-bin-trust-routine-creators
Section 16.1.3.4, Binary Log Options and Variables
-
-
log-
bin-
trust-routine-creators[={0|1}]
Section 16.1.3.4, Binary Log Options and Variables
Option Index
3379
--log-bin=base_name.extension
Section 5.2.4, The Binary Log
--log-bin=log_name
Section 6.2.3, Backup Strategy Summary
--log-bin=old_host_name-bin
Section B.1.8.2, Additional Known Issues
--log-bin[=base_name]
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4, The Binary Log
--log-bin[=file_name]
Section 5.6, Running Multiple MySQL Servers on the Same Machine
--log-error
Section 12.5.6.3, FLUSH Syntax
Description
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
Section 5.1.2, Server Command Options
Section 5.2.6, Server Log Maintenance
Section 5.2.2, The Error Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--log-error my-errors
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
--log-error=file_name
Description
Description
Section 5.2.2, The Error Log
--log-error[=file_name]
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
Section 5.2.2, The Error Log
--log-isam[=file_name]
Section 5.1.2, Server Command Options
--log-long-format
Section 5.1.2, Server Command Options
--log-output
Section 1.4.1, What Is New in MySQL 5.1
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.2.3, The General Query Log
Section 5.2.5, The Slow Query Log
--log-output=FILE
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
--log-output=TABLE
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--log-output=TABLE,FILE
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
--log-output[=value,...]
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
-
-log-queries-not-using-indexes
Section 5.1.2, Server Command Options
Section 5.2.5, The Slow Query Log
--log-short-format
Section 5.1.2, Server Command Options
--log-slave-updates
Section 16.3.6, How to Report Replication Bugs or Problems
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.2.4, The Binary Log
--log-slow-admin-statements
Section 5.1.2, Server Command Options
Section 5.2.5, The Slow Query Log
--log-slow-queries
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.2.5, The Slow Query Log
--log-slow-queries[=file_name]
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
Section 5.2.5, The Slow Query Log
--log-slow-slave-statements
Section 16.1.3.3, Replication Slave Options and Variables
--log-tc-size
Section 5.1.7, Server Status Variables
--log-tc-size=size
Section 5.1.2, Server Command Options
--log-tc=file_name
Section 5.1.2, Server Command Options
--log-warnings
Option Index
3380
Section B.1.2.11, Communication Errors and Aborted Connections
Section 5.2.4.3, Mixed Binary Logging Format
Section 5.1.2, Server Command Options
Section 5.2.2, The Error Log
--log-warnings=0
Section 5.1.2, Server Command Options
--log-warnings=2
Section B.1.2.9, MySQL server has gone away
--log-warnings[=level]
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.2, Server Command Options
--log=file_name
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
--log[=file_name]
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
Section 5.2.3, The General Query Log
--loops
Description
--loose
Section 4.2.3.2, Program Option Modifiers
--loose-opt_name
Section 4.2.3.3, Using Option Files
--low-priority
Description
--low-priority-updates
Section 12.2.5, INSERT Syntax
Section 7.3.3, Concurrent Inserts
Section 16.3.4, Replication FAQ
Section 5.1.2, Server Command Options
Section 7.3.2, Table Locking Issues
--lower-case-table-names=0
Section 8.2.2, Identifier Case Sensitivity
--master-bind
Section 12.6.2.1, CHANGE MASTER TO Syntax
--master-connect-retry
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.3.1.15, Replication During a Master Shutdown
Section 7.5.6.5, Replication Slave I/O Thread States
Section 16.1.3.3, Replication Slave Options and Variables
--master-connect-retry=seconds
Section 16.1.3.3, Replication Slave Options and Variables
--master-data
Section 16.1.1.5, Creating a Data Snapshot Using mysqldump
Description
--master-data[=value]
Description
--master-host
Section 16.1.3.3, Replication Slave Options and Variables
--master-host=host_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-info-file
Section 16.4.2.2, The Slave Status Files
--master-info-file=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-password
Section 16.1.3.3, Replication Slave Options and Variables
--master-password=password
Section 16.1.3.3, Replication Slave Options and Variables
--master-port
Section 16.1.3.3, Replication Slave Options and Variables
--master-port=port_number
Section 16.1.3.3, Replication Slave Options and Variables
--master-retry-count
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 16.1.3.3, Replication Slave Options and Variables
--master-retry-count=count
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl*
Section 5.5.7.3, SSL Command Options
--master-ssl-ca
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-ca=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-capath
Section 16.1.3.3, Replication Slave Options and Variables
-
Option Index
3381
-mas-
ter-ssl-capath=directory_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-cert
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-cert=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-cipher
Section 16.1.3.3, Replication Slave Options and Variables
-
-master-ssl-cipher=cipher_list
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-key
Section 16.1.3.3, Replication Slave Options and Variables
--master-ssl-key=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-user
Section 16.1.3.3, Replication Slave Options and Variables
--master-user=user_name
Section 16.1.3.3, Replication Slave Options and Variables
--master-xxx
Section 1.4.2, What Is Planned for MySQL 6.0
--max
Section 4.2.3.4, Using Options to Set Program Variables
--max-binlog-dump-events
Section 16.1.3.4, Binary Log Options and Variables
--max-binlog-size
Section 16.1.3.3, Replication Slave Options and Variables
--max-record-length
Section 12.5.2.6, REPAIR TABLE Syntax
--max-record-length=len
Section 4.6.3.3, myisamchk Repair Options
--max-relay-log-size
Section 16.1.3.3, Replication Slave Options and Variables
--max-relay-log-size=size
Section 16.1.3.3, Replication Slave Options and Variables
--max-seeks-for-key=1000
Section 7.2.19, How to Avoid Table Scans
Section B.1.6, Optimizer-Related Issues
--max_a
Section 4.2.3.4, Using Options to Set Program Variables
--max_connect_errors=999999999
Section 12.5.6.3, FLUSH Syntax
--max_join_size
Section 4.5.1.5.2, Using the --safe-updates Option
--max_sort_length=N
Section 10.4.3, The BLOB and TEXT Types
--maximum
Section 4.2.3.2, Program Option Modifiers
--maximum-query_cache_size=32M
Section 7.5.5.3, Query Cache Configuration
Section 5.1.6, Using System Variables
--maximum-query_cache_size=4M
Section 4.2.3.2, Program Option Modifiers
--maximum-var_name=value
Section 5.1.2, Server Command Options
Section 5.1.6, Using System Variables
--medium-check
Section 4.6.3.2, myisamchk Check Options
Description
--memlock
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 13.6.2.2, Using Raw Devices for the Shared Tablespace
--method=command
Description
-
-min-examined-row-limit=number
Section 5.1.2, Server Command Options
--monitoring-interval=seconds
Section 4.6.10.1, MySQL Instance Manager Command Options
--myisam-block-size
Section 7.4.5.5, Key Cache Block Size
--myisam-block-size=N
Section 5.1.2, Server Command Options
Option Index
3382
--myisam-recover
Section 13.5.1, MyISAM Startup Options
Section 7.2.24, Other Optimization Tips
Section 5.1.4, Server System Variables
Section 6.4.6, Setting Up a Table Maintenance Schedule
Section B.1.2.19, Table-Corruption Issues
Section 13.5, The MyISAM Storage Engine
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
--myisam-recover=BACKUP,FORCE
Section 5.1.4, Server System Variables
--myisam-recover=mode
Section 13.5.1, MyISAM Startup Options
-
-myis-
am-recov-
er[=option[,option]...]]
Section 5.1.2, Server Command Options
--mysqladmin=prog_name
Description
--mysqld
Description
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--mysqld-safe-compatible
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
--mysqld-version
Description
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--mysqld-version=debug
Description
--mysqld-version=suffix
Description
--mysqld=mysqld_safe
Description
--mysqld=prog_name
Description
Description
--name_file=file_name, -N
file_name
Description
--named-commands
Section 4.5.1.1, mysql Options
--ndb
Description
--ndb-batch-size=#
Section 17.4.2, mysqld Command Options for MySQL Cluster
--ndb-cluster-connection-pool
Section 17.4.2, mysqld Command Options for MySQL Cluster
-
-ndb-cluster-connection-pool=#
Section 17.4.2, mysqld Command Options for MySQL Cluster
-
-ndb-cluster-connection-pool=4
Section 17.4.2, mysqld Command Options for MySQL Cluster
--ndb-connectstring
Section 17.4.2, mysqld Command Options for MySQL Cluster
Description
Description
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
-
-
ndb-connect-
string=connect_string
Section 17.4.2, mysqld Command Options for MySQL Cluster
Description
--ndb-force-send=1
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
--ndb-index-stat-enable=0
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
--ndb-log-empty-epochs
Section 16.1.3.3, Replication Slave Options and Variables
--ndb-mgmd-host
Description
--ndb-nodegroup-map
Description
Option Index
3383
--ndb-nodeid
Section 17.4.2, mysqld Command Options for MySQL Cluster
Description
--ndb-nodeid=#
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.6.23, Options Common to MySQL Cluster Programs
--ndb-optimized-node-selection
Description
Section 17.6.23, Options Common to MySQL Cluster Programs
--ndb-shm
Description
--ndb-use-exact-count=0
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
--ndb_optimized_node_selection
Section 17.4.3, MySQL Cluster System Variables
--ndbcluster
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 12.5.5.17, SHOW ENGINES Syntax
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.3, MySQL Cluster Configuration
Section 17.1.1, MySQL Cluster Core Concepts
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 17.3.4.2, Recommended Starting Configurations for MySQL
Cluster NDB 6.2 and Later
--ndbcluster -
-
ndb-connect-
string=management_host
Section 17.8.2, MySQL Cluster and MySQL Privileges
--new
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 4.2.3.3, Using Option Files
--nice=priority
Description
--no-auto-rehash
Section 4.5.1.1, mysql Options
--no-autocommit
Description
--no-beep
Section 4.5.1.1, mysql Options
Description
--no-binlog
Description
--no-contact
Description
--no-create-db
Description
--no-create-info
Description
--no-data
Description
--no-debug
Description
--no-defaults
Section 5.4.7, Causes of Access-Denied Errors
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Description
Description
Description
--no-embedded
Description
--no-log
Description
--no-named-commands
Section 4.5.1.1, mysql Options
--no-pager
Section 4.5.1.1, mysql Options
--no-restore-disk-objects
Description
--no-set-names
Description
--no-symlinks
Section 4.6.3.3, myisamchk Repair Options
--no-tee
Section 4.5.1.1, mysql Options
--no-upgrade
Description
--nodaemon
Description
Option Index
3384
Description
--nodata
Description
--nodeid
Section 17.4.2, mysqld Command Options for MySQL Cluster
Description
Description
--nodeid=node_id
Description
--nodes
Description
--noindices
Description
--nostart
Description
--not-started
Description
--nowait
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
--nowait-nodes
Description
--nowait-nodes=3
Description
--nowait-nodes=3,5
Description
--nowait-nodes=node_id_1[,
node_id_2[, ...]]
Description
--number-char-cols=N
Description
--number-int-cols=N
Description
--number-of-queries=N
Description
--numeric-dump-file=file_name
Description
--offset=N
Description
--old-passwords
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 5.5.6.3, Password Hashing in MySQL
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--old-style-user-limits
Section 5.5.4, Limiting Account Resources
Section 5.1.2, Server Command Options
--old_server
Description
--one-database
Section 4.5.1.1, mysql Options
--one-thread
Section 5.1.2, Server Command Options
--only-debug
Description
--only-print
Description
--open-files-limit
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 13.6.3, InnoDB Startup Options and System Variables
Section 2.13.4.1, FreeBSD Notes
Section 7.4.7, How MySQL Opens and Closes Tables
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 5.1.4, Server System Variables
--open-files-limit=count
Description
Section 5.1.2, Server Command Options
--opt
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 2.12.5, Copying MySQL Databases to Another Machine
Description
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--opt_name
Section 4.2.3.3, Using Option Files
--opt_name=value
Section 4.2.3.3, Using Option Files
--optimize
Description
Option Index
3385
--order
Description
--order-by-primary
Description
--order=index_name
Description
--out_dir=path, -D path
Description
--out_file=file_name, -O
file_name
Description
--pager
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
--pager[=command]
Section 4.5.1.1, mysql Options
--parallel-recover
Section 4.6.3.3, myisamchk Repair Options
--parallelism
Description
--parsable
Description
--passwd
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.6.10.1, MySQL Instance Manager Command Options
--password
Section 4.5.1.1, mysql Options
Section 5.5.2, Adding User Accounts
Section 5.4.7, Causes of Access-Denied Errors
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.5.6.2, End-User Guidelines for Password Security
Section 6.2, Example Backup and Recovery Strategy
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.2.1, Invoking MySQL Programs
Section 4.6.10.1, MySQL Instance Manager Command Options
Section B.1.2.5, Password Fails When Entered Interactively
Section 4.2.3.1, Using Options on the Command Line
--password-file
Section 4.6.10.4, Instance Manager User and Password Management
--password-file=file_name
Section 4.6.10.1, MySQL Instance Manager Command Options
--password=
Section 4.2.2, Connecting to the MySQL Server
--password=pass_val
Section 4.2.3.1, Using Options on the Command Line
--password=password
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
--password=your_pass
Section 5.4.7, Causes of Access-Denied Errors
Section 5.5.6.2, End-User Guidelines for Password Security
--password[=pass_val]
Section 4.2.2, Connecting to the MySQL Server
--password[=password]
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
--pid-file
Description
Section 5.1.4, Server System Variables
--pid-file=file_name
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.6, Running Multiple MySQL Servers on the Same Machine
--pid-file=path
Section 5.1.2, Server Command Options
--pipe
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Option Index
3386
Section 2.3.12, Testing The MySQL Installation
--plan
Description
--plugin-load
Section 12.5.3.3, INSTALL PLUGIN Syntax
Section 5.1.2, Server Command Options
--plugin-load=plugin_list
Section 5.1.2, Server Command Options
--plugin_dir=path
Section 22.2.1, Characteristics of the Plugin Interface
--plugin_name
Section 5.1.3, Server Options for Loading Plugins
--plugin_name=0
Section 5.1.3, Server Options for Loading Plugins
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--plugin_name=1
Section 5.1.3, Server Options for Loading Plugins
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--plugin_name=FORCE
Section 5.1.3, Server Options for Loading Plugins
--plugin_name=OFF
Section 5.1.3, Server Options for Loading Plugins
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--plugin_name=ON
Section 5.1.3, Server Options for Loading Plugins
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--plugin_name[=ON]
Section 5.1.3, Server Options for Loading Plugins
--plugindir
Description
--plugins=max
Section 17.2.2, MySQL Cluster Multi-Computer Installation
--plugins=max-no-innodb
Section 17.2.2, MySQL Cluster Multi-Computer Installation
--port
Section 5.4.7, Causes of Access-Denied Errors
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Section 4.2.1, Invoking MySQL Programs
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.6.2, Running Multiple Servers on Unix
Section 5.1.4, Server System Variables
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--port-open-timeout=num
Section 5.1.2, Server Command Options
--port=port_num
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
--port=port_number
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--position=N
Description
--post-query=value
Description
--post-system=str
Description
--pre-query=value
Description
--pre-system=str
Description
--prefix
Section 22.2.3.3, Creating a Plugin Library
Section 2.10.3, Installing from the Development Source Tree
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 5.6.2, Running Multiple Servers on Unix
--preserve-schema
Description
--preserve-trailing-spaces
Description
--preview
Description
Option Index
3387
--print
Description
--print-defaults
Section 4.2.3.3.1, Command-Line Options that Affect Option-File
Handling
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 2.12.1, Upgrading MySQL
--print-full-config
Description
--print-password-line
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.6.10.1, MySQL Instance Manager Command Options
--print_data
Description
--print_log
Description
--print_meta
Description
--promote-attributes
Description
--prompt
Section 4.5.1.2, mysql Commands
--prompt=format_str
Section 4.5.1.1, mysql Options
--protocol
Section 4.2.2, Connecting to the MySQL Server
Description
--protocol=MEMORY
Section 2.3.9, Starting the Server for the First Time
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--protocol=PIPE
Section 4.2.2, Connecting to the MySQL Server
Section 2.3.12, Testing The MySQL Installation
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--protocol=SOCKET
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--protocol=TCP
Section 4.2.2, Connecting to the MySQL Server
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
-
-pro-
tocol={TCP|SOCKET|PIPE|MEMORY}
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Section 5.6.2, Running Multiple Servers on Unix
--query
Description
Description
--query-cache-size=0
Section 7.3.4, External Locking
-
-
query=id,type,indexmemory,data
memory
Description
--query=query-options
Description
--query=value
Description
--quick
Section 4.6.3.5, myisamchk Memory Usage
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Section B.1.2.8, Out of memory
Description
Description
Description
Section 6.4.1, Using myisamchk for Crash Recovery
Section 4.2.3.3, Using Option Files
--quiet
Description
--quote-names
Description
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--raw
Section 4.5.1.1, mysql Options
Option Index
3388
--read-from-remote-server
Description
--read-only
Section 4.6.3.2, myisamchk Check Options
Section 16.1.3.3, Replication Slave Options and Variables
--reconnect
Section 4.5.1.1, mysql Options
--record_log_pos
Description
-
-re-
cord_log_pos=db_name.tbl_name
Description
--recover
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.5, myisamchk Memory Usage
Section 4.6.3.3, myisamchk Repair Options
--regexp=expr
Description
--relative
Description
--relay-log
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.4.2.1, The Slave Relay Log
--relay-log-index
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.4.2.1, The Slave Relay Log
--relay-log-index=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log-info-file
Section 16.4.2.2, The Slave Status Files
-
-relay-log-info-file=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log-purge={0|1}
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log-recovery
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log-recovery={0|1}
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log-space-limit
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log-space-limit=size
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--relay-log=myhost-bin
Section 12.6.2.1, CHANGE MASTER TO Syntax
--relnotes
Description
--reload
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Description
Section 17.3.4, MySQL Cluster Configuration Files
--remove
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.6.1.2, Starting Multiple Windows Servers as Services
Section 2.3.11, Starting MySQL as a Windows Service
--repair
Description
--replace
Description
Description
--replicate-*
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-*-db
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-*-do-*
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
--replicate-*-ignore-*
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Option Index
3389
--replicate-*-table
Section 16.4.3, How Servers Evaluate Replication Rules
--replicate-do-db
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 16.1.3.4, Binary Log Options and Variables
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.19, Replication and Reserved Words
Section 16.3.1.22, Replication and Temporary Tables
--replicate-do-db=db1
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-do-db=db_name
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-do-db=sales
Section 16.1.3.4, Binary Log Options and Variables
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-do-table
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.3.1.19, Replication and Reserved Words
Section 16.3.1.22, Replication and Temporary Tables
-
-replic-
ate-do-table=db_name.tbl_name
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-ignore-db
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 16.1.3.4, Binary Log Options and Variables
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.19, Replication and Reserved Words
--replicate-ignore-db=db_name
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-ignore-db=sales
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-ignore-table
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.3.1.19, Replication and Reserved Words
Section 16.3.1.22, Replication and Temporary Tables
-
-replic-
ate-ig-
nore-table=db_name.tbl_name
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-rewrite-db
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
-
-replic-
ate-rewrite-db="db1->db3"
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
-
-replic-
ate-rewrite-db="db2->db3"
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
-
-replic-
ate-re-
write-db=from_name->to_name
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-same-server-id
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-wild-do-table
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.22, Replication and Temporary Tables
-
-replic-
ate-wild-do-table=db_name.%
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-
wild-do-table=db_name.tbl_name
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-wild-do-table=foo%.%
Option Index
3390
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-wild-do-table=foo%.bar%
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-
wild-do-table=my\\_own\\%db
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-wild-do-table=my\_own\%db
Section 16.1.3.3, Replication Slave Options and Variables
--replicate-wild-ignore-table
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.4.3, How Servers Evaluate Replication Rules
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.22, Replication and Temporary Tables
-
-replic-
ate-
wild-ignore-table=db_name.%
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-
wild-ig-
nore-table=db_name.tbl_name
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-
wild-ignore-table=foo%.bar%
Section 16.1.3.3, Replication Slave Options and Variables
-
-replic-
ate-wild-ignore-table=mysql.%
Section 16.3.4, Replication FAQ
-
-replic-
ate-wild-ignore-table=norep_
Section 16.3.1.22, Replication and Temporary Tables
--report-host
Section 5.1.4, Server System Variables
--report-host=host_name
Section 12.5.5.35, SHOW SLAVE HOSTS Syntax
Section 16.1.3.3, Replication Slave Options and Variables
--report-password
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
--report-password=password
Section 16.1.3.3, Replication Slave Options and Variables
--report-port
Section 5.1.4, Server System Variables
--report-port=slave_port_num
Section 16.1.3.3, Replication Slave Options and Variables
--report-user
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
--report-user=user_name
Section 16.1.3.3, Replication Slave Options and Variables
--resetmaster
Description
--resetslave
Description
--restore_data
Description
--restore_epoch
Description
--restore_meta
Description
--result-file=file_name
Description
--result-file=name
Description
Option Index
3391
--rhost=host_name
Description
--rollback
Description
--routines
Description
Section 2.12.2.1, Downgrading to MySQL 5.0
--rowid
Description
--rows
Description
--rows=separator
Description
--run-as-service
Section 4.6.10.1, MySQL Instance Manager Command Options
--safe-mode
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 22.5.1, Debugging a MySQL Server
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
--safe-recover
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.5, myisamchk Memory Usage
Section 4.6.3.3, myisamchk Repair Options
--safe-show-database
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
--safe-updates
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
Section 4.5.1.5.2, Using the --safe-updates Option
--safe-user-create
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
--savequeries
Description
--secure-auth
Section 4.5.1.1, mysql Options
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
--secure-backup-file-priv
Section 5.1.2, Server Command Options
--secure-backup-file-priv=path
Section 5.1.2, Server Command Options
--secure-file-priv
Section 5.1.2, Server Command Options
--secure-file-priv=path
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
--select_limit
Section 4.5.1.5.2, Using the --safe-updates Option
--server-id
Section 16.1.3, Replication and Binary Logging Options and Variables
Section 5.1.4, Server System Variables
Section 16.3.5, Troubleshooting Replication
--server-id=id
Description
--server-id=value
Section 12.5.5.35, SHOW SLAVE HOSTS Syntax
-
-ser-
vice-startup-timeout=file_name
Description
--set-auto-increment[=value]
Section 4.6.3.4, Other myisamchk Options
--set-character-set
Section 2.10.2, Typical configure Options
--set-character-set=name
Section 4.6.3.3, myisamchk Repair Options
--set-charset
Description
--set-charset=charset_name
Description
--set-collation
Section 4.6.3.3, myisamchk Repair Options
--set-collation=name
Section 4.6.3.3, myisamchk Repair Options
--set-variable
Section 4.5.1.1, mysql Options
Description
Option Index
3392
--set-variable=option=value
Section 4.2.3.4, Using Options to Set Program Variables
--set-variable=var_name=value
Section 7.5.3, Tuning Server Parameters
--shared-memory
Section 4.2.2, Connecting to the MySQL Server
Section 5.1.2, Server Command Options
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
Section 2.3.9, Starting the Server for the First Time
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--shared-memory-base-name
Section 21.10.3.49, mysql_options()
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--shared-memory-base-name=name
Section 4.2.2, Connecting to the MySQL Server
Description
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
--short-form
Description
--show-slave-auth-info
Section 16.1.3.3, Replication Slave Options and Variables
--show-table-type
Description
--show-warnings
Section 4.5.1.1, mysql Options
--sigint-ignore
Section 4.5.1.1, mysql Options
--silent
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Section 6.4.6, Setting Up a Table Maintenance Schedule
--single-transaction
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Section 6.2.1, Backup Policy
Description
--skip
Description
Section 4.2.3.2, Program Option Modifiers
--skip-add-drop-table
Description
--skip-add-locks
Description
--skip-auto-rehash
Section 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions
--skip-base64-output
Description
-
-
skip-charac-
ter-set-client-handshake
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 9.1.12.7.1, The cp932 Character Set
--skip-column-names
Section 4.5.1.1, mysql Options
--skip-comments
Description
--skip-compact
Description
--skip-concurrent-insert
Section 5.1.2, Server Command Options
--skip-disable-keys
Description
--skip-dump-date
Description
--skip-engine_name
Section 12.5.5.17, SHOW ENGINES Syntax
--skip-events
Section 2.12.2.1, Downgrading to MySQL 5.0
Option Index
3393
--skip-extended-insert
Description
--skip-external-locking
Section 7.3.4, External Locking
Section 7.5.6.2, General Thread States
Section 2.8, Installing MySQL on NetWare
Section 5.1.2, Server Command Options
Section 7.5.2, System Factors and Startup Parameter Tuning
Section B.1.4.2, What to Do If MySQL Keeps Crashing
--skip-grant-tables
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.5.3.3, INSTALL PLUGIN Syntax
Section 2.10.6.1, Building MySQL from Source Using CMake and
Visual Studio
Section 5.4.7, Causes of Access-Denied Errors
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Description
Section 2.11.2.1, Problems Running mysql_install_db
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 2.10.2, Typical configure Options
Section 4.2.3.1, Using Options on the Command Line
Section 5.4.6, When Privilege Changes Take Effect
--skip-host-cache
Section 5.4.7, Causes of Access-Denied Errors
Section 7.5.11, How MySQL Uses DNS
Section 5.1.2, Server Command Options
--skip-innodb
Section 13.6.2, InnoDB Configuration
Section 13.6.3, InnoDB Startup Options and System Variables
Section 16.3.4, Replication FAQ
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
--skip-innodb-checksums
Section 13.6.3, InnoDB Startup Options and System Variables
-
-
skip-in-
nodb_adaptive_hash_index
Section 13.6.3, InnoDB Startup Options and System Variables
--skip-innodb_checksums
Section 13.6.3, InnoDB Startup Options and System Variables
--skip-innodb_doublewrite
Section 13.6.3, InnoDB Startup Options and System Variables
--skip-kill-mysqld
Description
--skip-line-numbers
Section 4.5.1.1, mysql Options
--skip-locking
Section 7.3.4, External Locking
--skip-log-warnings
Section 16.1.3.3, Replication Slave Options and Variables
--skip-merge
Section 5.3.3, Security-Related mysqld Options
Section 5.1.4, Server System Variables
Section 13.8, The MERGE Storage Engine
--skip-name-resolve
Section 5.4.7, Causes of Access-Denied Errors
Section 2.13.4.1, FreeBSD Notes
Section 7.5.11, How MySQL Uses DNS
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 2.3.12, Testing The MySQL Installation
--skip-named-commands
Section 4.5.1.1, mysql Options
--skip-ndbcluster
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.4.3, MySQL Cluster System Variables
--skip-networking
Section B.1.2.2, Can't connect to [local] MySQL
server
Section B.1.2.9, MySQL server has gone away
Section 5.4.7, Causes of Access-Denied Errors
Section 7.5.11, How MySQL Uses DNS
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
--skip-new
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 22.5.1, Debugging a MySQL Server
Section 5.1.4, Server System Variables
--skip-opt
Description
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--skip-pager
Section 4.5.1.1, mysql Options
--skip-plugin_name
Section 5.1.3, Server Options for Loading Plugins
--skip-quick
Description
Option Index
3394
--skip-quote-names
Description
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--skip-reconnect
Section 4.5.1.1, mysql Options
Section 21.10.11, Controlling Automatic Reconnection Behavior
Section 4.5.1.5.3, Disabling mysql Auto-Reconnect
--skip-safemalloc
Section 22.5.1.1, Compiling MySQL for Debugging
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 5.1.2, Server Command Options
--skip-set-charset
Description
--skip-show-database
Section 12.5.5.15, SHOW DATABASES Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
--skip-slave-start
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 12.6.2.7, START SLAVE Syntax
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.5, Troubleshooting Replication
--skip-ssl
Section 5.5.7.3, SSL Command Options
--skip-stack-trace
Section 22.5.1.4, Debugging mysqld under gdb
Section 5.1.2, Server Command Options
--skip-super-large-pages
Section 7.5.9, Enabling Large Page Support
Section 5.1.2, Server Command Options
--skip-symbolic-links
Section 12.1.17, CREATE TABLE Syntax
Section 5.3.2, Making MySQL Secure Against Attackers
Section 5.1.2, Server Command Options
Section 7.6.1.3, Using Symbolic Links for Databases on Windows
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
--skip-syslog
Description
Section 5.2.2, The Error Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--skip-table-check
Description
--skip-thread-priority
Section 2.13.4.5, BSD/OS Version 3.x Notes
Section 2.13.2.1, Mac OS X 10.x (Darwin)
Section 5.1.2, Server Command Options
--skip-triggers
Description
--skip-tz-utc
Description
--skip-write-binlog
Description
--skip-xxx
Description
--skip_grant_tables
Section 4.2.3.1, Using Options on the Command Line
--slave
Description
--slave-load-tmpdir
Section 6.1, Database Backups
--slave-load-tmpdir=file_name
Section 16.1.3.3, Replication Slave Options and Variables
--slave-net-timeout
Section 16.1.3.3, Replication Slave Options and Variables
--slave-net-timeout=seconds
Section 16.1.3.3, Replication Slave Options and Variables
--slave-skip-errors
Section 16.3.1.25, Replication and Transactions
-
-
slave-
skip-er-
rors=[err_code1,err_code2,...|
all]
Section 16.1.3.3, Replication Slave Options and Variables
-
-
slave_compressed_protocol={0|1
}
Section 16.1.3.3, Replication Slave Options and Variables
--sleep
Option Index
3395
Description
--sleep=delay
Description
--slow-query-log
Section 5.1.2, Server Command Options
--slow-query-log[={0|1}]
Section 5.1.2, Server Command Options
--slow_query_log
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.2.5, The Slow Query Log
--slow_query_log_file
Section 5.1.4, Server System Variables
-
-slow_query_log_file=file_name
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.2.5, The Slow Query Log
--socket
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 5.4.7, Causes of Access-Denied Errors
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Section B.1.4.5, How to Protect or Change the MySQL Unix Socket
File
Section 4.2.1, Invoking MySQL Programs
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.6.2, Running Multiple Servers on Unix
Section 2.3.12, Testing The MySQL Installation
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--socket=/path/to/socket
Section B.1.2.2, Can't connect to [local] MySQL
server
--socket=file_name
Section 4.2.2, Connecting to the MySQL Server
Section 5.6.3, Using Client Programs in a Multiple-Server Environ-
ment
--socket=path
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
--sort-index
Section 4.6.3.4, Other myisamchk Options
Section 6.4.4, Table Optimization
--sort-records=N
Section 4.6.3.4, Other myisamchk Options
--sort-records=index_num
Section 6.4.4, Table Optimization
--sort-recover
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.5, myisamchk Memory Usage
Section 4.6.3.3, myisamchk Repair Options
--sort_buffer_size=16M
Section 4.6.3.5, myisamchk Memory Usage
--spassword[=password]
Description
--sporadic-binlog-dump-fail
Section 16.1.3.4, Binary Log Options and Variables
--sql-mode
Section A.3, MySQL 5.1 FAQ Server SQL Mode
Section 5.1.2, Server Command Options
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--sql-mode=""
Section 5.1.8, Server SQL Modes
--sql-mode="mode_value"
Section 1.7.2, Selecting SQL Modes
--sql-mode="modes"
Section 5.1.8, Server SQL Modes
--sql-mode=IGNORE_SPACE
Chapter 11, Functions and Operators
--sql-mode=MAXDB
Section 10.3.1.1, TIMESTAMP Properties
-
-
Option Index
3396
sql-
mode=value[,value[,value...]]
Section 5.1.2, Server Command Options
-
-
sql_mode="TRADITIONAL,ALLOW_IN
VALID_DATES"
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--ssl
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.5.7.3, SSL Command Options
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.5.7.2, Using SSL Connections
--ssl*
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
--ssl-ca
Section 12.5.1.3, GRANT Syntax
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.5.7.3, SSL Command Options
Section 5.5.7.2, Using SSL Connections
--ssl-ca=file_name
Section 5.5.7.3, SSL Command Options
--ssl-capath
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.5.7.3, SSL Command Options
--ssl-capath=directory_name
Section 5.5.7.3, SSL Command Options
--ssl-cert
Section 12.5.1.3, GRANT Syntax
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.5.7.3, SSL Command Options
Section 5.5.7.2, Using SSL Connections
--ssl-cert=file_name
Section 5.5.7.3, SSL Command Options
--ssl-cipher
Section 16.1.3.3, Replication Slave Options and Variables
--ssl-cipher=cipher_list
Section 5.5.7.3, SSL Command Options
--ssl-key
Section 12.5.1.3, GRANT Syntax
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.5.7.3, SSL Command Options
Section 5.5.7.2, Using SSL Connections
--ssl-key=file_name
Section 5.5.7.3, SSL Command Options
--ssl-verify-server-cert
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 5.5.7.3, SSL Command Options
Section 16.4.2.2, The Slave Status Files
--ssl-xxx
Section 5.5.7.2, Using SSL Connections
--ssl=0
Section 5.5.7.3, SSL Command Options
--standalone
Section 22.5.1.2, Creating Trace Files
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 5.1.2, Server Command Options
Section 2.3.10, Starting MySQL from the Windows Command Line
--start-datetime
Description
Section 6.3.1, Specifying Times for Recovery
--start-datetime=datetime
Description
--start-position
Description
Section 6.3.2, Specifying Positions for Recovery
--start-position=N
Description
--statefile=file_name, -S
file_name
Description
Option Index
3397
--static
Section 2.13.3, Solaris Notes
--stats
Description
--status
Description
--stop-datetime
Description
Section 6.3.1, Specifying Times for Recovery
--stop-datetime=datetime
Description
--stop-position
Section 6.3.2, Specifying Positions for Recovery
--stop-position=N
Description
--suffix=str
Description
--super-large-pages
Section 7.5.9, Enabling Large Page Support
Section 5.1.2, Server Command Options
--superuser=user_name
Description
--symbolic-links
Section 5.1.2, Server Command Options
Section 7.6.1.3, Using Symbolic Links for Databases on Windows
--symbols-file=file_name
Description
--sysdate-is-now
Section 11.6, Date and Time Functions
Section 16.3.1.10, Replication and System Functions
Section 5.1.2, Server Command Options
Section 5.1.5, Session System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--syslog
Description
Section 5.2.2, The Error Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--syslog-tag=tag
Description
Section 5.2.2, The Error Log
--tab
Chapter 6, Backup and Recovery
Description
Description
--tab=path
Description
--table
Section 4.5.1.1, mysql Options
Description
--table_cache
Section 7.4.7, How MySQL Opens and Closes Tables
--table_open_cache
Section 7.4.7, How MySQL Opens and Closes Tables
--tables
Description
Description
-
-
tc-heurist-
ic-recover={COMMIT|ROLLBACK}
Section 5.1.2, Server Command Options
--tcp-ip
Description
--tee
Section 4.5.1.2, mysql Commands
--tee=file_name
Section 4.5.1.1, mysql Options
--temp-pool
Section 5.1.2, Server Command Options
--test
Description
--thread-stack=192K
Section 2.13.1.5, Linux x86 Notes
--thread_cache_size=5'
Section 22.5.1.4, Debugging mysqld under gdb
--thread_handling=no-threads
Section 5.1.2, Server Command Options
--thread_handling=one-thread
Option Index
3398
Section 5.1.2, Server Command Options
-
-
thread_handling=one-thread-per
-connection
Section 7.5.7, How MySQL Uses Threads for Client Connections
-
-
thread_handling=pool-of-thread
s
Section 7.5.7, How MySQL Uses Threads for Client Connections
--thread_pool_size=N
Section 7.5.7, How MySQL Uses Threads for Client Connections
--thread_stack=N
Section 7.5.7, How MySQL Uses Threads for Client Connections
--timeout
Description
--timeout=seconds
Description
--timezone
Section 9.7, MySQL Server Time Zone Support
Section 5.1.4, Server System Variables
Section B.1.4.6, Time Zone Problems
--timezone=timezone
Description
--timezone=timezone_name
Section 9.7, MySQL Server Time Zone Support
Section 16.3.1.24, Replication and Time Zones
Section B.1.4.6, Time Zone Problems
--tmpdir
Section B.1.2.13, Can't create/write to file
Section 5.1.2, Server Command Options
Section B.1.4.4, Where MySQL Stores Temporary Files
--tmpdir=path
Section 4.6.3.5, myisamchk Memory Usage
Section 4.6.3.3, myisamchk Repair Options
Description
Description
Section 5.6, Running Multiple MySQL Servers on the Same Machine
Section 5.1.2, Server Command Options
--to-last-log
Description
--transaction-isolation
Section 13.6.8, The InnoDB Transaction Model and Locking
-
-transac-
tion-isolation=SERIALIZABLE
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--transaction-isolation=level
Section 12.4.6, SET TRANSACTION Syntax
Section 5.1.2, Server Command Options
--transactional
Description
--triggers
Description
--try-reconnect=number
Description
--tupscan
Description
--type
Description
Description
--type=node_type
Description
--tz-utc
Description
--unbuffered
Section 4.5.1.1, mysql Options
--unpack
Section 4.6.3.3, myisamchk Repair Options
Section 13.5.3, MyISAM Table Storage Formats
Description
--unqualified
Description
--update-state
Section 4.6.3.2, myisamchk Check Options
Section 6.4.3, How to Repair Tables
Section 13.5, The MyISAM Storage Engine
--usage
Description
Description
Section 17.6.23, Options Common to MySQL Cluster Programs
Option Index
3399
--use-frm
Description
--use-manager
Description
--use-mysqld_safe
Description
--use-threads
Description
--use-threads=N
Description
--useHexFormat
Description
--user
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Description
Description
Section 6.2, Example Backup and Recovery Strategy
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.7, Installing MySQL on i5/OS
Section 4.2.1, Invoking MySQL Programs
Section 2.13.1.2, Linux Binary Distribution Notes
Section 4.2.3.5, Option Defaults, Options Expecting Values, and the =
Sign
Section 5.1.2, Server Command Options
Section 2.13.3, Solaris Notes
Section 2.10.1, Source Installation Overview
Section 2.11.2, Unix Post-Installation Procedures
Section 5.5.1, User Names and Passwords
Section 4.2.3.3, Using Option Files
--user=mysql
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
--user=root
Section 5.3.5, How to Run MySQL as a Normal User
Section 5.3.2, Making MySQL Secure Against Attackers
Section 5.1.2, Server Command Options
--user=user_name
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.3.5, How to Run MySQL as a Normal User
Section 4.6.10.1, MySQL Instance Manager Command Options
--user={user_name|user_id}
Description
Section 5.1.2, Server Command Options
--username
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.6.10.1, MySQL Instance Manager Command Options
--username=user_name
Section 4.6.10.1, MySQL Instance Manager Command Options
--var_name=value
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Section 13.6.3, InnoDB Startup Options and System Variables
Description
Description
Description
Section 5.1.2, Server Command Options
Section 7.5.3, Tuning Server Parameters
--verbose
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Section 4.6.7.2, mysqlbinlog Row Event Display
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.1.2, Server Command Options
Section 2.3.10, Starting MySQL from the Windows Command Line
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 7.5.3, Tuning Server Parameters
Section 4.2.3.3, Using Option Files
Section 4.2.3.1, Using Options on the Command Line
--version
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Option Index
3400
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 5.1.2, Server Command Options
Section 4.2.3.1, Using Options on the Command Line
--vertical
Section 4.5.1.1, mysql Options
Description
Section 1.6, How to Report Bugs or Problems
--wait
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
--wait-timeout=N
Section 4.6.10.1, MySQL Instance Manager Command Options
--wait[=count]
Description
--where='where_condition'
Description
--with
Section 2.10.2, Typical configure Options
--with-archive-storage-engine
Section 13.12, The ARCHIVE Storage Engine
--with-berkeley-db
Section 2.1.2.2, Choosing a Distribution Format
--with-big-tables
Section 13.8.1, MERGE Table Problems
Section 5.1.4, Server System Variables
Section 13.5, The MyISAM Storage Engine
Section 2.10.2, Typical configure Options
-
-with-blackhole-storage-engine
Section 13.14, The BLACKHOLE Storage Engine
--with-charset
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 9.1.3.1, Server Character Set and Collation
Section 2.10.2, Typical configure Options
--with-charset=MYSET
Section 9.4, Adding a New Character Set
--with-charset=charset_name
Section B.1.2.17, Can't initialize character set
Section 9.2, The Character Set Used for Data and Sorting
--with-collation
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 9.1.3.1, Server Character Set and Collation
Section 2.10.2, Typical configure Options
--with-comment
Section 5.1.4, Server System Variables
--with-csv-storage-engine
Section 13.13, The CSV Storage Engine
--with-debug
Section 22.5.1.1, Compiling MySQL for Debugging
Section 2.10.4, Dealing with Problems Compiling MySQL
Section 22.5.2, Debugging a MySQL Client
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 2.1.2.4, MySQL Binaries Compiled by Sun Microsystems,
Inc.
Section 5.1.2, Server Command Options
Section 2.10.2, Typical configure Options
Section B.1.4.2, What to Do If MySQL Keeps Crashing
--with-debug=full
Section 22.5.1.1, Compiling MySQL for Debugging
Section 22.5.2, Debugging a MySQL Client
Description
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 2.1.2.4, MySQL Binaries Compiled by Sun Microsystems,
Inc.
Section 5.1.2, Server Command Options
Section B.1.4.2, What to Do If MySQL Keeps Crashing
--with-debug[=full]
Section 2.1.2.2, Choosing a Distribution Format
-
-
with-embed-
ded-privilege-control
Section 21.9, libmysqld, the Embedded MySQL Server Library
--with-embedded-server
Section 21.9.1, Compiling Programs with libmysqld
Section 2.10.2, Typical configure Options
Option Index
3401
--with-example-storage-engine
Section 13.10, The EXAMPLE Storage Engine
--with-extra-charsets=LIST
Section 2.10.2, Typical configure Options
-
-
with-ex-
tra-charsets=charset_name
Section B.1.2.17, Can't initialize character set
--with-extra-charsets=complex
Section B.1.2.17, Can't initialize character set
Section 9.2, The Character Set Used for Data and Sorting
-
-
with-ex-
tra-charsets=list-of-charsets
| complex | all | none
Section 9.2, The Character Set Used for Data and Sorting
-
-with-federated-storage-engine
Section 13.11, The FEDERATED Storage Engine
--with-libevent
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 5.1.4, Server System Variables
Section 2.10.2, Typical configure Options
--with-libwrap
Section 2.1.2.2, Choosing a Distribution Format
--with-low-memory
Section 2.13.4.4, BSD/OS Version 2.x Notes
Section 2.10.4, Dealing with Problems Compiling MySQL
--with-max-indexes=N
Section 13.5, The MyISAM Storage Engine
--with-mit-threads
Section 2.13.4.1, FreeBSD Notes
Section 2.10.5, MIT-pthreads Notes
-
-
with-
mysqld-ldflags=-all-static
Section 22.3.2, Adding a New User-Defined Function
Section 2.13.1.7, Linux Alpha Notes
-
-with-mysqld-ldflags=-rdynamic
Section 22.3.2, Adding a New User-Defined Function
-
-
with-
named-thread-libs="-lpthread -
lmach -lexc -lc"
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
--with-named-z-libs
Section 2.1.2.2, Choosing a Distribution Format
--with-named-z-libs=no
Section 2.13.3.1, Solaris 2.7/2.8 Notes
Section 2.13.3, Solaris Notes
--with-ndb-sci=/opt/DIS
Section 17.11.1, Configuring MySQL Cluster to use SCI Sockets
-
-
with-ndb-sci=/your/path/to/SCI
Section 17.3.4.11, SCI Transport Connections in MySQL Cluster
--with-ndbcluster
Section 17.3.1, Building MySQL Cluster from Source Code
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.6.1, MySQL Server Usage for MySQL Cluster
--with-openssl
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--with-partition
Chapter 18, Partitioning
--with-plugin-PLUGIN
Section 2.10.2, Typical configure Options
--with-plugins
Section 2.10.2, Typical configure Options
--with-raid
Section 2.1.2.2, Choosing a Distribution Format
Section 2.10.4, Dealing with Problems Compiling MySQL
--with-ssl
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.5.7.2, Using SSL Connections
Option Index
3402
--with-ssl=path
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--with-tcp-port
Section 2.10.3, Installing from the Development Source Tree
--with-unix-socket-path
Section B.1.4.5, How to Protect or Change the MySQL Unix Socket
File
Section 2.10.3, Installing from the Development Source Tree
--with-yassl
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
--with-zlib-dir=no|bundled|DIR
Section 2.10.2, Typical configure Options
--without
Section 2.10.2, Typical configure Options
--without-libevent
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 2.10.2, Typical configure Options
--without-plugin-PLUGIN
Section 2.10.2, Typical configure Options
--without-query-cache
Section 7.5.5, The MySQL Query Cache
--without-server
Section 2.10.5, MIT-pthreads Notes
Section 2.10.2, Typical configure Options
--write-binlog
Description
--xml
Section 4.5.1.1, mysql Options
Description
Description
Section 11.10, XML Functions
-1
Section 1.7.5.6, '--' as the Start of a Comment
Section 18.2.3, HASH Partitioning
Section 11.2.3, Comparison Functions and Operators
Description
Section 11.5.2, Mathematical Functions
Section 11.11.4, Miscellaneous Functions
Section 11.4.1, String Comparison Functions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
-?
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 5.1.2, Server Command Options
Section 4.2.3.1, Using Options on the Command Line
-A
Section 4.5.1.1, mysql Options
Description
Description
Description
-A[value]
Section 4.6.3.4, Other myisamchk Options
-B
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Description
Description
-C
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
-C charset_name
Section 5.1.2, Server Command Options
-D
Description
Description
-D character
Description
Option Index
3403
-D db_name
Section 4.5.1.1, mysql Options
-DBIG_TABLES
Section 2.10.2, Typical configure Options
-DHAVE_rts_threads
Section 22.5.4, Comments about RTS Threads
-DUSE_ALARM_THREAD
Section 22.1.1, MySQL Threads
-DUSE_SYMDIR
Section 7.6.1.3, Using Symbolic Links for Databases on Windows
-E
Section 4.5.1.1, mysql Options
Description
Description
-F
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.2, mysql Commands
Description
Description
-F str
Description
-G
Section 4.5.1.1, mysql Options
-H
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
-H host_name
Description
-I
Section 21.10.16, Building Client Programs
Description
Description
Description
Description
-I/usr/local/mysql/include
Section 21.10.16, Building Client Programs
-K
Description
-L
Section 4.5.1.1, mysql Options
Section 21.10.16, Building Client Programs
Description
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Section 9.3, Setting the Error Message Language
-L/lib
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
-L/usr/lib
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
-L/usr/lib/gcc-lib/... -lgcc
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
-L/usr/local/mysql/lib -
lmysqlclient -lz
Section 21.10.16, Building Client Programs
-Lpath
Section 2.13.1.3, Linux Source Distribution Notes
Section 2.13.3, Solaris Notes
-N
Section 4.5.1.1, mysql Options
-O
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
-O var_name=value
Section 7.5.3, Tuning Server Parameters
-O back_log=50
Section 2.13.3, Solaris Notes
-O thread_stack=192K
Section 2.13.1.5, Linux x86 Notes
-O0
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 2.10.4, Dealing with Problems Compiling MySQL
-O2
Section 2.13.5.3, IBM-AIX notes
-O3
Section 2.13.5.6, Alpha-DEC-OSF/1 Notes
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 2.13.5.3, IBM-AIX notes
-O6
Section 2.13.5.1, HP-UX Version 10.20 Notes
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
-P
Option Index
3404
Section 4.2.2, Connecting to the MySQL Server
Description
Section 4.2.1, Invoking MySQL Programs
Section 4.6.10.1, MySQL Instance Manager Command Options
-P port_num
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.1.2, Server Command Options
-P[password]
Description
-Q
Description
-R
Description
Description
Description
-R N
Section 4.6.3.4, Other myisamchk Options
-R index_num
Section 6.4.4, Table Optimization
-R record_pos_file record_pos
Description
-RELEASE
Section 2.13.4.1, FreeBSD Notes
-S
Section 4.5.1.2, mysql Commands
Section 4.2.1, Invoking MySQL Programs
Section 4.6.3.4, Other myisamchk Options
Section 6.4.4, Table Optimization
-S file_name
Section 4.2.2, Connecting to the MySQL Server
-S path
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
-T
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
-T [flags]
Section 5.1.2, Server Command Options
-T path
Description
Description
-U
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.1, mysql Options
-U user_name
Description
-V
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 5.1.2, Server Command Options
Section 4.2.3.1, Using Options on the Command Line
-W
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
-W [level]
Section 5.1.2, Server Command Options
Option Index
3405
-Wa,-many
Section 2.13.5.3, IBM-AIX notes
-
Wl,r/full/path/to/libmysqlclie
nt.so
Section 2.13.1.3, Linux Source Distribution Notes
Section 2.13.3, Solaris Notes
-X
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
Description
-Xc
Section 2.13.3, Solaris Notes
-Y
Description
Section 1.4.1, What Is New in MySQL 5.1
-a
Section 17.7.2, Commands in the MySQL Cluster Management Client
Description
Description
Description
Section 4.6.3.4, Other myisamchk Options
Section 6.4.4, Table Optimization
-arch generic
Section 2.13.1.7, Linux Alpha Notes
-arch generic
Section 2.13.1.7, Linux Alpha Notes
-b
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
-b path
Section 5.1.2, Server Command Options
-b offset
Section 4.6.3.4, Other myisamchk Options
-c
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Section A.10, MySQL 5.1 FAQ MySQL Cluster
-c N
Description
Description
Description
-c column_list
Description
-c connect_string
Section 17.6.23, Options Common to MySQL Cluster Programs
-c file_name
Description
-d
Section 4.6.3.1, myisamchk General Options
Description
Description
Description
Description
Description
Description
Description
Section 4.6.3.4, Other myisamchk Options
-d db_name
Description
Description
-e
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.3, myisamchk Repair Options
Description
Description
Description
Section 6.4.2, How to Check MyISAM Tables for Errors
Section 17.6.23, Options Common to MySQL Cluster Programs
Section 17.2.6, Safe Shutdown and Restart of MySQL Cluster
Section 4.2.3.1, Using Options on the Command Line
Section 17.7.3.2, Using The MySQL Cluster Management Client to
Create a Backup
-e command
Section 17.6.23, Options Common to MySQL Cluster Programs
-e engine_name
Description
-e file_name
Description
-e num
Description
Option Index
3406
-e statement
Section 4.5.1.1, mysql Options
-eis
Section 6.4.5, Getting Information About a Table
-f
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 17.2.4, Initial Startup of MySQL Cluster
Section A.10, MySQL 5.1 FAQ MySQL Cluster
-f N
Description
-f filename
Description
-fast
Section 2.13.1.7, Linux Alpha Notes
-felide-constructors
Section 2.10, MySQL Installation Using a Source Distribution
-fno-exceptions
Section 2.13.5.3, IBM-AIX notes
Section 2.10, MySQL Installation Using a Source Distribution
-fno-inline
Section 2.10.4, Dealing with Problems Compiling MySQL
-fno-rtti
Section 2.10, MySQL Installation Using a Source Distribution
-fomit-frame-pointer
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 2.1.2.4, MySQL Binaries Compiled by Sun Microsystems,
Inc.
Section 22.5.1.5, Using a Stack Trace
-fomit-frame-pointer -
ffixed-ebp
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
-g
Section 4.5.1.1, mysql Options
Section 22.5.1.1, Compiling MySQL for Debugging
Description
-g pattern
Description
-g suffix
Description
-h
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Section 4.2.1, Invoking MySQL Programs
Section 2.10.5, MIT-pthreads Notes
-h host_name
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
-h localhost
Section 4.2.3.1, Using Options on the Command Line
-h path
Section 5.1.2, Server Command Options
-hlocalhost
Section 4.2.3.1, Using Options on the Command Line
-i
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.1, mysql Options
Section 17.7.2, Commands in the MySQL Cluster Management Client
Description
Description
Description
Description
Section 6.4.2, How to Check MyISAM Tables for Errors
Section 22.5.1.3, Using pdb to create a Windows crashdump
-i N
Description
-i delay
Option Index
3407
Description
-i name
Description
-j N
Description
-j big_tbl_name
Description
-k
Description
-k val
Section 4.6.3.3, myisamchk Repair Options
-l
Section 4.6.3.3, myisamchk Repair Options
Description
Description
Description
Description
Description
Section 5.2.3, The General Query Log
-l [file_name]
Section 5.1.2, Server Command Options
Section 5.2.3, The General Query Log
-l lock_type
Description
-l path
Description
-ldbug
Section 21.10.17, How to Make a Threaded Client
-lg++
Section 2.10.4, Dealing with Problems Compiling MySQL
-lgcc
Section 2.13.3, Solaris Notes
-lgthreads -lsocket -lgthreads
Section 2.13.5.8, SCO UNIX and OpenServer 5.0.x Notes
-libmysqlclient
Section 21.10.2, C API Function Overview
-libmysqld
Section 21.10.2, C API Function Overview
-lm
Section 21.10.10.4, Problems Linking with the C API
-lmach -lexc
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
-lmysqlclient
Section 21.10.3.39, mysql_library_end()
Section 21.10.9, C API Embedded Server Function Descriptions
-lmysqlclient -lz
Section 21.10.16, Building Client Programs
-lmysqld
Section 21.10.3.39, mysql_library_end()
Section 21.10.9, C API Embedded Server Function Descriptions
-lmystrings
Section 21.10.17, How to Make a Threaded Client
-lmysys
Section 21.10.17, How to Make a Threaded Client
-lpthread
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
-lz
Section 21.9.1, Compiling Programs with libmysqld
Section 2.15.3, Problems Using the Perl DBI/DBD Interface
Section 2.13.3.1, Solaris 2.7/2.8 Notes
Section 2.13.3, Solaris Notes
-m
Section 4.6.3.2, myisamchk Check Options
Section 4.5.1.1, mysql Options
Description
Description
-m64
Section 2.10, MySQL Installation Using a Source Distribution
Section 2.13.3, Solaris Notes
-max
Section 2.3.8, Selecting a MySQL Server Type
-mcpu
Section 2.13.3, Solaris Notes
-mcpu=v8 -Wa,-xarch=v8plusa
Section 2.13.3, Solaris Notes
-mcpu=v8 -Wa,-xarch=v8plusa
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
-mcpu=xxx
Section 2.13.5.3, IBM-AIX notes
Option Index
3408
-mt
Section 2.13.3, Solaris Notes
-n
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Section 17.7.2, Commands in the MySQL Cluster Management Client
Description
Description
Description
Description
Description
Description
Description
-n N
Description
-n file_name
Description
-nocheck
Description
-noprint
Description
-nt
Section 2.3.8, Selecting a MySQL Server Type
-o
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Section 21.9.1, Compiling Programs with libmysqld
Description
Description
-o async
Section 7.6, Disk Issues
-o N
Description
-o index_name
Description
-o noatime
Section 7.6, Disk Issues
-o offset
Description
-p
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 5.5.2, Adding User Accounts
Section 5.4.7, Causes of Access-Denied Errors
Section 4.2.2, Connecting to the MySQL Server
Section 3.3.1, Creating and Selecting a Database
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 5.5.6.2, End-User Guidelines for Password Security
Section 2.8, Installing MySQL on NetWare
Section 4.6.10.4, Instance Manager User and Password Management
Section 4.2.1, Invoking MySQL Programs
Section B.1.2.5, Password Fails When Entered Interactively
Section 2.3.11, Starting MySQL as a Windows Service
Section 2.3.10, Starting MySQL from the Windows Command Line
Section 2.3.12, Testing The MySQL Installation
Section 2.3.14, Upgrading MySQL on Windows
Section 5.5.1, User Names and Passwords
Section 4.2.3.1, Using Options on the Command Line
Section 2.11.1, Windows Post-Installation Procedures
-p N
Description
-p num
Description
-p password
Section 4.6.10.1, MySQL Instance Manager Command Options
-p[pass_val]
Section 4.2.2, Connecting to the MySQL Server
-p[password]
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
-ppass_val
Section 4.2.3.1, Using Options on the Command Line
-ppassword
Description
-pthread
Section 2.13.5.5, Alpha-DEC-UNIX Notes (Tru64)
Option Index
3409
-pyour_pass
Section 5.5.6.2, End-User Guidelines for Password Security
-q
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
-q value
Description
-qstrict
Section 2.13.5.3, IBM-AIX notes
-r
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.3, myisamchk Repair Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Section 6.4.3, How to Repair Tables
-r -q
Section 6.4.3, How to Repair Tables
-r file_name
Description
-r name
Description
-r path
Section 5.1.2, Server Command Options
-rdynamic
Section 22.3.2, Adding a New User-Defined Function
-s
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 6.4.2, How to Check MyISAM Tables for Errors
Section 6.4.3, How to Repair Tables
Section 6.4.6, Setting Up a Table Maintenance Schedule
-s file_name
Description
-s num
Description
-s sort_type
Description
-server
Section 2.4, Installing MySQL from RPM Packages on Linux
-skip-auto-rehash
Section 4.5.1.1, mysql Options
-slow_query_log_file
Section 5.1.2, Server Command Options
-ss
Section 4.6.3.1, myisamchk General Options
-static
Section 7.5.1, How Compiling and Linking Affects the Speed of
MySQL
Section 2.13.1.2, Linux Binary Distribution Notes
-t
Section 4.5.1.1, mysql Options
Description
Description
Description
Description
Description
Description
Description
Description
-t N
Description
-t path
Section 4.6.3.3, myisamchk Repair Options
Section 5.1.2, Server Command Options
-t seconds
Description
-u
Section 4.6.3.3, myisamchk Repair Options
Description
Description
Description
Section 4.6.10.4, Instance Manager User and Password Management
Option Index
3410
Section 4.2.1, Invoking MySQL Programs
Section 2.3.12, Testing The MySQL Installation
Section 5.5.1, User Names and Passwords
Section 2.11.1, Windows Post-Installation Procedures
-u {user_name|user_id}
Section 5.1.2, Server Command Options
-u user_name
Section 4.5.1.1, mysql Options
Section 4.2.2, Connecting to the MySQL Server
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 4.6.10.1, MySQL Instance Manager Command Options
-v
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Section 4.6.7.2, mysqlbinlog Row Event Display
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Section 6.4.5, Getting Information About a Table
Section 6.4.2, How to Check MyISAM Tables for Errors
Section 5.1.2, Server Command Options
Section 4.2.3.1, Using Options on the Command Line
-v -v -v
Section 4.5.1.1, mysql Options
-vv
Section 4.6.3.1, myisamchk General Options
-vvv
Section 4.6.3.1, myisamchk General Options
-w
Section 4.6.3.1, myisamchk General Options
Section 4.5.1.1, mysql Options
Description
-w 'where_condition'
Description
-w write_file
Description
-w[count]
Description
-x
Description
Description
-x N
Description
-y N
Description
-z
Description
Description
Aborted_connects
Section B.1.2.11, Communication Errors and Aborted Connections
CFLAGS
Section 2.13.3, Solaris Notes
Com_dealloc_sql
Section 5.1.7, Server Status Variables
Com_delete
Section 5.1.7, Server Status Variables
Com_execute_sql
Section 5.1.7, Server Status Variables
Com_insert
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.7, Server Status Variables
Com_prepare_sql
Section 5.1.7, Server Status Variables
Com_select
Section 7.5.5.1, How the Query Cache Operates
Section 7.5.5.4, Query Cache Status and Maintenance
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.7, Server Status Variables
Com_stmt_close
Section 5.1.7, Server Status Variables
Com_stmt_execute
Option Index
3411
Section 5.1.7, Server Status Variables
Com_stmt_fetch
Section 5.1.7, Server Status Variables
Com_stmt_prepare
Section 5.1.7, Server Status Variables
Com_stmt_reprepare
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 5.1.7, Server Status Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Com_stmt_reset
Section 5.1.7, Server Status Variables
Com_stmt_send_long_data
Section 5.1.7, Server Status Variables
HELP
Section 17.7.2, Commands in the MySQL Cluster Management Client
Ndb_cluster_node_id
Section 17.4.2, mysqld Command Options for MySQL Cluster
ON
Section 3.3.4.9, Using More Than one Table
Queries
Section 5.1.7, Server Status Variables
Questions
Section 5.1.7, Server Status Variables
Slave_running
Section 5.1.7, Server Status Variables
\G
Section 4.5.1.1, mysql Options
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Description
Section 1.6, How to Report Bugs or Problems
\P
Section 4.5.1.2, mysql Commands
\c
Section 4.5.1.2, mysql Commands
Section 3.2, Entering Queries
\q
Section 4.5.1.1, mysql Options
Section 3.1, Connecting to and Disconnecting from the Server
\s
Section 4.5.1.2, mysql Commands
Section 4.2.3.3, Using Option Files
Section 5.5.7.2, Using SSL Connections
\t
Section 4.5.1.2, mysql Commands
Section 4.5.1.1, mysql Options
Section 12.2.6, LOAD DATA INFILE Syntax
Description
Section 8.1.1, Strings
Section 4.2.3.3, Using Option Files
\w
Section 4.5.1.2, mysql Commands
all
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 16.1.3.3, Replication Slave Options and Variables
Section 2.10.2, Typical configure Options
analyze
Section 12.5.2.1, ANALYZE TABLE Syntax
ansi
Description
backup
Section 12.5.2.2, BACKUP TABLE Syntax
backup_path
Description
backup_path=
Description
basedir
Section 2.3.7, Creating an Option File
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.3.13, Troubleshooting a MySQL Installation Under Win-
dows
binlog_format
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.2, Server Command Options
c
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.17, CREATE TABLE Syntax
Description
Section 8.2.1, Identifier Qualifiers
Section 3.3.4.7, Pattern Matching
Section 11.4.2, Regular Expressions
Section 9.1.12.1, Unicode Character Sets
charset
Section 4.5.1.2, mysql Commands
Option Index
3412
Section 9.1.4, Connection Character Sets and Collations
check
Section 12.5.2.3, CHECK TABLE Syntax
col
Section 16.1.3.2, Replication Master Options and Variables
compress
Section 21.10.3.49, mysql_options()
Section B.1.3.1, Problems Linking to the MySQL Client Library
connect
Section B.1.3.1, Problems Linking to the MySQL Client Library
connect_timeout
Section 4.5.1.1, mysql Options
Description
count
Section 12.5.5.16, SHOW ENGINE Syntax
Section 8.2.4, Function Name Parsing and Resolution
Section 5.1.8, Server SQL Modes
csv
Section 2.10.2, Typical configure Options
d
Section 12.1.7, ALTER TABLE Syntax
Section 7.2.9, LEFT JOIN and RIGHT JOIN Optimization
Section 11.4.2, Regular Expressions
Section 22.5.3, The DBUG Package
Section 9.1.12.1, Unicode Character Sets
daemon
Section 17.3.4.5, Defining a MySQL Cluster Management Server
data
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 18.3.1, Management of RANGE and LIST Partitions
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 12.4.7.1, XA Transaction SQL Syntax
datadir
Section 2.3.7, Creating an Option File
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
Section 2.3.13, Troubleshooting a MySQL Installation Under Win-
dows
Section D.7.3, Windows Platform Limitations
date
Section 11.6, Date and Time Functions
db
Section 12.5.1.3, GRANT Syntax
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 21.10.3.3, mysql_change_user()
Section 21.10.3.8, mysql_create_db()
Section 21.10.3.11, mysql_drop_db()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.60, mysql_select_db()
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section 21.10.1, C API Data Types
Section 5.4.7, Causes of Access-Denied Errors
Section 2.12.5, Copying MySQL Databases to Another Machine
Description
Section 7.5.6, Examining Thread Information
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section D.6, Restrictions on Character Sets
Section 20.22, The INFORMATION_SCHEMA PROCESSLIST Table
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
Section 2.11.2, Unix Post-Installation Procedures
dbname
Section A.5, MySQL 5.1 FAQ Triggers
debug
Section 21.10.3.49, mysql_options()
Description
decode_bits
Section 4.6.3.1, myisamchk General Options
default-storage-engine
Section 13.3, Setting the Storage Engine
Chapter 13, Storage Engines
default-table-type
Section 13.3, Setting the Storage Engine
Chapter 13, Storage Engines
defaults-extra-file
Section 4.2.3.3, Using Option Files
delimiter
Section 4.5.1.2, mysql Commands
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 19.1, Defining Stored Programs
description
Section 12.3.3, HELP Syntax
e
Section B.1.5.1, Case Sensitivity in String Searches
event-scheduler
Section 5.1.2, Server Command Options
exit
Section 22.5.3, The DBUG Package
Option Index
3413
extended-status
Description
fields
Section 13.6.13.2.3, InnoDB Table Monitor Output
flush-hosts
Section 12.5.6.3, FLUSH Syntax
Description
Section 5.4.1, Privileges Provided by MySQL
flush-logs
Section 12.5.6.3, FLUSH Syntax
Description
Section 5.4.1, Privileges Provided by MySQL
flush-privileges
Section 12.5.6.3, FLUSH Syntax
Description
Section 5.4.1, Privileges Provided by MySQL
flush-status
Section 12.5.6.3, FLUSH Syntax
Description
Section 5.4.1, Privileges Provided by MySQL
flush-tables
Section 12.5.6.3, FLUSH Syntax
Description
Section 5.4.1, Privileges Provided by MySQL
flush-threads
Description
Section 5.4.1, Privileges Provided by MySQL
forcedirectio
Section 2.13.3, Solaris Notes
ft_max_word_len
Section 4.6.3.1, myisamchk General Options
ft_min_word_len
Section 4.6.3.1, myisamchk General Options
ft_stopword_file
Section 4.6.3.1, myisamchk General Options
general_log
Section 5.1.4, Server System Variables
have_partition_engine
Chapter 18, Partitioning
Section 5.1.4, Server System Variables
help
Section 4.5.1.2, mysql Commands
Section 4.5.1.3, mysql Server-Side Help
host
Section 12.5.1.3, GRANT Syntax
Section 21.10.3.7, mysql_connect()
Section 21.10.3.52, mysql_real_connect()
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.4.7, Causes of Access-Denied Errors
Section 3.1, Connecting to and Disconnecting from the Server
Section 13.6.4.2, Converting Tables from Other Storage Engines to
InnoDB
Section 2.12.5, Copying MySQL Databases to Another Machine
Description
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 2.11.2, Unix Post-Installation Procedures
html
Description
init-file
Section 7.4.5.2, Multiple Key Caches
initial
Section 17.7.5.1, MySQL Cluster Messages in the Cluster Log
innodb
Section 5.1.3, Server Options for Loading Plugins
innodb_file_per_table
Section 13.6.13.2.2, InnoDB Tablespace Monitor Output
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
innodb_status_file=1
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
innodb_table_locks
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
key_buffer_size
Section 4.6.3.2, myisamchk Check Options
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.3, myisamchk Repair Options
language
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
ledir
Description
Description
length
Section 21.10.3.34, mysql_hex_string()
Section 21.10.3.53, mysql_real_escape_string()
Section 21.10.3.54, mysql_real_query()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.20, mysql_stmt_prepare()
Option Index
3414
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 21.10.5, C API Prepared Statement Data types
Section 22.2.3.3, Creating a Plugin Library
Section 22.2.3.2, Type-Specific Plugin Structures and Functions
local
Section 5.1.6.1, Structured System Variables
local-infile
Section 5.3.4, Security Issues with LOAD DATA LOCAL
log
Section 2.10.3, Installing from the Development Source Tree
log_backup_output
Section 5.1.4, Server System Variables
log_bin_trust_routine_creators
Section 16.1.3.4, Binary Log Options and Variables
Section 1.4.2, What Is Planned for MySQL 6.0
max_allowed_packet
Section 4.5.1.1, mysql Options
Description
Section 4.2.3.4, Using Options to Set Program Variables
multi_range_count
Section 17.4.3, MySQL Cluster System Variables
Section 5.1.4, Server System Variables
myisam_block_size
Section 4.6.3.1, myisamchk General Options
myisam_stats_method
Section 4.6.3.1, myisamchk General Options
myisamchk
Section 4.6.3.4, Other myisamchk Options
mysql
Section 4.5.1.3, mysql Server-Side Help
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.1.16, CREATE SERVER Syntax
Section 12.5.1.1, CREATE USER Syntax
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 12.5.3.2, DROP FUNCTION Syntax
Section 12.5.1.2, DROP USER Syntax
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.3.3, HELP Syntax
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section B.1.2.9, MySQL server has gone away
Section 12.5.1.4, RENAME USER Syntax
Section 12.5.1.5, REVOKE Syntax
Section 12.5.1.6, SET PASSWORD Syntax
Section 12.5.5.22, SHOW GRANTS Syntax
Section 21.10.3.3, mysql_change_user()
Section 21.10.3.5, mysql_close()
Section 21.10.3.14, mysql_errno()
Section 21.10.3.15, mysql_error()
Section 21.10.3.33, mysql_get_ssl_cipher()
Section 21.10.3.36, mysql_init()
Section 21.10.3.53, mysql_real_escape_string()
Section 21.10.3.60, mysql_select_db()
Section 21.10.3.67, mysql_ssl_set()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.25, mysql_stmt_send_long_data()
Section 5.4.4, Access Control, Stage 1: Connection Verification
Section 12.5.1, Account Management Statements
Section 5.5.2, Adding User Accounts
Section 5.5.6.1, Administrator Guidelines for Password Security
Section 5.5.5, Assigning Account Passwords
Section 6.2.1, Backup Policy
Section 21.10.14, C API Prepared Statement Handling of Date and
Time Values
Section 5.4.7, Causes of Access-Denied Errors
Section 22.2.1, Characteristics of the Plugin Interface
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Chapter 21, Connectors and APIs
Section 13.6.4.2, Converting Tables from Other Storage Engines to
InnoDB
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 13.11.2.1, Creating a FEDERATED Table Using
CONNECTION
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 3.3, Creating and Using a Database
Section 8.2, Schema Object Names
Section 17.3.4.7, Defining SQL and Other API Nodes in a MySQL
Cluster
Description
Section 2.12.2, Downgrading MySQL
Section 7.5.9, Enabling Large Page Support
Section 5.3.1, General Security Guidelines
Section 7.5.5.1, How the Query Cache Operates
Section 2.9, Installing MySQL from tar.gz Packages on Other Unix-
Like Systems
Section 2.4, Installing MySQL from RPM Packages on Linux
Section 2.5, Installing MySQL on Mac OS X
Section 2.6, Installing MySQL on Solaris
Section 5.5.4, Limiting Account Resources
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 5.3.2, Making MySQL Secure Against Attackers
Section 1.4.1, What Is New in MySQL 5.1
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 17.2.2, MySQL Cluster Multi-Computer Installation
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section 21.11, MySQL PHP API
Section 9.7, MySQL Server Time Zone Support
Section 12.4.5.3, Other Table-Locking Notes
Section 4.1, Overview of MySQL Programs
Section 5.5.6.3, Password Hashing in MySQL
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 2.11.2.1, Problems Running mysql_install_db
Section 16.3.1.9, Replication and FLUSH
Section 16.3.1.17, Replication of the System mysql Database
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section 13.6.14, Restrictions on InnoDB Tables
Option Index
3415
Section D.6, Restrictions on Character Sets
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 2.13.5.9, SCO OpenServer 6.0.x Notes
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.9, Server-Side Help
Section 2.10.1, Source Installation Overview
Section 5.6.1.1, Starting Multiple Windows Servers at the Command
Line
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.11.2.3, Starting and Troubleshooting the MySQL Server
Section 12.4.3, Statements That Cause an Implicit Commit
Section 9.7.1, Staying Current with Time Zone Changes
Section 5.4, The MySQL Access Privilege System
Section 22.2, The MySQL Plugin Interface
Section 2.3.13, Troubleshooting a MySQL Installation Under Win-
dows
Section 2.11.2, Unix Post-Installation Procedures
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.5.1, User Names and Passwords
Section 4.2.3.1, Using Options on the Command Line
Section 13.6.2.2, Using Raw Devices for the Shared Tablespace
Section 5.5.7.2, Using SSL Connections
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
Section 19.2, Using Stored Routines (Procedures and Functions)
Section 2.11.1, Windows Post-Installation Procedures
mysql.server
Section 12.1.16, CREATE SERVER Syntax
mysqlbinlog
Section 12.5.5.3, SHOW BINLOG EVENTS Syntax
Section 6.3, Point-in-Time Recovery
mysqld
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 21.10.2, C API Function Overview
Description
Description
Description
Section 13.11.1, FEDERATED Storage Engine Overview
Section 2.7, Installing MySQL on i5/OS
Section 5.2.4.3, Mixed Binary Logging Format
Section 17.4.1, MySQL Cluster Server Option and Variable Reference
Section 4.6.10.7, MySQL Instance Manager Commands
Section 5.1.1, Server Option and Variable Reference
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
Section 5.2.2, The Error Log
Section 16.4.2.2, The Slave Status Files
Section 22.5.1.3, Using pdb to create a Windows crashdump
mysqld-path
Section 4.6.10.1, MySQL Instance Manager Command Options
mysqld-
path=path-to-mysqld-binary
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
mysqld_safe
Description
Description
Section 5.2.2, The Error Log
ndb-connectstring
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 17.2.3, MySQL Cluster Multi-Computer Configuration
Section 17.6.1, MySQL Server Usage for MySQL Cluster
ndb_mgmd
Description
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
ndb_optimization_delay
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
ndb_restore
Description
ndbd
Description
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
net_retry_count
Section 16.4.1, Replication Implementation Details
net_write_timeout
Section 16.4.1, Replication Implementation Details
nice
Description
nodeid
Description
nonguarded
Description
offset
Section 21.10.3.9, mysql_data_seek()
Section 21.10.3.23, mysql_field_seek()
Section 21.10.3.58, mysql_row_seek()
Section 21.10.7.7, mysql_stmt_data_seek()
Section 21.10.7.12, mysql_stmt_fetch_column()
Section 21.10.7.23, mysql_stmt_row_seek()
one-thread
Option Index
3416
Section 5.1.4, Server System Variables
open_files_limit
Description
Section D.7.3, Windows Platform Limitations
optimize
Section 12.5.2.5, OPTIMIZE TABLE Syntax
p
Section 12.2.1, CALL Syntax
Section 18.2.6, How MySQL Partitioning Handles NULL
Section 19.2.1, Stored Routine Syntax
Section 22.5.3, The DBUG Package
password
Description
pid-file
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 5.2.4, The Binary Log
ping
Description
Section 16.3.5, Troubleshooting Replication
pipe
Section 21.10.3.49, mysql_options()
port
Section 21.10.3.52, mysql_real_connect()
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
print
Section 11.4.2, Regular Expressions
processlist
Description
prompt
Section 4.5.1.2, mysql Commands
quick
Section 4.2.3.3, Using Option Files
quit
Section 4.5.1.1, mysql Options
raw
Section 13.6.2.2, Using Raw Devices for the Shared Tablespace
read_buffer_size
Section 4.6.3.1, myisamchk General Options
reconnect
Section B.1.2.9, MySQL server has gone away
Section 21.10.3.52, mysql_real_connect()
Section 21.10.2, C API Function Overview
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
record_buffer
Section 7.5.8, How MySQL Uses Memory
Section 7.5.3, Tuning Server Parameters
refresh
Description
Section 5.4.1, Privileges Provided by MySQL
rehash
Section 4.5.1.1, mysql Options
relay_log_recovery
Section 16.1.3.3, Replication Slave Options and Variables
reload
Description
Section 5.4.1, Privileges Provided by MySQL
repair
Section 12.5.2.6, REPAIR TABLE Syntax
replication-ignore-table
Section 16.3.1.29, Replication and Views
resolve_stack_dump
Section B.1.4.2, What to Do If MySQL Keeps Crashing
resolveip
Section 2.13.1.2, Linux Binary Distribution Notes
rows
Section 18.3.4, Obtaining Information About Partitions
Section 7.2.1, Optimizing Queries with EXPLAIN
s
Description
Section 11.4.2, Regular Expressions
Section 9.1.12.1, Unicode Character Sets
select_limit
Section 4.5.1.1, mysql Options
server-id
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
Section 16.1.3.2, Replication Master Options and Variables
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.1.1.8, Setting Up Replication with Existing Data
Section 16.1.1.2, Setting the Replication Master Configuration
Section 16.1.1.3, Setting the Replication Slave Configuration
server-id=3
Option Index
3417
Section 16.1.3.3, Replication Slave Options and Variables
set-variable=option=value
Section 4.2.3.4, Using Options to Set Program Variables
shutdown
Description
Section 2.13.5.10, SCO UnixWare 7.1.x and OpenUNIX 8.0.0 Notes
shutdown_timeout
Description
skip-networking
Section 16.3.4, Replication FAQ
Section 16.1.1.2, Setting the Replication Master Configuration
Section 16.3.5, Troubleshooting Replication
slave
Section 1.2, Typographical and Syntax Conventions
slave_exec_mode
Section 16.1.3.3, Replication Slave Options and Variables
slave_net_timeout
Section 16.1.3.3, Replication Slave Options and Variables
slave_skip_errors
Section 16.1.3.3, Replication Slave Options and Variables
slave_transaction_retries
Section 16.1.3.3, Replication Slave Options and Variables
slow_query_log
Section 5.1.4, Server System Variables
sort
Section 11.12.3, GROUP BY and HAVING with Hidden Columns
sort_buffer_size
Section 4.6.3.1, myisamchk General Options
Section 4.6.3.3, myisamchk Repair Options
sort_key_blocks
Section 4.6.3.1, myisamchk General Options
source
Section 4.5.1.4, Executing SQL Statements from a Text File
Section 3.5, Using mysql in Batch Mode
sql-mode=""
Section 5.1.8, Server SQL Modes
sql-mode="modes"
Section 5.1.8, Server SQL Modes
sql_big_tables
Section 7.5.8, How MySQL Uses Memory
Section 5.1.5, Session System Variables
sql_low_priority_updates
Section 5.1.4, Server System Variables
sql_max_join_size
Section 5.1.4, Server System Variables
sql_slave_skip_counter
Section 16.1.3.3, Replication Slave Options and Variables
start-slave
Description
stats_method
Section 4.6.3.1, myisamchk General Options
status
Section 4.5.1.2, mysql Commands
Section 12.5.2.1, ANALYZE TABLE Syntax
Section 12.5.2.2, BACKUP TABLE Syntax
Section 12.5.2.3, CHECK TABLE Syntax
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 12.5.2.6, REPAIR TABLE Syntax
Section 12.5.2.7, RESTORE TABLE Syntax
Description
Section 4.6.10.5, MySQL Server Instance Status Monitoring
stop-slave
Description
syslog
Section 17.3.4.5, Defining a MySQL Cluster Management Server
Description
Section 17.7.4, Event Reports Generated in MySQL Cluster
Section 17.7.4.1, MySQL Cluster Logging Management Commands
Section 5.2.2, The Error Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
system
Chapter 20, INFORMATION_SCHEMA Tables
tab
Section 11.4.2, Regular Expressions
table
Section 21.10.1, C API Data Types
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.8, Subqueries in the FROM clause
test
Section 12.2.2, DELETE Syntax
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 13.6.13.2.3, InnoDB Table Monitor Output
Section 12.5.5.19, SHOW EVENTS Syntax
Section 11.3, Control Flow Functions
Section 13.6.4, Creating and Using InnoDB Tables
Option Index
3418
Section 3.3, Creating and Using a Database
Description
Section 3.6, Examples of Common Queries
Section 8.2.4, Function Name Parsing and Resolution
Section 4.2.1, Invoking MySQL Programs
Section 16.1.3.3, Replication Slave Options and Variables
Section 2.11.3, Securing the Initial MySQL Accounts
Section 19.2.1, Stored Routine Syntax
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
Section 2.11.2, Unix Post-Installation Procedures
Section 4.2.3.1, Using Options on the Command Line
timeout
Section 21.10.3.49, mysql_options()
tmpdir
Section 4.6.3.3, myisamchk Repair Options
Section B.1.2.13, Can't create/write to file
Section 7.2.13, ORDER BY Optimization
Section 6.1, Database Backups
Section 2.3, Installing MySQL on Windows
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
type
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 13.6.13.2.3, InnoDB Table Monitor Output
Section 21.10.1, C API Data Types
Section 22.2.3.1, General Plugin Structures and Functions
Section 7.2.19, How to Avoid Table Scans
Section 7.2.6, Index Merge Optimization
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
Section 22.2.3.2, Type-Specific Plugin Structures and Functions
update
Section 7.5.6.3, Delayed-Insert Thread States
Description
use-manager
Section 4.6.10.3, Starting the MySQL Server with MySQL Instance
Manager
user
Section B.1.2.15, Ignoring user
Section 21.10.3.49, mysql_options()
Section 21.10.3.52, mysql_real_connect()
Section 5.4.4, Access Control, Stage 1: Connection Verification
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section 5.5.5, Assigning Account Passwords
Section 5.5.9, Auditing MySQL Account Activity
Section 5.4.7, Causes of Access-Denied Errors
Section 3.1, Connecting to and Disconnecting from the Server
Section 13.6.4.2, Converting Tables from Other Storage Engines to
InnoDB
Section 2.12.5, Copying MySQL Databases to Another Machine
Section 17.3.4.5, Defining a MySQL Cluster Management Server
Description
Section 11.11.2, Encryption and Compression Functions
Section 5.3.1, General Security Guidelines
Section 5.3.5, How to Run MySQL as a Normal User
Section 5.5.4, Limiting Account Resources
Section 5.3.2, Making MySQL Secure Against Attackers
Section 5.5.6.3, Password Hashing in MySQL
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section D.6, Restrictions on Character Sets
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.1.2, Server Command Options
Section 5.4.3, Specifying Account Names
Section 2.11.2.2, Starting and Stopping MySQL Automatically
Section 2.11.2, Unix Post-Installation Procedures
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.5.1, User Names and Passwords
Section 5.5.7.2, Using SSL Connections
Section 11.10, XML Functions
v
Section 12.1.20, CREATE VIEW Syntax
Section 16.3.1.10, Replication and System Functions
variables
Description
version
Description
Section 22.2.3.1, General Plugin Structures and Functions
Section 5.1.4, Server System Variables
write
Section 22.5.4, Comments about RTS Threads
Description
write_buffer_size
Section 4.6.3.1, myisamchk General Options
Option Index
3419
Privileges Index
ALL
Section 5.4.1, Privileges Provided by MySQL
ALL PRIVILEGES
Section 5.4.1, Privileges Provided by MySQL
ALL [PRIVILEGES]
Section 5.4.1, Privileges Provided by MySQL
ALTER
Section 12.1.1, ALTER DATABASE Syntax
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.1.33, RENAME TABLE Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
ALTER ROUTINE
Section 12.1.4, ALTER FUNCTION Syntax
Section 12.1.5, ALTER PROCEDURE Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.26, DROP PROCEDURE and DROP FUNCTION Syntax
Section 12.5.1.3, GRANT Syntax
Section 19.6, Binary Logging of Stored Programs
Section 5.4.1, Privileges Provided by MySQL
Section 5.1.4, Server System Variables
Section 19.2.2, Stored Routines and MySQL Privileges
CREATE
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.10, CREATE DATABASE Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.1.33, RENAME TABLE Syntax
Section 5.4.1, Privileges Provided by MySQL
CREATE ROUTINE
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.5.1.3, GRANT Syntax
Section 19.6, Binary Logging of Stored Programs
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 5.4.1, Privileges Provided by MySQL
Section 5.1.4, Server System Variables
Section 19.2.2, Stored Routines and MySQL Privileges
CREATE TABLESPACE
Section 12.5.1.3, GRANT Syntax
CREATE TEMPORARY TABLES
Section 12.1.17, CREATE TABLE Syntax
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
CREATE USER
Section 12.5.1.1, CREATE USER Syntax
Section 12.5.1.2, DROP USER Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.4, RENAME USER Syntax
Section 12.5.1.5, REVOKE Syntax
Section 5.4.1, Privileges Provided by MySQL
CREATE VIEW
Section 12.1.9, ALTER VIEW Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
Section D.4, Restrictions on Views
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
DELETE
Section 12.1.17, CREATE TABLE Syntax
Section 12.5.3.2, DROP FUNCTION Syntax
Section 12.5.1.2, DROP USER Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.2.7, REPLACE Syntax
Section 12.2.10, TRUNCATE Syntax
Section 12.5.3.4, UNINSTALL PLUGIN Syntax
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 5.4.1, Privileges Provided by MySQL
Section 13.8, The MERGE Storage Engine
Section 22.3.2.6, User-Defined Function Security Precautions
DROP
Section 12.1.9, ALTER VIEW Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.1.21, DROP DATABASE Syntax
Section 12.1.28, DROP TABLE Syntax
Section 12.1.31, DROP VIEW Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.1.33, RENAME TABLE Syntax
Section 12.2.10, TRUNCATE Syntax
Section 18.3.1, Management of RANGE and LIST Partitions
Section 5.4.1, Privileges Provided by MySQL
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
Section 5.4, The MySQL Access Privilege System
EVENT
Section 12.1.2, ALTER EVENT Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.22, DROP EVENT Syntax
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
EXECUTE
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 5.1.4, Server System Variables
Section 19.2.2, Stored Routines and MySQL Privileges
3420
FILE
Section 12.5.1.3, GRANT Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.2.8, SELECT Syntax
Section 5.4.7, Causes of Access-Denied Errors
Description
Section 5.3.2, Making MySQL Secure Against Attackers
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 16.1.3.3, Replication Slave Options and Variables
Section 11.4, String Functions
Section 10.4.3, The BLOB and TEXT Types
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
GRANT OPTION
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.5, REVOKE Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
INDEX
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
INSERT
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.2.1, ANALYZE TABLE Syntax
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.5.1.1, CREATE USER Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.2.5, INSERT Syntax
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 12.1.33, RENAME TABLE Syntax
Section 12.5.2.6, REPAIR TABLE Syntax
Section 12.2.7, REPLACE Syntax
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 13.4.1, Pluggable Storage Engine Architecture
Section 5.4.1, Privileges Provided by MySQL
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
Section 22.3.2.6, User-Defined Function Security Precautions
LOCK TABLES
Section 12.5.1.3, GRANT Syntax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Description
Section 5.4.1, Privileges Provided by MySQL
PROCESS
Section 12.5.1.3, GRANT Syntax
Section 12.5.6.4, KILL Syntax
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 5.5.2, Adding User Accounts
Section 7.5.6, Examining Thread Information
Section 5.3.2, Making MySQL Secure Against Attackers
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 5.4.1, Privileges Provided by MySQL
Section 20.22, The INFORMATION_SCHEMA PROCESSLIST Table
REFERENCES
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
RELOAD
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Section 12.5.6.6, RESET Syntax
Section 21.10.3.55, mysql_refresh()
Section 21.10.3.56, mysql_reload()
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Description
Description
Section 11.11.2, Encryption and Compression Functions
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
REPLICATION CLIENT
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
REPLICATION SLAVE
Section 12.5.1.3, GRANT Syntax
Section 16.1.1.1, Creating a User for Replication
Section 5.4.1, Privileges Provided by MySQL
Section 16.1.3.3, Replication Slave Options and Variables
SELECT
Section 12.5.2.1, ANALYZE TABLE Syntax
Section 12.5.2.4, CHECKSUM TABLE Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.2.5, INSERT Syntax
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 12.5.2.6, REPAIR TABLE Syntax
Section 12.5.5.12, SHOW CREATE TABLE Syntax
Privileges Index
3421
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 12.5.5.22, SHOW GRANTS Syntax
Section 12.2.11, UPDATE Syntax
Section 5.4.5, Access Control, Stage 2: Request Verification
Description
Description
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 5.4.1, Privileges Provided by MySQL
Section D.4, Restrictions on Views
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
Section 13.8, The MERGE Storage Engine
Section 5.4, The MySQL Access Privilege System
Section 19.3.1, Trigger Syntax
SHOW DATABASES
Section 12.5.1.3, GRANT Syntax
Section 12.5.5.15, SHOW DATABASES Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
SHOW VIEW
Section 12.5.1.3, GRANT Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 5.4.1, Privileges Provided by MySQL
Section D.4, Restrictions on Views
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
SHUTDOWN
Section 12.5.1.3, GRANT Syntax
Section 21.10.3.65, mysql_shutdown()
Section 5.4.5, Access Control, Stage 2: Request Verification
Description
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 5.1.11, The Shutdown Process
SUPER
Section 12.1.2, ALTER EVENT Syntax
Section 12.1.4, ALTER FUNCTION Syntax
Section 12.1.6, ALTER SERVER Syntax
Section 12.1.9, ALTER VIEW Syntax
Section 12.5.6.1, BINLOG Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.16, CREATE SERVER Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.1.22, DROP EVENT Syntax
Section 12.1.27, DROP SERVER Syntax
Section 12.1.30, DROP TRIGGER Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.6.4, KILL Syntax
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Section 12.4.6, SET TRANSACTION Syntax
Section 12.6.1.3, SET sql_log_bin Syntax
Section 12.5.4, SET Syntax
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section 12.6.2.7, START SLAVE Syntax
Section 12.6.2.8, STOP SLAVE Syntax
Section B.1.2.7, Too many connections
Section 21.10.3.12, mysql_dump_debug_info()
Section 16.1.3.4, Binary Log Options and Variables
Section 19.6, Binary Logging of Stored Programs
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Description
Section 11.11.2, Encryption and Compression Functions
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 16.1.1, How to Set Up Replication
Section 5.3.2, Making MySQL Secure Against Attackers
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 9.8, MySQL Server Locale Support
Section 9.7, MySQL Server Time Zone Support
Section 5.4.1, Privileges Provided by MySQL
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 5.2.4.2, Setting The Binary Log Format
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 5.2.4, The Binary Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.1.6, Using System Variables
TRIGGER
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.30, DROP TRIGGER Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section 5.4.1, Privileges Provided by MySQL
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
UPDATE
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.2.5, INSERT Syntax
Section 12.5.1.4, RENAME USER Syntax
Section 12.5.1.5, REVOKE Syntax
Section 12.2.11, UPDATE Syntax
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 5.4.1, Privileges Provided by MySQL
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
Section 13.8, The MERGE Storage Engine
Section 19.3.1, Trigger Syntax
USAGE
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
Privileges Index
3422
SQL Modes Index
ALLOW_INVALID_DATES
Section 10.3, Date and Time Types
Section B.1.5.2, Problems Using DATE Columns
Section 5.1.8, Server SQL Modes
Section 10.3.1, The DATETIME, DATE, and TIMESTAMP Types
ANSI
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 8.2.4, Function Name Parsing and Resolution
Section 5.1.8, Server SQL Modes
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
ANSI_QUOTES
Section 13.6.4.4, FOREIGN KEY Constraints
Section 8.2, Schema Object Names
Description
Section 1.7.4, MySQL Extensions to Standard SQL
Section 5.1.8, Server SQL Modes
Section 8.1.1, Strings
DB2
Section 5.1.8, Server SQL Modes
ERROR_FOR_DIVISION_BY_ZERO
Section 5.1.8, Server SQL Modes
HIGH_NOT_PRECEDENCE
Section 11.2.1, Operator Precedence
Section 5.1.8, Server SQL Modes
IGNORE_SPACE
Section 4.5.1.1, mysql Options
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 8.2.4, Function Name Parsing and Resolution
Section 5.1.8, Server SQL Modes
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
MAXDB
Section 10.3.1.1, TIMESTAMP Properties
Section 5.1.8, Server SQL Modes
MSSQL
Section 5.1.8, Server SQL Modes
MYSQL323
Section 5.1.8, Server SQL Modes
MYSQL40
Section 5.1.8, Server SQL Modes
NO_AUTO_CREATE_USER
Section 12.5.1.3, GRANT Syntax
Section 5.5.2, Adding User Accounts
Section 5.1.8, Server SQL Modes
NO_AUTO_VALUE_ON_ZERO
Section 12.1.17, CREATE TABLE Syntax
Section 5.1.8, Server SQL Modes
NO_BACKSLASH_ESCAPES
Section 5.1.8, Server SQL Modes
Section 11.4.1, String Comparison Functions
Section 8.1.1, Strings
NO_DIR_IN_CREATE
Section 12.1.17, CREATE TABLE Syntax
Section 18.1, Overview of Partitioning in MySQL
Section 16.3.1.5, Replication and DIRECTORY Table Options
Section 16.3.1.28, Replication and Variables
Section 5.1.8, Server SQL Modes
Section 18.2.5, Subpartitioning
NO_ENGINE_SUBSTITUTION
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 5.1.3, Server Options for Loading Plugins
Section 5.1.8, Server SQL Modes
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
NO_FIELD_OPTIONS
Section 5.1.8, Server SQL Modes
NO_KEY_OPTIONS
Section 5.1.8, Server SQL Modes
NO_TABLE_OPTIONS
Section 5.1.8, Server SQL Modes
NO_UNSIGNED_SUBTRACTION
Section 10.2, Numeric Types
Section 10.1.1, Overview of Numeric Types
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.8, Server SQL Modes
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
NO_ZERO_DATE
Section 10.3.1.1, TIMESTAMP Properties
Section 11.9, Cast Functions and Operators
Section 10.3, Date and Time Types
Section B.1.5.2, Problems Using DATE Columns
Section 5.1.8, Server SQL Modes
NO_ZERO_IN_DATE
Section 12.1.17, CREATE TABLE Syntax
Section 10.3, Date and Time Types
Section B.1.5.2, Problems Using DATE Columns
Section 5.1.8, Server SQL Modes
ONLY_FULL_GROUP_BY
Section 11.12.3, GROUP BY and HAVING with Hidden Columns
Section 5.1.8, Server SQL Modes
3423
ORACLE
Section 5.1.8, Server SQL Modes
PAD_CHAR_TO_FULL_LENGTH
Section 10.1.3, Overview of String Types
Section 5.1.8, Server SQL Modes
Section 10.4.1, The CHAR and VARCHAR Types
PIPES_AS_CONCAT
Section 11.2.1, Operator Precedence
Section 5.1.8, Server SQL Modes
POSTGRESQL
Section 5.1.8, Server SQL Modes
REAL_AS_FLOAT
Section 10.2, Numeric Types
Section 10.1.1, Overview of Numeric Types
Section 5.1.8, Server SQL Modes
STRICT_ALL_TABLES
Section 5.5.2, Adding User Accounts
Section 1.7.6.2, Constraints on Invalid Data
Section A.3, MySQL 5.1 FAQ Server SQL Mode
Section 5.1.8, Server SQL Modes
STRICT_TRANS_TABLES
Section 5.5.2, Adding User Accounts
Section 1.7.6.2, Constraints on Invalid Data
Section A.3, MySQL 5.1 FAQ Server SQL Mode
Section 5.1.8, Server SQL Modes
TRADITIONAL
Section 10.3.1.1, TIMESTAMP Properties
Section A.3, MySQL 5.1 FAQ Server SQL Mode
Section 5.1.8, Server SQL Modes
SQL Modes Index
3424
Status Variable Index
Aborted_clients
Section B.1.2.11, Communication Errors and Aborted Connections
Section 5.1.7, Server Status Variables
Aborted_connects
Section B.1.2.11, Communication Errors and Aborted Connections
Section 5.1.7, Server Status Variables
Binlog_cache_disk_use
Section 16.1.3.4, Binary Log Options and Variables
Section 5.1.7, Server Status Variables
Section 5.2.4, The Binary Log
Binlog_cache_use
Section 16.1.3.4, Binary Log Options and Variables
Section 5.1.7, Server Status Variables
Section 5.2.4, The Binary Log
Bytes_received
Section 5.1.7, Server Status Variables
Bytes_sent
Section 5.1.7, Server Status Variables
Compression
Section 5.1.7, Server Status Variables
Connections
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Created_tmp_disk_tables
Section 5.1.7, Server Status Variables
Created_tmp_files
Section 5.1.7, Server Status Variables
Created_tmp_tables
Section 5.1.7, Server Status Variables
Delayed_errors
Section 5.1.7, Server Status Variables
Delayed_insert_threads
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.7, Server Status Variables
Delayed_writes
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.7, Server Status Variables
Flush_commands
Section 5.1.7, Server Status Variables
Handler_commit
Section 5.1.7, Server Status Variables
Handler_delete
Section 5.1.7, Server Status Variables
Handler_discover
Section 17.4.4, MySQL Cluster Status Variables
Handler_prepare
Section 5.1.7, Server Status Variables
Handler_read_first
Section 5.1.7, Server Status Variables
Handler_read_key
Section 5.1.7, Server Status Variables
Handler_read_next
Section 5.1.7, Server Status Variables
Handler_read_prev
Section 5.1.7, Server Status Variables
Handler_read_rnd
Section 5.1.7, Server Status Variables
Handler_read_rnd_next
Section 5.1.7, Server Status Variables
Handler_rollback
Section 5.1.7, Server Status Variables
Handler_savepoint
Section 5.1.7, Server Status Variables
Handler_savepoint_rollback
Section 5.1.7, Server Status Variables
Handler_update
Section 5.1.7, Server Status Variables
Handler_write
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_pages_data
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_pages_dirty
Section 5.1.7, Server Status Variables
In-
nodb_buffer_pool_pages_flushed
3425
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_pages_free
Section 5.1.7, Server Status Variables
In-
nodb_buffer_pool_pages_latched
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_pages_misc
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_pages_total
Section 5.1.7, Server Status Variables
In-
nodb_buffer_pool_read_ahead_rn
d
Section 5.1.7, Server Status Variables
In-
nodb_buffer_pool_read_ahead_se
q
Section 5.1.7, Server Status Variables
In-
nodb_buffer_pool_read_requests
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_reads
Section 5.1.7, Server Status Variables
Innodb_buffer_pool_wait_free
Section 5.1.7, Server Status Variables
In-
nodb_buffer_pool_write_request
s
Section 5.1.7, Server Status Variables
Innodb_data_fsyncs
Section 5.1.7, Server Status Variables
Innodb_data_pending_fsyncs
Section 5.1.7, Server Status Variables
Innodb_data_pending_reads
Section 5.1.7, Server Status Variables
Innodb_data_pending_writes
Section 5.1.7, Server Status Variables
Innodb_data_read
Section 5.1.7, Server Status Variables
Innodb_data_reads
Section 5.1.7, Server Status Variables
Innodb_data_writes
Section 5.1.7, Server Status Variables
Innodb_data_written
Section 5.1.7, Server Status Variables
Innodb_dblwr_pages_written
Section 5.1.7, Server Status Variables
Innodb_dblwr_writes
Section 5.1.7, Server Status Variables
Innodb_have_sync_atomic
Section 5.1.7, Server Status Variables
Innodb_heap_enabled
Section 5.1.7, Server Status Variables
Innodb_log_waits
Section 5.1.7, Server Status Variables
Innodb_log_write_requests
Section 5.1.7, Server Status Variables
Innodb_log_writes
Section 5.1.7, Server Status Variables
Innodb_os_log_fsyncs
Section 5.1.7, Server Status Variables
Innodb_os_log_pending_fsyncs
Section 5.1.7, Server Status Variables
Innodb_os_log_pending_writes
Section 5.1.7, Server Status Variables
Innodb_os_log_written
Section 5.1.7, Server Status Variables
Innodb_page_size
Section 5.1.7, Server Status Variables
Innodb_pages_created
Section 5.1.7, Server Status Variables
Innodb_pages_read
Section 5.1.7, Server Status Variables
Status Variable Index
3426
Innodb_pages_written
Section 5.1.7, Server Status Variables
Innodb_row_lock_current_waits
Section 5.1.7, Server Status Variables
Innodb_row_lock_time
Section 5.1.7, Server Status Variables
Innodb_row_lock_time_avg
Section 5.1.7, Server Status Variables
Innodb_row_lock_time_max
Section 5.1.7, Server Status Variables
Innodb_row_lock_waits
Section 5.1.7, Server Status Variables
Innodb_rows_deleted
Section 5.1.7, Server Status Variables
Innodb_rows_inserted
Section 5.1.7, Server Status Variables
Innodb_rows_read
Section 5.1.7, Server Status Variables
Innodb_rows_updated
Section 5.1.7, Server Status Variables
Innodb_wake_ups
Section 5.1.7, Server Status Variables
Key_blocks_not_flushed
Section 5.1.7, Server Status Variables
Key_blocks_unused
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Key_blocks_used
Section 5.1.7, Server Status Variables
Key_read_requests
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Key_reads
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Key_write_requests
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Key_writes
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Last_query_cost
Section 5.1.7, Server Status Variables
Max_used_connections
Section 12.5.6.3, FLUSH Syntax
Section 5.1.7, Server Status Variables
Ndb_cluster_node_id
Section 17.4.4, MySQL Cluster Status Variables
Ndb_config_from_host
Section 17.4.4, MySQL Cluster Status Variables
Ndb_config_from_port
Section 17.4.4, MySQL Cluster Status Variables
Ndb_execute_count
Section 17.4.4, MySQL Cluster Status Variables
Ndb_number_of_data_nodes
Section 17.4.4, MySQL Cluster Status Variables
Ndb_pruned_scan_count
Section 17.4.4, MySQL Cluster Status Variables
Ndb_scan_count
Section 17.4.4, MySQL Cluster Status Variables
Not_flushed_delayed_rows
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.7, Server Status Variables
Open_files
Section 5.1.7, Server Status Variables
Open_streams
Section 5.1.7, Server Status Variables
Open_table_definitions
Section 5.1.7, Server Status Variables
Open_tables
Section 5.1.7, Server Status Variables
Opened_files
Section 5.1.7, Server Status Variables
Opened_table_definitions
Section 5.1.7, Server Status Variables
Status Variable Index
3427
Opened_tables
Section 7.4.7, How MySQL Opens and Closes Tables
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Prepared_stmt_count
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Qcache_free_blocks
Section 7.5.5.3, Query Cache Configuration
Section 7.5.5.4, Query Cache Status and Maintenance
Section 5.1.7, Server Status Variables
Qcache_free_memory
Section 5.1.7, Server Status Variables
Qcache_hits
Section 7.5.5.1, How the Query Cache Operates
Section 5.1.7, Server Status Variables
Qcache_inserts
Section 5.1.7, Server Status Variables
Qcache_lowmem_prunes
Section 7.5.5.3, Query Cache Configuration
Section 7.5.5.4, Query Cache Status and Maintenance
Section 5.1.7, Server Status Variables
Qcache_not_cached
Section 5.1.7, Server Status Variables
Qcache_queries_in_cache
Section 7.5.5.3, Query Cache Configuration
Section 5.1.7, Server Status Variables
Qcache_total_blocks
Section 7.5.5.3, Query Cache Configuration
Section 7.5.5.4, Query Cache Status and Maintenance
Section 5.1.7, Server Status Variables
Queries
Section 5.1.7, Server Status Variables
Questions
Description
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_clients
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_net_avg_w
ait_time
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_net_wait_
time
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_net_waits
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_no_times
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_no_tx
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_status
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_timefunc_
failures
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_tx_avg_wa
it_time
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_tx_wait_t
ime
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_tx_waits
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_wait_pos_
backtraverse
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_wait_sess
ions
Section 5.1.7, Server Status Variables
Rpl_semi_sync_master_yes_tx
Section 5.1.7, Server Status Variables
Rpl_semi_sync_slave_status
Section 5.1.7, Server Status Variables
Rpl_status
Section 5.1.7, Server Status Variables
Select_full_join
Section 5.1.7, Server Status Variables
Status Variable Index
3428
Select_full_range_join
Section 5.1.7, Server Status Variables
Select_range
Section 5.1.7, Server Status Variables
Select_range_check
Section 5.1.7, Server Status Variables
Select_scan
Section 5.1.7, Server Status Variables
Slave_heartbeat_period
Section 17.4.4, MySQL Cluster Status Variables
Section 5.1.7, Server Status Variables
Slave_open_temp_tables
Section 16.3.1.22, Replication and Temporary Tables
Section 5.1.7, Server Status Variables
Slave_received_heartbeats
Section 17.4.4, MySQL Cluster Status Variables
Section 5.1.7, Server Status Variables
Slave_retried_transactions
Section 5.1.7, Server Status Variables
Slave_running
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.4.1, Replication Implementation Details
Section 5.1.7, Server Status Variables
Slow_launch_threads
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Slow_queries
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Sort_merge_passes
Section 5.1.7, Server Status Variables
Sort_range
Section 5.1.7, Server Status Variables
Sort_rows
Section 5.1.7, Server Status Variables
Sort_scan
Section 5.1.7, Server Status Variables
Ssl_accept_renegotiates
Section 5.1.7, Server Status Variables
Ssl_accepts
Section 5.1.7, Server Status Variables
Ssl_callback_cache_hits
Section 5.1.7, Server Status Variables
Ssl_cipher
Section 5.1.7, Server Status Variables
Section 5.5.7.2, Using SSL Connections
Ssl_cipher_list
Section 5.1.7, Server Status Variables
Ssl_client_connects
Section 5.1.7, Server Status Variables
Ssl_connect_renegotiates
Section 5.1.7, Server Status Variables
Ssl_ctx_verify_depth
Section 5.1.7, Server Status Variables
Ssl_ctx_verify_mode
Section 5.1.7, Server Status Variables
Ssl_default_timeout
Section 5.1.7, Server Status Variables
Ssl_finished_accepts
Section 5.1.7, Server Status Variables
Ssl_finished_connects
Section 5.1.7, Server Status Variables
Ssl_session_cache_hits
Section 5.1.7, Server Status Variables
Ssl_session_cache_misses
Section 5.1.7, Server Status Variables
Ssl_session_cache_mode
Section 5.1.7, Server Status Variables
Ssl_session_cache_overflows
Section 5.1.7, Server Status Variables
Ssl_session_cache_size
Section 5.1.7, Server Status Variables
Ssl_session_cache_timeouts
Section 5.1.7, Server Status Variables
Ssl_sessions_reused
Section 5.1.7, Server Status Variables
Status Variable Index
3429
Ssl_used_session_cache_entries
Section 5.1.7, Server Status Variables
Ssl_verify_depth
Section 5.1.7, Server Status Variables
Ssl_verify_mode
Section 5.1.7, Server Status Variables
Ssl_version
Section 5.1.7, Server Status Variables
Table_locks_immediate
Section 7.3.1, Internal Locking Methods
Section 5.1.7, Server Status Variables
Table_locks_waited
Section 7.3.1, Internal Locking Methods
Section 5.1.7, Server Status Variables
Tc_log_max_pages_used
Section 5.1.7, Server Status Variables
Tc_log_page_size
Section 5.1.7, Server Status Variables
Tc_log_page_waits
Section 5.1.7, Server Status Variables
Threads_cached
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 5.1.7, Server Status Variables
Threads_connected
Section 5.1.7, Server Status Variables
Threads_created
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Threads_running
Section 5.1.7, Server Status Variables
Uptime
Description
Section 5.1.7, Server Status Variables
Uptime_since_flush_status
Section 5.1.7, Server Status Variables
Status Variable Index
3430
Statement/Syntax Index
ALTER DATABASE
Section 12.1.1, ALTER DATABASE Syntax
Section 16.1.3.4, Binary Log Options and Variables
Section 9.1.3.2, Database Character Set and Collation
Section 1.7.4, MySQL Extensions to Standard SQL
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.2.4, The Binary Log
ALTER EVENT
Section 12.1.2, ALTER EVENT Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 19.6, Binary Logging of Stored Programs
Section 16.3.1.7, Replication of Invoked Features
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.4.3, Statements That Cause an Implicit Commit
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
ALTER FUNCTION
Section 12.1.4, ALTER FUNCTION Syntax
Section 19.6, Binary Logging of Stored Programs
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.2.1, Stored Routine Syntax
ALTER LOGFILE GROUP
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
ALTER ONLINE TABLE ... REOR-
GANIZE PARTITION
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
Section 17.7.8.1, Adding MySQL Cluster Data Nodes Online: General
Issues
Section 17.7.2, Commands in the MySQL Cluster Management Client
ALTER ONLINE TABLE tbl REOR-
GANIZE PARTITION
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
ALTER PROCEDURE
Section 12.1.5, ALTER PROCEDURE Syntax
Section 19.6, Binary Logging of Stored Programs
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.2.1, Stored Routine Syntax
ALTER SCHEMA
Section 12.1.1, ALTER DATABASE Syntax
ALTER SERVER
Section 12.1.6, ALTER SERVER Syntax
ALTER TABLE
Section 4.6.3.1, myisamchk General Options
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.2.3, CHECK TABLE Syntax
Section 12.1.13, CREATE INDEX Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.24, DROP INDEX Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 13.6.4.4, FOREIGN KEY Constraints
Section 12.5.1.3, GRANT Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 13.6.4.5, InnoDB and MySQL Replication
Section 12.5.6.4, KILL Syntax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 13.8.1, MERGE Table Problems
Section 7.4.6, MyISAM Index Statistics Collection
Section 13.5.1, MyISAM Startup Options
Section 13.5.3, MyISAM Table Storage Formats
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 18.2.1, RANGE Partitioning
Section 12.1.33, RENAME TABLE Syntax
Section 12.5.5.16, SHOW ENGINE Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section B.1.7.3, TEMPORARY Table Problems
Section B.1.2.12, The table is full
Section 21.10.3.35, mysql_info()
Section 13.6.4.3.1, Traditional InnoDB Auto-Increment Locking
Section B.1.8.2, Additional Known Issues
Section 9.1.3.4, Column Character Set and Collation
Section 13.6.8.2, Consistent Nonlocking Reads
Section 13.6.4.2, Converting Tables from Other Storage Engines to
InnoDB
Section 11.13.4.3, Creating Spatial Columns
Section 11.13.6.1, Creating Spatial Indexes
Section 3.3.2, Creating a Table
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
Section 13.6.11.3, Defragmenting a Table
Description
Description
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 13.6.6.2, Forcing InnoDB Recovery
Section 11.8, Full-Text Search Functions
Section 7.5.6.2, General Thread States
Section B.1.4.3, How MySQL Handles a Full Disk
Section 7.5.5.1, How the Query Cache Operates
Section 6.4.3, How to Repair Tables
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 17.12.10, Limitations Relating to Multiple MySQL Cluster
Nodes
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 17.12.2, Limits and Differences of MySQL Cluster from Stand-
ard MySQL Limits
Section 17.2.5, Loading Sample Data into MySQL Cluster and Per-
forming Queries
Section 18.3.3, Maintenance of Partitions
Section 18.3.2, Management of HASH and KEY Partitions
Section 18.3.1, Management of RANGE and LIST Partitions
Section 1.4.1, What Is New in MySQL 5.1
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.5.2, MySQL Cluster 5.1 and MySQL Cluster NDB 6.x/7.x
Upgrade and Downgrade Compatibility
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 17.2.3, MySQL Cluster Multi-Computer Configuration
Section 17.4.3, MySQL Cluster System Variables
Section 1.7.4, MySQL Extensions to Standard SQL
3431
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 17.12.1, Noncompliance with SQL Syntax in MySQL Cluster
Section 10.2, Numeric Types
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 18.1, Overview of Partitioning in MySQL
Section 10.1.3, Overview of String Types
Section 18.3, Partition Management
Section 18.5.1, Partitioning Keys, Primary Keys, and Unique Keys
Section 18.5.2, Partitioning Limitations Relating to Storage Engines
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 5.4.1, Privileges Provided by MySQL
Section B.1.7.1, Problems with ALTER TABLE
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section 16.3.1.1, Replication and AUTO_INCREMENT
Section 16.3.1.19, Replication and Reserved Words
Section 18.5, Restrictions and Limitations on Partitioning
Section D.4, Restrictions on Views
Section 12.7, SQL Syntax for Prepared Statements
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 5.2.4.2, Setting The Binary Log Format
Section 13.3, Setting the Storage Engine
Section 12.1.17.1, Silent Column Specification Changes
Section 12.4.3, Statements That Cause an Implicit Commit
Chapter 13, Storage Engines
Section 9.1.3.3, Table Character Set and Collation
Section 13.12, The ARCHIVE Storage Engine
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 13.5, The MyISAM Storage Engine
Section 5.2.5, The Slow Query Log
Section 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 3.6.9, Using AUTO_INCREMENT
Section 13.6.2.1, Using Per-Table Tablespaces
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 1.4.2, What Is Planned for MySQL 6.0
Section B.1.4.2, What to Do If MySQL Keeps Crashing
Section B.1.4.4, Where MySQL Stores Temporary Files
ALTER TABLE ... REORGANIZE
PARTITION
Section 17.7.8.1, Adding MySQL Cluster Data Nodes Online: General
Issues
ALTER TABLESPACE
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
ALTER VIEW
Section 12.1.9, ALTER VIEW Syntax
Section 12.1.20, CREATE VIEW Syntax
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.4, Restrictions on Views
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.5.2, View Processing Algorithms
Section 19.5.1, View Syntax
ALTER [ONLINE] TABLE ta-
ble_name REORGANIZE PARTITION
Section 17.7.8.3, Adding MySQL Cluster Data Nodes Online: Detailed
Example
ANALYZE TABLE
Section 4.6.3.1, myisamchk General Options
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.2.1, ANALYZE TABLE Syntax
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.8.1, MERGE Table Problems
Section 7.4.6, MyISAM Index Statistics Collection
Section 12.5.5.23, SHOW INDEX Syntax
Section B.1.8.2, Additional Known Issues
Description
Description
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 7.5.6.2, General Thread States
Section 18.3.3, Maintenance of Partitions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.1.9, Replication and FLUSH
Section 18.5, Restrictions and Limitations on Partitioning
Section 13.6.14, Restrictions on InnoDB Tables
Section 5.1.2, Server Command Options
Section 7.2.3, Speed of SELECT Queries
Section 12.4.3, Statements That Cause an Implicit Commit
Section 6.4, Table Maintenance and Crash Recovery
Section 5.2.5, The Slow Query Log
BACKUP DATABASE
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 2.10.2, Typical configure Options
Section 1.4.2, What Is Planned for MySQL 6.0
BACKUP TABLE
Section 12.5.2.2, BACKUP TABLE Syntax
Section 12.5.2.7, RESTORE TABLE Syntax
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 1.4.2, What Is Planned for MySQL 6.0
BEGIN
Section 13.6.12, InnoDB Error Handling
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 19.6, Binary Logging of Stored Programs
Description
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.25, Replication and Transactions
Section 5.1.5, Session System Variables
Section 12.4.3, Statements That Cause an Implicit Commit
Section 13.6.8, The InnoDB Transaction Model and Locking
BEGIN ... END
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Statement/Syntax Index
3432
BEGIN WORK
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
BEGIN [WORK]
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section D.1, Restrictions on Stored Routines, Triggers, and Events
BINLOG
Section 4.6.7.2, mysqlbinlog Row Event Display
Section 12.5.6.1, BINLOG Syntax
Description
CACHE INDEX
Section 12.5.6.2, CACHE INDEX Syntax
Section 12.5.6.5, LOAD INDEX INTO CACHE Syntax
Section 7.4.5.4, Index Preloading
Section 7.4.5.2, Multiple Key Caches
Section 18.5, Restrictions and Limitations on Partitioning
Section 12.4.3, Statements That Cause an Implicit Commit
CALL
Section 12.2.1, CALL Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.37, mysql_insert_id()
Section 21.10.3.45, mysql_more_results()
Section 21.10.3.46, mysql_next_result()
Section 21.10.3.52, mysql_real_connect()
Section 21.10.3.64, mysql_set_server_option()
Section 19.6, Binary Logging of Stored Programs
Section 21.10.4, C API Prepared Statements
Section 21.10.12, C API Support for Multiple Statement Execution
Section 21.10.15, C API Support for Prepared CALL Statements
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.7, SQL Syntax for Prepared Statements
Chapter 19, Stored Programs and Views
Section 19.2.1, Stored Routine Syntax
Section 19.3.1, Trigger Syntax
CASE
Section 11.3, Control Flow Functions
CHANGE MASTER TO
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 16.1.3.4, Binary Log Options and Variables
Section 16.1.1.5, Creating a Data Snapshot Using mysqldump
Description
Section 17.4.4, MySQL Cluster Status Variables
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.1.15, Replication During a Master Shutdown
Section 7.5.6.7, Replication Slave Connection Thread States
Section 7.5.6.5, Replication Slave I/O Thread States
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.7, Server Status Variables
Section 16.1.1.8, Setting Up Replication with Existing Data
Section 16.1.1.7, Setting Up Replication with New Master and Slaves
Section 1.4.2, What Is Planned for MySQL 6.0
CHECK TABLE
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.2.3, CHECK TABLE Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 13.6.13.3, InnoDB General Troubleshooting
Section 13.8.1, MERGE Table Problems
Section 7.4.6, MyISAM Index Statistics Collection
Section B.1.2.9, MySQL server has gone away
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 13.6.6, Backing Up and Recovering an InnoDB Database
Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt
Section 13.5.4.1, Corrupted MyISAM Tables
Description
Description
Section 7.3.4, External Locking
Section 6.4.3, How to Repair Tables
Section 1.6, How to Report Bugs or Problems
Section 2.8, Installing MySQL on NetWare
Section 18.3.3, Maintenance of Partitions
Section A.6, MySQL 5.1 FAQ Views
Section 1.7.4, MySQL Extensions to Standard SQL
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
Section 18.5, Restrictions and Limitations on Partitioning
Section D.2, Restrictions on Server-Side Cursors
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.4, Restrictions on Views
Section 6.4.6, Setting Up a Table Maintenance Schedule
Section 12.4.3, Statements That Cause an Implicit Commit
Section 6.4, Table Maintenance and Crash Recovery
Section 13.12, The ARCHIVE Storage Engine
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
CHECK TABLE ... EXTENDED
Section 12.5.2.3, CHECK TABLE Syntax
CHECK TABLE ... FOR UPGRADE
Section 12.5.2.6, REPAIR TABLE Syntax
Section 2.12.3, Checking Whether Table Indexes Must Be Rebuilt
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
CHECKSUM TABLE
Section 12.5.2.4, CHECKSUM TABLE Syntax
Section 12.1.17, CREATE TABLE Syntax
COMMIT
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 13.6.12, InnoDB Error Handling
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 12.4.4, SAVEPOINT and ROLLBACK TO SAVEPOINT Syn-
tax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section B.1.8.2, Additional Known Issues
Section 19.6, Binary Logging of Stored Programs
Section 13.1, Comparing Transaction and Nontransaction Engines
Statement/Syntax Index
3433
Description
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 13.6.4.1, How to Use Transactions in InnoDB with Different
APIs
Section 13.6.8.7, Implicit Transaction Commit and Rollback
Section 12.4, MySQL Transactional and Locking Statements
Section 16.1.1.4, Obtaining the Master Replication Information
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.25, Replication and Transactions
Section 13.6.14, Restrictions on InnoDB Tables
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 7.2.21, Speed of INSERT Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Chapter 13, Storage Engines
Section 13.6.8, The InnoDB Transaction Model and Locking
Section 5.2.4, The Binary Log
Section 1.7.5.2, Transactions and Atomic Operations
Section 19.3.1, Trigger Syntax
CREATE DATABASE
Section 12.1.10, CREATE DATABASE Syntax
Section 12.5.5.8, SHOW CREATE DATABASE Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 21.10.3.8, mysql_create_db()
Chapter 6, Backup and Recovery
Section 16.1.3.4, Binary Log Options and Variables
Section 21.10.2, C API Function Overview
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 9.1.3.2, Database Character Set and Collation
Description
Section 8.2.2, Identifier Case Sensitivity
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 1.7.4, MySQL Extensions to Standard SQL
Section 16.1.3.3, Replication Slave Options and Variables
Section 9.1.3.1, Server Character Set and Collation
Section 12.4.3, Statements That Cause an Implicit Commit
Section 5.2.4, The Binary Log
CREATE EVENT
Section 12.1.2, ALTER EVENT Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.5.5.9, SHOW CREATE EVENT Syntax
Section 19.6, Binary Logging of Stored Programs
Section 16.3.1.7, Replication of Invoked Features
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.4.3, Statements That Cause an Implicit Commit
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
CREATE FUNCTION
Section 12.1.4, ALTER FUNCTION Syntax
Section 12.1.12, CREATE FUNCTION Syntax
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.5.3.2, DROP FUNCTION Syntax
Section 22.3, Adding New Functions to MySQL
Section 19.6, Binary Logging of Stored Programs
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Description
Section 8.2.4, Function Name Parsing and Resolution
Section 16.3.1.7, Replication of Invoked Features
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.2.1, Stored Routine Syntax
Section 22.3.2.1, UDF Calling Sequences for Simple Functions
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 22.3.2.6, User-Defined Function Security Precautions
CREATE INDEX
Section 12.1.13, CREATE INDEX Syntax
Section 11.13.6.1, Creating Spatial Indexes
Section 11.8, Full-Text Search Functions
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.4, Server System Variables
Section 12.4.3, Statements That Cause an Implicit Commit
CREATE LOGFILE GROUP
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
CREATE OR REPLACE VIEW
Section D.4, Restrictions on Views
CREATE PROCEDURE
Section 12.1.5, ALTER PROCEDURE Syntax
Section 12.2.1, CALL Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 19.6, Binary Logging of Stored Programs
Description
Section 16.3.1.7, Replication of Invoked Features
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.2.1, Stored Routine Syntax
CREATE SCHEMA
Section 12.1.10, CREATE DATABASE Syntax
Section 17.12.8, Issues Exclusive to MySQL Cluster
CREATE SERVER
Section 12.1.6, ALTER SERVER Syntax
Section 12.1.16, CREATE SERVER Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 12.5.6.3, FLUSH Syntax
Section 13.11.2.2, Creating a FEDERATED Table Using CREATE
SERVER
Section 7.5.8, How MySQL Uses Memory
Section 13.11.2, How to Create FEDERATED Tables
CREATE TABLE
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.13, CREATE INDEX Syntax
Section 12.1.16, CREATE SERVER Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 12.3.1, DESCRIBE Syntax
Section 13.6.4.4, FOREIGN KEY Constraints
Section 18.2.3, HASH Partitioning
Statement/Syntax Index
3434
Section 12.3.3, HELP Syntax
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 13.6.4.5, InnoDB and MySQL Replication
Section 18.2.4, KEY Partitioning
Section 18.2.2, LIST Partitioning
Section 13.5.3, MyISAM Table Storage Formats
Section 18.2.1, RANGE Partitioning
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 12.5.5.12, SHOW CREATE TABLE Syntax
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 12.5.5.16, SHOW ENGINE Syntax
Section 12.5.5.38, SHOW TABLE STATUS Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 10.3.1.1, TIMESTAMP Properties
Section 12.2.10, TRUNCATE Syntax
Section B.1.2.12, The table is full
Section 12.5.3.4, UNINSTALL PLUGIN Syntax
Section 13.6.4.3.1, Traditional InnoDB Auto-Increment Locking
Chapter 6, Backup and Recovery
Section 21.10.4, C API Prepared Statements
Section 9.1.3.4, Column Character Set and Collation
Section 7.4.2, Column Indexes
Section 11.13.4.3, Creating Spatial Columns
Section 11.13.6.1, Creating Spatial Indexes
Section 13.11.2.1, Creating a FEDERATED Table Using
CONNECTION
Section 3.3.2, Creating a Table
Section 13.6.4, Creating and Using InnoDB Tables
Section 9.1.3.2, Database Character Set and Collation
Description
Section 1.7.5.4, Foreign Keys
Section 11.8, Full-Text Search Functions
Section 3.4, Getting Information About Databases and Tables
Section 18.2.6, How MySQL Partitioning Handles NULL
Section 7.5.10, How MySQL Uses Internal Temporary Tables
Section 8.2.2, Identifier Case Sensitivity
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 3.3.3, Loading Data into a Table
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 7.4.1, Make Your Data as Small as Possible
Section 18.3.1, Management of RANGE and LIST Partitions
Section 1.4.1, What Is New in MySQL 5.1
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.3.4.1, MySQL Cluster Configuration Basic Example
Section 17.2.3, MySQL Cluster Multi-Computer Configuration
Section 1.7.4, MySQL Extensions to Standard SQL
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 17.12.1, Noncompliance with SQL Syntax in MySQL Cluster
Section 18.1, Overview of Partitioning in MySQL
Section 10.1.3, Overview of String Types
Section 18.3, Partition Management
Section 18.2, Partition Types
Section 18.5.3, Partitioning Limitations Relating to Functions
Section 18.5.2, Partitioning Limitations Relating to Storage Engines
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 5.4.1, Privileges Provided by MySQL
Section 7.5.6.7, Replication Slave Connection Thread States
Section 16.3.1.1, Replication and AUTO_INCREMENT
Section 16.3.1.5, Replication and DIRECTORY Table Options
Section 16.3.1.2, Replication and Character Sets
Section 16.3.1.3, Replication of CREATE TABLE ... SELECT
Statements
Section 18.5, Restrictions and Limitations on Partitioning
Section 12.7, SQL Syntax for Prepared Statements
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 5.2.4.2, Setting The Binary Log Format
Section 13.3, Setting the Storage Engine
Section 12.1.17.1, Silent Column Specification Changes
Section 7.2.21, Speed of INSERT Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Chapter 13, Storage Engines
Section 18.2.5, Subpartitioning
Section 9.1.3.3, Table Character Set and Collation
Section 13.12, The ARCHIVE Storage Engine
Section 10.4.4, The ENUM Type
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 13.5, The MyISAM Storage Engine
Section 12.2.9.1, The Subquery as Scalar Operand
Section 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 3.6.9, Using AUTO_INCREMENT
Section 3.3.4.9, Using More Than one Table
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 1.4.2, What Is Planned for MySQL 6.0
CREATE TABLE ... SELECT
Section 12.1.17, CREATE TABLE Syntax
Section 1.7.5.1, SELECT INTO TABLE
Section 19.6, Binary Logging of Stored Programs
Section 13.6.8.2, Consistent Nonlocking Reads
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 16.3.1.3, Replication of CREATE TABLE ... SELECT
Statements
Section 5.1.4, Server System Variables
Section 12.4.3, Statements That Cause an Implicit Commit
CREATE TABLE ... SELECT ...
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 18.3.1, Management of RANGE and LIST Partitions
CREATE TABLESPACE
Section 17.3.4.6, Defining MySQL Cluster Data Nodes
CREATE TEMPORARY TABLE
Section 12.5.1.3, GRANT Syntax
Description
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 12.4.3, Statements That Cause an Implicit Commit
CREATE TRIGGER
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.5.5.13, SHOW CREATE TRIGGER Syntax
Section 19.6, Binary Logging of Stored Programs
Section A.5, MySQL 5.1 FAQ Triggers
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 16.3.1.7, Replication of Invoked Features
Statement/Syntax Index
3435
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.3.1, Trigger Syntax
CREATE USER
Section 12.5.1.1, CREATE USER Syntax
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 5.5.2, Adding User Accounts
Section 5.5.6.1, Administrator Guidelines for Password Security
Section 5.5.5, Assigning Account Passwords
Section 5.4.7, Causes of Access-Denied Errors
Section 5.5.6.2, End-User Guidelines for Password Security
Section 7.5.8, How MySQL Uses Memory
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.1.17, Replication of the System mysql Database
Section 5.4.3, Specifying Account Names
Section 12.4.3, Statements That Cause an Implicit Commit
Section 5.4, The MySQL Access Privilege System
CREATE VIEW
Section 12.1.9, ALTER VIEW Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 7.5.6.2, General Thread States
Section 5.4.1, Privileges Provided by MySQL
Section D.4, Restrictions on Views
Section 12.4.3, Statements That Cause an Implicit Commit
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 19.5.3, Updatable and Insertable Views
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 19.5.2, View Processing Algorithms
Section 19.5.1, View Syntax
DEALLOCATE PREPARE
Section 12.7.3, DEALLOCATE PREPARE Syntax
Section 12.7.1, PREPARE Syntax
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.7, Server Status Variables
DECLARE
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
DELETE
Section 4.5.1.1, mysql Options
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.2.2, DELETE Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 13.6.4.4, FOREIGN KEY Constraints
Section 12.5.1.3, GRANT Syntax
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.4.5, InnoDB and MySQL Replication
Section 12.2.8.1, JOIN Syntax
Section 12.5.6.4, KILL Syntax
Section 18.2.2, LIST Partitioning
Section 13.8.1, MERGE Table Problems
Section 18.2.1, RANGE Partitioning
Section 12.5.1.5, REVOKE Syntax
Section 12.4.6, SET TRANSACTION Syntax
Section 12.2.10, TRUNCATE Syntax
Section 7.2.4, WHERE Clause Optimization
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.13, mysql_stmt_field_count()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 5.5.2, Adding User Accounts
Section B.1.8.2, Additional Known Issues
Section 16.1.3.4, Binary Log Options and Variables
Section 21.10.2, C API Function Overview
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.4, C API Prepared Statements
Section 5.4.7, Causes of Access-Denied Errors
Section 17.3.6, Configuring MySQL Cluster Parameters for Local
Checkpoints
Section B.1.5.6, Deleting Rows from Related Tables
Description
Section 13.6.6.2, Forcing InnoDB Recovery
Section 1.7.5.4, Foreign Keys
Chapter 11, Functions and Operators
Section 7.5.6.2, General Thread States
Section 7.5.5.1, How the Query Cache Operates
Section 7.3.1, Internal Locking Methods
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 17.12.2, Limits and Differences of MySQL Cluster from Stand-
ard MySQL Limits
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 18.3.1, Management of RANGE and LIST Partitions
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section 1.7.4, MySQL Extensions to Standard SQL
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
Section 5.4.2, Privilege System Grant Tables
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.11, Replication and LIMIT
Section 16.3.1.18, Replication and the Query Optimizer
Section 16.3.1.16, Replication with MEMORY Tables
Section 8.3, Reserved Words
Section D.3, Restrictions on Subqueries
Section D.4, Restrictions on Views
Section 12.2.9.11, Rewriting Subqueries as Joins
Section 12.7, SQL Syntax for Prepared Statements
Section 2.11.3, Securing the Initial MySQL Accounts
Section 3.3.4.1, Selecting All Data
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 7.2.23, Speed of DELETE Statements
Section 7.2.21, Speed of INSERT Statements
Section 12.2.9.9, Subquery Errors
Section 12.2.9, Subquery Syntax
Section 7.3.2, Table Locking Issues
Section 13.12, The ARCHIVE Storage Engine
Statement/Syntax Index
3436
Section 13.14, The BLACKHOLE Storage Engine
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 13.8, The MERGE Storage Engine
Section 5.2.4, The Binary Log
Section 5.4, The MySQL Access Privilege System
Section 19.3.1, Trigger Syntax
Section 19.5.3, Updatable and Insertable Views
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 19.3, Using Triggers
Section 4.5.1.5.2, Using the --safe-updates Option
Section 21.10.10.2, What Results You Can Get from a Query
Section 5.4.6, When Privilege Changes Take Effect
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
DELETE FROM ... WHERE ...
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
DESCRIBE
Section 12.1.17, CREATE TABLE Syntax
Section 12.3.1, DESCRIBE Syntax
Section 12.3.2, EXPLAIN Syntax
Section 7.2.17, LIMIT Optimization
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 3.3.2, Creating a Table
Section 20.28, Extensions to SHOW Statements
Section 3.4, Getting Information About Databases and Tables
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.1.17.1, Silent Column Specification Changes
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
Section 9.1.10, UTF-8 for Metadata
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 3.6.6, Using Foreign Keys
DO
Section 12.1.2, ALTER EVENT Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.2.3, DO Syntax
Section 19.6, Binary Logging of Stored Programs
Section 21.10.4, C API Prepared Statements
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 11.11.4, Miscellaneous Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.3, Restrictions on Subqueries
Section 12.7, SQL Syntax for Prepared Statements
Section 12.2.9, Subquery Syntax
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
DROP DATABASE
Section 12.1.21, DROP DATABASE Syntax
Section 21.10.3.11, mysql_drop_db()
Section 16.1.3.4, Binary Log Options and Variables
Section 21.10.2, C API Function Overview
Description
Section 7.5.5.1, How the Query Cache Operates
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 1.7.4, MySQL Extensions to Standard SQL
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 16.1.3.3, Replication Slave Options and Variables
Section 12.4.3, Statements That Cause an Implicit Commit
Section 5.2.4, The Binary Log
DROP DATABASE IF EXISTS
Section 16.3.1.6, Replication of DROP ... IF EXISTS Statements
DROP EVENT
Section 12.1.22, DROP EVENT Syntax
Section 19.6, Binary Logging of Stored Programs
Section 16.3.1.7, Replication of Invoked Features
Section 12.4.3, Statements That Cause an Implicit Commit
DROP FUNCTION
Section 12.1.4, ALTER FUNCTION Syntax
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.1.23, DROP FUNCTION Syntax
Section 12.5.3.2, DROP FUNCTION Syntax
Section 12.1.26, DROP PROCEDURE and DROP FUNCTION Syntax
Section 22.3, Adding New Functions to MySQL
Section 19.6, Binary Logging of Stored Programs
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 8.2.4, Function Name Parsing and Resolution
Section 16.3.1.7, Replication of Invoked Features
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.2.1, Stored Routine Syntax
Section 2.12.1, Upgrading MySQL
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 22.3.2.6, User-Defined Function Security Precautions
DROP FUNCTION IF EXISTS
Section 16.3.1.6, Replication of DROP ... IF EXISTS Statements
DROP INDEX
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.24, DROP INDEX Syntax
Section 11.13.6.1, Creating Spatial Indexes
Section 1.7.4, MySQL Extensions to Standard SQL
Section 12.7, SQL Syntax for Prepared Statements
Section 12.4.3, Statements That Cause an Implicit Commit
DROP PROCEDURE
Section 12.1.5, ALTER PROCEDURE Syntax
Section 12.1.26, DROP PROCEDURE and DROP FUNCTION Syntax
Section 19.6, Binary Logging of Stored Programs
Section 16.3.1.7, Replication of Invoked Features
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.2.1, Stored Routine Syntax
DROP PROCEDURE IF EXISTS
Section 16.3.1.6, Replication of DROP ... IF EXISTS Statements
DROP SCHEMA
Section 12.1.21, DROP DATABASE Syntax
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.5, Session System Variables
Statement/Syntax Index
3437
DROP SERVER
Section 12.1.27, DROP SERVER Syntax
Section 12.5.6.3, FLUSH Syntax
Section 7.5.8, How MySQL Uses Memory
DROP TABLE
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.28, DROP TABLE Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 13.8.1, MERGE Table Problems
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 12.6.2.7, START SLAVE Syntax
Section 12.2.10, TRUNCATE Syntax
Section 12.5.3.4, UNINSTALL PLUGIN Syntax
Section B.1.8.2, Additional Known Issues
Section 13.6.8.2, Consistent Nonlocking Reads
Description
Description
Description
Section 22.2.2, Full-Text Parser Plugins
Section 7.5.5.1, How the Query Cache Operates
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 17.12.2, Limits and Differences of MySQL Cluster from Stand-
ard MySQL Limits
Section 1.7.4, MySQL Extensions to Standard SQL
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section D.4, Restrictions on Views
Section 12.7, SQL Syntax for Prepared Statements
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.5, Session System Variables
Section 5.2.4.2, Setting The Binary Log Format
Section 12.4.3, Statements That Cause an Implicit Commit
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 13.6.13.4, Troubleshooting InnoDB Data Dictionary Opera-
tions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
DROP TABLE IF EXISTS
Section 16.3.1.6, Replication of DROP ... IF EXISTS Statements
DROP TRIGGER
Section 12.1.30, DROP TRIGGER Syntax
Section A.5, MySQL 5.1 FAQ Triggers
Section 16.3.1.7, Replication of Invoked Features
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.3.1, Trigger Syntax
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
DROP USER
Section 12.5.1.2, DROP USER Syntax
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.5, REVOKE Syntax
Section 7.5.8, How MySQL Uses Memory
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 5.4.1, Privileges Provided by MySQL
Section 5.5.3, Removing User Accounts
Section 16.3.1.17, Replication of the System mysql Database
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.4.3, Statements That Cause an Implicit Commit
DROP VIEW
Section 12.1.31, DROP VIEW Syntax
Section D.4, Restrictions on Views
Section 12.4.3, Statements That Cause an Implicit Commit
Section 19.5.1, View Syntax
DROP VIEW IF EXISTS
Section 16.3.1.6, Replication of DROP ... IF EXISTS Statements
EXECUTE
Section 12.2.1, CALL Syntax
Section 12.7.2, EXECUTE Syntax
Section 12.7.1, PREPARE Syntax
Section 7.5.5.1, How the Query Cache Operates
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.4, Restrictions on Views
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.7, Server Status Variables
EXPLAIN
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 7.2.15, DISTINCT Optimization
Section 12.3.2, EXPLAIN Syntax
Section 7.2.20, INFORMATION_SCHEMA Optimization
Section 7.2.8, IS NULL Optimization
Section 7.2.13, ORDER BY Optimization
Section 12.2.8, SELECT Syntax
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 22.5.1, Debugging a MySQL Server
Section 7.5.10, How MySQL Uses Internal Temporary Tables
Section 7.2.19, How to Avoid Table Scans
Section 12.2.8.2, Index Hint Syntax
Section 7.2.6, Index Merge Optimization
Section 7.2.14.1, Loose index scan
Section 18.3.4, Obtaining Information About Partitions
Section B.1.6, Optimizer-Related Issues
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.10, Optimizing Subqueries
Section 7.2.24, Other Optimization Tips
Section 4.1, Overview of MySQL Programs
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section B.1.5.7, Solving Problems with No Matching Rows
Section 7.2.3, Speed of SELECT Queries
Section 12.2.9.8, Subqueries in the FROM clause
Section 7.2.6.1, The Index Merge Intersection Access Algorithm
Section 7.2.5.2, The Range Access Method for Multiple-Part Indexes
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
Section 11.13.6.2, Using a Spatial Index
Statement/Syntax Index
3438
EXPLAIN SELECT
Section 7.2.7, Condition Pushdown Optimization
Section 13.6.8.9, How to Cope with Deadlocks
Section 1.6, How to Report Bugs or Problems
Section 1.7.4, MySQL Extensions to Standard SQL
Section 18.3.4, Obtaining Information About Partitions
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 12.2.9.8, Subqueries in the FROM clause
FETCH
Section D.1, Restrictions on Stored Routines, Triggers, and Events
FLUSH
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.6.6, RESET Syntax
Section 6.2.1, Backup Policy
Description
Section 1.7.4, MySQL Extensions to Standard SQL
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.1.9, Replication and FLUSH
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section B.1.4.1.1, Resetting the Root Password on Windows Systems
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.7, Server Status Variables
FLUSH DES_KEY_FILE
Section 11.11.2, Encryption and Compression Functions
FLUSH HOSTS
Section B.1.2.6, Host 'host_name' is blocked
Section 21.10.3.55, mysql_refresh()
Section 7.5.11, How MySQL Uses DNS
Section 5.1.4, Server System Variables
FLUSH LOGS
Section 12.5.6.3, FLUSH Syntax
Section 21.10.3.55, mysql_refresh()
Section 6.2.1, Backup Policy
Section 6.2.3, Backup Strategy Summary
Section 6.1, Database Backups
Section 5.2, MySQL Server Logs
Section 16.3.1.9, Replication and FLUSH
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.2.6, Server Log Maintenance
Section 5.1.10, Server Response to Signals
Section 5.2.2, The Error Log
Section 5.2.3, The General Query Log
Section 16.4.2.1, The Slave Relay Log
FLUSH MASTER
Section 12.5.6.3, FLUSH Syntax
Section 16.3.1.9, Replication and FLUSH
FLUSH PRIVILEGES
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 12.5.6.3, FLUSH Syntax
Section 21.10.3.55, mysql_refresh()
Section 21.10.3.56, mysql_reload()
Section 5.5.2, Adding User Accounts
Section 5.4.7, Causes of Access-Denied Errors
Description
Section 7.5.8, How MySQL Uses Memory
Section 5.5.4, Limiting Account Resources
Section 17.8.3, MySQL Cluster and MySQL Security Procedures
Section 5.4.2, Privilege System Grant Tables
Section 16.3.1.9, Replication and FLUSH
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.10, Server Response to Signals
Section 1.2, Typographical and Syntax Conventions
Section 5.4.6, When Privilege Changes Take Effect
FLUSH QUERY CACHE
Section 12.5.6.3, FLUSH Syntax
Section 7.5.5.4, Query Cache Status and Maintenance
FLUSH SLAVE
Section 12.5.6.3, FLUSH Syntax
Section 16.3.1.9, Replication and FLUSH
FLUSH TABLE
Section 7.2.21, Speed of INSERT Statements
FLUSH TABLES
Section 12.5.6.3, FLUSH Syntax
Section 12.2.4, HANDLER Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 13.8.1, MERGE Table Problems
Section 21.10.3.55, mysql_refresh()
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 6.1, Database Backups
Description
Description
Section 7.5.6.2, General Thread States
Section 7.4.7, How MySQL Opens and Closes Tables
Section 7.5.8, How MySQL Uses Memory
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 16.1.1.4, Obtaining the Master Replication Information
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
Section 7.5.5.4, Query Cache Status and Maintenance
Section 16.3.1.9, Replication and FLUSH
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 7.2.21, Speed of INSERT Statements
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
FLUSH TABLES WITH READ LOCK
Section 12.5.6.3, FLUSH Syntax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section B.1.8.2, Additional Known Issues
Section 6.2.1, Backup Policy
Section 16.1.1.5, Creating a Data Snapshot Using mysqldump
Section 6.1, Database Backups
Description
Section 12.4.5.1, Interaction of Table Locking and Transactions
Statement/Syntax Index
3439
Section 16.1.1.4, Obtaining the Master Replication Information
Section 16.3.1.9, Replication and FLUSH
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 12.4.3, Statements That Cause an Implicit Commit
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
FLUSH USER_RESOURCES
Section 12.5.6.3, FLUSH Syntax
Section 5.5.4, Limiting Account Resources
GRANT
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.5.1.1, CREATE USER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.5.1.2, DROP USER Syntax
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.4, RENAME USER Syntax
Section 12.5.1.5, REVOKE Syntax
Section 12.5.5.22, SHOW GRANTS Syntax
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section 5.5.6.1, Administrator Guidelines for Password Security
Section 5.5.5, Assigning Account Passwords
Section 5.4.7, Causes of Access-Denied Errors
Section 16.1.1.1, Creating a User for Replication
Section 5.5.6.2, End-User Guidelines for Password Security
Section 5.3.1, General Security Guidelines
Section 7.5.8, How MySQL Uses Memory
Section 5.5.4, Limiting Account Resources
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 5.3.2, Making MySQL Secure Against Attackers
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 7.2, Optimizing SELECT and Other Statements
Section 5.5.6.3, Password Hashing in MySQL
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 2.11.2.1, Problems Running mysql_install_db
Section 16.3.4, Replication FAQ
Section 16.3.1.9, Replication and FLUSH
Section 16.3.1.17, Replication of the System mysql Database
Section 5.5.7.3, SSL Command Options
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.8, Server SQL Modes
Section 5.4.3, Specifying Account Names
Section 12.4.3, Statements That Cause an Implicit Commit
Section 5.4, The MySQL Access Privilege System
Section 5.5.1, User Names and Passwords
Section 5.5.7.2, Using SSL Connections
Section 5.5.7, Using SSL for Secure Connections
Section 5.4.6, When Privilege Changes Take Effect
GRANT ALL
Section 12.5.1.3, GRANT Syntax
GRANT USAGE
Section 5.5.5, Assigning Account Passwords
Section 5.5.4, Limiting Account Resources
HANDLER
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 12.2.4, HANDLER Syntax
Section 21.10.3.3, mysql_change_user()
Section 21.10.11, Controlling Automatic Reconnection Behavior
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 1.7, MySQL Standards Compliance
HANDLER ... CLOSE
Section 12.5.5.26, SHOW OPEN TABLES Syntax
HANDLER ... OPEN
Section 12.5.5.26, SHOW OPEN TABLES Syntax
HELP
Section 12.3.3, HELP Syntax
Section 12.4.5.3, Other Table-Locking Notes
Section 5.1.9, Server-Side Help
IF
Section 11.3, Control Flow Functions
INSERT
Section 12.1.13, CREATE INDEX Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.2.2, DELETE Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 13.6.4.4, FOREIGN KEY Constraints
Section 12.5.1.3, GRANT Syntax
Section 12.2.5.1, INSERT ... SELECT Syntax
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 13.6.8.4, InnoDB Record, Gap, and Next-Key Locks
Section 13.6.3, InnoDB Startup Options and System Variables
Section 18.2.2, LIST Partitioning
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 13.8.1, MERGE Table Problems
Section B.1.2.9, MySQL server has gone away
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 1.7.6.1, PRIMARY KEY and UNIQUE Index Constraints
Section 18.2.1, RANGE Partitioning
Section 12.2.7, REPLACE Syntax
Section 12.5.5.29, SHOW PROCEDURE CODE Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.37, mysql_insert_id()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.10, mysql_stmt_execute()
Statement/Syntax Index
3440
Section 21.10.7.13, mysql_stmt_field_count()
Section 21.10.7.16, mysql_stmt_insert_id()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 21.10.7.20, mysql_stmt_prepare()
Section 21.10.3.69, mysql_store_result()
Section 13.6.4.3.1, Traditional InnoDB Auto-Increment Locking
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section 5.5.5, Assigning Account Passwords
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 6.2.1, Backup Policy
Chapter 6, Backup and Recovery
Section 19.6, Binary Logging of Stored Programs
Section 21.10.2, C API Function Overview
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.4, C API Prepared Statements
Section 21.10.12, C API Support for Multiple Statement Execution
Section 5.4.7, Causes of Access-Denied Errors
Section 7.3.3, Concurrent Inserts
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 17.3.6, Configuring MySQL Cluster Parameters for Local
Checkpoints
Section 1.7.6.2, Constraints on Invalid Data
Section 13.11.2.1, Creating a FEDERATED Table Using
CONNECTION
Section 10.1.4, Data Type Default Values
Description
Section 13.6.6.2, Forcing InnoDB Recovery
Section 1.7.5.4, Foreign Keys
Section 7.5.6.2, General Thread States
Section 7.5.5.1, How the Query Cache Operates
Section 21.10.10.3, How to Get the Unique ID for the Last Inserted
Row
Section 13.6.4.1, How to Use Transactions in InnoDB with Different
APIs
Section 11.11.3, Information Functions
Section 7.3.1, Internal Locking Methods
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 3.3.3, Loading Data into a Table
Section 17.2.5, Loading Sample Data into MySQL Cluster and Per-
forming Queries
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 18.3.1, Management of RANGE and LIST Partitions
Section 11.11.4, Miscellaneous Functions
Section A.1, MySQL 5.1 FAQ General
Section A.5, MySQL 5.1 FAQ Triggers
Section A.6, MySQL 5.1 FAQ Views
Section 7.1.1, MySQL Design Limitations and Tradeoffs
Section 1.7.4, MySQL Extensions to Standard SQL
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 10.2, Numeric Types
Section 7.2.24, Other Optimization Tips
Section 10.1.2, Overview of Date and Time Types
Section 17.5.1, Performing a Rolling Restart of a MySQL Cluster
Section 11.13.4.4, Populating Spatial Columns
Section 5.4.2, Privilege System Grant Tables
Section 16.1.3.2, Replication Master Options and Variables
Section 16.3.1.1, Replication and AUTO_INCREMENT
Section 16.3.1.10, Replication and System Functions
Section 18.5, Restrictions and Limitations on Partitioning
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.3, Restrictions on Subqueries
Section 12.7, SQL Syntax for Prepared Statements
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.8, Server SQL Modes
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 7.2.21, Speed of INSERT Statements
Section 12.2.9, Subquery Syntax
Section 7.3.2, Table Locking Issues
Section 13.12, The ARCHIVE Storage Engine
Section 13.14, The BLACKHOLE Storage Engine
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 13.8, The MERGE Storage Engine
Section 13.5, The MyISAM Storage Engine
Section 9.1.6.4, The _bin and binary Collations
Section 5.2.4, The Binary Log
Section 5.4, The MySQL Access Privilege System
Section 7.5.5, The MySQL Query Cache
Section 5.1.11, The Shutdown Process
Section 19.3.1, Trigger Syntax
Section 19.5.3, Updatable and Insertable Views
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 19.3, Using Triggers
Section 21.10.10.2, What Results You Can Get from a Query
Section 5.4.6, When Privilege Changes Take Effect
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
INSERT ... ON DUPLICATE KEY
UPDATE
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 13.8.1, MERGE Table Problems
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.37, mysql_insert_id()
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 11.11.3, Information Functions
Section 11.11.4, Miscellaneous Functions
Section 5.2.4, The Binary Log
INSERT ... SELECT
Section 12.2.5.1, INSERT ... SELECT Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 21.10.3.37, mysql_insert_id()
Section B.1.8.2, Additional Known Issues
Section 7.3.3, Concurrent Inserts
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 16.3.1.11, Replication and LIMIT
Section 5.1.4, Server System Variables
Section 5.2.4, The Binary Log
INSERT ... SET
Section 12.2.5, INSERT Syntax
INSERT ... VALUES
Statement/Syntax Index
3441
Section 12.2.5, INSERT Syntax
Section 21.10.3.35, mysql_info()
INSERT DELAYED
Section 12.1.7, ALTER TABLE Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 12.5.6.4, KILL Syntax
Section 13.8.1, MERGE Table Problems
Section B.1.8.2, Additional Known Issues
Section 7.5.6.3, Delayed-Insert Thread States
Description
Section 2.13.1.3, Linux Source Distribution Notes
Section 5.2.4.3, Mixed Binary Logging Format
Section 22.1.1, MySQL Threads
Section 7.2.24, Other Optimization Tips
Section 12.4.5.3, Other Table-Locking Notes
Section 18.5, Restrictions and Limitations on Partitioning
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 7.2.21, Speed of INSERT Statements
Section 7.3.2, Table Locking Issues
Section 13.12, The ARCHIVE Storage Engine
Section 13.14, The BLACKHOLE Storage Engine
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 1.7.5.2, Transactions and Atomic Operations
Section 19.5.3, Updatable and Insertable Views
INSERT IGNORE
Section 1.7.6.3, ENUM and SET Constraints
Section 12.2.5, INSERT Syntax
Section 1.7.6.2, Constraints on Invalid Data
Section 11.11.3, Information Functions
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 5.1.8, Server SQL Modes
INSERT INTO ... SELECT
Section 12.1.11, CREATE EVENT Syntax
Section 12.2.5, INSERT Syntax
Section 1.7.5.1, SELECT INTO TABLE
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 13.6.8.2, Consistent Nonlocking Reads
Section 1.7.6.2, Constraints on Invalid Data
Section 5.1.4, Server System Variables
Section 13.9, The MEMORY (HEAP) Storage Engine
INSERT INTO ... SELECT ...
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 21.10.3.35, mysql_info()
Section 21.10.10.2, What Results You Can Get from a Query
INSTALL PLUGIN
Section 12.5.6.3, FLUSH Syntax
Section 12.5.3.3, INSTALL PLUGIN Syntax
Section 22.2.1, Characteristics of the Plugin Interface
Section 22.2.3.3, Creating a Plugin Library
Section 22.2.3.1, General Plugin Structures and Functions
Section 7.5.8, How MySQL Uses Memory
Section 13.4.1, Pluggable Storage Engine Architecture
Section 5.1.2, Server Command Options
Section 5.1.3, Server Options for Loading Plugins
Section 2.10.2, Typical configure Options
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
KILL
Section 12.5.1.3, GRANT Syntax
Section 12.5.6.4, KILL Syntax
Section B.1.2.9, MySQL server has gone away
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 21.10.3.38, mysql_kill()
Section 7.5.6.2, General Thread States
Section 12.4.5.3, Other Table-Locking Notes
Section 5.4.1, Privileges Provided by MySQL
KILL CONNECTION
Section 12.5.6.4, KILL Syntax
Section 12.6.2.8, STOP SLAVE Syntax
KILL QUERY
Section 12.5.6.4, KILL Syntax
Section 12.6.2.8, STOP SLAVE Syntax
LEAVE
Section D.1, Restrictions on Stored Routines, Triggers, and Events
LOAD DATA
Section 12.1.19, CREATE TRIGGER Syntax
Section 13.6.4.4, FOREIGN KEY Constraints
Section 12.2.6, LOAD DATA INFILE Syntax
Section B.1.8.2, Additional Known Issues
Section 7.3.3, Concurrent Inserts
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 3.3.3, Loading Data into a Table
Section 5.3.2, Making MySQL Secure Against Attackers
Section 16.3.1.12, Replication and LOAD DATA
Section 18.5, Restrictions and Limitations on Partitioning
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.3.4, Security Issues with LOAD DATA LOCAL
Section 5.3.3, Security-Related mysqld Options
Section 3.3.4.1, Selecting All Data
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 10.4.4, The ENUM Type
Section 8.4, User-Defined Variables
LOAD DATA INFILE
Section 4.5.1.1, mysql Options
Section 4.6.7.1, mysqlbinlog Hex Dump Format
Section 12.2.6, LOAD DATA INFILE Syntax
Section 13.5.1, MyISAM Startup Options
Section 8.1.6, NULL Values
Section 12.2.8, SELECT Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section B.1.8.2, Additional Known Issues
Chapter 6, Backup and Recovery
Section 5.4.7, Causes of Access-Denied Errors
Section 7.3.3, Concurrent Inserts
Section 6.1, Database Backups
Section 9.1.3.2, Database Character Set and Collation
Description
Statement/Syntax Index
3442
Description
Description
Description
Section B.1.4.3, How MySQL Handles a Full Disk
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 1.7.4, MySQL Extensions to Standard SQL
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 10.2, Numeric Types
Section 7.2.24, Other Optimization Tips
Section 4.1, Overview of MySQL Programs
Section 5.4.1, Privileges Provided by MySQL
Section B.1.5.3, Problems with NULL Values
Section 16.3.2, Replication Compatibility Between MySQL Versions
Section 16.1.3.3, Replication Slave Options and Variables
Section 7.5.6.6, Replication Slave SQL Thread States
Section 16.3.1.12, Replication and LOAD DATA
Section D.6, Restrictions on Character Sets
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 7.2.21, Speed of INSERT Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Section 12.2.9, Subquery Syntax
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 5.4, The MySQL Access Privilege System
Section 12.2.9.1, The Subquery as Scalar Operand
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section B.1.4.4, Where MySQL Stores Temporary Files
LOAD DATA LOCAL
Section 21.10.3.49, mysql_options()
Section 21.10.3.52, mysql_real_connect()
Description
Section 5.3.4, Security Issues with LOAD DATA LOCAL
LOAD DATA LOCAL INFILE
Section 21.10.3.63, mysql_set_local_infile_handler()
Section 21.10.2, C API Function Overview
Description
Section 16.3.1.12, Replication and LOAD DATA
LOAD INDEX INTO CACHE
Section 12.5.6.5, LOAD INDEX INTO CACHE Syntax
Section 7.4.5.4, Index Preloading
Section 18.5, Restrictions and Limitations on Partitioning
Section 12.4.3, Statements That Cause an Implicit Commit
LOAD XML
Section 1.4.2, What Is Planned for MySQL 6.0
LOCK TABLE
Section 7.3.3, Concurrent Inserts
Section 7.5.6.2, General Thread States
Section B.1.7.1, Problems with ALTER TABLE
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
LOCK TABLES
Section 12.5.2.2, BACKUP TABLE Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.3.3, HELP Syntax
Section 13.6.3, InnoDB Startup Options and System Variables
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 12.4.5.2, LOCK TABLES and Triggers
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 6.1, Database Backups
Section 11.6, Date and Time Functions
Section 13.6.8.8, Deadlock Detection and Rollback
Description
Description
Section 13.6.8.9, How to Cope with Deadlocks
Section 12.4.5.1, Interaction of Table Locking and Transactions
Section 7.3.1, Internal Locking Methods
Section 17.12.10, Limitations Relating to Multiple MySQL Cluster
Nodes
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 12.4.5.3, Other Table-Locking Notes
Section 5.4.1, Privileges Provided by MySQL
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
Section 13.6.14, Restrictions on InnoDB Tables
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 7.2.21, Speed of INSERT Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Section 7.5.2, System Factors and Startup Parameter Tuning
Section 7.3.2, Table Locking Issues
Section 13.14, The BLACKHOLE Storage Engine
Section 1.7.5.2, Transactions and Atomic Operations
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 1.4.2, What Is Planned for MySQL 6.0
OPTIMIZE TABLE
Section 4.6.3.1, myisamchk General Options
Section 12.1.7, ALTER TABLE Syntax
Section 12.2.2, DELETE Syntax
Section 12.5.6.4, KILL Syntax
Section 13.8.1, MERGE Table Problems
Section 12.5.2.5, OPTIMIZE TABLE Syntax
Section 17.7.8.2, Adding MySQL Cluster Data Nodes Online: Basic
procedure
Section B.1.8.2, Additional Known Issues
Section 22.5.1, Debugging a MySQL Server
Description
Description
Section 13.5.3.2, Dynamic Table Characteristics
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 7.5.6.2, General Thread States
Section B.1.4.3, How MySQL Handles a Full Disk
Section 17.12.2, Limits and Differences of MySQL Cluster from Stand-
ard MySQL Limits
Section 18.3.3, Maintenance of Partitions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.2.24, Other Optimization Tips
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.1.9, Replication and FLUSH
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.2, Server Command Options
Section 6.4.6, Setting Up a Table Maintenance Schedule
Statement/Syntax Index
3443
Section 7.2.22, Speed of UPDATE Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Section 13.5.3.1, Static (Fixed-Length) Table Characteristics
Section 6.4, Table Maintenance and Crash Recovery
Section 6.4.4, Table Optimization
Section 13.12, The ARCHIVE Storage Engine
Section 5.1.11, The Shutdown Process
Section 5.2.5, The Slow Query Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
PREPARE
Section 12.2.1, CALL Syntax
Section 12.7.3, DEALLOCATE PREPARE Syntax
Section 12.7.2, EXECUTE Syntax
Section 12.7.1, PREPARE Syntax
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 7.5.5.1, How the Query Cache Operates
Section 8.2.2, Identifier Case Sensitivity
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.4, Restrictions on Views
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.7, Server Status Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
PURGE BINARY LOGS
Section 12.5.1.3, GRANT Syntax
Section 12.6.1.1, PURGE BINARY LOGS Syntax
Section 12.6.1.2, RESET MASTER Syntax
Section 6.2.1, Backup Policy
Section 5.4.1, Privileges Provided by MySQL
Section 5.2.4, The Binary Log
RELEASE SAVEPOINT
Section 12.4.4, SAVEPOINT and ROLLBACK TO SAVEPOINT Syn-
tax
RENAME TABLE
Section 12.1.7, ALTER TABLE Syntax
Section 12.2.2, DELETE Syntax
Section 13.8.1, MERGE Table Problems
Section 12.1.33, RENAME TABLE Syntax
Description
Section 7.5.6.2, General Thread States
Section 1.7.4, MySQL Extensions to Standard SQL
Section 12.7, SQL Syntax for Prepared Statements
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 12.4.3, Statements That Cause an Implicit Commit
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 13.6.2.1, Using Per-Table Tablespaces
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
RENAME USER
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.4, RENAME USER Syntax
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 5.4.1, Privileges Provided by MySQL
Section 12.4.3, Statements That Cause an Implicit Commit
REPAIR TABLE
Section 4.6.3.1, myisamchk General Options
Section 12.1.7, ALTER TABLE Syntax
Section 12.5.6.4, KILL Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 13.8.1, MERGE Table Problems
Section 13.5.1, MyISAM Startup Options
Section 12.5.2.6, REPAIR TABLE Syntax
Section B.1.8.2, Additional Known Issues
Section 13.5.4.1, Corrupted MyISAM Tables
Section 6.1, Database Backups
Description
Description
Section 7.3.4, External Locking
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 7.5.6.2, General Thread States
Section B.1.4.3, How MySQL Handles a Full Disk
Section 6.4.3, How to Repair Tables
Section 1.6, How to Report Bugs or Problems
Section 2.8, Installing MySQL on NetWare
Section 18.3.3, Maintenance of Partitions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 5.4.1, Privileges Provided by MySQL
Section 13.5.4.2, Problems from Tables Not Being Closed Properly
Section B.1.7.1, Problems with ALTER TABLE
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section 16.3.1.9, Replication and FLUSH
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.4, Server System Variables
Section 6.4.6, Setting Up a Table Maintenance Schedule
Section 12.4.3, Statements That Cause an Implicit Commit
Section 6.4, Table Maintenance and Crash Recovery
Section 13.12, The ARCHIVE Storage Engine
Section 5.1.11, The Shutdown Process
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
REPEAT
Section 19.1, Defining Stored Programs
REPLACE
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 13.8.1, MERGE Table Problems
Section B.1.2.9, MySQL server has gone away
Section 12.2.7, REPLACE Syntax
Section 21.10.3.1, mysql_affected_rows()
Section B.1.8.2, Additional Known Issues
Section 21.10.4, C API Prepared Statements
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 10.1.4, Data Type Default Values
Description
Section 7.1.2, Designing Applications for Portability
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 1.7.4, MySQL Extensions to Standard SQL
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.2, Server Command Options
Section 12.2.9, Subquery Syntax
Statement/Syntax Index
3444
Section 13.12, The ARCHIVE Storage Engine
REPLACE ... SELECT
Section B.1.8.2, Additional Known Issues
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
RESET
Section 12.5.6.3, FLUSH Syntax
Section 12.5.6.6, RESET Syntax
Section 1.7.4, MySQL Extensions to Standard SQL
RESET MASTER
Section 12.5.6.3, FLUSH Syntax
Section 12.6.1.2, RESET MASTER Syntax
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 21.10.3.55, mysql_refresh()
Section 5.2.4, The Binary Log
RESET SLAVE
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 12.5.6.3, FLUSH Syntax
Section 12.6.1.2, RESET MASTER Syntax
Section 12.6.2.5, RESET SLAVE Syntax
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 21.10.3.55, mysql_refresh()
Section 16.1.3.3, Replication Slave Options and Variables
Section 1.4.2, What Is Planned for MySQL 6.0
RESIGNAL
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
RESTORE
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 1.4.2, What Is Planned for MySQL 6.0
RESTORE TABLE
Section 12.5.2.2, BACKUP TABLE Syntax
Section 12.5.2.7, RESTORE TABLE Syntax
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
Section 1.4.2, What Is Planned for MySQL 6.0
RETURN
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section D.1, Restrictions on Stored Routines, Triggers, and Events
REVOKE
Section 12.5.6.3, FLUSH Syntax
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.5, REVOKE Syntax
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.3.1, General Security Guidelines
Section 7.5.8, How MySQL Uses Memory
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 1.7.5, MySQL Differences from Standard SQL
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 2.11.2.1, Problems Running mysql_install_db
Section 16.3.4, Replication FAQ
Section 16.3.1.17, Replication of the System mysql Database
Section 12.4.3, Statements That Cause an Implicit Commit
Section 5.4, The MySQL Access Privilege System
Section 5.5.1, User Names and Passwords
Section 5.4.6, When Privilege Changes Take Effect
REVOKE ALL PRIVILEGES
Section 12.5.1.3, GRANT Syntax
Section 5.4.1, Privileges Provided by MySQL
ROLLBACK
Section 13.6.12, InnoDB Error Handling
Section 12.4.4, SAVEPOINT and ROLLBACK TO SAVEPOINT Syn-
tax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 21.10.3.3, mysql_change_user()
Section 19.6, Binary Logging of Stored Programs
Section 13.1, Comparing Transaction and Nontransaction Engines
Section 13.6.8.8, Deadlock Detection and Rollback
Section 13.6.4.1, How to Use Transactions in InnoDB with Different
APIs
Section 11.11.3, Information Functions
Section 12.4.5.1, Interaction of Table Locking and Transactions
Section 12.4, MySQL Transactional and Locking Statements
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.25, Replication and Transactions
Section B.1.5.5, Rollback Failure for Nontransactional Tables
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 12.4.2, Statements That Cannot Be Rolled Back
Section 12.4.3, Statements That Cause an Implicit Commit
Chapter 13, Storage Engines
Section 13.6.8, The InnoDB Transaction Model and Locking
Section 5.2.4, The Binary Log
Section 1.7.5.2, Transactions and Atomic Operations
Section 19.3.1, Trigger Syntax
ROLLBACK TO SAVEPOINT
Section 12.4.4, SAVEPOINT and ROLLBACK TO SAVEPOINT Syn-
tax
SAVEPOINT
Section 12.4.4, SAVEPOINT and ROLLBACK TO SAVEPOINT Syn-
tax
SELECT
Section 4.5.1.1, mysql Options
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.9, ALTER VIEW Syntax
Section 12.2.1, CALL Syntax
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.2.2, DELETE Syntax
Statement/Syntax Index
3445
Section 12.2.9.6, EXISTS and NOT EXISTS
Section 12.3.2, EXPLAIN Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 12.5.1.3, GRANT Syntax
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 11.12.3, GROUP BY and HAVING with Hidden Columns
Section 12.2.4, HANDLER Syntax
Chapter 20, INFORMATION_SCHEMA Tables
Section 12.2.5.1, INSERT ... SELECT Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 13.6.3, InnoDB Startup Options and System Variables
Section 12.2.8.1, JOIN Syntax
Section 12.5.6.4, KILL Syntax
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 12.6.2.3, LOAD TABLE tbl_name FROM MASTER Syn-
tax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 13.8.1, MERGE Table Problems
Section 22.4.1, PROCEDURE ANALYSE
Section 13.6.8.3, SELECT ... FOR UPDATE and SELECT ...
LOCK IN SHARE MODE Locking Reads
Section 12.2.8, SELECT Syntax
Section 12.4.6, SET TRANSACTION Syntax
Section 12.5.4, SET Syntax
Section 12.5.5.3, SHOW BINLOG EVENTS Syntax
Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 12.5.5.18, SHOW ERRORS Syntax
Section 12.5.5.29, SHOW PROCEDURE CODE Syntax
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 12.5.5, SHOW Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 12.2.8.3, UNION Syntax
Section 12.2.11, UPDATE Syntax
Section 7.2.4, WHERE Clause Optimization
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.17, mysql_fetch_field()
Section 21.10.3.22, mysql_field_count()
Section 21.10.3.47, mysql_num_fields()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.11, mysql_stmt_fetch()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section B.1.8.2, Additional Known Issues
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 13.6.8.5, Avoiding the Phantom Problem Using Next-Key
Locking
Section 19.6, Binary Logging of Stored Programs
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.4, C API Prepared Statements
Section 21.10.12, C API Support for Multiple Statement Execution
Section 7.4.2, Column Indexes
Section 7.3.3, Concurrent Inserts
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 17.3.6, Configuring MySQL Cluster Parameters for Local
Checkpoints
Section 9.1.4, Connection Character Sets and Collations
Section 13.6.8.2, Consistent Nonlocking Reads
Section 13.11.2.1, Creating a FEDERATED Table Using
CONNECTION
Section 13.6.8.8, Deadlock Detection and Rollback
Description
Description
Description
Section 7.4.8, Disadvantages of Creating Many Tables in the Same
Database
Section 5.1.6.2, Dynamic System Variables
Section 3.2, Entering Queries
Section 9.1.6.7, Examples of the Effect of Collation
Section 13.6.6.2, Forcing InnoDB Recovery
Section 1.7.5.4, Foreign Keys
Chapter 11, Functions and Operators
Section 7.5.6.2, General Thread States
Section 18.2.6, How MySQL Partitioning Handles NULL
Section 7.4.4, How MySQL Uses Indexes
Section 7.5.10, How MySQL Uses Internal Temporary Tables
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 7.5.5.1, How the Query Cache Operates
Section 13.6.8.9, How to Cope with Deadlocks
Section 1.6, How to Report Bugs or Problems
Section 13.6.4.1, How to Use Transactions in InnoDB with Different
APIs
Section 8.2.1, Identifier Qualifiers
Section 12.2.8.2, Index Hint Syntax
Section 11.11.3, Information Functions
Section 7.3.1, Internal Locking Methods
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 17.2.5, Loading Sample Data into MySQL Cluster and Per-
forming Queries
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 5.3.2, Making MySQL Secure Against Attackers
Section 18.3.1, Management of RANGE and LIST Partitions
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 11.8.1, Natural Language Full-Text Searches
Section 18.3.4, Obtaining Information About Partitions
Section B.1.6, Optimizer-Related Issues
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2, Optimizing SELECT and Other Statements
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 4.6.3.4, Other myisamchk Options
Section 7.2.24, Other Optimization Tips
Section 12.4.5.3, Other Table-Locking Notes
Section 5.4.1, Privileges Provided by MySQL
Section B.1.5.2, Problems Using DATE Columns
Section B.1.5.8, Problems with Floating-Point Comparisons
Section 7.5.5.2, Query Cache SELECT Options
Section 7.5.5.4, Query Cache Status and Maintenance
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
Section 13.13.1, Repairing and Checking CSV Tables
Section 16.3.4, Replication FAQ
Section 16.4, Replication Implementation
Section 16.1.3.2, Replication Master Options and Variables
Section 16.3.1.7, Replication of Invoked Features
Section 8.3, Reserved Words
Statement/Syntax Index
3446
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section D.3, Restrictions on Subqueries
Section D.4, Restrictions on Views
Section 3.3.4, Retrieving Information from a Table
Section 2.13.5.7, SGI Irix Notes
Section 12.7, SQL Syntax for Prepared Statements
Section 3.6.7, Searching on Two Keys
Section 3.3.4.1, Selecting All Data
Section 3.3.4.2, Selecting Particular Rows
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section B.1.5.7, Solving Problems with No Matching Rows
Section 7.2.21, Speed of INSERT Statements
Section 7.2.3, Speed of SELECT Queries
Section 7.2.22, Speed of UPDATE Statements
Section 19.2.1, Stored Routine Syntax
Section 8.1.1, Strings
Section 12.2.9.8, Subqueries in the FROM clause
Section 12.2.9.9, Subquery Errors
Section 12.2.9, Subquery Syntax
Section 7.3.2, Table Locking Issues
Section 13.12, The ARCHIVE Storage Engine
Section 10.4.4, The ENUM Type
Section 20.3, The INFORMATION_SCHEMA COLUMNS Table
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 13.8, The MERGE Storage Engine
Section 5.2.4, The Binary Log
Section 9.2, The Character Set Used for Data and Sorting
Section 5.4, The MySQL Access Privilege System
Section 7.5.5, The MySQL Query Cache
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 12.2.9.1, The Subquery as Scalar Operand
Section 19.3.1, Trigger Syntax
Section 1.2, Typographical and Syntax Conventions
Section 9.1.10, UTF-8 for Metadata
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 8.4, User-Defined Variables
Section 22.5.1.6, Using Server Logs to Find Causes of Errors in
mysqld
Section 5.1.6, Using System Variables
Section 11.13.6.2, Using a Spatial Index
Section 4.5.1.5.2, Using the --safe-updates Option
Section 19.5.1, View Syntax
Section B.1.4.4, Where MySQL Stores Temporary Files
SELECT ... FOR UPDATE
Section 13.6.8.1, InnoDB Lock Modes
Section 13.6.8.3, SELECT ... FOR UPDATE and SELECT ...
LOCK IN SHARE MODE Locking Reads
Section 13.6.8.9, How to Cope with Deadlocks
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
SELECT ... FROM
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
SELECT ... FROM ... FOR UPDATE
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
SELECT ... FROM ... LOCK IN
SHARE MODE
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
SELECT ... INTO OUTFILE
Section 12.2.6, LOAD DATA INFILE Syntax
Section 8.1.6, NULL Values
Section 1.7.5.1, SELECT INTO TABLE
Section 12.2.8, SELECT Syntax
Chapter 6, Backup and Recovery
Section 5.4.7, Causes of Access-Denied Errors
Section 5.3.2, Making MySQL Secure Against Attackers
Section 2.3.15, MySQL on Windows Compared to MySQL on Unix
Section 5.4.1, Privileges Provided by MySQL
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 1.2, Typographical and Syntax Conventions
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
SELECT ... LOCK IN SHARE MODE
Section 13.6.8.1, InnoDB Lock Modes
Section 13.6.8.3, SELECT ... FOR UPDATE and SELECT ...
LOCK IN SHARE MODE Locking Reads
Section 12.4.6, SET TRANSACTION Syntax
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
SELECT DISTINCT
Section 7.5.6.2, General Thread States
Section D.3, Restrictions on Subqueries
SET
Section 12.5.4, SET Syntax
Section 12.5.5.41, SHOW VARIABLES Syntax
Section 16.1.3.4, Binary Log Options and Variables
Section 19.6, Binary Logging of Stored Programs
Section 21.10.4, C API Prepared Statements
Section 19.1, Defining Stored Programs
Description
Section 5.1.6.2, Dynamic System Variables
Chapter 11, Functions and Operators
Section 11.11.3, Information Functions
Section 1.7.4, MySQL Extensions to Standard SQL
Section 7.5.5.3, Query Cache Configuration
Section 16.1.3.2, Replication Master Options and Variables
Section 16.1.3.3, Replication Slave Options and Variables
Section D.3, Restrictions on Subqueries
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 12.2.9, Subquery Syntax
Section 19.3.1, Trigger Syntax
Section 8.4, User-Defined Variables
Section 4.2.3.4, Using Options to Set Program Variables
Section 5.1.6, Using System Variables
Section 4.5.1.5.2, Using the --safe-updates Option
SET GLOBAL
Section 12.5.1.3, GRANT Syntax
Section 12.5.4, SET Syntax
Section 5.1.6.2, Dynamic System Variables
Statement/Syntax Index
3447
Section 7.4.5.2, Multiple Key Caches
Section 5.4.1, Privileges Provided by MySQL
Section 5.1.6, Using System Variables
SET PASSWORD
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.6, SET PASSWORD Syntax
Section 12.5.4, SET Syntax
Section 5.5.6.1, Administrator Guidelines for Password Security
Section 5.5.5, Assigning Account Passwords
Section 5.4.7, Causes of Access-Denied Errors
Section 5.5.6.2, End-User Guidelines for Password Security
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 5.5.6.3, Password Hashing in MySQL
Section 16.3.1.17, Replication of the System mysql Database
Section 2.11.3, Securing the Initial MySQL Accounts
Section 5.4.3, Specifying Account Names
Section 12.4.3, Statements That Cause an Implicit Commit
Section 5.4.6, When Privilege Changes Take Effect
SET SESSION
Section 12.5.4, SET Syntax
Section 5.1.6.2, Dynamic System Variables
Section 5.1.6, Using System Variables
SET TIMESTAMP = value
Section 7.5.6, Examining Thread Information
SET TRANSACTION
Section 12.4.6, SET TRANSACTION Syntax
Section 13.6.8, The InnoDB Transaction Model and Locking
SET TRANSACTION ISOLATION
LEVEL
Section 12.5.4, SET Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 5.1.4, Server System Variables
SET [GLOBAL|SESSION]
sql_mode='mode_value'
Section 1.7.2, Selecting SQL Modes
SET [GLOBAL|SESSION]
sql_mode='modes'
Section A.3, MySQL 5.1 FAQ Server SQL Mode
SET autocommit
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 12.4, MySQL Transactional and Locking Statements
SHOW
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Chapter 20, INFORMATION_SCHEMA Tables
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 12.5.5.23, SHOW INDEX Syntax
Section 12.5.5.26, SHOW OPEN TABLES Syntax
Section 12.5.5.39, SHOW TABLES Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 12.5.5, SHOW Syntax
Section 21.10.7.27, mysql_stmt_store_result()
Section 21.10.3.69, mysql_store_result()
Section 21.10.3.71, mysql_use_result()
Section 21.10.1, C API Data Types
Section 21.10.2, C API Function Overview
Section 21.10.4, C API Prepared Statements
Section 13.6.4, Creating and Using InnoDB Tables
Section 3.3, Creating and Using a Database
Description
Section 20.28, Extensions to SHOW Statements
Section 8.2.3, Mapping of Identifiers to File Names
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 1.7.4, MySQL Extensions to Standard SQL
Section 16.3.4, Replication FAQ
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 12.6.1, SQL Statements for Controlling Master Servers
Section 12.7, SQL Syntax for Prepared Statements
Section 19.2.3, Stored Routine Metadata
Section 20.11, The INFORMATION_SCHEMA COLLA-
TION_CHARACTER_SET_APPLICABILITY Table
Section 20.9, The INFORMATION_SCHEMA CHARACTER_SETS Ta-
ble
Section 20.10, The INFORMATION_SCHEMA COLLATIONS Table
Section 20.3, The INFORMATION_SCHEMA COLUMNS Table
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
Section 20.18, The INFORMATION_SCHEMA ENGINES Table
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
Section 20.21, The INFORMATION_SCHEMA FILES Table
Section 20.24, The INFORMATION_SCHEMA GLOBAL_STATUS and
SESSION_STATUS Tables
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
Section 20.13, The INFORMATION_SCHEMA KEY_COLUMN_USAGE
Table
Section 20.19, The INFORMATION_SCHEMA PARTITIONS Table
Section 20.17, The INFORMATION_SCHEMA PLUGINS Table
Section 20.22, The INFORMATION_SCHEMA PROCESSLIST Table
Section 20.26, The INFORMATION_SCHEMA PROFILING Table
Section 20.23, The INFORMATION_SCHEMA REFEREN-
TIAL_CONSTRAINTS Table
Section 20.1, The INFORMATION_SCHEMA SCHEMATA Table
Section 20.6, The INFORMATION_SCHEMA
SCHEMA_PRIVILEGES Table
Section 20.4, The INFORMATION_SCHEMA STATISTICS Table
Section 20.2, The INFORMATION_SCHEMA TABLES Table
Section 20.12, The INFORMATION_SCHEMA TA-
BLE_CONSTRAINTS Table
Section 20.7, The INFORMATION_SCHEMA TABLE_PRIVILEGES
Table
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 20.5, The INFORMATION_SCHEMA USER_PRIVILEGES
Table
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 5.2.4, The Binary Log
Section 9.1.10, UTF-8 for Metadata
Statement/Syntax Index
3448
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
SHOW AUTHORS
Section 12.5.5.1, SHOW AUTHORS Syntax
SHOW BINARY LOGS
Section 12.6.1.1, PURGE BINARY LOGS Syntax
Section 12.5.5.2, SHOW BINARY LOGS Syntax
Section 12.6.1, SQL Statements for Controlling Master Servers
SHOW BINLOG EVENTS
Section 12.5.5.3, SHOW BINLOG EVENTS Syntax
Section 12.6.2.7, START SLAVE Syntax
Section D.2, Restrictions on Server-Side Cursors
Section 12.6.1, SQL Statements for Controlling Master Servers
SHOW CHARACTER SET
Section 12.1.1, ALTER DATABASE Syntax
Section 12.5.5.4, SHOW CHARACTER SET Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 9.1.12, Character Sets and Collations That MySQL Supports
Section 9.1.2, Character Sets and Collations in MySQL
Section 20.28, Extensions to SHOW Statements
SHOW COLLATION
Section 12.1.1, ALTER DATABASE Syntax
Section 12.5.5.5, SHOW COLLATION Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 21.10.1, C API Data Types
Section 9.1.2, Character Sets and Collations in MySQL
Section 9.1.3.5, Character String Literal Character Set and Collation
Section 9.5.2, Choosing a Collation ID
Section 9.1.3.4, Column Character Set and Collation
Section 9.1.3.2, Database Character Set and Collation
Section 9.1.3.3, Table Character Set and Collation
Section 20.11, The INFORMATION_SCHEMA COLLA-
TION_CHARACTER_SET_APPLICABILITY Table
Section 9.2, The Character Set Used for Data and Sorting
Section 2.10.2, Typical configure Options
SHOW COLUMNS
Section 12.3.1, DESCRIBE Syntax
Section 12.3.2, EXPLAIN Syntax
Section 7.2.17, LIMIT Optimization
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 20.28, Extensions to SHOW Statements
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
SHOW CONTRIBUTORS
Section 12.5.5.7, SHOW CONTRIBUTORS Syntax
SHOW CREATE DATABASE
Section 12.5.5.8, SHOW CREATE DATABASE Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 5.1.5, Session System Variables
SHOW CREATE EVENT
Section 12.5.5.9, SHOW CREATE EVENT Syntax
SHOW CREATE FUNCTION
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.5.5.10, SHOW CREATE FUNCTION Syntax
Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax
Section 1.6, How to Report Bugs or Problems
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 19.2.3, Stored Routine Metadata
SHOW CREATE PROCEDURE
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.5.5.10, SHOW CREATE FUNCTION Syntax
Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax
Section 1.6, How to Report Bugs or Problems
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 19.2.3, Stored Routine Metadata
SHOW CREATE SCHEMA
Section 12.5.5.8, SHOW CREATE DATABASE Syntax
SHOW CREATE TABLE
Section 12.1.17, CREATE TABLE Syntax
Section 12.3.1, DESCRIBE Syntax
Section 13.6.4.4, FOREIGN KEY Constraints
Section 18.2.4, KEY Partitioning
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 12.5.5.12, SHOW CREATE TABLE Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 10.1.4, Data Type Default Values
Section 3.4, Getting Information About Databases and Tables
Section 13.11.2, How to Create FEDERATED Tables
Section 6.4.3, How to Repair Tables
Section 18.3.1, Management of RANGE and LIST Partitions
Section 18.3.4, Obtaining Information About Partitions
Section 2.12.4, Rebuilding or Repairing Tables or Indexes
Section 5.1.8, Server SQL Modes
Section 5.1.5, Session System Variables
Section 12.1.17.1, Silent Column Specification Changes
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 3.6.6, Using Foreign Keys
Section 7.6.1.2, Using Symbolic Links for Tables on Unix
SHOW CREATE TRIGGER
Section 12.5.5.13, SHOW CREATE TRIGGER Syntax
SHOW CREATE VIEW
Section 12.5.1.3, GRANT Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 5.4.1, Privileges Provided by MySQL
Section D.4, Restrictions on Views
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 19.5.4, View Metadata
SHOW DATABASES
Section 12.1.10, CREATE DATABASE Syntax
Section 12.5.1.3, GRANT Syntax
Chapter 20, INFORMATION_SCHEMA Tables
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Statement/Syntax Index
3449
Section 12.5.5.15, SHOW DATABASES Syntax
Section 3.3, Creating and Using a Database
Section 20.28, Extensions to SHOW Statements
Section 3.4, Getting Information About Databases and Tables
Section 8.2.2, Identifier Case Sensitivity
Section 2.13.1.6, Linux SPARC Notes
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 17.8.2, MySQL Cluster and MySQL Privileges
Section 5.4.2, Privilege System Grant Tables
Section 5.3.3, Security-Related mysqld Options
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
SHOW ENGINE
Section 12.5.5.16, SHOW ENGINE Syntax
SHOW ENGINE BDB LOGS
Section 12.5.5.16, SHOW ENGINE Syntax
SHOW ENGINE INNODB MUTEX
Section 12.5.5.16, SHOW ENGINE Syntax
Section 5.1.4, Server System Variables
SHOW ENGINE INNODB STATUS
Section 13.6.4.4, FOREIGN KEY Constraints
Section 13.6.13.2.1, InnoDB Standard Monitor and Lock Monitor Out-
put
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.13.2, SHOW ENGINE INNODB STATUS and the In-
noDB Monitors
Section 12.5.5.16, SHOW ENGINE Syntax
Section 12.5.5.24, SHOW INNODB STATUS Syntax
Section 13.6.8.9, How to Cope with Deadlocks
Section 13.6.2.1, Using Per-Table Tablespaces
Section 1.4.2, What Is Planned for MySQL 6.0
SHOW ENGINE NDB STATUS
Section 12.5.5.16, SHOW ENGINE Syntax
Section 17.7, Management of MySQL Cluster
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
SHOW ENGINE NDBCLUSTER STATUS
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
SHOW ENGINES
Section 12.5.5.17, SHOW ENGINES Syntax
Section A.10, MySQL 5.1 FAQ MySQL Cluster
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
Section 2.3.8, Selecting a MySQL Server Type
Chapter 13, Storage Engines
Section 13.12, The ARCHIVE Storage Engine
Section 13.14, The BLACKHOLE Storage Engine
Section 13.6, The InnoDB Storage Engine
Section 1.4.2, What Is Planned for MySQL 6.0
SHOW ERRORS
Section 12.5.5.18, SHOW ERRORS Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 5.1.4, Server System Variables
SHOW EVENTS
Section 12.1.11, CREATE EVENT Syntax
Section 12.5.5.19, SHOW EVENTS Syntax
Section 16.3.1.7, Replication of Invoked Features
SHOW FULL COLUMNS
Section 12.1.17, CREATE TABLE Syntax
Section 9.1.8.3, SHOW Statements and INFORMATION_SCHEMA
Section 20.8, The INFORMATION_SCHEMA
COLUMN_PRIVILEGES Table
SHOW FULL PROCESSLIST
Description
Section 7.5.6, Examining Thread Information
SHOW FUNCTION CODE
Section 12.5.5.20, SHOW FUNCTION CODE Syntax
Section 12.5.5.29, SHOW PROCEDURE CODE Syntax
SHOW FUNCTION STATUS
Section 12.5.5.21, SHOW FUNCTION STATUS Syntax
Section 12.5.5.30, SHOW PROCEDURE STATUS Syntax
Section 19.2.3, Stored Routine Metadata
SHOW GLOBAL STATUS
Section 20.24, The INFORMATION_SCHEMA GLOBAL_STATUS and
SESSION_STATUS Tables
SHOW GLOBAL VARIABLES
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
SHOW GRANTS
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.5, REVOKE Syntax
Section 12.5.5.22, SHOW GRANTS Syntax
Section 12.5.5.28, SHOW PRIVILEGES Syntax
Section 5.5.2, Adding User Accounts
Section 5.3.1, General Security Guidelines
Section 5.4.2, Privilege System Grant Tables
Section 5.4, The MySQL Access Privilege System
SHOW INDEX
Section 12.5.2.1, ANALYZE TABLE Syntax
Section 12.3.1, DESCRIBE Syntax
Section 13.6.3, InnoDB Startup Options and System Variables
Section 7.4.6, MyISAM Index Statistics Collection
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 12.5.5.23, SHOW INDEX Syntax
Section 12.2.8.2, Index Hint Syntax
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 4.6.3.4, Other myisamchk Options
Section 13.6.14, Restrictions on InnoDB Tables
Section 20.4, The INFORMATION_SCHEMA STATISTICS Table
Section 20.12, The INFORMATION_SCHEMA TA-
BLE_CONSTRAINTS Table
Statement/Syntax Index
3450
SHOW INNODB STATUS
Section 12.5.5.16, SHOW ENGINE Syntax
Section 12.5.5.24, SHOW INNODB STATUS Syntax
Section 1.4.2, What Is Planned for MySQL 6.0
SHOW MASTER LOGS
Section 12.5.5.2, SHOW BINARY LOGS Syntax
SHOW MASTER STATUS
Section 12.5.5.25, SHOW MASTER STATUS Syntax
Section 16.1.1.5, Creating a Data Snapshot Using mysqldump
Section 16.3.6, How to Report Replication Bugs or Problems
Section 16.1.1.4, Obtaining the Master Replication Information
Section 5.4.1, Privileges Provided by MySQL
Section 12.6.1, SQL Statements for Controlling Master Servers
Section 16.3.5, Troubleshooting Replication
SHOW OPEN TABLES
Section 12.5.5.26, SHOW OPEN TABLES Syntax
SHOW PLUGINS
Section 12.5.5.27, SHOW PLUGINS Syntax
Section 22.2.1, Characteristics of the Plugin Interface
Chapter 18, Partitioning
Section 1.4.2, What Is Planned for MySQL 6.0
SHOW PRIVILEGES
Section 12.5.5.28, SHOW PRIVILEGES Syntax
SHOW PROCEDURE CODE
Section 12.5.5.20, SHOW FUNCTION CODE Syntax
Section 12.5.5.29, SHOW PROCEDURE CODE Syntax
SHOW PROCEDURE STATUS
Section 12.5.5.21, SHOW FUNCTION STATUS Syntax
Section 12.5.5.30, SHOW PROCEDURE STATUS Syntax
Section 19.2.3, Stored Routine Metadata
SHOW PROCESSLIST
Section 12.5.1.3, GRANT Syntax
Section 13.6.12, InnoDB Error Handling
Section 12.5.6.4, KILL Syntax
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 12.5.5.33, SHOW PROFILES Syntax
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section B.1.2.7, Too many connections
Section 21.10.3.43, mysql_list_processes()
Description
Section 7.5.6.2, General Thread States
Section 5.3.2, Making MySQL Secure Against Attackers
Section 17.6.1, MySQL Server Usage for MySQL Cluster
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.4, Replication FAQ
Section 16.4.1, Replication Implementation Details
Section 16.3.5, Troubleshooting Replication
SHOW PROFILE
Section 12.5.5.32, SHOW PROFILE Syntax
Section 12.5.5.33, SHOW PROFILES Syntax
Section 7.5.6, Examining Thread Information
Section 7.5.6.2, General Thread States
Section 5.1.5, Session System Variables
Section 20.26, The INFORMATION_SCHEMA PROFILING Table
Section 2.10.2, Typical configure Options
SHOW PROFILES
Section 12.5.5.32, SHOW PROFILE Syntax
Section 12.5.5.33, SHOW PROFILES Syntax
Section 5.1.5, Session System Variables
Section 20.26, The INFORMATION_SCHEMA PROFILING Table
Section 2.10.2, Typical configure Options
SHOW RELAYLOG EVENTS
Section 12.5.5.3, SHOW BINLOG EVENTS Syntax
SHOW SCHEMAS
Section 12.5.5.15, SHOW DATABASES Syntax
SHOW SESSION STATUS
Section 20.24, The INFORMATION_SCHEMA GLOBAL_STATUS and
SESSION_STATUS Tables
SHOW SESSION VARIABLES
Section 20.25, The INFORMATION_SCHEMA GLOBAL_VARIABLES
and SESSION_VARIABLES Tables
SHOW SLAVE HOSTS
Section 12.5.5.35, SHOW SLAVE HOSTS Syntax
Section 16.1.3.3, Replication Slave Options and Variables
Section 12.6.1, SQL Statements for Controlling Master Servers
SHOW SLAVE STATUS
Section 12.6.1.1, PURGE BINARY LOGS Syntax
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 12.6.2.7, START SLAVE Syntax
Section 16.3.6, How to Report Replication Bugs or Problems
Section 5.4.1, Privileges Provided by MySQL
Section 16.3.4, Replication FAQ
Section 16.4.1, Replication Implementation Details
Section 7.5.6.5, Replication Slave I/O Thread States
Section 16.1.3.3, Replication Slave Options and Variables
Section 12.6.2, SQL Statements for Controlling Slave Servers
Section 5.1.7, Server Status Variables
Section 16.3.1.20, Slave Errors during Replication
Section 16.4.2.2, The Slave Status Files
Section 16.3.5, Troubleshooting Replication
SHOW STATUS
Section 17.4.2, mysqld Command Options for MySQL Cluster
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.5.5.37, SHOW STATUS Syntax
Section 22.2.3.3, Creating a Plugin Library
Section 17.3.4.7, Defining SQL and Other API Nodes in a MySQL
Cluster
Section 22.2.3.1, General Plugin Structures and Functions
Statement/Syntax Index
3451
Section 7.5.5.4, Query Cache Status and Maintenance
Section 17.7.7, Quick Reference: MySQL Cluster SQL Statements
Section 16.4.1, Replication Implementation Details
Section 16.3.1.23, Replication Retries and Timeouts
Section 16.3.1.22, Replication and Temporary Tables
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
SHOW TABLE STATUS
Section 12.1.17, CREATE TABLE Syntax
Section 12.3.1, DESCRIBE Syntax
Section 13.6.3, InnoDB Startup Options and System Variables
Section 12.5.5.6, SHOW COLUMNS Syntax
Section 12.5.5.38, SHOW TABLE STATUS Syntax
Section 13.6.4.3.1, Traditional InnoDB Auto-Increment Locking
Section 13.6.4, Creating and Using InnoDB Tables
Section 13.6.11.2, File Space Management
Section 18.3.4, Obtaining Information About Partitions
Section 13.6.10.5, Physical Row Structure
Section 13.6.14, Restrictions on InnoDB Tables
Section 13.12, The ARCHIVE Storage Engine
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
SHOW TABLES
Chapter 20, INFORMATION_SCHEMA Tables
Section 12.5.5.38, SHOW TABLE STATUS Syntax
Section 12.5.5.39, SHOW TABLES Syntax
Section B.1.7.3, TEMPORARY Table Problems
Section B.1.2.16, Table 'tbl_name' doesn't exist
Section 3.3.2, Creating a Table
Description
Section 20.28, Extensions to SHOW Statements
Section 8.2.2, Identifier Case Sensitivity
Section 8.2.3, Mapping of Identifiers to File Names
SHOW TRIGGERS
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section A.5, MySQL 5.1 FAQ Triggers
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 19.3.2, Trigger Metadata
SHOW VARIABLES
Section 12.5.4, SET Syntax
Section 12.5.5.41, SHOW VARIABLES Syntax
Section 22.2.3.3, Creating a Plugin Library
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Chapter 18, Partitioning
Section 16.1.3.2, Replication Master Options and Variables
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 5.1.6, Using System Variables
SHOW WARNINGS
Section 12.1.7, ALTER TABLE Syntax
Section 12.1.26, DROP PROCEDURE and DROP FUNCTION Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 1.7.6.1, PRIMARY KEY and UNIQUE Index Constraints
Section 12.5.5.18, SHOW ERRORS Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 8.2.4, Function Name Parsing and Resolution
Section 5.2.4.3, Mixed Binary Logging Format
Section 7.2.16, Optimizing IN/=ANY Subqueries
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 5.1.4, Server System Variables
SIGNAL
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
START SLAVE
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 12.5.5.36, SHOW SLAVE STATUS Syntax
Section 12.6.2.7, START SLAVE Syntax
Section 12.6.2.8, STOP SLAVE Syntax
Description
Section 16.4.1, Replication Implementation Details
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.20, Slave Errors during Replication
Section 16.3.5, Troubleshooting Replication
START TRANSACTION
Section 13.6.12, InnoDB Error Handling
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 13.6.8.3, SELECT ... FOR UPDATE and SELECT ...
LOCK IN SHARE MODE Locking Reads
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 13.6.8.9, How to Cope with Deadlocks
Section 13.6.4.1, How to Use Transactions in InnoDB with Different
APIs
Section 12.4.5.1, Interaction of Table Locking and Transactions
Section 12.4, MySQL Transactional and Locking Statements
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 5.1.5, Session System Variables
Section 7.2.21, Speed of INSERT Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Section 13.6.8, The InnoDB Transaction Model and Locking
Section 19.3.1, Trigger Syntax
Section 12.4.7.2, XA Transaction States
STOP SLAVE
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 12.6.1.2, RESET MASTER Syntax
Section 12.6.2.5, RESET SLAVE Syntax
Section 12.6.2.7, START SLAVE Syntax
Section 12.6.2.8, STOP SLAVE Syntax
Section 16.1.1.9, Introducing Additional Slaves to an Existing Replica-
tion Environment
TRUNCATE
Section 12.1.19, CREATE TRIGGER Syntax
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 12.2.10, TRUNCATE Syntax
Section 13.5.3.3, Compressed Table Characteristics
Description
Section 7.5.5.1, How the Query Cache Operates
Section 17.12.3, Limits Relating to Transaction Handling in MySQL
Cluster
Section 17.12.2, Limits and Differences of MySQL Cluster from Stand-
ard MySQL Limits
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 16.3.1.27, Replication and TRUNCATE
Statement/Syntax Index
3452
TRUNCATE TABLE
Section 12.2.2, DELETE Syntax
Section 13.8.1, MERGE Table Problems
Section 12.2.10, TRUNCATE Syntax
Description
Section 17.12.2, Limits and Differences of MySQL Cluster from Stand-
ard MySQL Limits
Section 18.3.1, Management of RANGE and LIST Partitions
Section 5.4.1, Privileges Provided by MySQL
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 12.4.3, Statements That Cause an Implicit Commit
Section 13.9, The MEMORY (HEAP) Storage Engine
Section 21.10.10.2, What Results You Can Get from a Query
UNINSTALL PLUGIN
Section 12.5.6.3, FLUSH Syntax
Section 12.5.3.3, INSTALL PLUGIN Syntax
Section 12.5.3.4, UNINSTALL PLUGIN Syntax
Section 22.2.1, Characteristics of the Plugin Interface
Section 22.2.3.1, General Plugin Structures and Functions
Section 7.5.8, How MySQL Uses Memory
Section 13.4.1, Pluggable Storage Engine Architecture
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
UNION
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.20, CREATE VIEW Syntax
Section 12.2.8, SELECT Syntax
Section 12.2.8.3, UNION Syntax
Section 21.10.1, C API Data Types
Section 7.5.10, How MySQL Uses Internal Temporary Tables
Section 11.11.3, Information Functions
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 10.2, Numeric Types
Section 7.2.1, Optimizing Queries with EXPLAIN
Section D.4, Restrictions on Views
Section 9.1.8.1, Result Strings
Section 3.6.7, Searching on Two Keys
Section 5.1.7, Server Status Variables
Section 12.2.9, Subquery Syntax
Section 13.8, The MERGE Storage Engine
Section 7.2.5.1, The Range Access Method for Single-Part Indexes
Section 19.5.3, Updatable and Insertable Views
Section 19.5.2, View Processing Algorithms
Section 19.5.1, View Syntax
Section 11.10, XML Functions
UNION ALL
Section 12.2.8.3, UNION Syntax
Section 7.5.10, How MySQL Uses Internal Temporary Tables
Section 11.11.3, Information Functions
Section 19.5.3, Updatable and Insertable Views
Section 19.5.2, View Processing Algorithms
UNION DISTINCT
Section 12.2.8.3, UNION Syntax
UNLOCK TABLES
Section 12.5.6.3, FLUSH Syntax
Section 12.4.5, LOCK TABLES and UNLOCK TABLES Syntax
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 6.1, Database Backups
Description
Section 13.6.8.9, How to Cope with Deadlocks
Section 12.4.5.1, Interaction of Table Locking and Transactions
Section 12.4.5.3, Other Table-Locking Notes
Section 13.6.14, Restrictions on InnoDB Tables
Section D.1, Restrictions on Stored Routines, Triggers, and Events
Section 7.2.21, Speed of INSERT Statements
Section 12.4.3, Statements That Cause an Implicit Commit
Section 7.5.2, System Factors and Startup Parameter Tuning
Section 13.14, The BLACKHOLE Storage Engine
Section 1.7.5.2, Transactions and Atomic Operations
UPDATE
Section 4.5.1.1, mysql Options
Section 4.6.7.2, mysqlbinlog Row Event Display
Section 12.5.2.3, CHECK TABLE Syntax
Section 12.1.17, CREATE TABLE Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.1.20, CREATE VIEW Syntax
Section B.1.2.4, Client does not support authentica-
tion protocol
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 13.6.4.4, FOREIGN KEY Constraints
Section 12.5.1.3, GRANT Syntax
Section 12.2.5.3, INSERT ... ON DUPLICATE KEY UPDATE
Syntax
Section 12.2.5.2, INSERT DELAYED Syntax
Section 12.2.5, INSERT Syntax
Section 13.6.8.4, InnoDB Record, Gap, and Next-Key Locks
Section 13.6.3, InnoDB Startup Options and System Variables
Section 12.2.8.1, JOIN Syntax
Section 12.5.6.4, KILL Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 1.7.6.1, PRIMARY KEY and UNIQUE Index Constraints
Section 13.6.8.3, SELECT ... FOR UPDATE and SELECT ...
LOCK IN SHARE MODE Locking Reads
Section 12.5.1.6, SET PASSWORD Syntax
Section 12.4.6, SET TRANSACTION Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 12.2.11, UPDATE Syntax
Section 7.2.4, WHERE Clause Optimization
Section 21.10.3.1, mysql_affected_rows()
Section 21.10.3.35, mysql_info()
Section 21.10.3.37, mysql_insert_id()
Section 21.10.3.48, mysql_num_rows()
Section 21.10.3.49, mysql_options()
Section 21.10.7.1, mysql_stmt_affected_rows()
Section 21.10.7.10, mysql_stmt_execute()
Section 21.10.7.16, mysql_stmt_insert_id()
Section 21.10.7.17, mysql_stmt_num_rows()
Section 5.4.5, Access Control, Stage 2: Request Verification
Section 5.5.2, Adding User Accounts
Section B.1.8.2, Additional Known Issues
Section 5.5.5, Assigning Account Passwords
Section 12.7.4, Automatic Prepared Statement Repreparation
Section 16.1.3.4, Binary Log Options and Variables
Section 21.10.2, C API Function Overview
Section 21.10.6, C API Prepared Statement Function Overview
Section 21.10.4, C API Prepared Statements
Section 21.10.12, C API Support for Multiple Statement Execution
Statement/Syntax Index
3453
Section 5.4.7, Causes of Access-Denied Errors
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
Section 17.3.6, Configuring MySQL Cluster Parameters for Local
Checkpoints
Section 1.7.6.2, Constraints on Invalid Data
Section 13.11.2.1, Creating a FEDERATED Table Using
CONNECTION
Section 10.1.4, Data Type Default Values
Section 13.6.6.2, Forcing InnoDB Recovery
Chapter 11, Functions and Operators
Section 7.5.6.2, General Thread States
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 7.5.5.1, How the Query Cache Operates
Section 12.2.8.2, Index Hint Syntax
Section 11.11.3, Information Functions
Section 7.3.1, Internal Locking Methods
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 11.11.4, Miscellaneous Functions
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 7.1.1, MySQL Design Limitations and Tradeoffs
Section 1.7.4, MySQL Extensions to Standard SQL
Section 10.2, Numeric Types
Section 12.4.5.3, Other Table-Locking Notes
Section 10.1.2, Overview of Date and Time Types
Section 5.4.2, Privilege System Grant Tables
Section B.1.5.2, Problems Using DATE Columns
Section 16.1.3.3, Replication Slave Options and Variables
Section 16.3.1.11, Replication and LIMIT
Section 16.3.1.18, Replication and the Query Optimizer
Section 16.3.1.7, Replication of Invoked Features
Section B.1.4.1.2, Resetting the Root Password on Unix Systems
Section B.1.4.1.1, Resetting the Root Password on Windows Systems
Section 18.5, Restrictions and Limitations on Partitioning
Section D.3, Restrictions on Subqueries
Section D.4, Restrictions on Views
Section 12.2.9.11, Rewriting Subqueries as Joins
Section 12.7, SQL Syntax for Prepared Statements
Section 2.11.3, Securing the Initial MySQL Accounts
Section 3.3.4.1, Selecting All Data
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 7.2.21, Speed of INSERT Statements
Section 7.2.22, Speed of UPDATE Statements
Section 12.2.9.9, Subquery Errors
Section 12.2.9, Subquery Syntax
Section 7.3.2, Table Locking Issues
Section 13.12, The ARCHIVE Storage Engine
Section 13.14, The BLACKHOLE Storage Engine
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 13.8, The MERGE Storage Engine
Section 13.5, The MyISAM Storage Engine
Section 9.1.6.4, The _bin and binary Collations
Section 5.2.4, The Binary Log
Section 5.4, The MySQL Access Privilege System
Section 5.1.11, The Shutdown Process
Section 1.7.5.2, Transactions and Atomic Operations
Section 19.3.1, Trigger Syntax
Section 19.5.3, Updatable and Insertable Views
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 19.3, Using Triggers
Section 4.5.1.5.2, Using the --safe-updates Option
Section 21.10.10.2, What Results You Can Get from a Query
Section 5.4.6, When Privilege Changes Take Effect
Section 21.10.10.1, Why mysql_store_result() Sometimes Re-
turns NULL After mysql_query() Returns Success
UPDATE ... (SELECT)
Section 13.6.8.2, Consistent Nonlocking Reads
UPDATE ... WHERE ...
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
USE
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Chapter 20, INFORMATION_SCHEMA Tables
Section 12.3.4, USE Syntax
Section 16.1.3.4, Binary Log Options and Variables
Section 3.3.1, Creating and Selecting a Database
Section 3.3, Creating and Using a Database
Description
Description
Section 12.2.8.2, Index Hint Syntax
Section 16.1.3.3, Replication Slave Options and Variables
Section 19.2.1, Stored Routine Syntax
Section 5.2.4, The Binary Log
XA COMMIT
Section 12.4.7.2, XA Transaction States
XA END
Section D.5, Restrictions on XA Transactions
Section 12.4.7.1, XA Transaction SQL Syntax
Section 12.4.7.2, XA Transaction States
XA PREPARE
Section 12.4.7.2, XA Transaction States
XA RECOVER
Section 12.4.7.1, XA Transaction SQL Syntax
Section 12.4.7.2, XA Transaction States
XA ROLLBACK
Section 12.4.7.2, XA Transaction States
XA START
Section D.5, Restrictions on XA Transactions
Section 12.4.7.1, XA Transaction SQL Syntax
Section 12.4.7.2, XA Transaction States
Statement/Syntax Index
3454
System Variable Index
auto_increment_increment
Section A.1, MySQL 5.1 FAQ General
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 16.1.3.2, Replication Master Options and Variables
Section 3.6.9, Using AUTO_INCREMENT
auto_increment_offset
Section A.1, MySQL 5.1 FAQ General
Section 17.12.11, Previous MySQL Cluster Issues Resolved in MySQL
5.1 and MySQL Cluster NDB 6.x
Section 16.1.3.2, Replication Master Options and Variables
Section 3.6.9, Using AUTO_INCREMENT
autocommit
Section 12.2.2, DELETE Syntax
Section 13.6.8.3, SELECT ... FOR UPDATE and SELECT ...
LOCK IN SHARE MODE Locking Reads
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 5.1.5, Session System Variables
autocommit = 0
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.8.8, Deadlock Detection and Rollback
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
autocommit = 1
Section 12.4.5.1, Interaction of Table Locking and Transactions
Section 13.6.14, Restrictions on InnoDB Tables
Section 1.7.5.2, Transactions and Atomic Operations
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
automatic_sp_privileges
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 5.1.4, Server System Variables
Section 19.2.2, Stored Routines and MySQL Privileges
back_log
Section 5.1.4, Server System Variables
backup_history_log
Section 5.1.4, Server System Variables
backup_history_log_file
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
backup_progress_log
Section 5.1.4, Server System Variables
backup_progress_log_file
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
backup_wait_timeout
Section 5.1.5, Session System Variables
backupdir
Section 5.1.4, Server System Variables
basedir
Section 12.5.3.3, INSTALL PLUGIN Syntax
Section 5.1.4, Server System Variables
big_tables
Section 5.1.5, Session System Variables
binlog_cache_size
Section 16.1.3.4, Binary Log Options and Variables
Section 5.1.7, Server Status Variables
Section 5.2.4, The Binary Log
binlog_format
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4.4, Logging Format for Changes to mysql Database
Tables
Section 5.2.4.3, Mixed Binary Logging Format
Section 16.3.4, Replication FAQ
Section 16.3.1.17, Replication of the System mysql Database
Section 5.2.4.2, Setting The Binary Log Format
bulk_insert_buffer_size
Section 13.5.1, MyISAM Startup Options
Section 5.1.4, Server System Variables
Section 7.2.21, Speed of INSERT Statements
character_set_client
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.5.4, SET Syntax
Section 12.5.5.9, SHOW CREATE EVENT Syntax
Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 12.5.5.19, SHOW EVENTS Syntax
Section 12.5.5.30, SHOW PROCEDURE STATUS Syntax
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section 21.10.5, C API Prepared Statement Data types
Section 9.1.4, Connection Character Sets and Collations
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 5.1.4, Server System Variables
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 5.2.4, The Binary Log
character_set_connection
Section 9.1.8.2, CONVERT() and CAST()
Section 12.5.4, SET Syntax
Section 9.1.3.5, Character String Literal Character Set and Collation
Section 9.1.4, Connection Character Sets and Collations
Section 11.6, Date and Time Functions
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
3455
Korean Character Sets
Section 9.8, MySQL Server Locale Support
Section 9.1.8.1, Result Strings
Section 5.1.4, Server System Variables
Section 9.1.7, String Repertoire
Section 8.1.1, Strings
character_set_database
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.5.4, SET Syntax
Section 9.1.4, Connection Character Sets and Collations
Section 9.1.3.2, Database Character Set and Collation
Section 5.1.4, Server System Variables
character_set_filesystem
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.2.8, SELECT Syntax
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 11.4, String Functions
character_set_results
Section 12.5.4, SET Syntax
Section 9.1.4, Connection Character Sets and Collations
Section A.11, MySQL 5.1 FAQ MySQL Chinese, Japanese, and
Korean Character Sets
Section 5.1.4, Server System Variables
Section 9.1.10, UTF-8 for Metadata
character_set_server
Section 9.1.4, Connection Character Sets and Collations
Section 9.1.3.2, Database Character Set and Collation
Section 11.11.4, Miscellaneous Functions
Section 16.3.1.2, Replication and Character Sets
Section 9.1.3.1, Server Character Set and Collation
Section 5.1.4, Server System Variables
character_set_system
Section 5.1.4, Server System Variables
Section 9.1.10, UTF-8 for Metadata
character_sets_dir
Section 9.5.3, Adding a Simple Collation to an 8-Bit Character Set
Section 9.5.4, Adding a UCA Collation to a Unicode Character Set
Section 5.1.4, Server System Variables
collation_connection
Section 9.1.8.2, CONVERT() and CAST()
Section 12.5.4, SET Syntax
Section 12.5.5.9, SHOW CREATE EVENT Syntax
Section 12.5.5.11, SHOW CREATE PROCEDURE Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 12.5.5.19, SHOW EVENTS Syntax
Section 12.5.5.30, SHOW PROCEDURE STATUS Syntax
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section 9.1.3.5, Character String Literal Character Set and Collation
Section 9.1.4, Connection Character Sets and Collations
Section 11.6, Date and Time Functions
Section 9.1.8.1, Result Strings
Section 5.1.4, Server System Variables
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 5.2.4, The Binary Log
collation_database
Section 9.1.4, Connection Character Sets and Collations
Section 9.1.3.2, Database Character Set and Collation
Section 5.1.4, Server System Variables
Section 5.2.4, The Binary Log
collation_server
Section 9.1.4, Connection Character Sets and Collations
Section 9.1.3.2, Database Character Set and Collation
Section 16.3.1.2, Replication and Character Sets
Section 9.1.3.1, Server Character Set and Collation
Section 5.1.4, Server System Variables
Section 5.2.4, The Binary Log
completion_type
Section 12.4.1, START TRANSACTION, COMMIT, and ROLLBACK
Syntax
Section 21.10.3.6, mysql_commit()
Section 21.10.3.57, mysql_rollback()
Section 5.1.4, Server System Variables
concurrent_insert
Section 7.3.3, Concurrent Inserts
Section 7.3.1, Internal Locking Methods
Section 7.2.24, Other Optimization Tips
Section 5.1.4, Server System Variables
connect_timeout
Section B.1.2.3, Lost connection to MySQL server
Section 21.10.3.52, mysql_real_connect()
Section B.1.2.11, Communication Errors and Aborted Connections
Section 5.1.4, Server System Variables
datadir
Section 2.3, Installing MySQL on Windows
Section 5.1.4, Server System Variables
date_format
Section 5.1.4, Server System Variables
datetime_format
Section 5.1.4, Server System Variables
debug
Section 5.1.4, Server System Variables
debug_sync
Section 5.1.4, Server System Variables
default_week_format
Section 11.6, Date and Time Functions
Section 5.1.4, Server System Variables
System Variable Index
3456
delay_key_write
Section 12.1.17, CREATE TABLE Syntax
Section 5.1.4, Server System Variables
delayed_insert_limit
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.4, Server System Variables
delayed_insert_timeout
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.4, Server System Variables
delayed_queue_size
Section 12.2.5.2, INSERT DELAYED Syntax
Section 5.1.4, Server System Variables
div_precision_increment
Section 11.5.1, Arithmetic Operators
Section 5.1.4, Server System Variables
engine_condition_pushdown
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
error_count
Section 12.5.5.18, SHOW ERRORS Syntax
Section 5.1.5, Session System Variables
event_scheduler
Section 12.5.5.31, SHOW PROCESSLIST Syntax
Section 21.9.2, Restrictions When Using the Embedded MySQL Serv-
er
Section 5.1.4, Server System Variables
expire_logs_days
Section 12.6.1.1, PURGE BINARY LOGS Syntax
Section 5.2.6, Server Log Maintenance
Section 5.1.4, Server System Variables
flush
Section 5.1.4, Server System Variables
flush_time
Section 5.1.4, Server System Variables
foreign_key_checks
Section 13.6.4.4, FOREIGN KEY Constraints
Section 16.3.1.28, Replication and Variables
Section 5.1.8, Server SQL Modes
Section 5.1.5, Session System Variables
Section 5.2.4, The Binary Log
foreign_key_checks = 0
Section 13.6.4.4, FOREIGN KEY Constraints
Section 5.1.5, Session System Variables
ft_boolean_syntax
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 5.1.4, Server System Variables
ft_max_word_len
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 22.2.2, Full-Text Parser Plugins
Section 5.1.4, Server System Variables
ft_min_word_len
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 22.2.2, Full-Text Parser Plugins
Section 5.1.4, Server System Variables
ft_query_expansion_limit
Section 5.1.4, Server System Variables
ft_stopword_file
Section 16.1.1.6, Creating a Data Snapshot Using Raw Data Files
Section 11.8.6, Fine-Tuning MySQL Full-Text Search
Section 5.1.4, Server System Variables
general_log
Section 1.4.1, What Is New in MySQL 5.1
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 5.2.3, The General Query Log
general_log_file
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 5.2.3, The General Query Log
Section 5.2.5, The Slow Query Log
group_concat_max_len
Section 11.12.1, GROUP BY (Aggregate) Functions
Section 5.1.4, Server System Variables
have_archive
Section 5.1.4, Server System Variables
have_blackhole_engine
Section 5.1.4, Server System Variables
have_compress
Section 5.1.4, Server System Variables
have_crypt
Section 5.1.4, Server System Variables
have_csv
Section 5.1.4, Server System Variables
System Variable Index
3457
have_dynamic_loading
Section 5.1.4, Server System Variables
have_example_engine
Section 5.1.4, Server System Variables
have_federated_engine
Section 5.1.4, Server System Variables
have_geometry
Section 5.1.4, Server System Variables
have_innodb
Section B.1.5.5, Rollback Failure for Nontransactional Tables
Section 5.1.4, Server System Variables
have_isam
Section 5.1.4, Server System Variables
have_merge_engine
Section 5.1.4, Server System Variables
have_ndbcluster
Section 17.4.3, MySQL Cluster System Variables
have_openssl
Section 5.1.4, Server System Variables
Section 5.5.7.2, Using SSL Connections
have_partitioning
Chapter 18, Partitioning
Section 5.1.4, Server System Variables
have_query_cache
Section 7.5.5.3, Query Cache Configuration
Section 5.1.4, Server System Variables
have_raid
Section 5.1.4, Server System Variables
have_row_based_replication
Section 5.1.4, Server System Variables
have_rtree_keys
Section 5.1.4, Server System Variables
have_ssl
Section 5.1.4, Server System Variables
Section 5.5.7.2, Using SSL Connections
have_symlink
Section 5.1.4, Server System Variables
hostname
Section 5.1.4, Server System Variables
identity
Section 5.1.5, Session System Variables
ignore_builtin_innodb
Section 13.6.3, InnoDB Startup Options and System Variables
init_connect
Section 9.1.5, Configuring the Character Set and Collation for Applica-
tions
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
init_file
Section 5.1.4, Server System Variables
init_slave
Section 16.1.3.3, Replication Slave Options and Variables
innodb_adaptive_hash_index
Section 13.6.3, InnoDB Startup Options and System Variables
in-
nodb_additional_mem_pool_size
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_autoextend_increment
Section 13.6.2, InnoDB Configuration
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.5, Adding, Removing, or Resizing InnoDB Data and Log
Files
innodb_autoinc_lock_mode
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.4.3.2, Configurable InnoDB Auto-Increment Locking
innodb_buffer_pool_awe_mem_mb
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_buffer_pool_size
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_checksums
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_commit_concurrency
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_concurrency_tickets
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_data_file_path
Section 13.6.2, InnoDB Configuration
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.5, Adding, Removing, or Resizing InnoDB Data and Log
System Variable Index
3458
Files
Section 13.6.2.4, Dealing with InnoDB Initialization Problems
Chapter 13, Storage Engines
Section 13.6.2.2, Using Raw Devices for the Shared Tablespace
innodb_data_home_dir
Section 13.6.2, InnoDB Configuration
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.2.4, Dealing with InnoDB Initialization Problems
innodb_doublewrite
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_fast_shutdown
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.5, Adding, Removing, or Resizing InnoDB Data and Log
Files
Section 5.1.11, The Shutdown Process
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
innodb_file_io_threads
Section 13.6.13.2.1, InnoDB Standard Monitor and Lock Monitor Out-
put
Section 13.6.3, InnoDB Startup Options and System Variables
Section 22.1.1, MySQL Threads
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
innodb_file_per_table
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.4.5, InnoDB and MySQL Replication
Section 13.6.2.3, Creating the InnoDB Tablespace
Section 18.5, Restrictions and Limitations on Partitioning
Section 13.6.2.1, Using Per-Table Tablespaces
innodb_flush_log_at_trx_commit
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_flush_method
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_force_recovery
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.6.2, Forcing InnoDB Recovery
innodb_lock_wait_timeout
Section 13.6.3, InnoDB Startup Options and System Variables
Section 13.6.8.8, Deadlock Detection and Rollback
Section 16.3.1.23, Replication Retries and Timeouts
Section 16.1.3.3, Replication Slave Options and Variables
innodb_locks_unsafe_for_binlog
Section 13.6.8.4, InnoDB Record, Gap, and Next-Key Locks
Section 13.6.3, InnoDB Startup Options and System Variables
Section 12.4.6, SET TRANSACTION Syntax
Section 13.6.8.2, Consistent Nonlocking Reads
Section 13.6.8.6, Locks Set by Different SQL Statements in InnoDB
innodb_log_arch_dir
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_log_archive
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_log_buffer_size
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_log_file_size
Section 13.6.3, InnoDB Startup Options and System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
innodb_log_files_in_group
Section 13.6.3, InnoDB Startup Options and System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
innodb_log_group_home_dir
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_max_dirty_pages_pct
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_max_purge_lag
Section 13.6.9, InnoDB Multi-Versioning
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_mirrored_log_groups
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_open_files
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_read_io_threads
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
innodb_rollback_on_timeout
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_stats_on_metadata
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_support_xa
Section 13.6.13.1, InnoDB Performance Tuning Tips
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_sync_spin_loops
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_table_locks
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_thread_concurrency
Section 13.6.13.2.1, InnoDB Standard Monitor and Lock Monitor Out-
put
System Variable Index
3459
Section 13.6.3, InnoDB Startup Options and System Variables
Section 7.5.7, How MySQL Uses Threads for Client Connections
in-
nodb_thread_concurrency_timer_
based
Section 5.1.7, Server Status Variables
innodb_thread_sleep_delay
Section 13.6.3, InnoDB Startup Options and System Variables
in-
nodb_use_legacy_cardinality_al
gorithm
Section 13.6.3, InnoDB Startup Options and System Variables
innodb_write_io_threads
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
insert_id
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
Section 5.1.5, Session System Variables
interactive_timeout
Section 21.10.3.52, mysql_real_connect()
Section B.1.2.11, Communication Errors and Aborted Connections
Section 2.13.4.1, FreeBSD Notes
Section 2.13.2.1, Mac OS X 10.x (Darwin)
Section 5.1.4, Server System Variables
join_buffer_size
Section 7.2.10, Nested-Loop Join Algorithms
Section 5.1.4, Server System Variables
join_cache_level
Section 5.1.4, Server System Variables
keep_files_on_create
Section 5.1.4, Server System Variables
key_buffer_size
Section B.1.8.2, Additional Known Issues
Section 7.2.2, Estimating Query Performance
Section 7.5.8, How MySQL Uses Memory
Section 6.4.3, How to Repair Tables
Section 7.4.5.2, Multiple Key Caches
Section 7.4.5.6, Restructuring a Key Cache
Section 5.1.2, Server Command Options
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 7.2.23, Speed of DELETE Statements
Section 7.2.21, Speed of INSERT Statements
Section 5.1.6.1, Structured System Variables
Section 7.4.5, The MyISAM Key Cache
Section 7.5.3, Tuning Server Parameters
Section 4.2.3.3, Using Option Files
key_cache_age_threshold
Section 7.4.5.3, Midpoint Insertion Strategy
Section 5.1.4, Server System Variables
Section 5.1.6.1, Structured System Variables
key_cache_block_size
Section 7.4.5.5, Key Cache Block Size
Section 7.4.5.6, Restructuring a Key Cache
Section 5.1.4, Server System Variables
Section 5.1.6.1, Structured System Variables
key_cache_division_limit
Section 7.4.5.3, Midpoint Insertion Strategy
Section 5.1.4, Server System Variables
Section 5.1.6.1, Structured System Variables
language
Section 5.1.4, Server System Variables
large_files_support
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.4, Server System Variables
large_page_size
Section 5.1.4, Server System Variables
large_pages
Section 5.1.4, Server System Variables
last_insert_id
Section 5.1.5, Session System Variables
lc_time_names
Section 11.6, Date and Time Functions
Section 9.8, MySQL Server Locale Support
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
license
Section 22.2.3.1, General Plugin Structures and Functions
Section 5.1.4, Server System Variables
local_infile
Section 5.1.4, Server System Variables
locked_in_memory
Section 5.1.4, Server System Variables
log
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
log_backup_output
Section 5.1.4, Server System Variables
log_bin
System Variable Index
3460
Section 5.1.4, Server System Variables
log_bin_trust_function_creator
s
Section 16.1.3.4, Binary Log Options and Variables
Section 19.6, Binary Logging of Stored Programs
Section A.4, MySQL 5.1 FAQ Stored Procedures and Functions
Section 5.1.4, Server System Variables
Section 1.4.2, What Is Planned for MySQL 6.0
log_error
Section 5.1.4, Server System Variables
log_output
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 5.2.3, The General Query Log
Section 5.2.5, The Slow Query Log
log_queries_not_using_indexes
Section 5.1.4, Server System Variables
log_slave_updates
Section 16.1.3.4, Binary Log Options and Variables
Section 5.1.4, Server System Variables
log_slow_queries
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
log_warnings
Section 5.1.4, Server System Variables
Section 5.2.2, The Error Log
long_query_time
Description
Section 5.2, MySQL Server Logs
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.2, Server Command Options
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 5.2.5, The Slow Query Log
low_priority_updates
Section 5.1.4, Server System Variables
lower_case_file_system
Section 5.1.4, Server System Variables
lower_case_table_names
Section 13.6.4.4, FOREIGN KEY Constraints
Section 12.5.1.3, GRANT Syntax
Section 12.5.1.5, REVOKE Syntax
Section 1.6, How to Report Bugs or Problems
Section 8.2.2, Identifier Case Sensitivity
Section 5.1.4, Server System Variables
max_allowed_packet
Section 11.12.1, GROUP BY (Aggregate) Functions
Section B.1.2.3, Lost connection to MySQL server
Section B.1.2.9, MySQL server has gone away
Section B.1.2.10, Packet too large
Section 21.10.3.71, mysql_use_result()
Section B.1.2.11, Communication Errors and Aborted Connections
Section 11.2.3, Comparison Functions and Operators
Section B.1.5.6, Deleting Rows from Related Tables
Section 7.5.8, How MySQL Uses Memory
Section 21.10, MySQL C API
Section 5.1.4, Server System Variables
Section 11.4, String Functions
Section 10.4.3, The BLOB and TEXT Types
Section 4.2.3.3, Using Option Files
max_binlog_cache_size
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4, The Binary Log
max_binlog_size
Section 16.1.3.4, Binary Log Options and Variables
Section 5.1.4, Server System Variables
Section 5.2.4, The Binary Log
Section 16.4.2.1, The Slave Relay Log
max_connect_errors
Section 12.5.6.3, FLUSH Syntax
Section B.1.2.6, Host 'host_name' is blocked
Section 5.1.4, Server System Variables
max_connections
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 12.5.1.3, GRANT Syntax
Section B.1.2.7, Too many connections
Section 22.5.1.4, Debugging mysqld under gdb
Section 7.4.7, How MySQL Opens and Closes Tables
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 5.5.4, Limiting Account Resources
Section 2.13.1.4, Linux Post-Installation Notes
Section 5.4.2, Privilege System Grant Tables
Section 5.4.1, Privileges Provided by MySQL
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
max_connections+1
Section B.1.2.7, Too many connections
max_delayed_threads
Section 5.1.4, Server System Variables
max_error_count
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 5.1.4, Server System Variables
max_heap_table_size
Section B.1.2.12, The table is full
Section 7.5.10, How MySQL Uses Internal Temporary Tables
System Variable Index
3461
Section D.2, Restrictions on Server-Side Cursors
Section 5.1.4, Server System Variables
Section 13.9, The MEMORY (HEAP) Storage Engine
max_insert_delayed_threads
Section 5.1.4, Server System Variables
max_join_size
Section 4.5.1.1, mysql Options
Section 12.5.4, SET Syntax
Section 7.2.1, Optimizing Queries with EXPLAIN
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
Section 5.1.6, Using System Variables
max_length_for_sort_data
Section 7.2.13, ORDER BY Optimization
Section 5.1.4, Server System Variables
max_prepared_stmt_count
Section 12.7, SQL Syntax for Prepared Statements
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
max_relay_log_size
Section 16.1.3.4, Binary Log Options and Variables
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
Section 16.4.2.1, The Slave Relay Log
max_seeks_for_key
Section 13.6.14, Restrictions on InnoDB Tables
Section 5.1.4, Server System Variables
max_sort_length
Section 12.1.17, CREATE TABLE Syntax
Section B.1.8.2, Additional Known Issues
Section 5.1.4, Server System Variables
Section 10.4.3, The BLOB and TEXT Types
max_sp_recursion_depth
Section 5.1.4, Server System Variables
Section 19.2.1, Stored Routine Syntax
max_tmp_tables
Section 7.4.7, How MySQL Opens and Closes Tables
Section 5.1.4, Server System Variables
max_user_connections
Section 12.5.1.3, GRANT Syntax
Section 5.5.4, Limiting Account Resources
Section 5.3.2, Making MySQL Secure Against Attackers
Section 5.4.2, Privilege System Grant Tables
Section 5.1.4, Server System Variables
max_write_lock_count
Section 5.1.4, Server System Variables
Section 7.3.2, Table Locking Issues
min_examined_row_limit
Section 5.1.4, Server System Variables
Section 5.2.5, The Slow Query Log
myisam_data_pointer_size
Section 12.1.17, CREATE TABLE Syntax
Section B.1.2.12, The table is full
Section 5.1.4, Server System Variables
myis-
am_max_extra_sort_file_size
Section 13.5.1, MyISAM Startup Options
myisam_max_sort_file_size
Section 13.5.1, MyISAM Startup Options
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.4, Server System Variables
myisam_recover_options
Section 5.1.4, Server System Variables
myisam_repair_threads
Section 5.1.4, Server System Variables
myisam_sort_buffer_size
Section 12.1.7, ALTER TABLE Syntax
Section 13.5.1, MyISAM Startup Options
Section 5.1.4, Server System Variables
myisam_stats_method
Section 7.4.6, MyISAM Index Statistics Collection
Section 5.1.4, Server System Variables
myisam_use_mmap
Section 7.5.8, How MySQL Uses Memory
Section 5.1.4, Server System Variables
named_pipe
Section 5.1.4, Server System Variables
ndb_autoincrement_prefetch_sz
Section 17.4.3, MySQL Cluster System Variables
ndb_cache_check_time
Section 17.4.3, MySQL Cluster System Variables
ndb_extra_logging
Section 17.4.3, MySQL Cluster System Variables
ndb_force_send
Section 17.4.3, MySQL Cluster System Variables
ndb_index_stat_cache_entries
Section 17.4.3, MySQL Cluster System Variables
System Variable Index
3462
ndb_index_stat_enable
Section 17.4.3, MySQL Cluster System Variables
ndb_index_stat_update_freq
Section 17.4.3, MySQL Cluster System Variables
ndb_optimized_node_selection
Section 17.4.3, MySQL Cluster System Variables
Section 17.7.4.3, Using CLUSTERLOG STATISTICS in the MySQL
Cluster Management Client
ndb_report_thresh_binlog_epoch
_slip
Section 17.4.3, MySQL Cluster System Variables
ndb_report_thresh_binlog_mem_u
sage
Section 17.4.3, MySQL Cluster System Variables
ndb_use_copying_alter_table
Section 17.4.3, MySQL Cluster System Variables
ndb_use_exact_count
Section 17.4.3, MySQL Cluster System Variables
ndb_use_transactions
Section 17.4.3, MySQL Cluster System Variables
ndb_wait_connected
Section 17.4.3, MySQL Cluster System Variables
net_buffer_length
Section 4.5.1.1, mysql Options
Description
Section 7.5.8, How MySQL Uses Memory
Section 21.10, MySQL C API
Section 5.1.4, Server System Variables
net_read_timeout
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section B.1.2.3, Lost connection to MySQL server
Section 2.13.4.1, FreeBSD Notes
Section 2.13.2.1, Mac OS X 10.x (Darwin)
Section 5.1.4, Server System Variables
net_retry_count
Section 21.10.3.49, mysql_options()
Section 5.1.4, Server System Variables
net_write_timeout
Section 12.6.2.2, LOAD DATA FROM MASTER Syntax
Section 5.1.4, Server System Variables
new
Section 5.1.4, Server System Variables
old
Section 12.2.8.2, Index Hint Syntax
Section 5.1.4, Server System Variables
old_passwords
Section 5.1.4, Server System Variables
one_shot
Section 5.1.4, Server System Variables
open_files_limit
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 18.5, Restrictions and Limitations on Partitioning
Section 5.1.4, Server System Variables
optimizer_prune_level
Section 7.5.4, Controlling Query Optimizer Performance
Section 5.1.4, Server System Variables
optimizer_search_depth
Section 7.5.4, Controlling Query Optimizer Performance
Section 5.1.4, Server System Variables
optimizer_switch
Section 5.1.4, Server System Variables
Section 7.2.18, Using optimizer_switch to Control the Optim-
izer
optimizer_use_mrr
Section 5.1.4, Server System Variables
pid_file
Section 5.1.4, Server System Variables
plugin_dir
Section 12.5.3.1, CREATE FUNCTION Syntax
Section 12.5.3.3, INSTALL PLUGIN Syntax
Section 22.2.1, Characteristics of the Plugin Interface
Section 22.3.2.5, Compiling and Installing User-Defined Functions
Section 22.2.3.3, Creating a Plugin Library
Section 13.4.1, Pluggable Storage Engine Architecture
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 22.3.2.6, User-Defined Function Security Precautions
port
Section B.1.2.2, Can't connect to [local] MySQL
server
Section 5.1.4, Server System Variables
preload_buffer_size
Section 5.1.4, Server System Variables
prepared_stmt_count
Section 5.1.4, Server System Variables
System Variable Index
3463
profiling
Section 12.5.5.33, SHOW PROFILES Syntax
Section 5.1.5, Session System Variables
Section 20.26, The INFORMATION_SCHEMA PROFILING Table
profiling_history_size
Section 12.5.5.33, SHOW PROFILES Syntax
Section 5.1.5, Session System Variables
protocol_version
Section 5.1.4, Server System Variables
pseudo_thread_id
Section 5.1.4, Server System Variables
query_alloc_block_size
Section 5.1.4, Server System Variables
query_cache_limit
Section 7.5.5.3, Query Cache Configuration
Section 5.1.4, Server System Variables
query_cache_min_res_unit
Section 7.5.5.3, Query Cache Configuration
Section 5.1.4, Server System Variables
query_cache_size
Section 7.5.5.3, Query Cache Configuration
Section 5.1.4, Server System Variables
Section 7.5.5, The MySQL Query Cache
Section 5.1.6, Using System Variables
query_cache_type
Section 12.2.8, SELECT Syntax
Section 7.5.5.2, Query Cache SELECT Options
Section 7.5.5.3, Query Cache Configuration
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
query_cache_wlock_invalidate
Section 5.1.4, Server System Variables
query_prealloc_size
Section 5.1.4, Server System Variables
rand_seed1
Section 5.1.5, Session System Variables
rand_seed2
Section 5.1.5, Session System Variables
range_alloc_block_size
Section 5.1.4, Server System Variables
read_buffer_size
Section 7.5.8, How MySQL Uses Memory
Section 5.1.4, Server System Variables
Section 7.5.3, Tuning Server Parameters
read_only
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
read_rnd_buffer_size
Section 7.2.13, ORDER BY Optimization
Section 7.5.8, How MySQL Uses Memory
Section 5.1.4, Server System Variables
Section 7.5.3, Tuning Server Parameters
relay_log_purge
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 5.1.4, Server System Variables
relay_log_space_limit
Section 7.5.6.5, Replication Slave I/O Thread States
Section 5.1.4, Server System Variables
report_host
Section 5.1.4, Server System Variables
report_password
Section 5.1.4, Server System Variables
report_port
Section 5.1.4, Server System Variables
report_user
Section 5.1.4, Server System Variables
rpl_recovery_rank
Section 16.1.3.3, Replication Slave Options and Variables
rpl_semi_sync_master_enabled
Section 5.1.4, Server System Variables
rpl_semi_sync_master_reply_log
_file_pos
Section 5.1.4, Server System Variables
rpl_semi_sync_master_timeout
Section 5.1.4, Server System Variables
rpl_semi_sync_master_trace_lev
el
Section 5.1.4, Server System Variables
rpl_semi_sync_slave_enabled
Section 5.1.4, Server System Variables
System Variable Index
3464
rpl_semi_sync_slave_trace_leve
l
Section 5.1.4, Server System Variables
secure_auth
Section 5.1.4, Server System Variables
secure_backup_file_priv
Section 5.1.4, Server System Variables
secure_file_priv
Section 12.2.6, LOAD DATA INFILE Syntax
Section 12.2.8, SELECT Syntax
Section 5.1.4, Server System Variables
Section 11.4, String Functions
server_id
Section 11.11.4, Miscellaneous Functions
Section 5.1.4, Server System Variables
shared_memory
Section 5.1.4, Server System Variables
shared_memory_base_name
Section 5.1.4, Server System Variables
skip_external_locking
Section 7.3.4, External Locking
Section 5.1.4, Server System Variables
skip_networking
Section 5.1.4, Server System Variables
skip_show_database
Section 5.1.4, Server System Variables
slave_compressed_protocol
Section 16.1.3.3, Replication Slave Options and Variables
slave_exec_mode
Section 16.1.3.3, Replication Slave Options and Variables
slave_load_tmpdir
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
slave_net_timeout
Section 12.6.2.1, CHANGE MASTER TO Syntax
Section 16.3.1.15, Replication During a Master Shutdown
Section 7.5.6.5, Replication Slave I/O Thread States
Section 16.1.3.3, Replication Slave Options and Variables
Section 5.1.4, Server System Variables
slave_skip_errors
Section 16.1.3.3, Replication Slave Options and Variables
slave_transaction_retries
Section 16.3.1.23, Replication Retries and Timeouts
Section 16.1.3.3, Replication Slave Options and Variables
slow_launch_time
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
slow_query_log
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 5.2.5, The Slow Query Log
slow_query_log_file
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.4, Server System Variables
Section 5.2.5, The Slow Query Log
socket
Section 5.1.4, Server System Variables
sort_buffer_size
Section 7.2.13, ORDER BY Optimization
Section 6.4.3, How to Repair Tables
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 7.5.3, Tuning Server Parameters
sql_auto_is_null
Section 16.3.1.28, Replication and Variables
Section 5.1.5, Session System Variables
Section 5.2.4, The Binary Log
sql_auto_is_null = 0
Section 11.2.3, Comparison Functions and Operators
sql_big_selects
Section 5.1.4, Server System Variables
Section 5.1.5, Session System Variables
sql_buffer_result
Section 5.1.5, Session System Variables
sql_log_bin
Section 12.6.1.3, SET sql_log_bin Syntax
Section 17.12.8, Issues Exclusive to MySQL Cluster
Section 17.12.1, Noncompliance with SQL Syntax in MySQL Cluster
Section 5.1.5, Session System Variables
sql_log_off
Section 5.2.1, Selecting General Query and Slow Query Log Output
Destinations
Section 5.1.5, Session System Variables
Section 5.2.3, The General Query Log
System Variable Index
3465
sql_log_update
Section 5.1.5, Session System Variables
sql_mode
Section 12.1.11, CREATE EVENT Syntax
Section 12.1.15, CREATE PROCEDURE and CREATE FUNCTION
Syntax
Section 12.1.19, CREATE TRIGGER Syntax
Section 12.5.5.14, SHOW CREATE VIEW Syntax
Section 12.5.5.40, SHOW TRIGGERS Syntax
Section 10.3.1.1, TIMESTAMP Properties
Section 1.6, How to Report Bugs or Problems
Section B.1.5.2, Problems Using DATE Columns
Section 16.3.1.28, Replication and Variables
Section 1.7.3, Running MySQL in ANSI Mode
Section 1.7.2, Selecting SQL Modes
Section 5.1.8, Server SQL Modes
Section 5.1.4, Server System Variables
Section 20.14, The INFORMATION_SCHEMA ROUTINES Table
Section 20.16, The INFORMATION_SCHEMA TRIGGERS Table
Section 20.15, The INFORMATION_SCHEMA VIEWS Table
Section 5.2.4, The Binary Log
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
Section 5.1.6, Using System Variables
sql_notes
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 5.1.5, Session System Variables
sql_quote_show_create
Section 12.5.5.8, SHOW CREATE DATABASE Syntax
Section 12.5.5.12, SHOW CREATE TABLE Syntax
Section 5.1.5, Session System Variables
sql_safe_updates
Section 5.1.5, Session System Variables
sql_select_limit
Section 5.1.4, Server System Variables
sql_slave_skip_counter
Section 16.1.3.3, Replication Slave Options and Variables
sql_warnings
Section 5.1.5, Session System Variables
ssl_ca
Section 5.1.4, Server System Variables
ssl_capath
Section 5.1.4, Server System Variables
ssl_cert
Section 5.1.4, Server System Variables
ssl_cipher
Section 5.5.2, Adding User Accounts
Section 5.4.2, Privilege System Grant Tables
Section 5.1.4, Server System Variables
ssl_key
Section 5.1.4, Server System Variables
storage_engine
Section 16.3.1.28, Replication and Variables
Section 5.1.4, Server System Variables
Section 13.3, Setting the Storage Engine
Chapter 13, Storage Engines
Section 1.4.2, What Is Planned for MySQL 6.0
sync_binlog
Section 13.6.3, InnoDB Startup Options and System Variables
Section 16.1.3.4, Binary Log Options and Variables
Section 5.2.4, The Binary Log
sync_frm
Section 5.1.4, Server System Variables
sync_master_info
Section 16.1.3.3, Replication Slave Options and Variables
sync_relay_log
Section 16.1.3.3, Replication Slave Options and Variables
sync_relay_log_info
Section 16.1.3.3, Replication Slave Options and Variables
system_time_zone
Section 9.7, MySQL Server Time Zone Support
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
table_cache
Section 7.4.7, How MySQL Opens and Closes Tables
Section 5.1.4, Server System Variables
Section 7.5.3, Tuning Server Parameters
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
table_definition_cache
Section 5.1.4, Server System Variables
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
table_lock_wait_timeout
Section 5.1.4, Server System Variables
table_open_cache
Section B.1.2.18, 'FILE' NOT FOUND and Similar Errors
Section 7.4.7, How MySQL Opens and Closes Tables
Section 5.1.2, Server Command Options
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 7.5.3, Tuning Server Parameters
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
System Variable Index
3466
table_type
Section 5.1.4, Server System Variables
Chapter 13, Storage Engines
Section 1.4.2, What Is Planned for MySQL 6.0
thread_cache_size
Section 22.5.1.4, Debugging mysqld under gdb
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 7.2.24, Other Optimization Tips
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
thread_concurrency
Section 5.1.4, Server System Variables
thread_handling
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 5.1.4, Server System Variables
thread_pool_size
Section 7.5.7, How MySQL Uses Threads for Client Connections
Section 5.1.4, Server System Variables
thread_stack
Section 7.5.8, How MySQL Uses Memory
Section 5.1.4, Server System Variables
Section 19.2.1, Stored Routine Syntax
time_format
Section 5.1.4, Server System Variables
time_zone
Section 12.5.5.19, SHOW EVENTS Syntax
Section 10.3.1.1, TIMESTAMP Properties
Section 11.6, Date and Time Functions
Section 9.7, MySQL Server Time Zone Support
Section 5.1.2, Server Command Options
Section 5.1.4, Server System Variables
Section 20.20, The INFORMATION_SCHEMA EVENTS Table
timed_mutexes
Section 12.5.5.16, SHOW ENGINE Syntax
Section 5.1.4, Server System Variables
timestamp
Section 13.11.3, FEDERATED Storage Engine Notes and Tips
timestamp = {timestamp_value |
DEFAULT}
Section 5.1.5, Session System Variables
timezone
Section 2.12.1.1, Upgrading from MySQL 5.0 to 5.1
tmp_table_size
Section 7.5.6.2, General Thread States
Section 7.5.10, How MySQL Uses Internal Temporary Tables
Section 7.5.8, How MySQL Uses Memory
Section 5.1.7, Server Status Variables
Section 5.1.4, Server System Variables
Section 13.9, The MEMORY (HEAP) Storage Engine
transaction_alloc_block_size
Section 5.1.4, Server System Variables
transaction_prealloc_size
Section 5.1.4, Server System Variables
tx_isolation
Section 12.4.6, SET TRANSACTION Syntax
Section 5.1.4, Server System Variables
unique_checks
Section 13.6.4.2, Converting Tables from Other Storage Engines to
InnoDB
Section 16.3.1.28, Replication and Variables
Section 5.1.5, Session System Variables
Section 5.2.4, The Binary Log
updatable_views_with_limit
Section 5.1.4, Server System Variables
Section 19.5.3, Updatable and Insertable Views
version_comment
Section 5.1.4, Server System Variables
version_compile_machine
Section 5.1.4, Server System Variables
version_compile_os
Section 5.1.4, Server System Variables
wait_timeout
Section B.1.2.9, MySQL server has gone away
Section 21.10.3.52, mysql_real_connect()
Section B.1.2.11, Communication Errors and Aborted Connections
Section 2.13.4.1, FreeBSD Notes
Section 2.13.2.1, Mac OS X 10.x (Darwin)
Section 5.1.4, Server System Variables
warning_count
Section 12.5.5.42, SHOW WARNINGS Syntax
Section 5.1.5, Session System Variables
System Variable Index
3467

You might also like